diff --git a/.gitignore b/.gitignore index caabdf211..c0d9a49c6 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,3 @@ bld/ #performance reports & sessions *.vsp *.psess -/packages/MonoGame.Framework.WindowsDX.3.4.0.459/lib/net40 diff --git a/Barotrauma/Barotrauma.csproj b/Barotrauma/Barotrauma.csproj deleted file mode 100644 index 9eb20d525..000000000 --- a/Barotrauma/Barotrauma.csproj +++ /dev/null @@ -1,1730 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {008C0F83-E914-4966-9135-EA885059EDD8} - WinExe - Properties - Barotrauma - Barotrauma - 512 - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 0.1.0.%2a - false - true - v4.5 - - - - x86 - true - full - false - bin\Windows\Debug\ - DEBUG;TRACE;WINDOWS - prompt - 4 - false - - - x86 - pdbonly - true - bin\Windows\Release\ - TRACE;WINDOWS - - - .allowedextension - - prompt - 4 - false - - - Icon.ico - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - C:\Program Files (x86)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll - - - False - ..\packages\NVorbis.0.8.5.0\lib\NVorbis.dll - - - False - C:\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\OpenTK.dll - - - - ..\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll - - - False - C:\Program Files (x86)\MonoGame\v3.0\Assemblies\Windows\SharpDX.dll - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - Designer - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Designer - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Always - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - Designer - - - PreserveNewest - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - - - - False - Microsoft .NET Framework 4 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 4.5 - true - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - - - - - - - - {0aad36e3-51a5-4a07-ab60-5c8a66bd38b7} - Farseer Physics MonoGame - - - {3b8f9edb-6e5e-450c-abc2-ec49075d0b50} - Hyper.ComponentModel - - - {49ba1c69-6104-41ac-a5d8-b54fa9f696e8} - Lidgren.Network - - - {c293db32-fa42-486d-b128-5a12522fae4e} - SharpFont - - - - - \ No newline at end of file diff --git a/Barotrauma/BarotraumaClient/BarotraumaClient.csproj b/Barotrauma/BarotraumaClient/BarotraumaClient.csproj new file mode 100644 index 000000000..1aaea586e --- /dev/null +++ b/Barotrauma/BarotraumaClient/BarotraumaClient.csproj @@ -0,0 +1,305 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {008C0F83-E914-4966-9135-EA885059EDD8} + WinExe + Properties + Barotrauma + Barotrauma + 512 + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 0.1.0.%2a + false + true + v4.5 + + + + x86 + true + full + false + ..\bin\Windows\Debug\ + TRACE;DEBUG;WINDOWS;CLIENT + prompt + 4 + false + + + x86 + pdbonly + true + ..\bin\Windows\Release\ + TRACE;WINDOWS;CLIENT + + + .allowedextension + + prompt + 4 + false + + + ..\BarotraumaShared\Icon.ico + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\MonoGame.Framework.dll + True + + + False + ..\..\Libraries\NuGet\NVorbis.0.8.5.0\lib\NVorbis.dll + + + False + ..\..\Libraries\NuGet\OpenTK.2.0.0\lib\net20\OpenTK.dll + + + + ..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll + + + False + ..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\SharpDX.dll + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + False + Microsoft .NET Framework 4 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 4.5 + true + + + + + {0aad36e3-51a5-4a07-ab60-5c8a66bd38b7} + Farseer Physics MonoGame + + + {3b8f9edb-6e5e-450c-abc2-ec49075d0b50} + Hyper.ComponentModel + + + {49ba1c69-6104-41ac-a5d8-b54fa9f696e8} + Lidgren.Network + + + {c293db32-fa42-486d-b128-5a12522fae4e} + SharpFont + + + + + + + + + + \ No newline at end of file diff --git a/Barotrauma/Barotrauma.csproj.user b/Barotrauma/BarotraumaClient/BarotraumaClient.csproj.user similarity index 100% rename from Barotrauma/Barotrauma.csproj.user rename to Barotrauma/BarotraumaClient/BarotraumaClient.csproj.user diff --git a/Barotrauma/OpenAL32.dll b/Barotrauma/BarotraumaClient/OpenAL32.dll similarity index 100% rename from Barotrauma/OpenAL32.dll rename to Barotrauma/BarotraumaClient/OpenAL32.dll diff --git a/Barotrauma/BarotraumaClient/OpenTK.dll.config b/Barotrauma/BarotraumaClient/OpenTK.dll.config new file mode 100644 index 000000000..7098d39e9 --- /dev/null +++ b/Barotrauma/BarotraumaClient/OpenTK.dll.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Barotrauma/Properties/AssemblyInfo.cs b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs similarity index 93% rename from Barotrauma/Properties/AssemblyInfo.cs rename to Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs index 8f0f2c21e..3ebce2d8b 100644 --- a/Barotrauma/Properties/AssemblyInfo.cs +++ b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.6.0.2")] -[assembly: AssemblyFileVersion("0.6.0.2")] +[assembly: AssemblyVersion("0.6.0.1000")] +[assembly: AssemblyFileVersion("0.6.0.1000")] diff --git a/Barotrauma/Source/Camera.cs b/Barotrauma/BarotraumaClient/Source/Camera.cs similarity index 100% rename from Barotrauma/Source/Camera.cs rename to Barotrauma/BarotraumaClient/Source/Camera.cs diff --git a/Barotrauma/BarotraumaClient/Source/Characters/AI/AIController.cs b/Barotrauma/BarotraumaClient/Source/Characters/AI/AIController.cs new file mode 100644 index 000000000..3613ba3fe --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/AI/AIController.cs @@ -0,0 +1,11 @@ +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Barotrauma +{ + partial class AIController : ISteerable + { + public virtual void DebugDraw(SpriteBatch spriteBatch) { } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Characters/AI/AITarget.cs b/Barotrauma/BarotraumaClient/Source/Characters/AI/AITarget.cs new file mode 100644 index 000000000..05721d77b --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/AI/AITarget.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Barotrauma +{ + partial class AITarget + { + public static bool ShowAITargets; + + public void Draw(SpriteBatch spriteBatch) + { + if (!ShowAITargets) return; + + var rangeSprite = GUI.SubmarineIcon; + + if (soundRange > 0.0f) + rangeSprite.Draw(spriteBatch, + new Vector2(WorldPosition.X, -WorldPosition.Y), + Color.Cyan * 0.1f, rangeSprite.Origin, + 0.0f, soundRange / rangeSprite.size.X); + + if (sightRange > 0.0f) + rangeSprite.Draw(spriteBatch, + new Vector2(WorldPosition.X, -WorldPosition.Y), + Color.Orange * 0.1f, rangeSprite.Origin, + 0.0f, sightRange / rangeSprite.size.X); + } + } +} diff --git a/Barotrauma/Source/Characters/AI/CrewCommander.cs b/Barotrauma/BarotraumaClient/Source/Characters/AI/CrewCommander.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/CrewCommander.cs rename to Barotrauma/BarotraumaClient/Source/Characters/AI/CrewCommander.cs diff --git a/Barotrauma/BarotraumaClient/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaClient/Source/Characters/AI/EnemyAIController.cs new file mode 100644 index 000000000..451477959 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/AI/EnemyAIController.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Xml.Linq; +using FarseerPhysics; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using FarseerPhysics.Dynamics; +using Microsoft.Xna.Framework.Graphics; + +namespace Barotrauma +{ + partial class EnemyAIController : AIController + { + public override void DebugDraw(SpriteBatch spriteBatch) + { + if (Character.IsDead) return; + + Vector2 pos = Character.WorldPosition; + pos.Y = -pos.Y; + + if (selectedAiTarget != null) + { + GUI.DrawLine(spriteBatch, pos, new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red); + + if (wallAttackPos != Vector2.Zero) + { + GUI.DrawRectangle(spriteBatch, ConvertUnits.ToDisplayUnits(new Vector2(wallAttackPos.X, -wallAttackPos.Y)) - new Vector2(10.0f, 10.0f), new Vector2(20.0f, 20.0f), Color.Red, false); + } + + GUI.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY * 20.0f, Color.Red); + } + + if (selectedAiTarget != null) + { + GUI.DrawLine(spriteBatch, + new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y), + new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red); + } + + GUI.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY * 80.0f, Color.Red); + + GUI.Font.DrawString(spriteBatch, "updatetargets: " + updateTargetsTimer, pos - Vector2.UnitY * 100.0f, Color.Red); + GUI.Font.DrawString(spriteBatch, "cooldown: " + coolDownTimer, pos - Vector2.UnitY * 120.0f, Color.Red); + + + IndoorsSteeringManager pathSteering = steeringManager as IndoorsSteeringManager; + if (pathSteering == null || pathSteering.CurrentPath == null || pathSteering.CurrentPath.CurrentNode == null) return; + + GUI.DrawLine(spriteBatch, + new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y), + new Vector2(pathSteering.CurrentPath.CurrentNode.DrawPosition.X, -pathSteering.CurrentPath.CurrentNode.DrawPosition.Y), + Color.LightGreen); + + + for (int i = 1; i < pathSteering.CurrentPath.Nodes.Count; i++) + { + GUI.DrawLine(spriteBatch, + new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y), + new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y), + Color.LightGreen); + + GUI.SmallFont.DrawString(spriteBatch, + pathSteering.CurrentPath.Nodes[i].ID.ToString(), + new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y - 10), + Color.LightGreen); + } + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Characters/AI/HumanAIController.cs b/Barotrauma/BarotraumaClient/Source/Characters/AI/HumanAIController.cs new file mode 100644 index 000000000..0e9e56964 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/AI/HumanAIController.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework; +using System; + +namespace Barotrauma +{ + partial class HumanAIController : AIController + { + partial void InitProjSpecific() + { + if (GameMain.GameSession != null && GameMain.GameSession.CrewManager != null) + { + CurrentOrder = Order.PrefabList.Find(o => o.Name.ToLowerInvariant() == "dismissed"); + objectiveManager.SetOrder(CurrentOrder, ""); + GameMain.GameSession.CrewManager.SetCharacterOrder(Character, CurrentOrder); + } + } + + partial void SetOrderProjSpecific(Order order) + { + GameMain.GameSession.CrewManager.SetCharacterOrder(Character, order); + } + + public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) + { + if (selectedAiTarget != null) + { + GUI.DrawLine(spriteBatch, + new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y), + new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red); + } + + IndoorsSteeringManager pathSteering = steeringManager as IndoorsSteeringManager; + if (pathSteering == null || pathSteering.CurrentPath == null || pathSteering.CurrentPath.CurrentNode == null) return; + + GUI.DrawLine(spriteBatch, + new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y), + new Vector2(pathSteering.CurrentPath.CurrentNode.DrawPosition.X, -pathSteering.CurrentPath.CurrentNode.DrawPosition.Y), + Color.LightGreen); + + + for (int i = 1; i < pathSteering.CurrentPath.Nodes.Count; i++) + { + GUI.DrawLine(spriteBatch, + new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y), + new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y), + Color.LightGreen); + + GUI.SmallFont.DrawString(spriteBatch, + pathSteering.CurrentPath.Nodes[i].ID.ToString(), + new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y - 10), + Color.LightGreen); + } + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Characters/AICharacter.cs b/Barotrauma/BarotraumaClient/Source/Characters/AICharacter.cs new file mode 100644 index 000000000..75b41a693 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/AICharacter.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using System; + +namespace Barotrauma +{ + partial class AICharacter : Character + { + partial void InitProjSpecific() + { + soundTimer = Rand.Range(0.0f, soundInterval); + } + + partial void SoundUpdate(float deltaTime) + { + if (soundTimer > 0) + { + soundTimer -= deltaTime; + } + else + { + switch (aiController.State) + { + case AIController.AIState.Attack: + PlaySound(CharacterSound.SoundType.Attack); + break; + default: + PlaySound(CharacterSound.SoundType.Idle); + break; + } + soundTimer = soundInterval; + } + } + + public override void DrawFront(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Camera cam) + { + base.DrawFront(spriteBatch, cam); + + if (GameMain.DebugDraw && !IsDead) aiController.DebugDraw(spriteBatch); + } + + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs new file mode 100644 index 000000000..1671e6c79 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Dynamics.Contacts; +using FarseerPhysics.Dynamics.Joints; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Barotrauma +{ + partial class Ragdoll + { + partial void ImpactProjSpecific(float impact, Body body) + { + float volume = Math.Min(impact - 3.0f, 1.0f); + + if (body.UserData is Limb) + { + Limb limb = (Limb)body.UserData; + + if (impact > 3.0f && limb.HitSound != null && limb.SoundTimer <= 0.0f) + { + limb.SoundTimer = Limb.SoundInterval; + limb.HitSound.Play(volume, impact * 100.0f, limb.WorldPosition); + } + } + else if (body == Collider.FarseerBody) + { + if (!character.IsRemotePlayer || GameMain.Server != null) + { + if (impact > ImpactTolerance) + { + SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, strongestImpact, Collider); + } + } + + if (Character.Controlled == character) GameMain.GameScreen.Cam.Shake = strongestImpact; + } + } + + partial void Splash(Limb limb, Hull limbHull) + { + //create a splash particle + GameMain.ParticleManager.CreateParticle("watersplash", + new Vector2(limb.Position.X, limbHull.Surface) + limbHull.Submarine.Position, + new Vector2(0.0f, Math.Abs(-limb.LinearVelocity.Y * 20.0f)), + 0.0f, limbHull); + + GameMain.ParticleManager.CreateParticle("bubbles", + new Vector2(limb.Position.X, limbHull.Surface) + limbHull.Submarine.Position, + limb.LinearVelocity * 0.001f, + 0.0f, limbHull); + + //if the Character dropped into water, create a wave + if (limb.LinearVelocity.Y < 0.0f) + { + if (splashSoundTimer <= 0.0f) + { + SoundPlayer.PlaySplashSound(limb.WorldPosition, Math.Abs(limb.LinearVelocity.Y) + Rand.Range(-5.0f, 0.0f)); + splashSoundTimer = 0.5f; + } + } + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + if (simplePhysicsEnabled) return; + + Collider.UpdateDrawPosition(); + + foreach (Limb limb in Limbs) + { + limb.Draw(spriteBatch); + } + } + + public void DebugDraw(SpriteBatch spriteBatch) + { + if (!GameMain.DebugDraw || !character.Enabled) return; + if (simplePhysicsEnabled) return; + + foreach (Limb limb in Limbs) + { + + if (limb.pullJoint != null) + { + Vector2 pos = ConvertUnits.ToDisplayUnits(limb.pullJoint.WorldAnchorA); + if (currentHull != null) pos += currentHull.Submarine.DrawPosition; + pos.Y = -pos.Y; + GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f); + } + + limb.body.DebugDraw(spriteBatch, inWater ? Color.Cyan : Color.White); + } + + Collider.DebugDraw(spriteBatch, frozen ? Color.Red : (inWater ? Color.SkyBlue : Color.Gray)); + GUI.Font.DrawString(spriteBatch, Collider.LinearVelocity.X.ToString(), new Vector2(Collider.DrawPosition.X, -Collider.DrawPosition.Y), Color.Orange); + + foreach (RevoluteJoint joint in LimbJoints) + { + Vector2 pos = ConvertUnits.ToDisplayUnits(joint.WorldAnchorA); + GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.White, true); + + pos = ConvertUnits.ToDisplayUnits(joint.WorldAnchorB); + GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.White, true); + } + + foreach (Limb limb in Limbs) + { + if (limb.body.TargetPosition != null) + { + Vector2 pos = ConvertUnits.ToDisplayUnits((Vector2)limb.body.TargetPosition); + if (currentHull != null) pos += currentHull.Submarine.DrawPosition; + pos.Y = -pos.Y; + + GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X - 10, (int)pos.Y - 10, 20, 20), Color.Cyan, false, 0.01f); + GUI.DrawLine(spriteBatch, pos, new Vector2(limb.WorldPosition.X, -limb.WorldPosition.Y), Color.Cyan); + } + } + + if (character.MemState.Count > 1) + { + Vector2 prevPos = ConvertUnits.ToDisplayUnits(character.MemState[0].Position); + if (currentHull != null) prevPos += currentHull.Submarine.DrawPosition; + prevPos.Y = -prevPos.Y; + + for (int i = 1; i < character.MemState.Count; i++) + { + Vector2 currPos = ConvertUnits.ToDisplayUnits(character.MemState[i].Position); + if (currentHull != null) currPos += currentHull.Submarine.DrawPosition; + currPos.Y = -currPos.Y; + + GUI.DrawRectangle(spriteBatch, new Rectangle((int)currPos.X - 3, (int)currPos.Y - 3, 6, 6), Color.Cyan * 0.6f, true, 0.01f); + GUI.DrawLine(spriteBatch, prevPos, currPos, Color.Cyan * 0.6f, 0, 3); + + prevPos = currPos; + } + } + + if (ignorePlatforms) + { + GUI.DrawLine(spriteBatch, + new Vector2(Collider.DrawPosition.X, -Collider.DrawPosition.Y), + new Vector2(Collider.DrawPosition.X, -Collider.DrawPosition.Y + 50), + Color.Orange, 0, 5); + } + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs b/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs new file mode 100644 index 000000000..033bbab9c --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; +using Microsoft.Xna.Framework; +using Barotrauma.Particles; + +namespace Barotrauma +{ + partial class Attack + { + private Sound sound; + + private ParticleEmitterPrefab particleEmitterPrefab; + + partial void InitProjSpecific(XElement element) + { + string soundPath = ToolBox.GetAttributeString(element, "sound", ""); + if (!string.IsNullOrWhiteSpace(soundPath)) + { + sound = Sound.Load(soundPath); + } + + foreach (XElement subElement in element.Elements()) + { + switch (subElement.Name.ToString().ToLowerInvariant()) + { + case "particleemitter": + particleEmitterPrefab = new ParticleEmitterPrefab(subElement); + break; + } + + } + } + + partial void DamageParticles(Vector2 worldPosition) + { + if (particleEmitterPrefab != null) + { + particleEmitterPrefab.Emit(worldPosition); + } + + if (sound != null) + { + sound.Play(1.0f, 500.0f, worldPosition); + } + } + } +} diff --git a/Barotrauma/Source/Characters/BackgroundSprite/BackgroundCreature.cs b/Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundCreature.cs similarity index 100% rename from Barotrauma/Source/Characters/BackgroundSprite/BackgroundCreature.cs rename to Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundCreature.cs diff --git a/Barotrauma/Source/Characters/BackgroundSprite/BackgroundCreatureManager.cs b/Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundCreatureManager.cs similarity index 91% rename from Barotrauma/Source/Characters/BackgroundSprite/BackgroundCreatureManager.cs rename to Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundCreatureManager.cs index ed2974c81..443221132 100644 --- a/Barotrauma/Source/Characters/BackgroundSprite/BackgroundCreatureManager.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundCreatureManager.cs @@ -64,14 +64,14 @@ namespace Barotrauma var wayPoints = WayPoint.WayPointList.FindAll(wp => wp.Submarine==null); if (wayPoints.Any()) { - WayPoint wp = wayPoints[Rand.Int(wayPoints.Count, false)]; + WayPoint wp = wayPoints[Rand.Int(wayPoints.Count, Rand.RandSync.ClientOnly)]; pos = new Vector2(wp.Rect.X, wp.Rect.Y); - pos += Rand.Vector(200.0f, false); + pos += Rand.Vector(200.0f, Rand.RandSync.ClientOnly); } else { - pos = Rand.Vector(2000.0f, false); + pos = Rand.Vector(2000.0f, Rand.RandSync.ClientOnly); } } else @@ -80,9 +80,9 @@ namespace Barotrauma } - var prefab = prefabs[Rand.Int(prefabs.Count, false)]; + var prefab = prefabs[Rand.Int(prefabs.Count, Rand.RandSync.ClientOnly)]; - int amount = Rand.Range(prefab.SwarmMin, prefab.SwarmMax, false); + int amount = Rand.Range(prefab.SwarmMin, prefab.SwarmMax, Rand.RandSync.ClientOnly); List swarmMembers = new List(); for (int n = 0; n < amount; n++) @@ -103,7 +103,7 @@ namespace Barotrauma activeSprites.Clear(); } - public void Update(Camera cam, float deltaTime) + public void Update(float deltaTime, Camera cam) { if (checkActiveTimer<0.0f) { diff --git a/Barotrauma/Source/Characters/BackgroundSprite/BackgroundCreaturePrefab.cs b/Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundCreaturePrefab.cs similarity index 100% rename from Barotrauma/Source/Characters/BackgroundSprite/BackgroundCreaturePrefab.cs rename to Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundCreaturePrefab.cs diff --git a/Barotrauma/Source/Characters/BackgroundSprite/BackgroundSpriteManager.cs b/Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundSpriteManager.cs similarity index 95% rename from Barotrauma/Source/Characters/BackgroundSprite/BackgroundSpriteManager.cs rename to Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundSpriteManager.cs index 9236b2c73..0d722798b 100644 --- a/Barotrauma/Source/Characters/BackgroundSprite/BackgroundSpriteManager.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundSpriteManager.cs @@ -101,10 +101,10 @@ namespace Barotrauma rotation = MathUtils.VectorToAngle(new Vector2(edgeNormal.Y, edgeNormal.X)); } - rotation += Rand.Range(prefab.RandomRotation.X, prefab.RandomRotation.Y, false); + rotation += Rand.Range(prefab.RandomRotation.X, prefab.RandomRotation.Y, Rand.RandSync.ClientOnly); var newSprite = new BackgroundSprite(prefab, - new Vector3((Vector2)pos, Rand.Range(prefab.DepthRange.X, prefab.DepthRange.Y, false)), Rand.Range(prefab.Scale.X, prefab.Scale.Y, false), rotation); + new Vector3((Vector2)pos, Rand.Range(prefab.DepthRange.X, prefab.DepthRange.Y, Rand.RandSync.ClientOnly)), Rand.Range(prefab.Scale.X, prefab.Scale.Y, Rand.RandSync.ClientOnly), rotation); //calculate the positions of the corners of the rotated sprite Vector2 halfSize = newSprite.Prefab.Sprite.size * newSprite.Scale / 2; @@ -155,8 +155,8 @@ namespace Barotrauma edgeNormal = Vector2.One; Vector2 randomPos = new Vector2( - Rand.Range(0.0f, level.Size.X, false), - Rand.Range(0.0f, level.Size.Y, false)); + Rand.Range(0.0f, level.Size.X, Rand.RandSync.ClientOnly), + Rand.Range(0.0f, level.Size.Y, Rand.RandSync.ClientOnly)); if (!prefab.SpawnOnWalls) return randomPos; @@ -167,7 +167,7 @@ namespace Barotrauma if (cells.Any()) { - VoronoiCell cell = cells[Rand.Int(cells.Count, false)]; + VoronoiCell cell = cells[Rand.Int(cells.Count, Rand.RandSync.ClientOnly)]; foreach (GraphEdge edge in cell.edges) { @@ -220,13 +220,13 @@ namespace Barotrauma if (!edges.Any()) return null; - int index = Rand.Int(edges.Count, false); + int index = Rand.Int(edges.Count, Rand.RandSync.ClientOnly); closestEdge = edges[index]; edgeNormal = normals[index]; float length = Vector2.Distance(closestEdge.point1, closestEdge.point2); Vector2 dir = (closestEdge.point1 - closestEdge.point2) / length; - Vector2 pos = closestEdge.point2 + dir * Rand.Range(prefab.Sprite.size.X / 2.0f, length - prefab.Sprite.size.X / 2.0f, false); + Vector2 pos = closestEdge.point2 + dir * Rand.Range(prefab.Sprite.size.X / 2.0f, length - prefab.Sprite.size.X / 2.0f, Rand.RandSync.ClientOnly); return pos; } @@ -331,7 +331,7 @@ namespace Barotrauma totalCommonness += prefab.GetCommonness(levelType); } - float randomNumber = Rand.Int(totalCommonness+1, false); + float randomNumber = Rand.Int(totalCommonness+1, Rand.RandSync.ClientOnly); foreach (BackgroundSpritePrefab prefab in prefabs) { diff --git a/Barotrauma/Source/Characters/BackgroundSprite/BackgroundSpritePrefab.cs b/Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundSpritePrefab.cs similarity index 100% rename from Barotrauma/Source/Characters/BackgroundSprite/BackgroundSpritePrefab.cs rename to Barotrauma/BarotraumaClient/Source/Characters/BackgroundSprite/BackgroundSpritePrefab.cs diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs new file mode 100644 index 000000000..773286b8a --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs @@ -0,0 +1,442 @@ +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Dynamics.Joints; +using Barotrauma.Networking; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Barotrauma.Particles; + +namespace Barotrauma +{ + partial class Character : Entity, IDamageable, IPropertyObject, IClientSerializable, IServerSerializable + { + protected float soundTimer; + protected float soundInterval; + + private List sounds; + + //the Character that the player is currently controlling + private static Character controlled; + + public static Character Controlled + { + get { return controlled; } + set + { + if (controlled == value) return; + controlled = value; + CharacterHUD.Reset(); + + if (controlled != null) + { + controlled.Enabled = true; + } + } + } + + private Dictionary hudProgressBars; + + public Dictionary HUDProgressBars + { + get { return hudProgressBars; } + } + + partial void InitProjSpecific(XDocument doc) + { + soundInterval = ToolBox.GetAttributeFloat(doc.Root, "soundinterval", 10.0f); + + keys = new Key[Enum.GetNames(typeof(InputType)).Length]; + + for (int i = 0; i < Enum.GetNames(typeof(InputType)).Length; i++) + { + keys[i] = new Key(GameMain.Config.KeyBind((InputType)i)); + } + + var soundElements = doc.Root.Elements("sound").ToList(); + + sounds = new List(); + foreach (XElement soundElement in soundElements) + { + sounds.Add(new CharacterSound(soundElement)); + } + + hudProgressBars = new Dictionary(); + } + + + /// + /// Control the Character according to player input + /// + public void ControlLocalPlayer(float deltaTime, Camera cam, bool moveCam = true) + { + if (!DisableControls) + { + for (int i = 0; i < keys.Length; i++) + { + keys[i].SetState(); + } + } + else + { + foreach (Key key in keys) + { + if (key == null) continue; + key.Reset(); + } + } + + if (moveCam) + { + if (needsAir && + pressureProtection < 80.0f && + (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure > 50.0f)) + { + float pressure = AnimController.CurrentHull == null ? 100.0f : AnimController.CurrentHull.LethalPressure; + + cam.Zoom = MathHelper.Lerp(cam.Zoom, + (pressure / 50.0f) * Rand.Range(1.0f, 1.05f), + (pressure - 50.0f) / 50.0f); + } + + if (IsHumanoid) + { + cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, 250.0f, deltaTime); + } + else + { + //increased visibility range when controlling large a non-humanoid + cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, MathHelper.Clamp(Mass, 250.0f, 800.0f), deltaTime); + } + } + + cursorPosition = cam.ScreenToWorld(PlayerInput.MousePosition); + if (AnimController.CurrentHull != null && AnimController.CurrentHull.Submarine != null) + { + cursorPosition -= AnimController.CurrentHull.Submarine.Position; + } + + Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition); + + if (Lights.LightManager.ViewTarget == this && Vector2.DistanceSquared(AnimController.Limbs[0].SimPosition, mouseSimPos) > 1.0f) + { + Body body = Submarine.PickBody(AnimController.Limbs[0].SimPosition, mouseSimPos); + Structure structure = null; + if (body != null) structure = body.UserData as Structure; + if (structure != null) + { + if (!structure.CastShadow && moveCam) + { + cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, 500.0f, 0.05f); + } + } + } + + if (!LockHands) + { + //find the closest item if selectkey has been hit, or if the Character is being + //controlled by the player (in order to highlight it) + + if (findClosestTimer <= 0.0f || Screen.Selected == GameMain.EditMapScreen) + { + closestCharacter = FindClosestCharacter(mouseSimPos); + if (closestCharacter != null && closestCharacter.info == null) + { + closestCharacter = null; + } + + float closestItemDist = 0.0f; + closestItem = FindClosestItem(mouseSimPos, out closestItemDist); + + if (closestCharacter != null && closestItem != null) + { + if (Vector2.DistanceSquared(closestCharacter.SimPosition, mouseSimPos) < ConvertUnits.ToSimUnits(closestItemDist) * ConvertUnits.ToSimUnits(closestItemDist)) + { + if (selectedConstruction != closestItem) closestItem = null; + } + else + { + closestCharacter = null; + } + } + + findClosestTimer = 0.1f; + } + else + { + findClosestTimer -= deltaTime; + } + + if (selectedCharacter == null && closestItem != null) + { + closestItem.IsHighlighted = true; + if (!LockHands && closestItem.Pick(this)) + { + + } + } + + if (IsKeyHit(InputType.Select)) + { + if (selectedCharacter != null) + { + DeselectCharacter(); + } + else if (closestCharacter != null && closestCharacter.IsHumanoid && closestCharacter.CanBeSelected) + { + SelectCharacter(closestCharacter); + } + } + } + else + { + if (selectedCharacter != null) DeselectCharacter(); + selectedConstruction = null; + closestItem = null; + closestCharacter = null; + } + + DisableControls = false; + } + + partial void UpdateControlled(float deltaTime,Camera cam) + { + if (controlled != this) return; + + ControlLocalPlayer(deltaTime, cam); + + Lights.LightManager.ViewTarget = this; + CharacterHUD.Update(deltaTime, this); + + foreach (HUDProgressBar progressBar in hudProgressBars.Values) + { + progressBar.Update(deltaTime); + } + + foreach (var pb in hudProgressBars.Where(pb => pb.Value.FadeTimer <= 0.0f).ToList()) + { + hudProgressBars.Remove(pb.Key); + } + } + + partial void DamageHUD(float amount) + { + if (controlled == this) CharacterHUD.TakeDamage(amount); + } + + partial void UpdateOxygenProjSpecific(float prevOxygen) + { + if (prevOxygen > 0.0f && Oxygen <= 0.0f && controlled == this) + { + SoundPlayer.PlaySound("drown"); + } + } + + partial void KillProjSpecific() + { + if (GameMain.NetworkMember != null && Character.controlled == this) + { + string chatMessage = InfoTextManager.GetInfoText("Self_CauseOfDeath." + causeOfDeath.ToString()); + if (GameMain.Client != null) chatMessage += " Your chat messages will only be visible to other dead players."; + + GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead); + GameMain.LightManager.LosEnabled = false; + controlled = null; + } + + PlaySound(CharacterSound.SoundType.Die); + } + + partial void DisposeProjSpecific() + { + if (controlled == this) controlled = null; + + if (GameMain.GameSession?.CrewManager != null && + GameMain.GameSession.CrewManager.characters.Contains(this)) + { + GameMain.GameSession.CrewManager.characters.Remove(this); + } + + if (GameMain.Client != null && GameMain.Client.Character == this) GameMain.Client.Character = null; + + if (Lights.LightManager.ViewTarget == this) Lights.LightManager.ViewTarget = null; + } + + public static void AddAllToGUIUpdateList() + { + for (int i = 0; i < CharacterList.Count; i++) + { + CharacterList[i].AddToGUIUpdateList(); + } + } + + public virtual void AddToGUIUpdateList() + { + if (controlled == this) + { + CharacterHUD.AddToGUIUpdateList(this); + } + } + + public void Draw(SpriteBatch spriteBatch) + { + if (!Enabled) return; + + AnimController.Draw(spriteBatch); + } + + public void DrawHUD(SpriteBatch spriteBatch, Camera cam) + { + CharacterHUD.Draw(spriteBatch, this, cam); + } + + public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam) + { + if (!Enabled) return; + + if (GameMain.DebugDraw) + { + AnimController.DebugDraw(spriteBatch); + + if (aiTarget != null) aiTarget.Draw(spriteBatch); + } + + /*if (memPos != null && memPos.Count > 0 && controlled == this) + { + PosInfo serverPos = memPos.Last(); + Vector2 remoteVec = ConvertUnits.ToDisplayUnits(serverPos.Position); + if (Submarine != null) + { + remoteVec += Submarine.DrawPosition; + } + remoteVec.Y = -remoteVec.Y; + + PosInfo localPos = memLocalPos.Find(m => m.ID == serverPos.ID); + int mpind = memLocalPos.FindIndex(lp => lp.ID == localPos.ID); + PosInfo localPos1 = mpind > 0 ? memLocalPos[mpind - 1] : null; + PosInfo localPos2 = mpind < memLocalPos.Count-1 ? memLocalPos[mpind + 1] : null; + + Vector2 localVec = ConvertUnits.ToDisplayUnits(localPos.Position); + Vector2 localVec1 = localPos1 != null ? ConvertUnits.ToDisplayUnits(((PosInfo)localPos1).Position) : Vector2.Zero; + Vector2 localVec2 = localPos2 != null ? ConvertUnits.ToDisplayUnits(((PosInfo)localPos2).Position) : Vector2.Zero; + if (Submarine != null) + { + localVec += Submarine.DrawPosition; + localVec1 += Submarine.DrawPosition; + localVec2 += Submarine.DrawPosition; + } + localVec.Y = -localVec.Y; + localVec1.Y = -localVec1.Y; + localVec2.Y = -localVec2.Y; + + //GUI.DrawLine(spriteBatch, remoteVec, localVec, Color.Yellow, 0, 10); + if (localPos1 != null) GUI.DrawLine(spriteBatch, remoteVec, localVec1, Color.Lime, 0, 2); + if (localPos2 != null) GUI.DrawLine(spriteBatch, remoteVec + Vector2.One, localVec2 + Vector2.One, Color.Red, 0, 2); + } + + Vector2 mouseDrawPos = CursorWorldPosition; + mouseDrawPos.Y = -mouseDrawPos.Y; + GUI.DrawLine(spriteBatch, mouseDrawPos - new Vector2(0, 5), mouseDrawPos + new Vector2(0, 5), Color.Red, 0, 10); + + Vector2 closestItemPos = closestItem != null ? closestItem.DrawPosition : Vector2.Zero; + closestItemPos.Y = -closestItemPos.Y; + GUI.DrawLine(spriteBatch, closestItemPos - new Vector2(0, 5), closestItemPos + new Vector2(0, 5), Color.Lime, 0, 10);*/ + + if (this == controlled || GUI.DisableHUD) return; + + Vector2 pos = DrawPosition; + pos.Y = -pos.Y; + + if (speechBubbleTimer > 0.0f) + { + GUI.SpeechBubbleIcon.Draw(spriteBatch, pos - Vector2.UnitY * 100.0f, + speechBubbleColor * Math.Min(speechBubbleTimer, 1.0f), 0.0f, + Math.Min((float)speechBubbleTimer, 1.0f)); + } + + if (this == controlled) return; + + if (info != null) + { + Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom; + Color nameColor = Color.White; + + if (Character.Controlled != null && TeamID != Character.Controlled.TeamID) + { + nameColor = Color.Red; + } + GUI.Font.DrawString(spriteBatch, Info.Name, namePos + new Vector2(1.0f / cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.001f); + GUI.Font.DrawString(spriteBatch, Info.Name, namePos, nameColor, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.0f); + + if (GameMain.DebugDraw) + { + GUI.Font.DrawString(spriteBatch, ID.ToString(), namePos - new Vector2(0.0f, 20.0f), Color.White); + } + } + + if (isDead) return; + + if (health < maxHealth * 0.98f) + { + Vector2 healthBarPos = new Vector2(pos.X - 50, DrawPosition.Y + 100.0f); + + GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health / maxHealth, Color.Lerp(Color.Red, Color.Green, health / maxHealth) * 0.8f); + } + } + + /// + /// Creates a progress bar that's "linked" to the specified object (or updates an existing one if there's one already linked to the object) + /// The progress bar will automatically fade out after 1 sec if the method hasn't been called during that time + /// + public HUDProgressBar UpdateHUDProgressBar(object linkedObject, Vector2 worldPosition, float progress, Color emptyColor, Color fullColor) + { + if (controlled != this) return null; + + HUDProgressBar progressBar = null; + if (!hudProgressBars.TryGetValue(linkedObject, out progressBar)) + { + progressBar = new HUDProgressBar(worldPosition, Submarine, emptyColor, fullColor); + hudProgressBars.Add(linkedObject, progressBar); + } + + progressBar.WorldPosition = worldPosition; + progressBar.FadeTimer = Math.Max(progressBar.FadeTimer, 1.0f); + progressBar.Progress = progress; + + return progressBar; + } + + public void PlaySound(CharacterSound.SoundType soundType) + { + if (sounds == null || sounds.Count == 0) return; + + var matchingSounds = sounds.FindAll(s => s.Type == soundType); + if (matchingSounds.Count == 0) return; + + var selectedSound = matchingSounds[Rand.Int(matchingSounds.Count)]; + selectedSound.Sound.Play(1.0f, selectedSound.Range, AnimController.WorldPosition); + } + + partial void ImplodeFX() + { + Vector2 centerOfMass = AnimController.GetCenterOfMass(); + + SoundPlayer.PlaySound("implode", 1.0f, 150.0f, WorldPosition); + + for (int i = 0; i < 10; i++) + { + Particle p = GameMain.ParticleManager.CreateParticle("waterblood", + ConvertUnits.ToDisplayUnits(centerOfMass) + Rand.Vector(5.0f), + Rand.Vector(10.0f)); + if (p != null) p.Size *= 2.0f; + + GameMain.ParticleManager.CreateParticle("bubbles", + ConvertUnits.ToDisplayUnits(centerOfMass) + Rand.Vector(5.0f), + new Vector2(Rand.Range(-50f, 50f), Rand.Range(-100f, 50f))); + } + } + } +} diff --git a/Barotrauma/Source/Characters/CharacterHUD.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs similarity index 100% rename from Barotrauma/Source/Characters/CharacterHUD.cs rename to Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterInfo.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterInfo.cs new file mode 100644 index 000000000..348b94069 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterInfo.cs @@ -0,0 +1,75 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.Linq; + +namespace Barotrauma +{ + partial class CharacterInfo + { + + public GUIFrame CreateInfoFrame(Rectangle rect) + { + GUIFrame frame = new GUIFrame(rect, Color.Transparent); + frame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); + + return CreateInfoFrame(frame); + } + + public GUIFrame CreateInfoFrame(GUIFrame frame) + { + new GUIImage(new Rectangle(0, 0, 30, 30), HeadSprite, Alignment.TopLeft, frame); + + ScalableFont font = frame.Rect.Width < 280 ? GUI.SmallFont : GUI.Font; + + int x = 0, y = 0; + new GUITextBlock(new Rectangle(x + 60, y, 200, 20), Name, "", frame, font); + y += 20; + + if (Job != null) + { + new GUITextBlock(new Rectangle(x + 60, y, 200, 20), Job.Name, "", frame, font); + y += 30; + + var skills = Job.Skills; + skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level)); + + new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", "", frame, font); + y += 20; + foreach (Skill skill in skills) + { + Color textColor = Color.White * (0.5f + skill.Level / 200.0f); + new GUITextBlock(new Rectangle(x, y, 200, 20), skill.Name, Color.Transparent, textColor, Alignment.Left, "", frame).Font = font; + new GUITextBlock(new Rectangle(x, y, 200, 20), skill.Level.ToString(), Color.Transparent, textColor, Alignment.Right, "", frame).Font = font; + y += 20; + } + } + + + return frame; + } + + public GUIFrame CreateCharacterFrame(GUIComponent parent, string text, object userData) + { + GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, "ListBoxElement", parent); + frame.UserData = userData; + + GUITextBlock textBlock = new GUITextBlock( + new Rectangle(40, 0, 0, 25), + text, + null, null, + Alignment.Left, Alignment.Left, + "", frame, false); + textBlock.Font = GUI.SmallFont; + textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); + + new GUIImage(new Rectangle(-5, -5, 0, 0), HeadSprite, Alignment.Left, frame); + + return frame; + } + + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs new file mode 100644 index 000000000..51b70cafd --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs @@ -0,0 +1,296 @@ +using Barotrauma.Networking; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Barotrauma +{ + partial class Character + { + public virtual void ClientWrite(NetBuffer msg, object[] extraData = null) + { + if (GameMain.Server != null) return; + + if (extraData != null) + { + switch ((NetEntityEvent.Type)extraData[0]) + { + case NetEntityEvent.Type.InventoryState: + msg.WriteRangedInteger(0, 2, 0); + inventory.ClientWrite(msg, extraData); + break; + case NetEntityEvent.Type.Repair: + msg.WriteRangedInteger(0, 2, 1); + msg.Write(AnimController.Anim == AnimController.Animation.CPR); + break; + case NetEntityEvent.Type.Status: + msg.WriteRangedInteger(0, 2, 2); + break; + } + } + else + { + msg.Write((byte)ClientNetObject.CHARACTER_INPUT); + + if (memInput.Count > 60) + { + memInput.RemoveRange(60, memInput.Count - 60); + } + + msg.Write(LastNetworkUpdateID); + byte inputCount = Math.Min((byte)memInput.Count, (byte)60); + msg.Write(inputCount); + for (int i = 0; i < inputCount; i++) + { + msg.WriteRangedInteger(0, (int)InputNetFlags.MaxVal, (int)memInput[i].states); + if (memInput[i].states.HasFlag(InputNetFlags.Aim)) + { + msg.Write(memInput[i].intAim); + } + if (memInput[i].states.HasFlag(InputNetFlags.Select) || memInput[i].states.HasFlag(InputNetFlags.Use)) + { + msg.Write(memInput[i].interact); + } + } + } + msg.WritePadBits(); + } + + public virtual void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) + { + if (GameMain.Server != null) return; + + switch (type) + { + case ServerNetObject.ENTITY_POSITION: + bool facingRight = AnimController.Dir > 0.0f; + + lastRecvPositionUpdateTime = (float)NetTime.Now; + + AnimController.Frozen = false; + Enabled = true; + + UInt16 networkUpdateID = 0; + if (msg.ReadBoolean()) + { + networkUpdateID = msg.ReadUInt16(); + } + else + { + bool aimInput = msg.ReadBoolean(); + keys[(int)InputType.Aim].Held = aimInput; + keys[(int)InputType.Aim].SetState(false, aimInput); + + bool useInput = msg.ReadBoolean(); + keys[(int)InputType.Use].Held = useInput; + keys[(int)InputType.Use].SetState(false, useInput); + + bool hasAttackLimb = msg.ReadBoolean(); + if (hasAttackLimb) + { + bool attackInput = msg.ReadBoolean(); + keys[(int)InputType.Attack].Held = attackInput; + keys[(int)InputType.Attack].SetState(false, attackInput); + } + + if (aimInput) + { + double aimAngle = ((double)msg.ReadUInt16() / 65535.0) * 2.0 * Math.PI; + cursorPosition = (ViewTarget == null ? AnimController.Collider.Position : ViewTarget.Position) + + new Vector2((float)Math.Cos(aimAngle), (float)Math.Sin(aimAngle)) * 60.0f; + + TransformCursorPos(); + } + facingRight = msg.ReadBoolean(); + } + + bool entitySelected = msg.ReadBoolean(); + Entity selectedEntity = null; + + AnimController.Animation animation = AnimController.Animation.None; + if (entitySelected) + { + ushort entityID = msg.ReadUInt16(); + selectedEntity = FindEntityByID(entityID); + if (selectedEntity is Character) + { + bool doingCpr = msg.ReadBoolean(); + if (doingCpr && selectedCharacter != null) + { + animation = AnimController.Animation.CPR; + } + } + } + + Vector2 pos = new Vector2( + msg.ReadFloat(), + msg.ReadFloat()); + + + int index = 0; + if (GameMain.NetworkMember.Character == this && AllowInput) + { + var posInfo = new CharacterStateInfo(pos, networkUpdateID, facingRight ? Direction.Right : Direction.Left, selectedEntity, animation); + while (index < memState.Count && NetIdUtils.IdMoreRecent(posInfo.ID, memState[index].ID)) + index++; + + memState.Insert(index, posInfo); + } + else + { + var posInfo = new CharacterStateInfo(pos, sendingTime, facingRight ? Direction.Right : Direction.Left, selectedEntity, animation); + while (index < memState.Count && posInfo.Timestamp > memState[index].Timestamp) + index++; + + memState.Insert(index, posInfo); + } + + break; + case ServerNetObject.ENTITY_EVENT: + + int eventType = msg.ReadRangedInteger(0, 2); + switch (eventType) + { + case 0: + inventory.ClientRead(type, msg, sendingTime); + break; + case 1: + byte ownerID = msg.ReadByte(); + ResetNetState(); + if (ownerID == GameMain.Client.ID) + { + if (controlled != null) + { + LastNetworkUpdateID = controlled.LastNetworkUpdateID; + } + + controlled = this; + IsRemotePlayer = false; + GameMain.Client.Character = this; + } + else if (controlled == this) + { + controlled = null; + IsRemotePlayer = ownerID > 0; + } + break; + case 2: + ReadStatus(msg); + break; + } + + break; + } + } + public static Character ReadSpawnData(NetBuffer inc, bool spawn = true) + { + DebugConsole.NewMessage("READING CHARACTER SPAWN DATA", Color.Cyan); + + if (GameMain.Server != null) return null; + + bool noInfo = inc.ReadBoolean(); + ushort id = inc.ReadUInt16(); + string configPath = inc.ReadString(); + + Vector2 position = new Vector2(inc.ReadFloat(), inc.ReadFloat()); + + bool enabled = inc.ReadBoolean(); + + DebugConsole.Log("Received spawn data for " + configPath); + + Character character = null; + if (noInfo) + { + if (!spawn) return null; + + character = Character.Create(configPath, position, null, true); + character.ID = id; + } + else + { + bool hasOwner = inc.ReadBoolean(); + int ownerId = hasOwner ? inc.ReadByte() : -1; + + + string newName = inc.ReadString(); + byte teamID = inc.ReadByte(); + + bool hasAi = inc.ReadBoolean(); + bool isFemale = inc.ReadBoolean(); + int headSpriteID = inc.ReadByte(); + string jobName = inc.ReadString(); + + JobPrefab jobPrefab = null; + Dictionary skillLevels = new Dictionary(); + if (!string.IsNullOrEmpty(jobName)) + { + jobPrefab = JobPrefab.List.Find(jp => jp.Name == jobName); + int skillCount = inc.ReadByte(); + for (int i = 0; i < skillCount; i++) + { + string skillName = inc.ReadString(); + int skillLevel = inc.ReadRangedInteger(0, 100); + + skillLevels.Add(skillName, skillLevel); + } + } + + if (!spawn) return null; + + + CharacterInfo ch = new CharacterInfo(configPath, newName, isFemale ? Gender.Female : Gender.Male, jobPrefab); + ch.HeadSpriteId = headSpriteID; + + System.Diagnostics.Debug.Assert(skillLevels.Count == ch.Job.Skills.Count); + if (ch.Job != null) + { + foreach (KeyValuePair skill in skillLevels) + { + Skill matchingSkill = ch.Job.Skills.Find(s => s.Name == skill.Key); + if (matchingSkill == null) + { + DebugConsole.ThrowError("Skill \"" + skill.Key + "\" not found in character \"" + newName + "\""); + continue; + } + matchingSkill.Level = skill.Value; + } + } + + character = Create(configPath, position, ch, GameMain.Client.ID != ownerId, hasAi); + character.ID = id; + character.TeamID = teamID; + + if (GameMain.Client.ID == ownerId) + { + GameMain.Client.Character = character; + Controlled = character; + + GameMain.LightManager.LosEnabled = true; + + character.memInput.Clear(); + character.memState.Clear(); + character.memLocalState.Clear(); + } + else + { + var ownerClient = GameMain.Client.ConnectedClients.Find(c => c.ID == ownerId); + if (ownerClient != null) + { + ownerClient.Character = character; + } + } + + if (configPath == Character.HumanConfigFile) + { + GameMain.GameSession.CrewManager.characters.Add(character); + } + } + + character.Enabled = Controlled == character || enabled; + + return character; + } + } +} diff --git a/Barotrauma/Source/Characters/CharacterSound.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterSound.cs similarity index 100% rename from Barotrauma/Source/Characters/CharacterSound.cs rename to Barotrauma/BarotraumaClient/Source/Characters/CharacterSound.cs diff --git a/Barotrauma/Source/Characters/HUDProgressBar.cs b/Barotrauma/BarotraumaClient/Source/Characters/HUDProgressBar.cs similarity index 100% rename from Barotrauma/Source/Characters/HUDProgressBar.cs rename to Barotrauma/BarotraumaClient/Source/Characters/HUDProgressBar.cs diff --git a/Barotrauma/BarotraumaClient/Source/Characters/HuskInfection.cs b/Barotrauma/BarotraumaClient/Source/Characters/HuskInfection.cs new file mode 100644 index 000000000..72350aebb --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/HuskInfection.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace Barotrauma +{ + partial class HuskInfection + { + partial void UpdateProjSpecific(float prevTimer, Character character) + { + if (IncubationTimer < 0.5f) + { + if (prevTimer % 0.1f > 0.05f && IncubationTimer % 0.1f < 0.05f) + { + GUI.AddMessage(InfoTextManager.GetInfoText("HuskDormant"), Color.Red, 4.0f); + } + } + else if (IncubationTimer < 1.0f) + { + if (state == InfectionState.Dormant && Character.Controlled == character) + { + new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak")); + } + } + else + { + if (Character.Controlled == character) new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate")); + } + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Jobs/JobPrefab.cs b/Barotrauma/BarotraumaClient/Source/Characters/Jobs/JobPrefab.cs new file mode 100644 index 000000000..71ece5041 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/Jobs/JobPrefab.cs @@ -0,0 +1,57 @@ +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Globalization; +using System.Xml.Linq; +using System.Linq; + +namespace Barotrauma +{ + partial class JobPrefab + { + public GUIFrame CreateInfoFrame() + { + int width = 500, height = 400; + + GUIFrame backFrame = new GUIFrame(Rectangle.Empty, Color.Black * 0.5f); + backFrame.Padding = Vector4.Zero; + + GUIFrame frame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", backFrame); + frame.Padding = new Vector4(30.0f, 30.0f, 30.0f, 30.0f); + + new GUITextBlock(new Rectangle(0, 0, 100, 20), Name, "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont); + + var descriptionBlock = new GUITextBlock(new Rectangle(0, 40, 0, 0), Description, "", Alignment.TopLeft, Alignment.TopLeft, frame, true, GUI.SmallFont); + + new GUITextBlock(new Rectangle(0, 40 + descriptionBlock.Rect.Height + 20, 100, 20), "Skills: ", "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont); + + int y = 40 + descriptionBlock.Rect.Height + 50; + foreach (SkillPrefab skill in Skills) + { + string skillDescription = Skill.GetLevelName((int)skill.LevelRange.X); + string skillDescription2 = Skill.GetLevelName((int)skill.LevelRange.Y); + + if (skillDescription2 != skillDescription) + { + skillDescription += "/" + skillDescription2; + } + new GUITextBlock(new Rectangle(0, y, 100, 20), + " - " + skill.Name + ": " + skillDescription, "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.SmallFont); + + y += 20; + } + + new GUITextBlock(new Rectangle(250, 40 + descriptionBlock.Rect.Height + 20, 0, 20), "Items: ", "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont); + + y = 40 + descriptionBlock.Rect.Height + 50; + foreach (string itemName in ItemNames) + { + new GUITextBlock(new Rectangle(250, y, 100, 20), + " - " + itemName, "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.SmallFont); + + y += 20; + } + + return backFrame; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs new file mode 100644 index 000000000..bc0c6dbc0 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs @@ -0,0 +1,136 @@ +using System; +using System.Xml.Linq; +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Dynamics.Joints; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Barotrauma.Items.Components; +using System.Collections.Generic; +using Barotrauma.Lights; +using System.Linq; +using System.IO; + +namespace Barotrauma +{ + partial class Limb + { + public LightSource LightSource + { + get; + private set; + } + + Sound hitSound; + + public Sound HitSound + { + get { return hitSound; } + } + + partial void InitProjSpecific(XElement element) + { + foreach (XElement subElement in element.Elements()) + { + switch (subElement.Name.ToString().ToLowerInvariant()) + { + case "lightsource": + LightSource = new LightSource(subElement); + break; + case "sound": + hitSound = Sound.Load(ToolBox.GetAttributeString(subElement, "file", "")); + break; + } + } + } + + partial void UpdateProjSpecific() + { + if (LightSource != null) + { + LightSource.ParentSub = body.Submarine; + } + } + + public void Draw(SpriteBatch spriteBatch) + { + float brightness = 1.0f - (burnt / 100.0f) * 0.5f; + Color color = new Color(brightness, brightness, brightness); + + if (isSevered) + { + if (severedFadeOutTimer > SeveredFadeOutTime) + { + return; + } + else if (severedFadeOutTimer > SeveredFadeOutTime - 1.0f) + { + color *= SeveredFadeOutTime - severedFadeOutTimer; + } + } + + body.Dir = Dir; + + bool hideLimb = wearingItems.Any(w => w != null && w.HideLimb); + if (!hideLimb) + { + body.Draw(spriteBatch, sprite, color, null, scale); + } + else + { + body.UpdateDrawPosition(); + } + + if (LightSource != null) + { + LightSource.Position = body.DrawPosition; + } + + foreach (WearableSprite wearable in wearingItems) + { + SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Vector2 origin = wearable.Sprite.Origin; + if (body.Dir == -1.0f) origin.X = wearable.Sprite.SourceRect.Width - origin.X; + + float depth = sprite.Depth - 0.000001f; + + if (wearable.DepthLimb != LimbType.None) + { + Limb depthLimb = character.AnimController.GetLimb(wearable.DepthLimb); + if (depthLimb != null) + { + depth = depthLimb.sprite.Depth - 0.000001f; + } + } + + wearable.Sprite.Draw(spriteBatch, + new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), + color, origin, + -body.DrawRotation, + scale, spriteEffect, depth); + } + + if (damage > 0.0f && damagedSprite != null && !hideLimb) + { + SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + float depth = sprite.Depth - 0.0000015f; + + damagedSprite.Draw(spriteBatch, + new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), + color * Math.Min(damage / 50.0f, 1.0f), sprite.Origin, + -body.DrawRotation, + 1.0f, spriteEffect, depth); + } + + if (!GameMain.DebugDraw) return; + + if (pullJoint != null) + { + Vector2 pos = ConvertUnits.ToDisplayUnits(pullJoint.WorldAnchorB); + GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.Red, true); + } + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs new file mode 100644 index 000000000..259dee661 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs @@ -0,0 +1,491 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Barotrauma.Networking; +using Barotrauma.Items.Components; +using System.Text; +using FarseerPhysics; + +namespace Barotrauma +{ + static partial class DebugConsole + { + static bool isOpen; + + //used for keeping track of the message entered when pressing up/down + static int selectedIndex; + + public static bool IsOpen + { + get + { + return isOpen; + } + } + + static GUIFrame frame; + static GUIListBox listBox; + static GUITextBox textBox; + + public static void Init(GameWindow window) + { + int x = 20, y = 20; + int width = 800, height = 500; + + frame = new GUIFrame(new Rectangle(x, y, width, height), new Color(0.4f, 0.4f, 0.4f, 0.8f)); + frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); + + listBox = new GUIListBox(new Rectangle(0, 0, 0, frame.Rect.Height - 40), Color.Black, "", frame); + //listBox.Color = Color.Black * 0.7f; + + textBox = new GUITextBox(new Rectangle(0, 0, 0, 20), Color.Black, Color.White, Alignment.BottomLeft, Alignment.Left, "", frame); + //textBox.Color = Color.Black * 0.7f; + + //messages already added before initialization -> add them to the listbox + List unInitializedMessages = new List(Messages); + Messages.Clear(); + + foreach (ColoredText msg in unInitializedMessages) + { + NewMessage(msg.Text, msg.Color); + } + + NewMessage("Press F3 to open/close the debug console", Color.Cyan); + NewMessage("Enter \"help\" for a list of available console commands", Color.Cyan); + + } + + public static void AddToGUIUpdateList() + { + if (isOpen) + { + frame.AddToGUIUpdateList(); + } + } + + public static void Update(GameMain game, float deltaTime) + { + if (PlayerInput.KeyHit(Keys.F3)) + { + isOpen = !isOpen; + if (isOpen) + { + textBox.Select(); + AddToGUIUpdateList(); + } + else + { + GUIComponent.ForceMouseOn(null); + textBox.Deselect(); + } + + //keyboardDispatcher.Subscriber = (isOpen) ? textBox : null; + } + + if (isOpen) + { + frame.Update(deltaTime); + + Character.DisableControls = true; + + if (PlayerInput.KeyHit(Keys.Up)) + { + SelectMessage(-1); + } + else if (PlayerInput.KeyHit(Keys.Down)) + { + SelectMessage(1); + } + + //textBox.Update(deltaTime); + + if (PlayerInput.KeyDown(Keys.Enter) && textBox.Text != "") + { + ExecuteCommand(textBox.Text, game); + textBox.Text = ""; + + //selectedIndex = messages.Count; + } + } + } + + private static void SelectMessage(int direction) + { + int messageCount = listBox.children.Count; + if (messageCount == 0) return; + + direction = Math.Min(Math.Max(-1, direction), 1); + + selectedIndex += direction; + if (selectedIndex < 0) selectedIndex = messageCount - 1; + selectedIndex = selectedIndex % messageCount; + + textBox.Text = (listBox.children[selectedIndex] as GUITextBlock).Text; + } + + public static void Draw(SpriteBatch spriteBatch) + { + if (!isOpen) return; + + frame.Draw(spriteBatch); + } + + private static bool IsCommandPermitted(string command, GameClient client) + { + switch (command) + { + case "kick": + return client.HasPermission(ClientPermissions.Kick); + case "ban": + case "banip": + return client.HasPermission(ClientPermissions.Ban); + case "netstats": + case "help": + case "dumpids": + case "admin": + case "entitylist": + return true; + default: + return false; + } + } + + private static bool ExecProjSpecific(string[] commands) + { + switch (commands[0].ToLowerInvariant()) + { + case "startclient": + if (commands.Length == 1) return true; + if (GameMain.Client == null) + { + GameMain.NetworkMember = new GameClient("Name"); + GameMain.Client.ConnectToServer(commands[1]); + } + break; + case "mainmenuscreen": + case "mainmenu": + case "menu": + GameMain.GameSession = null; + + List characters = new List(Character.CharacterList); + foreach (Character c in characters) + { + c.Remove(); + } + + GameMain.MainMenuScreen.Select(); + break; + case "gamescreen": + case "game": + GameMain.GameScreen.Select(); + break; + case "editmapscreen": + case "editmap": + case "edit": + if (commands.Length > 1) + { + Submarine.Load(string.Join(" ", commands.Skip(1)), true); + } + GameMain.EditMapScreen.Select(); + break; + case "editcharacter": + case "editchar": + GameMain.EditCharacterScreen.Select(); + break; + case "controlcharacter": + case "control": + { + if (commands.Length < 2) break; + + var character = FindMatchingCharacter(commands, true); + + if (character != null) + { + Character.Controlled = character; + } + } + break; + case "setclientcharacter": + { + if (GameMain.Server == null) break; + + int separatorIndex = Array.IndexOf(commands, ";"); + + if (separatorIndex == -1 || commands.Length < 4) + { + ThrowError("Invalid parameters. The command should be formatted as \"setclientcharacter [client] ; [character]\""); + break; + } + + string[] commandsLeft = commands.Take(separatorIndex).ToArray(); + string[] commandsRight = commands.Skip(separatorIndex).ToArray(); + + string clientName = String.Join(" ", commandsLeft.Skip(1)); + + var client = GameMain.Server.ConnectedClients.Find(c => c.name == clientName); + if (client == null) + { + ThrowError("Client \"" + clientName + "\" not found."); + } + + var character = FindMatchingCharacter(commandsRight, false); + GameMain.Server.SetClientCharacter(client, character); + } + break; + case "test": + Submarine.Load("aegir mark ii", true); + GameMain.DebugDraw = true; + GameMain.LightManager.LosEnabled = false; + GameMain.EditMapScreen.Select(); + break; + case "shake": + GameMain.GameScreen.Cam.Shake = 10.0f; + break; + case "losenabled": + case "los": + case "drawlos": + GameMain.LightManager.LosEnabled = !GameMain.LightManager.LosEnabled; + break; + case "lighting": + case "lightingenabled": + case "light": + case "lights": + GameMain.LightManager.LightingEnabled = !GameMain.LightManager.LightingEnabled; + break; + case "tutorial": + TutorialMode.StartTutorial(Tutorials.TutorialType.TutorialTypes[0]); + break; + case "editortutorial": + GameMain.EditMapScreen.Select(); + GameMain.EditMapScreen.StartTutorial(); + break; + case "lobbyscreen": + case "lobby": + GameMain.LobbyScreen.Select(); + break; + case "savemap": + case "savesub": + case "save": + if (commands.Length < 2) break; + + if (GameMain.EditMapScreen.CharacterMode) + { + GameMain.EditMapScreen.ToggleCharacterMode(); + } + + string fileName = string.Join(" ", commands.Skip(1)); + if (fileName.Contains("../")) + { + DebugConsole.ThrowError("Illegal symbols in filename (../)"); + return true; + } + + if (Submarine.SaveCurrent(System.IO.Path.Combine(Submarine.SavePath, fileName + ".sub"))) + { + NewMessage("Sub saved", Color.Green); + //Submarine.Loaded.First().CheckForErrors(); + } + + break; + case "loadmap": + case "loadsub": + case "load": + if (commands.Length < 2) break; + + Submarine.Load(string.Join(" ", commands.Skip(1)), true); + break; + case "cleansub": + for (int i = MapEntity.mapEntityList.Count - 1; i >= 0; i--) + { + MapEntity me = MapEntity.mapEntityList[i]; + + if (me.SimPosition.Length() > 2000.0f) + { + DebugConsole.NewMessage("Removed " + me.Name + " (simposition " + me.SimPosition + ")", Color.Orange); + MapEntity.mapEntityList.RemoveAt(i); + } + else if (me.MoveWithLevel) + { + DebugConsole.NewMessage("Removed " + me.Name + " (MoveWithLevel==true)", Color.Orange); + MapEntity.mapEntityList.RemoveAt(i); + } + else if (me is Item) + { + Item item = me as Item; + var wire = item.GetComponent(); + if (wire == null) continue; + + if (wire.GetNodes().Count > 0 && !wire.Connections.Any(c => c != null)) + { + wire.Item.Drop(null); + DebugConsole.NewMessage("Dropped wire (ID: " + wire.Item.ID + ") - attached on wall but no connections found", Color.Orange); + } + } + + } + break; + case "messagebox": + if (commands.Length < 3) break; + new GUIMessageBox(commands[1], commands[2]); + break; + case "debugdraw": + GameMain.DebugDraw = !GameMain.DebugDraw; + break; + case "disablehud": + case "hud": + GUI.DisableHUD = !GUI.DisableHUD; + GameMain.Instance.IsMouseVisible = !GameMain.Instance.IsMouseVisible; + break; + case "followsub": + Camera.FollowSub = !Camera.FollowSub; + break; + case "drawaitargets": + case "showaitargets": + AITarget.ShowAITargets = !AITarget.ShowAITargets; + break; +#if DEBUG + case "spamevents": + foreach (Item item in Item.ItemList) + { + for (int i = 0; i(); + if (itemContainer != null) + { + GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.InventoryState }); + } + + GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.Status }); + + item.NeedsPositionUpdate = true; + } + } + + foreach (Character c in Character.CharacterList) + { + GameMain.Server.CreateEntityEvent(c, new object[] { NetEntityEvent.Type.Status }); + } + + foreach (Structure wall in Structure.WallList) + { + GameMain.Server.CreateEntityEvent(wall); + } + break; + case "spamchatmessages": + int msgCount = 1000; + if (commands.Length > 1) int.TryParse(commands[1], out msgCount); + int msgLength = 50; + if (commands.Length > 2) int.TryParse(commands[2], out msgLength); + + for (int i = 0; i < msgCount; i++) + { + if (GameMain.Server != null) + { + GameMain.Server.SendChatMessage(ToolBox.RandomSeed(msgLength), ChatMessageType.Default); + } + else + { + GameMain.Client.SendChatMessage(ToolBox.RandomSeed(msgLength)); + } + } + break; +#endif + case "cleanbuild": + GameMain.Config.MusicVolume = 0.5f; + GameMain.Config.SoundVolume = 0.5f; + DebugConsole.NewMessage("Music and sound volume set to 0.5", Color.Green); + + GameMain.Config.GraphicsWidth = 0; + GameMain.Config.GraphicsHeight = 0; + GameMain.Config.WindowMode = WindowMode.Fullscreen; + DebugConsole.NewMessage("Resolution set to 0 x 0 (screen resolution will be used)", Color.Green); + DebugConsole.NewMessage("Fullscreen enabled", Color.Green); + + GameSettings.VerboseLogging = false; + + if (GameMain.Config.MasterServerUrl != "http://www.undertowgames.com/baromaster") + { + DebugConsole.ThrowError("MasterServerUrl \"" + GameMain.Config.MasterServerUrl + "\"!"); + } + + GameMain.Config.Save("config.xml"); + + var saveFiles = System.IO.Directory.GetFiles(SaveUtil.SaveFolder); + + foreach (string saveFile in saveFiles) + { + System.IO.File.Delete(saveFile); + DebugConsole.NewMessage("Deleted " + saveFile, Color.Green); + } + + if (System.IO.Directory.Exists(System.IO.Path.Combine(SaveUtil.SaveFolder, "temp"))) + { + System.IO.Directory.Delete(System.IO.Path.Combine(SaveUtil.SaveFolder, "temp"), true); + DebugConsole.NewMessage("Deleted temp save folder", Color.Green); + } + + if (System.IO.Directory.Exists(ServerLog.SavePath)) + { + var logFiles = System.IO.Directory.GetFiles(ServerLog.SavePath); + + foreach (string logFile in logFiles) + { + System.IO.File.Delete(logFile); + DebugConsole.NewMessage("Deleted " + logFile, Color.Green); + } + } + + if (System.IO.File.Exists("filelist.xml")) + { + System.IO.File.Delete("filelist.xml"); + DebugConsole.NewMessage("Deleted filelist", Color.Green); + } + + + if (System.IO.File.Exists("Submarines/TutorialSub.sub")) + { + System.IO.File.Delete("Submarines/TutorialSub.sub"); + + DebugConsole.NewMessage("Deleted TutorialSub from the submarine folder", Color.Green); + } + + if (System.IO.File.Exists(GameServer.SettingsFile)) + { + System.IO.File.Delete(GameServer.SettingsFile); + DebugConsole.NewMessage("Deleted server settings", Color.Green); + } + + if (System.IO.File.Exists(GameServer.ClientPermissionsFile)) + { + System.IO.File.Delete(GameServer.ClientPermissionsFile); + DebugConsole.NewMessage("Deleted client permission file", Color.Green); + + } + + if (System.IO.File.Exists("crashreport.txt")) + { + System.IO.File.Delete("crashreport.txt"); + DebugConsole.NewMessage("Deleted crashreport.txt", Color.Green); + } + + if (!System.IO.File.Exists("Content/Map/TutorialSub.sub")) + { + DebugConsole.ThrowError("TutorialSub.sub not found!"); + } + + break; + default: + return false; //command not found + break; + } + return true; //command found + } + } +} diff --git a/Barotrauma/Source/EventInput/EventInput.cs b/Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs similarity index 100% rename from Barotrauma/Source/EventInput/EventInput.cs rename to Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs diff --git a/Barotrauma/Source/EventInput/KeyboardDispatcher.cs b/Barotrauma/BarotraumaClient/Source/EventInput/KeyboardDispatcher.cs similarity index 100% rename from Barotrauma/Source/EventInput/KeyboardDispatcher.cs rename to Barotrauma/BarotraumaClient/Source/EventInput/KeyboardDispatcher.cs diff --git a/Barotrauma/BarotraumaClient/Source/Events/Missions/Mission.cs b/Barotrauma/BarotraumaClient/Source/Events/Missions/Mission.cs new file mode 100644 index 000000000..834118cd1 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Events/Missions/Mission.cs @@ -0,0 +1,25 @@ +using Barotrauma.Networking; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; + +namespace Barotrauma +{ + partial class Mission + { + public void ShowMessage(int index) + { + if (index >= headers.Count && index >= messages.Count) return; + + string header = index < headers.Count ? headers[index] : ""; + string message = index < messages.Count ? messages[index] : ""; + + GameServer.Log("Mission info: " + header + " - " + message, ServerLog.MessageType.ServerMessage); + + new GUIMessageBox(header, message); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Events/Missions/MissionMode.cs b/Barotrauma/BarotraumaClient/Source/Events/Missions/MissionMode.cs new file mode 100644 index 000000000..05387054d --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Events/Missions/MissionMode.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework; + +namespace Barotrauma +{ + partial class MissionMode : GameMode + { + public override void MsgBox() + { + if (mission == null) return; + + var missionMsg = new GUIMessageBox(mission.Name, mission.Description, 400, 400); + missionMsg.UserData = "missionstartmessage"; + + Networking.GameServer.Log("Mission: " + mission.Name, Networking.ServerLog.MessageType.ServerMessage); + Networking.GameServer.Log(mission.Description, Networking.ServerLog.MessageType.ServerMessage); + } + } +} diff --git a/Barotrauma/Source/Fonts/ScalableFont.cs b/Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs similarity index 100% rename from Barotrauma/Source/Fonts/ScalableFont.cs rename to Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs diff --git a/Barotrauma/Source/GUI/ComponentStyle.cs b/Barotrauma/BarotraumaClient/Source/GUI/ComponentStyle.cs similarity index 100% rename from Barotrauma/Source/GUI/ComponentStyle.cs rename to Barotrauma/BarotraumaClient/Source/GUI/ComponentStyle.cs diff --git a/Barotrauma/Source/GUI/GUI.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs similarity index 97% rename from Barotrauma/Source/GUI/GUI.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUI.cs index fca97836a..8625ad4b5 100644 --- a/Barotrauma/Source/GUI/GUI.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs @@ -6,15 +6,6 @@ using System.Collections.Generic; namespace Barotrauma { - [Flags] - public enum Alignment - { - CenterX = 1, Left = 2, Right = 4, CenterY = 8, Top = 16, Bottom = 32, - TopLeft = (Top | Left), TopCenter = (CenterX | Top), TopRight = (Top | Right), - CenterLeft = (Left | CenterY), Center = (CenterX | CenterY), CenterRight = (Right | CenterY), - BottomLeft = (Bottom | Left), BottomCenter = (CenterX | Bottom), BottomRight = (Bottom | Right), - } - public enum GUISoundType { Message, diff --git a/Barotrauma/Source/GUI/GUIButton.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIButton.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs diff --git a/Barotrauma/Source/GUI/GUIComponent.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIComponent.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs diff --git a/Barotrauma/Source/GUI/GUIDropDown.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIDropDown.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs diff --git a/Barotrauma/Source/GUI/GUIFrame.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIFrame.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIFrame.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIFrame.cs diff --git a/Barotrauma/Source/GUI/GUIImage.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIImage.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIImage.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIImage.cs diff --git a/Barotrauma/Source/GUI/GUIListBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIListBox.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs diff --git a/Barotrauma/Source/GUI/GUIMessage.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIMessage.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIMessage.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIMessage.cs diff --git a/Barotrauma/Source/GUI/GUIMessageBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIMessageBox.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs diff --git a/Barotrauma/Source/GUI/GUIProgressBar.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIProgressBar.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIProgressBar.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIProgressBar.cs diff --git a/Barotrauma/Source/GUI/GUIScrollBar.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIScrollBar.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIScrollBar.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIScrollBar.cs diff --git a/Barotrauma/Source/GUI/GUIStyle.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs similarity index 100% rename from Barotrauma/Source/GUI/GUIStyle.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs diff --git a/Barotrauma/Source/GUI/GUITextBlock.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs similarity index 100% rename from Barotrauma/Source/GUI/GUITextBlock.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs diff --git a/Barotrauma/Source/GUI/GUITextBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUITextBox.cs similarity index 100% rename from Barotrauma/Source/GUI/GUITextBox.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUITextBox.cs diff --git a/Barotrauma/Source/GUI/GUITickBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs similarity index 100% rename from Barotrauma/Source/GUI/GUITickBox.cs rename to Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs diff --git a/Barotrauma/Source/GUI/LoadingScreen.cs b/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs similarity index 98% rename from Barotrauma/Source/GUI/LoadingScreen.cs rename to Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs index cd0a87430..d05d63c65 100644 --- a/Barotrauma/Source/GUI/LoadingScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs @@ -44,6 +44,7 @@ namespace Barotrauma set { loadState = value; + DebugConsole.NewMessage("Loading: " + value.ToString() + "%",Color.Yellow); DrawLoadingText = true; } } diff --git a/Barotrauma/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs similarity index 96% rename from Barotrauma/Source/GameMain.cs rename to Barotrauma/BarotraumaClient/Source/GameMain.cs index 6f291cd27..c159b74bc 100644 --- a/Barotrauma/Source/GameMain.cs +++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs @@ -3,11 +3,11 @@ using System.Diagnostics; using System.Reflection; using FarseerPhysics; using FarseerPhysics.Dynamics; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Barotrauma.Networking; using Barotrauma.Particles; using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace Barotrauma @@ -106,7 +106,7 @@ namespace Barotrauma { GraphicsDeviceManager = new GraphicsDeviceManager(this); Window.Title = "Barotrauma"; - + Instance = this; Config = new GameSettings("config.xml"); @@ -141,6 +141,12 @@ namespace Barotrauma GraphicsHeight = Config.GraphicsHeight; GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.VSyncEnabled; + //for whatever reason, window isn't centered automatically + //since MonoGame 3.6 (nuget package might be broken), so + //let's do it manually + Window.Position = new Point((GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width - GraphicsWidth) / 2, + (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - GraphicsHeight) / 2); + GraphicsDeviceManager.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed; GraphicsDeviceManager.IsFullScreen = Config.WindowMode == WindowMode.Fullscreen || Config.WindowMode == WindowMode.BorderlessWindowed; @@ -192,6 +198,7 @@ namespace Barotrauma private IEnumerable Load() { + DebugConsole.NewMessage("LOADING COROUTINE", Color.Lime); GUI.GraphicsDevice = base.GraphicsDevice; GUI.Init(Content); @@ -274,6 +281,7 @@ namespace Barotrauma TitleScreen.LoadState = 100.0f; hasLoaded = true; + DebugConsole.NewMessage("LOADING COROUTINE FINISHED", Color.Lime); yield return CoroutineStatus.Success; } @@ -365,7 +373,7 @@ namespace Barotrauma } GUI.Update((float)Timing.Step); - } + } CoroutineManager.Update((float)Timing.Step, paused ? 0.0f : (float)Timing.Step); @@ -418,6 +426,5 @@ namespace Barotrauma base.OnExiting(sender, args); } - } -} \ No newline at end of file +} diff --git a/Barotrauma/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs similarity index 99% rename from Barotrauma/Source/GameSession/CrewManager.cs rename to Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index bc5dbef82..b1f11e76a 100644 --- a/Barotrauma/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -281,7 +281,7 @@ namespace Barotrauma listBox.ClearChildren(); characters.Clear(); - WayPoint[] waypoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSub); + WayPoint[] waypoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSub, false); for (int i = 0; i < waypoints.Length; i++) { diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameMode.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameMode.cs new file mode 100644 index 000000000..83b87c5ce --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameMode.cs @@ -0,0 +1,10 @@ +using Microsoft.Xna.Framework.Graphics; +namespace Barotrauma +{ + partial class GameMode + { + public virtual void Draw(SpriteBatch spriteBatch) + { + } + } +} diff --git a/Barotrauma/Source/GameSession/GameModes/SinglePlayerMode.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerMode.cs similarity index 100% rename from Barotrauma/Source/GameSession/GameModes/SinglePlayerMode.cs rename to Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerMode.cs diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/TraitorManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/TraitorManager.cs new file mode 100644 index 000000000..c0ad48d03 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/TraitorManager.cs @@ -0,0 +1,15 @@ +using Barotrauma.Networking; +using System.Collections.Generic; + +namespace Barotrauma +{ + partial class TraitorManager + { + public static void CreateStartPopUp(string targetName) + { + new GUIMessageBox("You are the Traitor!", + "Your secret task is to assassinate " + targetName + "! Discretion is an utmost concern; sinking the submarine and killing the entire crew " + + "will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.", 400, 350); + } + } +} diff --git a/Barotrauma/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs similarity index 100% rename from Barotrauma/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs rename to Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs diff --git a/Barotrauma/Source/GameSession/GameModes/Tutorials/EditorTutorial.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/EditorTutorial.cs similarity index 100% rename from Barotrauma/Source/GameSession/GameModes/Tutorials/EditorTutorial.cs rename to Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/EditorTutorial.cs diff --git a/Barotrauma/Source/GameSession/GameModes/Tutorials/TutorialMode.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/TutorialMode.cs similarity index 100% rename from Barotrauma/Source/GameSession/GameModes/Tutorials/TutorialMode.cs rename to Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/TutorialMode.cs diff --git a/Barotrauma/Source/GameSession/GameModes/Tutorials/TutorialType.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/TutorialType.cs similarity index 100% rename from Barotrauma/Source/GameSession/GameModes/Tutorials/TutorialType.cs rename to Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/TutorialType.cs diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameSession.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameSession.cs new file mode 100644 index 000000000..1254f63e8 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameSession.cs @@ -0,0 +1,197 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Xml.Linq; + +namespace Barotrauma +{ + partial class GameSession + { + private InfoFrameTab selectedTab; + private GUIButton infoButton; + private GUIFrame infoFrame; + + public Map Map + { + get + { + SinglePlayerMode mode = (gameMode as SinglePlayerMode); + return (mode == null) ? null : mode.Map; + } + } + + private ShiftSummary shiftSummary; + + public ShiftSummary ShiftSummary + { + get { return shiftSummary; } + } + + public bool LoadPrevious(GUIButton button, object obj) + { + Submarine.Unload(); + + SaveUtil.LoadGame(saveFile); + + GameMain.LobbyScreen.Select(); + + return true; + } + + private bool ToggleInfoFrame(GUIButton button, object obj) + { + if (infoFrame == null) + { + if (CrewManager != null && CrewManager.CrewCommander != null && CrewManager.CrewCommander.IsOpen) + { + CrewManager.CrewCommander.ToggleGUIFrame(); + } + + CreateInfoFrame(); + SelectInfoFrameTab(null, selectedTab); + } + else + { + infoFrame = null; + } + + return true; + } + + public void CreateInfoFrame() + { + int width = 600, height = 400; + + + infoFrame = new GUIFrame( + Rectangle.Empty, Color.Black * 0.8f, null); + + var innerFrame = new GUIFrame( + new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", infoFrame); + + innerFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); + + var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Crew", "", innerFrame); + crewButton.UserData = InfoFrameTab.Crew; + crewButton.OnClicked = SelectInfoFrameTab; + + var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), "Mission", "", innerFrame); + missionButton.UserData = InfoFrameTab.Mission; + missionButton.OnClicked = SelectInfoFrameTab; + + if (GameMain.Server != null) + { + var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), "Manage players", "", innerFrame); + manageButton.UserData = InfoFrameTab.ManagePlayers; + manageButton.OnClicked = SelectInfoFrameTab; + } + + var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Close", Alignment.BottomCenter, "", innerFrame); + closeButton.OnClicked = ToggleInfoFrame; + + } + + private bool SelectInfoFrameTab(GUIButton button, object userData) + { + selectedTab = (InfoFrameTab)userData; + + CreateInfoFrame(); + + switch (selectedTab) + { + case InfoFrameTab.Crew: + CrewManager.CreateCrewFrame(CrewManager.characters, infoFrame.children[0] as GUIFrame); + break; + case InfoFrameTab.Mission: + CreateMissionInfo(infoFrame.children[0] as GUIFrame); + break; + case InfoFrameTab.ManagePlayers: + GameMain.Server.ManagePlayersFrame(infoFrame.children[0] as GUIFrame); + break; + } + + return true; + } + + private void CreateMissionInfo(GUIFrame infoFrame) + { + if (Mission == null) + { + new GUITextBlock(new Rectangle(0, 0, 0, 50), "No mission", "", infoFrame, true); + return; + } + + new GUITextBlock(new Rectangle(0, 0, 0, 40), Mission.Name, "", infoFrame, GUI.LargeFont); + + new GUITextBlock(new Rectangle(0, 50, 0, 20), "Reward: " + Mission.Reward, "", infoFrame, true); + new GUITextBlock(new Rectangle(0, 70, 0, 50), Mission.Description, "", infoFrame, true); + + + } + + public void AddToGUIUpdateList() + { + infoButton.AddToGUIUpdateList(); + + if (gameMode != null) gameMode.AddToGUIUpdateList(); + + if (infoFrame != null) infoFrame.AddToGUIUpdateList(); + } + + public void Update(float deltaTime) + { + TaskManager.Update(deltaTime); + + if (GUI.DisableHUD) return; + + //guiRoot.Update(deltaTime); + infoButton.Update(deltaTime); + + if (gameMode != null) gameMode.Update(deltaTime); + if (Mission != null) Mission.Update(deltaTime); + if (infoFrame != null) + { + infoFrame.Update(deltaTime); + + if (CrewManager != null && CrewManager.CrewCommander != null && CrewManager.CrewCommander.IsOpen) + { + infoFrame = null; + } + } + } + + public void Draw(SpriteBatch spriteBatch) + { + if (GUI.DisableHUD) return; + + infoButton.Draw(spriteBatch); + + if (gameMode != null) gameMode.Draw(spriteBatch); + if (infoFrame != null) infoFrame.Draw(spriteBatch); + } + + public void Save(string filePath) + { + XDocument doc = new XDocument( + new XElement("Gamesession")); + + var now = DateTime.Now; + doc.Root.Add(new XAttribute("savetime", now.ToShortTimeString() + ", " + now.ToShortDateString())); + + doc.Root.Add(new XAttribute("submarine", submarine == null ? "" : submarine.Name)); + + doc.Root.Add(new XAttribute("mapseed", Map.Seed)); + + ((SinglePlayerMode)gameMode).Save(doc.Root); + + try + { + doc.Save(filePath); + } + catch + { + DebugConsole.ThrowError("Saving gamesession to \"" + filePath + "\" failed!"); + } + } + } +} diff --git a/Barotrauma/Source/GameSession/HireManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/HireManager.cs similarity index 100% rename from Barotrauma/Source/GameSession/HireManager.cs rename to Barotrauma/BarotraumaClient/Source/GameSession/HireManager.cs diff --git a/Barotrauma/Source/GameSession/ShiftSummary.cs b/Barotrauma/BarotraumaClient/Source/GameSession/ShiftSummary.cs similarity index 100% rename from Barotrauma/Source/GameSession/ShiftSummary.cs rename to Barotrauma/BarotraumaClient/Source/GameSession/ShiftSummary.cs diff --git a/Barotrauma/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs similarity index 84% rename from Barotrauma/Source/GameSettings.cs rename to Barotrauma/BarotraumaClient/Source/GameSettings.cs index c032645d5..598933a88 100644 --- a/Barotrauma/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs @@ -14,11 +14,11 @@ namespace Barotrauma Windowed, Fullscreen, BorderlessWindowed } - public class GameSettings + public partial class GameSettings { private GUIFrame settingsFrame; private GUIButton applyButton; - + private float soundVolume, musicVolume; private WindowMode windowMode; @@ -28,10 +28,10 @@ namespace Barotrauma private KeyOrMouse[] keyMapping; private bool unsavedSettings; - + public GUIFrame SettingsFrame { - get + get { if (settingsFrame == null) CreateSettingsFrame(); return settingsFrame; @@ -43,11 +43,13 @@ namespace Barotrauma return keyMapping[(int)inputType]; } - public int GraphicsWidth { get; set; } - public int GraphicsHeight { get; set; } + public int GraphicsWidth { get; set; } + public int GraphicsHeight { get; set; } public bool VSyncEnabled { get; set; } + public bool EnableSplashScreen { get; set; } + //public bool FullScreenEnabled { get; set; } public WindowMode WindowMode @@ -55,9 +57,7 @@ namespace Barotrauma get { return windowMode; } set { windowMode = value; } } - - public ContentPackage SelectedContentPackage { get; set; } - + public List JobNamePreferences { get { return jobNamePreferences; } @@ -70,15 +70,7 @@ namespace Barotrauma jobNamePreferences = value; } } - - public string MasterServerUrl { get; set; } - public bool AutoCheckUpdates { get; set; } - public bool WasGameUpdated { get; set; } - - public static bool VerboseLogging { get; set; } - - public bool EnableSplashScreen { get; set; } - + public bool UnsavedSettings { get @@ -100,7 +92,7 @@ namespace Barotrauma public float SoundVolume { - get { return soundVolume; } + get { return soundVolume; } set { soundVolume = MathHelper.Clamp(value, 0.0f, 1.0f); @@ -118,24 +110,13 @@ namespace Barotrauma } } - public GameSettings(string filePath) + partial void InitProjSpecific(XDocument doc) { - ContentPackage.LoadAll(ContentPackage.Folder); - - Load(filePath); - } - - public void Load(string filePath) - { - XDocument doc = ToolBox.TryLoadXml(filePath); - if (doc == null) { - DebugConsole.ThrowError("No config file found"); - GraphicsWidth = 1024; GraphicsHeight = 678; - + MasterServerUrl = ""; SelectedContentPackage = ContentPackage.list.Any() ? ContentPackage.list[0] : new ContentPackage(""); @@ -145,16 +126,15 @@ namespace Barotrauma { JobNamePreferences.Add(job.Name); } - return; } - + XElement graphicsMode = doc.Root.Element("graphicsmode"); GraphicsWidth = ToolBox.GetAttributeInt(graphicsMode, "width", 0); GraphicsHeight = ToolBox.GetAttributeInt(graphicsMode, "height", 0); VSyncEnabled = ToolBox.GetAttributeBool(graphicsMode, "vsync", true); - if (GraphicsWidth==0 || GraphicsHeight==0) + if (GraphicsWidth == 0 || GraphicsHeight == 0) { GraphicsWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; GraphicsHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; @@ -168,46 +148,31 @@ namespace Barotrauma windowMode = WindowMode.Fullscreen; } - MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", ""); - - AutoCheckUpdates = ToolBox.GetAttributeBool(doc.Root, "autocheckupdates", true); - WasGameUpdated = ToolBox.GetAttributeBool(doc.Root, "wasgameupdated", false); - SoundVolume = ToolBox.GetAttributeFloat(doc.Root, "soundvolume", 1.0f); MusicVolume = ToolBox.GetAttributeFloat(doc.Root, "musicvolume", 0.3f); - VerboseLogging = ToolBox.GetAttributeBool(doc.Root, "verboselogging", false); - EnableSplashScreen = ToolBox.GetAttributeBool(doc.Root, "enablesplashscreen", true); keyMapping = new KeyOrMouse[Enum.GetNames(typeof(InputType)).Length]; - keyMapping[(int)InputType.Up] = new KeyOrMouse(Keys.W); - keyMapping[(int)InputType.Down] = new KeyOrMouse(Keys.S); - keyMapping[(int)InputType.Left] = new KeyOrMouse(Keys.A); - keyMapping[(int)InputType.Right] = new KeyOrMouse(Keys.D); - keyMapping[(int)InputType.Run] = new KeyOrMouse(Keys.LeftShift); + keyMapping[(int)InputType.Up] = new KeyOrMouse(Keys.W); + keyMapping[(int)InputType.Down] = new KeyOrMouse(Keys.S); + keyMapping[(int)InputType.Left] = new KeyOrMouse(Keys.A); + keyMapping[(int)InputType.Right] = new KeyOrMouse(Keys.D); + keyMapping[(int)InputType.Run] = new KeyOrMouse(Keys.LeftShift); - keyMapping[(int)InputType.Chat] = new KeyOrMouse(Keys.Tab); - keyMapping[(int)InputType.CrewOrders] = new KeyOrMouse(Keys.C); + keyMapping[(int)InputType.Chat] = new KeyOrMouse(Keys.Tab); + keyMapping[(int)InputType.CrewOrders] = new KeyOrMouse(Keys.C); - keyMapping[(int)InputType.Select] = new KeyOrMouse(Keys.E); + keyMapping[(int)InputType.Select] = new KeyOrMouse(Keys.E); keyMapping[(int)InputType.Use] = new KeyOrMouse(0); keyMapping[(int)InputType.Aim] = new KeyOrMouse(1); - + foreach (XElement subElement in doc.Root.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) { - case "contentpackage": - string path = ToolBox.GetAttributeString(subElement, "path", ""); - - - SelectedContentPackage = ContentPackage.list.Find(cp => cp.Path == path); - - if (SelectedContentPackage == null) SelectedContentPackage = new ContentPackage(path); - break; case "keymapping": foreach (XAttribute attribute in subElement.Attributes()) { @@ -222,7 +187,7 @@ namespace Barotrauma else { Keys key; - if (Enum.TryParse(attribute.Value.ToString(), true, out key)) + if (Enum.TryParse(attribute.Value.ToString(), true, out key)) { keyMapping[(int)inputType] = new KeyOrMouse(key); } @@ -241,12 +206,12 @@ namespace Barotrauma } foreach (InputType inputType in Enum.GetValues(typeof(InputType))) - { - if (keyMapping[(int)inputType]==null) + { + if (keyMapping[(int)inputType] == null) { DebugConsole.ThrowError("Key binding for the input type \"" + inputType + " not set!"); keyMapping[(int)inputType] = new KeyOrMouse(Keys.D1); - } + } } @@ -257,7 +222,7 @@ namespace Barotrauma { UnsavedSettings = false; - XDocument doc = new XDocument(); + XDocument doc = new XDocument(); if (doc.Root == null) { @@ -275,7 +240,7 @@ namespace Barotrauma if (WasGameUpdated) { doc.Root.Add(new XAttribute("wasgameupdated", true)); - } + } XElement gMode = doc.Root.Element("graphicsmode"); if (gMode == null) @@ -284,7 +249,7 @@ namespace Barotrauma doc.Root.Add(gMode); } - if (GraphicsWidth==0 || GraphicsHeight==0) + if (GraphicsWidth == 0 || GraphicsHeight == 0) { gMode.ReplaceAttributes(new XAttribute("displaymode", windowMode)); } @@ -300,15 +265,15 @@ namespace Barotrauma if (SelectedContentPackage != null) { - doc.Root.Add(new XElement("contentpackage", + doc.Root.Add(new XElement("contentpackage", new XAttribute("path", SelectedContentPackage.Path))); } var keyMappingElement = new XElement("keymapping"); - doc.Root.Add(keyMappingElement); - for (int i = 0; i { VSyncEnabled = !VSyncEnabled; @@ -444,10 +409,10 @@ namespace Barotrauma new GUITextBlock(new Rectangle(x, y, 100, 20), "Controls:", "", settingsFrame); y += 30; var inputNames = Enum.GetNames(typeof(InputType)); - for (int i = 0; i< inputNames.Length; i++) + for (int i = 0; i < inputNames.Length; i++) { - new GUITextBlock(new Rectangle(x, y, 100, 18), inputNames[i]+": ", "", Alignment.TopLeft, Alignment.CenterLeft, settingsFrame); - var keyBox = new GUITextBox(new Rectangle(x + 100, y, 120, 18), null,null, Alignment.TopLeft, Alignment.CenterLeft, "", settingsFrame); + new GUITextBlock(new Rectangle(x, y, 100, 18), inputNames[i] + ": ", "", Alignment.TopLeft, Alignment.CenterLeft, settingsFrame); + var keyBox = new GUITextBox(new Rectangle(x + 100, y, 120, 18), null, null, Alignment.TopLeft, Alignment.CenterLeft, "", settingsFrame); keyBox.Text = keyMapping[i].ToString(); keyBox.UserData = i; @@ -502,7 +467,7 @@ namespace Barotrauma { yield return CoroutineStatus.Running; - while (keyBox.Selected && PlayerInput.GetKeyboardState.GetPressedKeys().Length==0 + while (keyBox.Selected && PlayerInput.GetKeyboardState.GetPressedKeys().Length == 0 && !PlayerInput.LeftButtonClicked() && !PlayerInput.RightButtonClicked()) { if (Screen.Selected != GameMain.MainMenuScreen && !GUI.SettingsMenuOpen) yield return CoroutineStatus.Success; @@ -534,7 +499,7 @@ namespace Barotrauma { yield return CoroutineStatus.Success; } - + keyBox.Deselect(); yield return CoroutineStatus.Success; diff --git a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs new file mode 100644 index 000000000..cebb34a89 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs @@ -0,0 +1,169 @@ +using System; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Barotrauma.Networking; +using Lidgren.Network; +using System.Collections.Generic; +using Barotrauma.Items.Components; + +namespace Barotrauma +{ + partial class CharacterInventory : Inventory + { + private static Texture2D icons; + + public Vector2[] SlotPositions; + + private GUIButton[] useOnSelfButton; + + partial void InitProjSpecific() + { + useOnSelfButton = new GUIButton[2]; + + if (icons == null) icons = TextureLoader.FromFile("Content/UI/inventoryIcons.png"); + + SlotPositions = new Vector2[limbSlots.Length]; + + int rectWidth = 40, rectHeight = 40; + int spacing = 10; + for (int i = 0; i < SlotPositions.Length; i++) + { + switch (i) + { + //head, torso, legs + case 0: + case 1: + case 2: + SlotPositions[i] = new Vector2( + spacing, + GameMain.GraphicsHeight - (spacing + rectHeight) * (3 - i)); + break; + //lefthand, righthand + case 3: + case 4: + SlotPositions[i] = new Vector2( + spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 2), + GameMain.GraphicsHeight - (spacing + rectHeight) * 3); + + useOnSelfButton[i - 3] = new GUIButton( + new Rectangle((int)SlotPositions[i].X, (int)(SlotPositions[i].Y - spacing - rectHeight), + rectWidth, rectHeight), "Use", "") + { + UserData = i, + OnClicked = UseItemOnSelf + }; + + + break; + case 5: + SlotPositions[i] = new Vector2( + spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 5), + GameMain.GraphicsHeight - (spacing + rectHeight) * 3); + + break; + default: + SlotPositions[i] = new Vector2( + spacing * 2 + rectWidth + (spacing + rectWidth) * ((i - 6) % 5), + GameMain.GraphicsHeight - (spacing + rectHeight) * ((i > 10) ? 2 : 1)); + break; + } + } + } + + private bool UseItemOnSelf(GUIButton button, object obj) + { + if (!(obj is int)) return false; + + int slotIndex = (int)obj; + + return UseItemOnSelf(slotIndex); + } + + protected override void CreateSlots() + { + if (slots == null) slots = new InventorySlot[capacity]; + + int rectWidth = 40, rectHeight = 40; + + Rectangle slotRect = new Rectangle(0, 0, rectWidth, rectHeight); + for (int i = 0; i < capacity; i++) + { + if (slots[i] == null) slots[i] = new InventorySlot(slotRect); + + slots[i].Disabled = false; + + slotRect.X = (int)(SlotPositions[i].X + DrawOffset.X); + slotRect.Y = (int)(SlotPositions[i].Y + DrawOffset.Y); + + slots[i].Rect = slotRect; + + slots[i].Color = limbSlots[i] == InvSlotType.Any ? Color.White * 0.2f : Color.White * 0.4f; + } + + MergeSlots(); + } + + public void DrawOwn(SpriteBatch spriteBatch) + { + if (slots == null) CreateSlots(); + + Rectangle slotRect = new Rectangle(0, 0, 40, 40); + + for (int i = 0; i < capacity; i++) + { + slotRect.X = (int)(SlotPositions[i].X + DrawOffset.X); + slotRect.Y = (int)(SlotPositions[i].Y + DrawOffset.Y); + + if (i == 1) //head + { + spriteBatch.Draw(icons, new Vector2(slotRect.Center.X, slotRect.Center.Y), + new Rectangle(0, 0, 56, 128), Color.White * 0.7f, 0.0f, + new Vector2(28.0f, 64.0f), Vector2.One, + SpriteEffects.None, 0.1f); + } + else if (i == 3 || i == 4) + { + spriteBatch.Draw(icons, new Vector2(slotRect.Center.X, slotRect.Center.Y), + new Rectangle(92, 41 * (4 - i), 36, 40), Color.White * 0.7f, 0.0f, + new Vector2(18.0f, 20.0f), Vector2.One, + SpriteEffects.None, 0.1f); + } + else if (i == 5) + { + spriteBatch.Draw(icons, new Vector2(slotRect.Center.X, slotRect.Center.Y), + new Rectangle(57, 0, 31, 32), Color.White * 0.7f, 0.0f, + new Vector2(15.0f, 16.0f), Vector2.One, + SpriteEffects.None, 0.1f); + } + } + + base.Draw(spriteBatch); + + if (character == Character.Controlled) + { + for (int i = 0; i < capacity; i++) + { + if (selectedSlot != i && + Items[i] != null && Items[i].CanUseOnSelf && character.HasSelectedItem(Items[i])) + { + useOnSelfButton[i - 3].Draw(spriteBatch); + } + } + } + + if (selectedSlot > -1) + { + DrawSubInventory(spriteBatch, selectedSlot); + + if (selectedSlot > -1 && + !slots[selectedSlot].IsHighlighted && + (draggingItem == null || draggingItem.Container != Items[selectedSlot])) + { + selectedSlot = -1; + } + } + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Door.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Door.cs new file mode 100644 index 000000000..7f3c8c79a --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Door.cs @@ -0,0 +1,142 @@ +using Barotrauma.Lights; +using Barotrauma.Networking; +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.Linq; + + +namespace Barotrauma.Items.Components +{ + partial class Door : ItemComponent, IDrawableComponent, IServerSerializable + { + private ConvexHull convexHull; + private ConvexHull convexHull2; + + private Vector2[] GetConvexHullCorners(Rectangle rect) + { + Vector2[] corners = new Vector2[4]; + corners[0] = new Vector2(rect.X, rect.Y - rect.Height); + corners[1] = new Vector2(rect.X, rect.Y); + corners[2] = new Vector2(rect.Right, rect.Y); + corners[3] = new Vector2(rect.Right, rect.Y - rect.Height); + + return corners; + } + + private void UpdateConvexHulls() + { + doorRect = new Rectangle( + item.Rect.Center.X - (int)(doorSprite.size.X / 2), + item.Rect.Y - item.Rect.Height / 2 + (int)(doorSprite.size.Y / 2.0f), + (int)doorSprite.size.X, + (int)doorSprite.size.Y); + + Rectangle rect = doorRect; + if (isHorizontal) + { + rect.Width = (int)(rect.Width * (1.0f - openState)); + } + else + { + rect.Height = (int)(rect.Height * (1.0f - openState)); + } + + if (window.Height > 0 && window.Width > 0) + { + rect.Height = -window.Y; + + rect.Y += (int)(doorRect.Height * openState); + rect.Height = Math.Max(rect.Height - (rect.Y - doorRect.Y), 0); + rect.Y = Math.Min(doorRect.Y, rect.Y); + + if (convexHull2 != null) + { + Rectangle rect2 = doorRect; + rect2.Y = rect2.Y + window.Y - window.Height; + + rect2.Y += (int)(doorRect.Height * openState); + rect2.Y = Math.Min(doorRect.Y, rect2.Y); + rect2.Height = rect2.Y - (doorRect.Y - (int)(doorRect.Height * (1.0f - openState))); + //convexHull2.SetVertices(GetConvexHullCorners(rect2)); + + if (rect2.Height == 0) + { + convexHull2.Enabled = false; + } + else + { + convexHull2.Enabled = true; + convexHull2.SetVertices(GetConvexHullCorners(rect2)); + } + } + } + + if (convexHull == null) return; + + if (rect.Height == 0 || rect.Width == 0) + { + convexHull.Enabled = false; + } + else + { + convexHull.Enabled = true; + convexHull.SetVertices(GetConvexHullCorners(rect)); + } + } + + public void Draw(SpriteBatch spriteBatch, bool editing) + { + Color color = (item.IsSelected) ? Color.Green : Color.White; + color = color * (item.Condition / 100.0f); + color.A = 255; + + //prefab.sprite.Draw(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color); + + if (stuck > 0.0f && weldedSprite != null) + { + Vector2 weldSpritePos = new Vector2(item.Rect.Center.X, item.Rect.Y - item.Rect.Height / 2.0f); + if (item.Submarine != null) weldSpritePos += item.Submarine.Position; + weldSpritePos.Y = -weldSpritePos.Y; + + weldedSprite.Draw(spriteBatch, + weldSpritePos, Color.White * (stuck / 100.0f), 0.0f, 1.0f); + } + + if (openState == 1.0f) + { + body.Enabled = false; + return; + } + + if (isHorizontal) + { + Vector2 pos = new Vector2(item.Rect.X, item.Rect.Y - item.Rect.Height / 2); + if (item.Submarine != null) pos += item.Submarine.DrawPosition; + pos.Y = -pos.Y; + + spriteBatch.Draw(doorSprite.Texture, pos, + new Rectangle((int)(doorSprite.SourceRect.X + doorSprite.size.X * openState), (int)doorSprite.SourceRect.Y, + (int)(doorSprite.size.X * (1.0f - openState)), (int)doorSprite.size.Y), + color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth); + } + else + { + Vector2 pos = new Vector2(item.Rect.Center.X, item.Rect.Y); + if (item.Submarine != null) pos += item.Submarine.DrawPosition; + pos.Y = -pos.Y; + + spriteBatch.Draw(doorSprite.Texture, pos, + new Rectangle(doorSprite.SourceRect.X, (int)(doorSprite.SourceRect.Y + doorSprite.size.Y * openState), + (int)doorSprite.size.X, (int)(doorSprite.size.Y * (1.0f - openState))), + color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth); + } + + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs new file mode 100644 index 000000000..72140c4ba --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs @@ -0,0 +1,273 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Barotrauma.Networking; +using System.IO; + +namespace Barotrauma.Items.Components +{ + class ItemSound + { + public readonly Sound Sound; + public readonly ActionType Type; + + public string VolumeProperty; + + public float VolumeMultiplier; + + public readonly float Range; + + public readonly bool Loop; + + public ItemSound(Sound sound, ActionType type, float range, bool loop = false) + { + this.Sound = sound; + this.Type = type; + this.Range = range; + + this.Loop = loop; + } + } + + partial class ItemComponent : IPropertyObject + { + private Dictionary> sounds; + + private GUIFrame guiFrame; + + protected GUIFrame GuiFrame + { + get + { + if (guiFrame == null) + { + DebugConsole.ThrowError("Error: the component " + name + " in " + item.Name + " doesn't have a GuiFrame component"); + guiFrame = new GUIFrame(new Rectangle(0, 0, 100, 100), Color.Black); + } + return guiFrame; + } + } + + private ItemSound loopingSound; + private int loopingSoundIndex; + public void PlaySound(ActionType type, Vector2 position) + { + if (loopingSound != null) + { + loopingSoundIndex = loopingSound.Sound.Loop(loopingSoundIndex, GetSoundVolume(loopingSound), position, loopingSound.Range); + return; + } + + List matchingSounds; + if (!sounds.TryGetValue(type, out matchingSounds)) return; + + ItemSound itemSound = null; + if (!Sounds.SoundManager.IsPlaying(loopingSoundIndex)) + { + int index = Rand.Int(matchingSounds.Count); + itemSound = matchingSounds[index]; + } + + if (itemSound == null) return; + + if (itemSound.Loop) + { + loopingSound = itemSound; + + loopingSoundIndex = loopingSound.Sound.Loop(loopingSoundIndex, GetSoundVolume(loopingSound), position, loopingSound.Range); + } + else + { + float volume = GetSoundVolume(itemSound); + if (volume == 0.0f) return; + itemSound.Sound.Play(volume, itemSound.Range, position); + } + } + + public void StopSounds(ActionType type) + { + if (loopingSoundIndex <= 0) return; + + if (loopingSound == null) return; + + if (loopingSound.Type != type) return; + + if (Sounds.SoundManager.IsPlaying(loopingSoundIndex)) + { + Sounds.SoundManager.Stop(loopingSoundIndex); + loopingSound = null; + loopingSoundIndex = -1; + } + } + + private float GetSoundVolume(ItemSound sound) + { + if (sound == null) return 0.0f; + if (sound.VolumeProperty == "") return 1.0f; + + ObjectProperty op = null; + if (properties.TryGetValue(sound.VolumeProperty.ToLowerInvariant(), out op)) + { + float newVolume = 0.0f; + try + { + newVolume = (float)op.GetValue(); + } + catch + { + return 0.0f; + } + newVolume *= sound.VolumeMultiplier; + + return MathHelper.Clamp(newVolume, 0.0f, 1.0f); + } + + return 0.0f; + } + + //public virtual void Draw(SpriteBatch spriteBatch, bool editing = false) + //{ + // item.drawableComponents = Array.FindAll(item.drawableComponents, i => i != this); + //} + + public virtual void DrawHUD(SpriteBatch spriteBatch, Character character) { } + + public virtual void AddToGUIUpdateList() { } + + public virtual void UpdateHUD(Character character) { } + + private bool LoadElemProjSpecific(XElement subElement) + { + switch (subElement.Name.ToString().ToLowerInvariant()) + { + case "guiframe": + string rectStr = ToolBox.GetAttributeString(subElement, "rect", "0.0,0.0,0.5,0.5"); + + string[] components = rectStr.Split(','); + if (components.Length < 4) break; + + Vector4 rect = ToolBox.GetAttributeVector4(subElement, "rect", Vector4.One); + if (components[0].Contains(".")) rect.X *= GameMain.GraphicsWidth; + if (components[1].Contains(".")) rect.Y *= GameMain.GraphicsHeight; + if (components[2].Contains(".")) rect.Z *= GameMain.GraphicsWidth; + if (components[3].Contains(".")) rect.W *= GameMain.GraphicsHeight; + + string style = ToolBox.GetAttributeString(subElement, "style", ""); + + Vector4 color = ToolBox.GetAttributeVector4(subElement, "color", Vector4.One); + + Alignment alignment = Alignment.Center; + try + { + alignment = (Alignment)Enum.Parse(typeof(Alignment), + ToolBox.GetAttributeString(subElement, "alignment", "Center"), true); + } + catch + { + DebugConsole.ThrowError("Error in " + subElement.Parent + "! \"" + subElement.Parent.Attribute("type").Value + "\" is not a valid alignment"); + } + + guiFrame = new GUIFrame( + new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Z, (int)rect.W), + new Color(color.X, color.Y, color.Z) * color.W, + alignment, style); + + break; + case "sound": + string filePath = ToolBox.GetAttributeString(subElement, "file", ""); + + if (filePath == "") filePath = ToolBox.GetAttributeString(subElement, "sound", ""); + + if (filePath == "") + { + DebugConsole.ThrowError("Error when instantiating item \"" + item.Name + "\" - sound with no file path set"); + break; + } + + if (!filePath.Contains("/") && !filePath.Contains("\\") && !filePath.Contains(Path.DirectorySeparatorChar)) + { + filePath = Path.Combine(Path.GetDirectoryName(item.Prefab.ConfigFile), filePath); + } + + ActionType type; + + try + { + type = (ActionType)Enum.Parse(typeof(ActionType), ToolBox.GetAttributeString(subElement, "type", ""), true); + } + catch (Exception e) + { + DebugConsole.ThrowError("Invalid sound type in " + subElement + "!", e); + break; + } + + Sound sound = Sound.Load(filePath); + + float range = ToolBox.GetAttributeFloat(subElement, "range", 800.0f); + bool loop = ToolBox.GetAttributeBool(subElement, "loop", false); + ItemSound itemSound = new ItemSound(sound, type, range, loop); + itemSound.VolumeProperty = ToolBox.GetAttributeString(subElement, "volume", ""); + itemSound.VolumeMultiplier = ToolBox.GetAttributeFloat(subElement, "volumemultiplier", 1.0f); + + List soundList = null; + if (!sounds.TryGetValue(itemSound.Type, out soundList)) + { + soundList = new List(); + sounds.Add(itemSound.Type, soundList); + } + + soundList.Add(itemSound); + break; + default: + return false; //unknown element + } + return true; //element processed + } + + //Starts a coroutine that will read the correct state of the component from the NetBuffer when correctionTimer reaches zero. + protected void StartDelayedCorrection(ServerNetObject type, NetBuffer buffer, float sendingTime) + { + if (delayedCorrectionCoroutine != null) CoroutineManager.StopCoroutines(delayedCorrectionCoroutine); + + delayedCorrectionCoroutine = CoroutineManager.StartCoroutine(DoDelayedCorrection(type, buffer, sendingTime)); + } + + private IEnumerable DoDelayedCorrection(ServerNetObject type, NetBuffer buffer, float sendingTime) + { + while (correctionTimer > 0.0f) + { + correctionTimer -= CoroutineManager.DeltaTime; + yield return CoroutineStatus.Running; + } + + ((IServerSerializable)this).ClientRead(type, buffer, sendingTime); + + correctionTimer = 0.0f; + delayedCorrectionCoroutine = null; + + yield return CoroutineStatus.Success; + } + + public virtual XElement Save(XElement parentElement) + { + XElement componentElement = new XElement(name); + + foreach (RelatedItem ri in requiredItems) + { + XElement newElement = new XElement("requireditem"); + ri.Save(newElement); + componentElement.Add(newElement); + } + + ObjectProperty.SaveProperties(this, componentElement); + + parentElement.Add(componentElement); + return componentElement; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemContainer.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemContainer.cs new file mode 100644 index 000000000..1c8136e49 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemContainer.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using FarseerPhysics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Barotrauma.Items.Components +{ + partial class ItemContainer : ItemComponent, IDrawableComponent + { + //TODO: shouldn't this be overriding the base method? + public void Draw(SpriteBatch spriteBatch, bool editing = false) + { + if (hideItems || (item.body != null && !item.body.Enabled)) return; + + Vector2 transformedItemPos = itemPos; + Vector2 transformedItemInterval = itemInterval; + float currentRotation = itemRotation; + + if (item.body == null) + { + transformedItemPos = new Vector2(item.Rect.X, item.Rect.Y); + if (item.Submarine != null) transformedItemPos += item.Submarine.DrawPosition; + transformedItemPos = transformedItemPos + itemPos; + } + else + { + //item.body.Enabled = true; + + Matrix transform = Matrix.CreateRotationZ(item.body.Rotation); + + if (item.body.Dir == -1.0f) + { + transformedItemPos.X = -transformedItemPos.X; + transformedItemInterval.X = -transformedItemInterval.X; + } + transformedItemPos = Vector2.Transform(transformedItemPos, transform); + transformedItemInterval = Vector2.Transform(transformedItemInterval, transform); + + transformedItemPos += item.DrawPosition; + + currentRotation += item.body.Rotation; + } + + foreach (Item containedItem in Inventory.Items) + { + if (containedItem == null) continue; + + containedItem.Sprite.Draw( + spriteBatch, + new Vector2(transformedItemPos.X, -transformedItemPos.Y), + -currentRotation, + 1.0f, + (item.body != null && item.body.Dir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + transformedItemPos += transformedItemInterval; + } + } + + public override void UpdateHUD(Character character) + { + Inventory.Update((float)Timing.Step); + } + + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + Inventory.Draw(spriteBatch); + } + + public override XElement Save(XElement parentElement) + { + XElement componentElement = base.Save(parentElement); + + string[] itemIdStrings = new string[Inventory.Items.Length]; + for (int i = 0; i < Inventory.Items.Length; i++) + { + itemIdStrings[i] = (Inventory.Items[i] == null) ? "0" : Inventory.Items[i].ID.ToString(); + } + + componentElement.Add(new XAttribute("contained", string.Join(",", itemIdStrings))); + + return componentElement; + } + } +} diff --git a/Barotrauma/Source/Items/Components/ItemLabel.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs similarity index 79% rename from Barotrauma/Source/Items/Components/ItemLabel.cs rename to Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs index 7452f2f84..76793efee 100644 --- a/Barotrauma/Source/Items/Components/ItemLabel.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs @@ -1,21 +1,24 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Xml.Linq; + namespace Barotrauma.Items.Components { - class ItemLabel : ItemComponent, IDrawableComponent + partial class ItemLabel : ItemComponent, IDrawableComponent { private GUITextBlock textBlock; + private Color textColor; + [HasDefaultValue("", true), Editable(100)] public string Text { get { return textBlock.Text.Replace("\n", ""); } - set + set { if (value == TextBlock.Text || item.Rect.Width < 5) return; - if (textBlock.Rect.Width != item.Rect.Width || textBlock.Rect.Height != item.Rect.Height) + if (textBlock.Rect.Width != item.Rect.Width || textBlock.Rect.Height != item.Rect.Height) { textBlock = null; } @@ -24,7 +27,6 @@ namespace Barotrauma.Items.Components } } - private Color textColor; [Editable, HasDefaultValue("0.0,0.0,0.0,1.0", true)] public string TextColor { @@ -35,7 +37,7 @@ namespace Barotrauma.Items.Components if (textBlock != null) textBlock.TextColor = textColor; } } - + [Editable, HasDefaultValue(1.0f, true)] public float TextScale { @@ -48,23 +50,23 @@ namespace Barotrauma.Items.Components private GUITextBlock TextBlock { - get - { + get + { if (textBlock == null) { - textBlock = new GUITextBlock(new Rectangle(item.Rect.X,-item.Rect.Y,item.Rect.Width, item.Rect.Height), "", - Color.Transparent, textColor, - Alignment.TopLeft, Alignment.Center, + textBlock = new GUITextBlock(new Rectangle(item.Rect.X, -item.Rect.Y, item.Rect.Width, item.Rect.Height), "", + Color.Transparent, textColor, + Alignment.TopLeft, Alignment.Center, null, null, true); textBlock.Font = GUI.SmallFont; textBlock.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); textBlock.TextDepth = item.Sprite.Depth - 0.0001f; textBlock.TextScale = TextScale; } - return textBlock; + return textBlock; } } - + public override void Move(Vector2 amount) { textBlock.Rect = new Rectangle(item.Rect.X, -item.Rect.Y, item.Rect.Width, item.Rect.Height); @@ -74,14 +76,14 @@ namespace Barotrauma.Items.Components : base(item, element) { } - + public void Draw(SpriteBatch spriteBatch, bool editing = false) { var drawPos = new Vector2( - item.DrawPosition.X - item.Rect.Width/2.0f, - -(item.DrawPosition.Y + item.Rect.Height/2.0f)); + item.DrawPosition.X - item.Rect.Width / 2.0f, + -(item.DrawPosition.Y + item.Rect.Height / 2.0f)); textBlock.Draw(spriteBatch, drawPos - textBlock.Rect.Location.ToVector2()); } } -} \ No newline at end of file +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/LightComponent.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/LightComponent.cs new file mode 100644 index 000000000..31e077742 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/LightComponent.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using Barotrauma.Lights; +using System; +using System.Xml.Linq; +using Barotrauma.Networking; +using Lidgren.Network; + +namespace Barotrauma.Items.Components +{ + partial class LightComponent : Powered, IServerSerializable, IDrawableComponent + { + private LightSource light; + + public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, bool editing = false) + { + if (light.LightSprite != null && (item.body == null || item.body.Enabled)) + { + light.LightSprite.Draw(spriteBatch, new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), lightColor * lightBrightness, 0.0f, 1.0f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, item.Sprite.Depth - 0.0001f); + } + } + + public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) + { + IsOn = msg.ReadBoolean(); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Deconstructor.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Deconstructor.cs new file mode 100644 index 000000000..9571bfa23 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Deconstructor.cs @@ -0,0 +1,61 @@ +using Barotrauma.Networking; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace Barotrauma.Items.Components +{ + partial class Deconstructor : Powered, IServerSerializable, IClientSerializable + { + GUIProgressBar progressBar; + GUIButton activateButton; + + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + GuiFrame.Draw(spriteBatch); + } + + public override void AddToGUIUpdateList() + { + GuiFrame.AddToGUIUpdateList(); + } + + public override void UpdateHUD(Character character) + { + GuiFrame.Update((float)Timing.Step); + } + + private bool ToggleActive(GUIButton button, object obj) + { + SetActive(!IsActive, Character.Controlled); + + currPowerConsumption = IsActive ? powerConsumption : 0.0f; + + if (GameMain.Server != null) + { + item.CreateServerEvent(this); + } + else if (GameMain.Client != null) + { + item.CreateClientEvent(this); + } + + return true; + } + + public void ClientWrite(NetBuffer msg, object[] extraData = null) + { + msg.Write(IsActive); + } + + public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) + { + SetActive(msg.ReadBoolean()); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Engine.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Engine.cs new file mode 100644 index 000000000..33eac0bce --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Engine.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace Barotrauma.Items.Components +{ + partial class Engine : Powered + { + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + //isActive = true; + GuiFrame.Draw(spriteBatch); + + //int width = 300, height = 300; + //int x = Game1.GraphicsWidth / 2 - width / 2; + //int y = Game1.GraphicsHeight / 2 - height / 2 - 50; + + //GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true); + + GUI.Font.DrawString(spriteBatch, "Force: " + (int)(targetForce) + " %", new Vector2(GuiFrame.Rect.X + 30, GuiFrame.Rect.Y + 30), Color.White); + } + + public override void AddToGUIUpdateList() + { + GuiFrame.AddToGUIUpdateList(); + } + + public override void UpdateHUD(Character character) + { + GuiFrame.Update(1.0f / 60.0f); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs new file mode 100644 index 000000000..b6f7d3dcb --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs @@ -0,0 +1,243 @@ +using Barotrauma.Networking; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace Barotrauma.Items.Components +{ + partial class Fabricator : Powered, IServerSerializable, IClientSerializable + { + private GUIListBox itemList; + + private GUIFrame selectedItemFrame; + + private GUIProgressBar progressBar; + private GUIButton activateButton; + + partial void InitProjSpecific() + { + GuiFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f); + + itemList = new GUIListBox(new Rectangle(0, 0, GuiFrame.Rect.Width / 2 - 20, 0), "", GuiFrame); + itemList.OnSelected = SelectItem; + + foreach (FabricableItem fi in fabricableItems) + { + GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, null, itemList) + { + UserData = fi, + Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f), + HoverColor = Color.Gold * 0.2f, + SelectedColor = Color.Gold * 0.5f, + ToolTip = fi.TargetItem.Description + }; + + GUITextBlock textBlock = new GUITextBlock( + new Rectangle(40, 0, 0, 25), + fi.TargetItem.Name, + Color.Transparent, Color.White, + Alignment.Left, Alignment.Left, + null, frame); + textBlock.ToolTip = fi.TargetItem.Description; + textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); + + if (fi.TargetItem.sprite != null) + { + GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), fi.TargetItem.sprite, Alignment.Left, frame); + img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f); + img.Color = fi.TargetItem.SpriteColor; + img.ToolTip = fi.TargetItem.Description; + } + } + } + + private bool SelectItem(GUIComponent component, object obj) + { + FabricableItem targetItem = obj as FabricableItem; + if (targetItem == null) return false; + + if (selectedItemFrame != null) GuiFrame.RemoveChild(selectedItemFrame); + + //int width = 200, height = 150; + selectedItemFrame = new GUIFrame(new Rectangle(0, 0, (int)(GuiFrame.Rect.Width * 0.4f), 300), Color.Black * 0.8f, Alignment.CenterY | Alignment.Right, null, GuiFrame); + + selectedItemFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); + + progressBar = new GUIProgressBar(new Rectangle(0, 0, 0, 20), Color.Green, "", 0.0f, Alignment.BottomCenter, selectedItemFrame); + progressBar.IsHorizontal = true; + + if (targetItem.TargetItem.sprite != null) + { + int y = 0; + + GUIImage img = new GUIImage(new Rectangle(10, 0, 40, 40), targetItem.TargetItem.sprite, Alignment.TopLeft, selectedItemFrame); + img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f); + img.Color = targetItem.TargetItem.SpriteColor; + + new GUITextBlock( + new Rectangle(60, 0, 0, 25), + targetItem.TargetItem.Name, + Color.Transparent, Color.White, + Alignment.TopLeft, + Alignment.TopLeft, null, + selectedItemFrame, true); + + y += 40; + + if (!string.IsNullOrWhiteSpace(targetItem.TargetItem.Description)) + { + var description = new GUITextBlock( + new Rectangle(0, y, 0, 0), + targetItem.TargetItem.Description, + "", Alignment.TopLeft, Alignment.TopLeft, + selectedItemFrame, true, GUI.SmallFont); + + y += description.Rect.Height + 10; + } + + + List inadequateSkills = new List(); + + if (Character.Controlled != null) + { + inadequateSkills = targetItem.RequiredSkills.FindAll(skill => Character.Controlled.GetSkillLevel(skill.Name) < skill.Level); + } + + Color textColor = Color.White; + string text; + if (!inadequateSkills.Any()) + { + text = "Required items:\n"; + foreach (Tuple ip in targetItem.RequiredItems) + { + text += " - " + ip.Item1.Name + " x" + ip.Item2 + "\n"; + } + text += "Required time: " + targetItem.RequiredTime + " s"; + } + else + { + text = "Skills required to calibrate:\n"; + foreach (Skill skill in inadequateSkills) + { + text += " - " + skill.Name + " lvl " + skill.Level + "\n"; + } + + textColor = Color.Red; + } + + new GUITextBlock( + new Rectangle(0, y, 0, 25), + text, + Color.Transparent, textColor, + Alignment.TopLeft, + Alignment.TopLeft, null, + selectedItemFrame); + + activateButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Create", Color.White, Alignment.CenterX | Alignment.Bottom, "", selectedItemFrame); + activateButton.OnClicked = StartButtonClicked; + activateButton.UserData = targetItem; + activateButton.Enabled = false; + } + + return true; + } + + private bool StartButtonClicked(GUIButton button, object obj) + { + if (fabricatedItem == null) + { + StartFabricating(obj as FabricableItem, Character.Controlled); + } + else + { + CancelFabricating(Character.Controlled); + } + + if (GameMain.Server != null) + { + item.CreateServerEvent(this); + } + else if (GameMain.Client != null) + { + item.CreateClientEvent(this); + } + + return true; + } + + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + GuiFrame.Draw(spriteBatch); + } + + public override void AddToGUIUpdateList() + { + GuiFrame.AddToGUIUpdateList(); + } + + public override void UpdateHUD(Character character) + { + FabricableItem targetItem = itemList.SelectedData as FabricableItem; + if (targetItem != null) + { + activateButton.Enabled = CanBeFabricated(targetItem, character); + } + + if (character != null) + { + bool itemsChanged = false; + if (prevContainedItems == null) + { + itemsChanged = true; + } + else + { + var itemContainer = item.GetComponent(); + for (int i = 0; i < itemContainer.Inventory.Items.Length; i++) + { + if (prevContainedItems[i] != itemContainer.Inventory.Items[i]) + { + itemsChanged = true; + break; + } + } + } + + if (itemsChanged) CheckFabricableItems(character); + } + + + GuiFrame.Update((float)Timing.Step); + } + + public void ClientWrite(NetBuffer msg, object[] extraData = null) + { + int itemIndex = fabricatedItem == null ? -1 : fabricableItems.IndexOf(fabricatedItem); + msg.WriteRangedInteger(-1, fabricableItems.Count - 1, itemIndex); + } + + public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) + { + int itemIndex = msg.ReadRangedInteger(-1, fabricableItems.Count - 1); + + if (itemIndex == -1) + { + CancelFabricating(); + } + else + { + //if already fabricating the selected item, return + if (fabricatedItem != null && fabricableItems.IndexOf(fabricatedItem) == itemIndex) return; + if (itemIndex < 0 || itemIndex >= fabricableItems.Count) return; + + SelectItem(null, fabricableItems[itemIndex]); + StartFabricating(fabricableItems[itemIndex]); + } + } + } +} \ No newline at end of file diff --git a/Barotrauma/Source/Items/Components/Machines/MiniMap.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs similarity index 61% rename from Barotrauma/Source/Items/Components/Machines/MiniMap.cs rename to Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs index 8f583d995..06934b0a0 100644 --- a/Barotrauma/Source/Items/Components/Machines/MiniMap.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs @@ -7,76 +7,8 @@ using System.Linq; namespace Barotrauma.Items.Components { - class MiniMap : Powered + partial class MiniMap : Powered { - class HullData - { - public float? Oxygen; - public float? Water; - } - - private DateTime resetDataTime; - - bool hasPower; - - [Editable, HasDefaultValue(false, true)] - public bool RequireWaterDetectors - { - get; - set; - } - - [Editable, HasDefaultValue(true, true)] - public bool RequireOxygenDetectors - { - get; - set; - } - - [Editable, HasDefaultValue(false, true)] - public bool ShowHullIntegrity - { - get; - set; - } - - - private Dictionary hullDatas; - - public MiniMap(Item item, XElement element) - : base(item, element) - { - IsActive = true; - - hullDatas = new Dictionary(); - } - - public override void Update(float deltaTime, Camera cam) - { - //periodically reset all hull data - //(so that outdated hull info won't be shown if detectors stop sending signals) - if (DateTime.Now > resetDataTime) - { - hullDatas.Clear(); - resetDataTime = DateTime.Now + new TimeSpan(0, 0, 1); - } - - currPowerConsumption = powerConsumption; - - hasPower = voltage > minVoltage; - - voltage = 0.0f; - } - - public override bool Pick(Character picker) - { - if (picker == null) return false; - - //picker.SelectedConstruction = item; - - return true; - } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) { if (item.Submarine == null) return; @@ -97,7 +29,7 @@ namespace Barotrauma.Items.Components Point topLeft = new Point( miniMap.X + (int)((hull.Rect.X - item.Submarine.HiddenSubPosition.X - item.Submarine.Borders.X) * size), miniMap.Y - (int)((hull.Rect.Y - item.Submarine.HiddenSubPosition.Y - item.Submarine.Borders.Y) * size)); - + Point bottomRight = new Point( topLeft.X + (int)(hull.Rect.Width * size), topLeft.Y + (int)(hull.Rect.Height * size)); @@ -112,7 +44,7 @@ namespace Barotrauma.Items.Components HullData hullData; hullDatas.TryGetValue(hull, out hullData); - + Color borderColor = Color.Green; @@ -154,9 +86,9 @@ namespace Barotrauma.Items.Components if (hullRect.Height * waterAmount > 3.0f) { Rectangle waterRect = new Rectangle( - hullRect.X, + hullRect.X, (int)(hullRect.Y + hullRect.Height * (1.0f - waterAmount)), - hullRect.Width, + hullRect.Width, (int)(hullRect.Height * waterAmount)); waterRect.Inflate(-3, -3); @@ -174,7 +106,7 @@ namespace Barotrauma.Items.Components { GUI.DrawString(spriteBatch, new Vector2(x + 10, y + height - 60), - "Hull breach", Color.Red, Color.Black * 0.5f, 2, GUI.SmallFont); + "Hull breach", Color.Red, Color.Black * 0.5f, 2, GUI.SmallFont); } GUI.DrawString(spriteBatch, @@ -189,51 +121,9 @@ namespace Barotrauma.Items.Components waterAmount == null ? Color.Red : Color.Lerp(Color.LightGreen, Color.Red, (float)waterAmount), Color.Black * 0.5f, 2, GUI.SmallFont); } - + GUI.DrawRectangle(spriteBatch, hullRect, borderColor, false, 0.0f, 2); } } - - public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power = 0) - { - base.ReceiveSignal(stepsTaken, signal, connection, source, sender, power); - - if (sender == null || sender.CurrentHull == null) return; - - Hull senderHull = sender.CurrentHull; - - HullData hullData; - if (!hullDatas.TryGetValue(senderHull, out hullData)) - { - hullData = new HullData(); - hullDatas.Add(senderHull, hullData); - } - - switch (connection.Name) - { - case "water_data_in": - //cheating a bit because water detectors don't actually send the water level - if (source.GetComponent() == null) - { - hullData.Water = Rand.Range(0.0f, 1.0f); - } - else - { - hullData.Water = Math.Min(senderHull.Volume / senderHull.FullVolume, 1.0f); - } - break; - case "oxygen_data_in": - float oxy; - - if (!float.TryParse(signal, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out oxy)) - { - oxy = Rand.Range(0.0f, 100.0f); - } - - hullData.Oxygen = oxy; - break; - } - } - } } diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs new file mode 100644 index 000000000..8080b4b8c --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs @@ -0,0 +1,117 @@ +using Barotrauma.Networking; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Specialized; +using System.Globalization; +using System.Xml.Linq; + +namespace Barotrauma.Items.Components +{ + partial class Pump : Powered, IServerSerializable, IClientSerializable + { + private GUITickBox isActiveTickBox; + + partial void InitProjSpecific() + { + isActiveTickBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Running", Alignment.TopLeft, GuiFrame); + isActiveTickBox.OnSelected = (GUITickBox box) => + { + targetLevel = null; + IsActive = !IsActive; + if (!IsActive) currPowerConsumption = 0.0f; + + if (GameMain.Server != null) + { + item.CreateServerEvent(this); + GameServer.Log(Character.Controlled + (IsActive ? " turned on " : " turned off ") + item.Name, ServerLog.MessageType.ItemInteraction); + } + else if (GameMain.Client != null) + { + correctionTimer = CorrectionDelay; + item.CreateClientEvent(this); + } + + return true; + }; + + var button = new GUIButton(new Rectangle(160, 40, 35, 30), "OUT", "", GuiFrame); + button.OnClicked = (GUIButton btn, object obj) => + { + FlowPercentage -= 10.0f; + + if (GameMain.Server != null) + { + item.CreateServerEvent(this); + GameServer.Log(Character.Controlled + " set the pumping speed of " + item.Name + " to " + (int)(flowPercentage) + " %", ServerLog.MessageType.ItemInteraction); + } + else if (GameMain.Client != null) + { + correctionTimer = CorrectionDelay; + item.CreateClientEvent(this); + } + + return true; + }; + + button = new GUIButton(new Rectangle(210, 40, 35, 30), "IN", "", GuiFrame); + button.OnClicked = (GUIButton btn, object obj) => + { + FlowPercentage += 10.0f; + + if (GameMain.Server != null) + { + item.CreateServerEvent(this); + GameServer.Log(Character.Controlled + " set the pumping speed of " + item.Name + " to " + (int)(flowPercentage) + " %", ServerLog.MessageType.ItemInteraction); + } + else if (GameMain.Client != null) + { + correctionTimer = CorrectionDelay; + item.CreateClientEvent(this); + } + + return true; + }; + } + + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + int x = GuiFrame.Rect.X; + int y = GuiFrame.Rect.Y; + + GuiFrame.Draw(spriteBatch); + + GUI.Font.DrawString(spriteBatch, "Pumping speed: " + (int)flowPercentage + " %", new Vector2(x + 40, y + 85), Color.White); + + } + + public override void AddToGUIUpdateList() + { + GuiFrame.AddToGUIUpdateList(); + } + + public override void UpdateHUD(Character character) + { + GuiFrame.Update(1.0f / 60.0f); + } + + public void ClientWrite(Lidgren.Network.NetBuffer msg, object[] extraData = null) + { + //flowpercentage can only be adjusted at 10% intervals -> no need for more accuracy than this + msg.WriteRangedInteger(-10, 10, (int)(flowPercentage / 10.0f)); + msg.Write(IsActive); + } + + public void ClientRead(ServerNetObject type, Lidgren.Network.NetBuffer msg, float sendingTime) + { + if (correctionTimer > 0.0f) + { + StartDelayedCorrection(type, msg.ExtractBits(5 + 1), sendingTime); + return; + } + + FlowPercentage = msg.ReadRangedInteger(-10, 10) * 10.0f; + IsActive = msg.ReadBoolean(); + } + } +} diff --git a/Barotrauma/Source/Items/Components/Machines/Radar.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Radar.cs similarity index 76% rename from Barotrauma/Source/Items/Components/Machines/Radar.cs rename to Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Radar.cs index 361d80136..3539b545c 100644 --- a/Barotrauma/Source/Items/Components/Machines/Radar.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Radar.cs @@ -9,130 +9,11 @@ using Voronoi2; namespace Barotrauma.Items.Components { - class Radar : Powered, IServerSerializable, IClientSerializable + partial class Radar : Powered, IServerSerializable, IClientSerializable { - private float range; - - private float pingState; - - private readonly Sprite pingCircle, screenOverlay; - - private readonly Sprite radarBlip; - private GUITickBox isActiveTickBox; private List radarBlips; - private float prevPingRadius; - - float prevPassivePingRadius; - - private Vector2 center; - private float displayRadius; - private float displayScale; - - private float displayBorderSize; - - [HasDefaultValue(10000.0f, false)] - public float Range - { - get { return range; } - set { range = MathHelper.Clamp(value, 0.0f, 100000.0f); } - } - - [HasDefaultValue(false, false)] - public bool DetectSubmarineWalls - { - get; - set; - } - - public override bool IsActive - { - get - { - return base.IsActive; - } - - set - { - base.IsActive = value; - if (isActiveTickBox != null) isActiveTickBox.Selected = value; - } - } - - public Radar(Item item, XElement element) - : base(item, element) - { - radarBlips = new List(); - - displayBorderSize = ToolBox.GetAttributeFloat(element, "displaybordersize", 0.0f); - - foreach (XElement subElement in element.Elements()) - { - switch (subElement.Name.ToString().ToLowerInvariant()) - { - case "pingcircle": - pingCircle = new Sprite(subElement); - break; - case "screenoverlay": - screenOverlay = new Sprite(subElement); - break; - case "blip": - radarBlip = new Sprite(subElement); - break; - } - } - - isActiveTickBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Active Sonar", Alignment.TopLeft, GuiFrame); - isActiveTickBox.OnSelected = (GUITickBox box) => - { - if (GameMain.Server != null) - { - item.CreateServerEvent(this); - } - else if (GameMain.Client != null) - { - item.CreateClientEvent(this); - correctionTimer = CorrectionDelay; - } - IsActive = box.Selected; - - return true; - }; - - GuiFrame.CanBeFocused = false; - - IsActive = false; - } - - public override void Update(float deltaTime, Camera cam) - { - currPowerConsumption = powerConsumption; - - base.Update(deltaTime, cam); - - if (voltage >= minVoltage || powerConsumption <= 0.0f) - { - pingState = pingState + deltaTime * 0.5f; - if (pingState > 1.0f) - { - if (item.CurrentHull != null) item.CurrentHull.AiTarget.SoundRange = Math.Max(Range * pingState, item.CurrentHull.AiTarget.SoundRange); - item.Use(deltaTime); - pingState = 0.0f; - } - } - else - { - pingState = 0.0f; - } - - Voltage -= deltaTime; - } - - public override bool Use(float deltaTime, Character character = null) - { - return pingState > 1.0f; - } public override void AddToGUIUpdateList() { @@ -142,13 +23,13 @@ namespace Barotrauma.Items.Components public override void UpdateHUD(Character character) { GuiFrame.Update((float)Timing.Step); - + for (int i = radarBlips.Count - 1; i >= 0; i--) { radarBlips[i].FadeTimer -= (float)Timing.Step * 0.5f; if (radarBlips[i].FadeTimer <= 0.0f) radarBlips.RemoveAt(i); } - + if (IsActive) { float pingRadius = displayRadius * pingState; @@ -162,11 +43,11 @@ namespace Barotrauma.Items.Components foreach (AITarget t in AITarget.List) { if (t.SoundRange <= 0.0f) continue; - + if (Vector2.Distance(t.WorldPosition, item.WorldPosition) < t.SoundRange) { Ping(t.WorldPosition, t.SoundRange * passivePingRadius * 0.2f, t.SoundRange * prevPassivePingRadius * 0.2f, displayScale, t.SoundRange, 0.5f); - + radarBlips.Add(new RadarBlip(t.WorldPosition, 1.0f)); } } @@ -178,11 +59,11 @@ namespace Barotrauma.Items.Components public override void DrawHUD(SpriteBatch spriteBatch, Character character) { GuiFrame.Draw(spriteBatch); - + int radius = GuiFrame.Rect.Height / 2 - 10; DrawRadar(spriteBatch, new Rectangle((int)GuiFrame.Center.X - radius, (int)GuiFrame.Center.Y - radius, radius * 2, radius * 2)); } - + private void DrawRadar(SpriteBatch spriteBatch, Rectangle rect) { center = new Vector2(rect.X + rect.Width * 0.5f, rect.Center.Y); @@ -191,9 +72,9 @@ namespace Barotrauma.Items.Components if (IsActive) { - pingCircle.Draw(spriteBatch, center, Color.White * (1.0f - pingState), 0.0f, (displayRadius*2 / pingCircle.size.X) * pingState); + pingCircle.Draw(spriteBatch, center, Color.White * (1.0f - pingState), 0.0f, (displayRadius * 2 / pingCircle.size.X) * pingState); } - + if (item.Submarine != null && !DetectSubmarineWalls) { float simScale = displayScale * Physics.DisplayToSimRation; @@ -239,7 +120,7 @@ namespace Barotrauma.Items.Components { screenOverlay.Draw(spriteBatch, center, 0.0f, rect.Width / screenOverlay.size.X); } - + if (GameMain.GameSession == null) return; DrawMarker(spriteBatch, @@ -267,7 +148,7 @@ namespace Barotrauma.Items.Components if (!sub.OnRadar) continue; if (item.Submarine == sub || sub.DockedTo.Contains(item.Submarine)) continue; if (sub.WorldPosition.Y > Level.Loaded.Size.Y) continue; - + DrawMarker(spriteBatch, sub.Name, sub.WorldPosition - item.WorldPosition, displayScale, center, (rect.Width * 0.45f)); } @@ -297,6 +178,7 @@ namespace Barotrauma.Items.Components } } + private void Ping(Vector2 pingSource, float pingRadius, float prevPingRadius, float displayScale, float range, float pingStrength = 1.0f) { foreach (Submarine submarine in Submarine.Loaded) @@ -409,8 +291,8 @@ namespace Barotrauma.Items.Components Vector2 lineDir = (point2 - point1) / length; range *= displayScale; - - for (float x = 0; x < length; x += lineStep*Rand.Range(0.8f,1.2f)) + + for (float x = 0; x < length; x += lineStep * Rand.Range(0.8f, 1.2f)) { Vector2 point = point1 + lineDir * x; //point += cell.Translation; @@ -419,7 +301,7 @@ namespace Barotrauma.Items.Components if (pointDist > displayRadius) continue; if (pointDist < prevPingRadius || pointDist > pingRadius) continue; - + float alpha = pingStrength * Rand.Range(1.5f, 2.0f); for (float z = 0; z < displayRadius - pointDist * displayScale; z += zStep) { @@ -442,7 +324,7 @@ namespace Barotrauma.Items.Components { alpha -= 0.1f; } - + if (alpha < 0) break; } @@ -461,8 +343,8 @@ namespace Barotrauma.Items.Components new Color(255, 255, 255) }; float scaledT = strength * (colors.Length - 1); - Color color = Color.Lerp(colors[(int)scaledT], colors[(int)Math.Min(scaledT+1, colors.Length-1)], (scaledT - (int)scaledT)); - + Color color = Color.Lerp(colors[(int)scaledT], colors[(int)Math.Min(scaledT + 1, colors.Length - 1)], (scaledT - (int)scaledT)); + Vector2 pos = (blip.Position - item.WorldPosition) * displayScale; pos.Y = -pos.Y; @@ -471,7 +353,7 @@ namespace Barotrauma.Items.Components blip.FadeTimer = 0.0f; return; } - + float posDist = pos.Length(); Vector2 dir = pos / posDist; float distFactor = (posDist / displayRadius); @@ -486,9 +368,9 @@ namespace Barotrauma.Items.Components return; } - radarBlip.Draw(spriteBatch, center + pos, color, radarBlip.Origin, MathUtils.VectorToAngle(pos), + radarBlip.Draw(spriteBatch, center + pos, color, radarBlip.Origin, MathUtils.VectorToAngle(pos), new Vector2(scale * 0.3f, scale) * 0.04f, SpriteEffects.None, 0); - + pos += Rand.Range(0.0f, 1.0f) * dir + Rand.Range(-scale, scale) * normal; radarBlip.Draw(spriteBatch, center + pos, color * 0.5f, radarBlip.Origin, MathUtils.VectorToAngle(pos), @@ -508,7 +390,7 @@ namespace Barotrauma.Items.Components Vector2 dir = Vector2.Normalize(position); - Vector2 markerPos = (dist*scale>radius) ? dir * radius : position; + Vector2 markerPos = (dist * scale > radius) ? dir * radius : position; markerPos += center; markerPos.X = (int)markerPos.X; @@ -516,47 +398,24 @@ namespace Barotrauma.Items.Components GUI.DrawRectangle(spriteBatch, new Rectangle((int)markerPos.X, (int)markerPos.Y, 5, 5), Color.LightBlue); - if (dir.X < 0.0f) markerPos.X -= GUI.SmallFont.MeasureString(label).X+10; + if (dir.X < 0.0f) markerPos.X -= GUI.SmallFont.MeasureString(label).X + 10; string wrappedLabel = ToolBox.WrapText(label, 150, GUI.SmallFont); - wrappedLabel += "\n"+((int)(dist * Physics.DisplayToRealWorldRatio) + " m"); + wrappedLabel += "\n" + ((int)(dist * Physics.DisplayToRealWorldRatio) + " m"); - GUI.DrawString(spriteBatch, - new Vector2(markerPos.X + 10, markerPos.Y), - wrappedLabel, - Color.LightBlue * textAlpha, Color.Black * textAlpha * 0.5f, - 2, GUI.SmallFont); + GUI.DrawString(spriteBatch, + new Vector2(markerPos.X + 10, markerPos.Y), + wrappedLabel, + Color.LightBlue * textAlpha, Color.Black * textAlpha * 0.5f, + 2, GUI.SmallFont); } - - protected override void RemoveComponentSpecific() - { - if (pingCircle!=null) pingCircle.Remove(); - if (screenOverlay != null) screenOverlay.Remove(); - } - + public void ClientWrite(Lidgren.Network.NetBuffer msg, object[] extraData = null) { msg.Write(IsActive); } - - public void ServerRead(ClientNetObject type, Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c) - { - bool isActive = msg.ReadBoolean(); - - if (!item.CanClientAccess(c)) return; - - IsActive = isActive; - isActiveTickBox.Selected = IsActive; - - item.CreateServerEvent(this); - } - - public void ServerWrite(Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c, object[] extraData = null) - { - msg.Write(IsActive); - } - + public void ClientRead(ServerNetObject type, Lidgren.Network.NetBuffer msg, float sendingTime) { if (correctionTimer > 0.0f) @@ -567,7 +426,7 @@ namespace Barotrauma.Items.Components IsActive = msg.ReadBoolean(); isActiveTickBox.Selected = IsActive; - } + } } class RadarBlip diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Reactor.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Reactor.cs new file mode 100644 index 000000000..3f9d63446 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Reactor.cs @@ -0,0 +1,265 @@ +using System; +using System.Collections.Generic; +using System.Xml.Linq; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Barotrauma.Networking; + +namespace Barotrauma.Items.Components +{ + partial class Reactor : Powered, IDrawableComponent, IServerSerializable, IClientSerializable + { + private GUITickBox autoTempTickBox; + + partial void InitProjSpecific() + { + var button = new GUIButton(new Rectangle(410, 70, 40, 40), "-", "", GuiFrame); + button.OnPressed = () => + { + lastUser = Character.Controlled; + if (nextServerLogWriteTime == null) + { + nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); + } + unsentChanges = true; + ShutDownTemp -= 100.0f; + + return false; + }; + + button = new GUIButton(new Rectangle(460, 70, 40, 40), "+", "", GuiFrame); + button.OnPressed = () => + { + lastUser = Character.Controlled; + if (nextServerLogWriteTime == null) + { + nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); + } + unsentChanges = true; + ShutDownTemp += 100.0f; + + return false; + }; + + autoTempTickBox = new GUITickBox(new Rectangle(410, 170, 20, 20), "Automatic temperature control", Alignment.TopLeft, GuiFrame); + autoTempTickBox.OnSelected = ToggleAutoTemp; + + button = new GUIButton(new Rectangle(210, 290, 40, 40), "+", "", GuiFrame); + button.OnPressed = () => + { + lastUser = Character.Controlled; + if (nextServerLogWriteTime == null) + { + nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); + } + unsentChanges = true; + FissionRate += 1.0f; + + return false; + }; + + button = new GUIButton(new Rectangle(210, 340, 40, 40), "-", "", GuiFrame); + button.OnPressed = () => + { + lastUser = Character.Controlled; + if (nextServerLogWriteTime == null) + { + nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); + } + unsentChanges = true; + FissionRate -= 1.0f; + + return false; + }; + + button = new GUIButton(new Rectangle(500, 290, 40, 40), "+", "", GuiFrame); + button.OnPressed = () => + { + lastUser = Character.Controlled; + if (nextServerLogWriteTime == null) + { + nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); + } + unsentChanges = true; + CoolingRate += 1.0f; + + return false; + }; + + button = new GUIButton(new Rectangle(500, 340, 40, 40), "-", "", GuiFrame); + button.OnPressed = () => + { + lastUser = Character.Controlled; + if (nextServerLogWriteTime == null) + { + nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); + } + unsentChanges = true; + CoolingRate -= 1.0f; + + return false; + }; + } + + private void UpdateGraph(float deltaTime) + { + graphTimer += deltaTime * 1000.0f; + + if (graphTimer > updateGraphInterval) + { + UpdateGraph(fissionRateGraph, fissionRate); + UpdateGraph(coolingRateGraph, coolingRate); + UpdateGraph(tempGraph, temperature); + + UpdateGraph(loadGraph, load); + + graphTimer = 0.0f; + } + } + + public void Draw(SpriteBatch spriteBatch, bool editing = false) + { + GUI.DrawRectangle(spriteBatch, + new Vector2(item.Rect.X + item.Rect.Width / 2 - 6, -item.Rect.Y + 29), + new Vector2(12, 42), Color.Black); + + if (temperature > 0) + GUI.DrawRectangle(spriteBatch, + new Vector2(item.Rect.X + item.Rect.Width / 2 - 5, -item.Rect.Y + 30 + (40.0f * (1.0f - temperature / 10000.0f))), + new Vector2(10, 40 * (temperature / 10000.0f)), new Color(temperature / 10000.0f, 1.0f - (temperature / 10000.0f), 0.0f, 1.0f), true); + } + + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + IsActive = true; + + int x = GuiFrame.Rect.X; + int y = GuiFrame.Rect.Y; + + GuiFrame.Draw(spriteBatch); + + float xOffset = graphTimer / updateGraphInterval; + + //GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true); + + GUI.Font.DrawString(spriteBatch, "Output: " + (int)temperature + " kW", + new Vector2(x + 450, y + 30), Color.Red); + GUI.Font.DrawString(spriteBatch, "Grid load: " + (int)load + " kW", + new Vector2(x + 600, y + 30), Color.Yellow); + + float maxLoad = 0.0f; + foreach (float loadVal in loadGraph) + { + maxLoad = Math.Max(maxLoad, loadVal); + } + + DrawGraph(tempGraph, spriteBatch, + new Rectangle(x + 30, y + 30, 400, 250), Math.Max(10000.0f, maxLoad), xOffset, Color.Red); + + DrawGraph(loadGraph, spriteBatch, + new Rectangle(x + 30, y + 30, 400, 250), Math.Max(10000.0f, maxLoad), xOffset, Color.Yellow); + + GUI.Font.DrawString(spriteBatch, "Shutdown Temperature: " + (int)shutDownTemp, new Vector2(x + 450, y + 80), Color.White); + + //GUI.Font.DrawString(spriteBatch, "Automatic Temperature Control: " + ((autoTemp) ? "ON" : "OFF"), new Vector2(x + 450, y + 180), Color.White); + + y += 300; + + GUI.Font.DrawString(spriteBatch, "Fission rate: " + (int)fissionRate + " %", new Vector2(x + 30, y), Color.White); + DrawGraph(fissionRateGraph, spriteBatch, + new Rectangle(x + 30, y + 30, 200, 100), 100.0f, xOffset, Color.Orange); + + + GUI.Font.DrawString(spriteBatch, "Cooling rate: " + (int)coolingRate + " %", new Vector2(x + 320, y), Color.White); + DrawGraph(coolingRateGraph, spriteBatch, + new Rectangle(x + 320, y + 30, 200, 100), 100.0f, xOffset, Color.LightBlue); + + + //y = y - 260; + } + + public override void AddToGUIUpdateList() + { + GuiFrame.AddToGUIUpdateList(); + } + + public override void UpdateHUD(Character character) + { + GuiFrame.Update(1.0f / 60.0f); + } + + private bool ToggleAutoTemp(GUITickBox tickBox) + { + unsentChanges = true; + autoTemp = tickBox.Selected; + + return true; + } + + static void UpdateGraph(IList graph, T newValue) + { + for (int i = graph.Count - 1; i > 0; i--) + { + graph[i] = graph[i - 1]; + } + graph[0] = newValue; + } + + static void DrawGraph(IList graph, SpriteBatch spriteBatch, Rectangle rect, float maxVal, float xOffset, Color color) + { + float lineWidth = (float)rect.Width / (float)(graph.Count - 2); + float yScale = (float)rect.Height / maxVal; + + GUI.DrawRectangle(spriteBatch, rect, Color.White); + + Vector2 prevPoint = new Vector2(rect.Right, rect.Bottom - (graph[1] + (graph[0] - graph[1]) * xOffset) * yScale); + + float currX = rect.Right - ((xOffset - 1.0f) * lineWidth); + + for (int i = 1; i < graph.Count - 1; i++) + { + currX -= lineWidth; + + Vector2 newPoint = new Vector2(currX, rect.Bottom - graph[i] * yScale); + + GUI.DrawLine(spriteBatch, prevPoint, newPoint - new Vector2(1.0f, 0), color); + + prevPoint = newPoint; + } + + Vector2 lastPoint = new Vector2(rect.X, + rect.Bottom - (graph[graph.Count - 1] + (graph[graph.Count - 2] - graph[graph.Count - 1]) * xOffset) * yScale); + + GUI.DrawLine(spriteBatch, prevPoint, lastPoint, color); + } + + public void ClientWrite(NetBuffer msg, object[] extraData = null) + { + msg.Write(autoTemp); + msg.WriteRangedSingle(shutDownTemp, 0.0f, 10000.0f, 15); + + msg.WriteRangedSingle(coolingRate, 0.0f, 100.0f, 8); + msg.WriteRangedSingle(fissionRate, 0.0f, 100.0f, 8); + + correctionTimer = CorrectionDelay; + } + + public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) + { + if (correctionTimer > 0.0f) + { + StartDelayedCorrection(type, msg.ExtractBits(16 + 1 + 15 + 8 + 8), sendingTime); + return; + } + + Temperature = msg.ReadRangedSingle(0.0f, 10000.0f, 16); + + AutoTemp = msg.ReadBoolean(); + ShutDownTemp = msg.ReadRangedSingle(0.0f, 10000.0f, 15); + + CoolingRate = msg.ReadRangedSingle(0.0f, 100.0f, 8); + FissionRate = msg.ReadRangedSingle(0.0f, 100.0f, 8); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs new file mode 100644 index 000000000..4915421a8 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs @@ -0,0 +1,268 @@ +using Barotrauma.Networking; +using FarseerPhysics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Xml.Linq; +using Voronoi2; + +namespace Barotrauma.Items.Components +{ + partial class Steering : Powered, IServerSerializable, IClientSerializable + { + private GUITickBox autopilotTickBox, maintainPosTickBox; + private GUITickBox levelEndTickBox, levelStartTickBox; + + public bool LevelStartSelected + { + get { return levelStartTickBox.Selected; } + set { levelStartTickBox.Selected = value; } + } + + public bool LevelEndSelected + { + get { return levelEndTickBox.Selected; } + set { levelEndTickBox.Selected = value; } + } + + public bool MaintainPos + { + get { return maintainPosTickBox.Selected; } + set { maintainPosTickBox.Selected = value; } + } + + partial void InitProjSpecific() + { + autopilotTickBox = new GUITickBox(new Rectangle(0, 25, 20, 20), "Autopilot", Alignment.TopLeft, GuiFrame); + autopilotTickBox.OnSelected = (GUITickBox box) => + { + AutoPilot = box.Selected; + unsentChanges = true; + + return true; + }; + + maintainPosTickBox = new GUITickBox(new Rectangle(5, 50, 15, 15), "Maintain position", Alignment.TopLeft, GUI.SmallFont, GuiFrame); + maintainPosTickBox.Enabled = false; + maintainPosTickBox.OnSelected = ToggleMaintainPosition; + + levelStartTickBox = new GUITickBox( + new Rectangle(5, 70, 15, 15), + GameMain.GameSession == null ? "" : ToolBox.LimitString(GameMain.GameSession.StartLocation.Name, 20), + Alignment.TopLeft, GUI.SmallFont, GuiFrame); + levelStartTickBox.Enabled = false; + levelStartTickBox.OnSelected = SelectDestination; + + levelEndTickBox = new GUITickBox( + new Rectangle(5, 90, 15, 15), + GameMain.GameSession == null ? "" : ToolBox.LimitString(GameMain.GameSession.EndLocation.Name, 20), + Alignment.TopLeft, GUI.SmallFont, GuiFrame); + levelEndTickBox.Enabled = false; + levelEndTickBox.OnSelected = SelectDestination; + } + + private bool ToggleMaintainPosition(GUITickBox tickBox) + { + unsentChanges = true; + + levelStartTickBox.Selected = false; + levelEndTickBox.Selected = false; + + if (item.Submarine == null) + { + posToMaintain = null; + } + else + { + posToMaintain = item.Submarine.WorldPosition; + } + + tickBox.Selected = true; + + return true; + } + + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + //if (voltage < minVoltage) return; + + int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height; + int x = GuiFrame.Rect.X; + int y = GuiFrame.Rect.Y; + + GuiFrame.Draw(spriteBatch); + + if (voltage < minVoltage && powerConsumption > 0.0f) return; + + Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40); + //GUI.DrawRectangle(spriteBatch, velRect, Color.White, false); + + if (item.Submarine != null && Level.Loaded != null) + { + Vector2 realWorldVelocity = ConvertUnits.ToDisplayUnits(item.Submarine.Velocity * Physics.DisplayToRealWorldRatio) * 3.6f; + float realWorldDepth = Math.Abs(item.Submarine.Position.Y - Level.Loaded.Size.Y) * Physics.DisplayToRealWorldRatio; + GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 65), + "Velocity: " + (int)realWorldVelocity.X + " km/h", Color.LightGreen, null, 0, GUI.SmallFont); + GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 50), + "Descent velocity: " + -(int)realWorldVelocity.Y + " km/h", Color.LightGreen, null, 0, GUI.SmallFont); + + GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 30), + "Depth: " + (int)realWorldDepth + " m", Color.LightGreen, null, 0, GUI.SmallFont); + } + + GUI.DrawLine(spriteBatch, + new Vector2(velRect.Center.X, velRect.Center.Y), + new Vector2(velRect.Center.X + currVelocity.X, velRect.Center.Y - currVelocity.Y), + Color.Gray); + + Vector2 targetVelPos = new Vector2(velRect.Center.X + targetVelocity.X, velRect.Center.Y - targetVelocity.Y); + + GUI.DrawLine(spriteBatch, + new Vector2(velRect.Center.X, velRect.Center.Y), + targetVelPos, + Color.LightGray); + + GUI.DrawRectangle(spriteBatch, new Rectangle((int)targetVelPos.X - 5, (int)targetVelPos.Y - 5, 10, 10), Color.White); + + if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(velRect.Center.X, velRect.Center.Y)) < 200.0f) + { + GUI.DrawRectangle(spriteBatch, new Rectangle((int)targetVelPos.X - 10, (int)targetVelPos.Y - 10, 20, 20), Color.Red); + } + } + + public override void AddToGUIUpdateList() + { + GuiFrame.AddToGUIUpdateList(); + } + + public override void UpdateHUD(Character character) + { + GuiFrame.Update(1.0f / 60.0f); + + if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y)) < 200.0f) + { + if (PlayerInput.LeftButtonHeld()) + { + TargetVelocity = PlayerInput.MousePosition - new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y); + targetVelocity.Y = -targetVelocity.Y; + + unsentChanges = true; + } + } + } + + private bool SelectDestination(GUITickBox tickBox) + { + unsentChanges = true; + + if (tickBox == levelStartTickBox) + { + levelEndTickBox.Selected = false; + } + else + { + levelStartTickBox.Selected = false; + } + + maintainPosTickBox.Selected = false; + posToMaintain = null; + tickBox.Selected = true; + + UpdatePath(); + + return true; + } + + public void ClientWrite(Lidgren.Network.NetBuffer msg, object[] extraData = null) + { + msg.Write(autoPilot); + + if (!autoPilot) + { + //no need to write steering info if autopilot is controlling + msg.Write(targetVelocity.X); + msg.Write(targetVelocity.Y); + } + else + { + msg.Write(posToMaintain != null); + if (posToMaintain != null) + { + msg.Write(((Vector2)posToMaintain).X); + msg.Write(((Vector2)posToMaintain).Y); + } + else + { + msg.Write(LevelStartSelected); + } + } + } + + public void ClientRead(ServerNetObject type, Lidgren.Network.NetBuffer msg, float sendingTime) + { + long msgStartPos = msg.Position; + + bool autoPilot = msg.ReadBoolean(); + Vector2 newTargetVelocity = targetVelocity; + bool maintainPos = false; + Vector2? newPosToMaintain = null; + bool headingToStart = false; + + if (autoPilot) + { + maintainPos = msg.ReadBoolean(); + if (maintainPos) + { + newPosToMaintain = new Vector2( + msg.ReadFloat(), + msg.ReadFloat()); + } + else + { + headingToStart = msg.ReadBoolean(); + } + } + else + { + newTargetVelocity = new Vector2(msg.ReadFloat(), msg.ReadFloat()); + } + + if (correctionTimer > 0.0f) + { + int msgLength = (int)(msg.Position - msgStartPos); + msg.Position = msgStartPos; + StartDelayedCorrection(type, msg.ExtractBits(msgLength), sendingTime); + return; + } + + AutoPilot = autoPilot; + + if (!AutoPilot) + { + targetVelocity = newTargetVelocity; + } + else + { + + MaintainPos = newPosToMaintain != null; + posToMaintain = newPosToMaintain; + + if (posToMaintain == null) + { + LevelStartSelected = headingToStart; + LevelEndSelected = !headingToStart; + UpdatePath(); + } + else + { + LevelStartSelected = false; + LevelEndSelected = false; + } + } + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Power/PowerContainer.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Power/PowerContainer.cs new file mode 100644 index 000000000..3865d26f8 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Power/PowerContainer.cs @@ -0,0 +1,110 @@ +using System; +using System.Xml.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Barotrauma.Networking; +using Lidgren.Network; + +namespace Barotrauma.Items.Components +{ + partial class PowerContainer : Powered, IDrawableComponent, IServerSerializable, IClientSerializable + { + partial void InitProjSpecific() + { + if (canBeSelected) + { + var button = new GUIButton(new Rectangle(160, 50, 30, 30), "-", "", GuiFrame); + button.OnClicked = (GUIButton btn, object obj) => + { + RechargeSpeed = rechargeSpeed - maxRechargeSpeed * 0.1f; + + if (GameMain.Server != null) + { + item.CreateServerEvent(this); + GameServer.Log(Character.Controlled + " set the recharge speed of " + item.Name + " to " + (int)((rechargeSpeed / maxRechargeSpeed) * 100.0f) + " %", ServerLog.MessageType.ItemInteraction); + } + else if (GameMain.Client != null) + { + item.CreateClientEvent(this); + correctionTimer = CorrectionDelay; + } + + return true; + }; + + button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", "", GuiFrame); + button.OnClicked = (GUIButton btn, object obj) => + { + RechargeSpeed = rechargeSpeed + maxRechargeSpeed * 0.1f; + + if (GameMain.Server != null) + { + item.CreateServerEvent(this); + GameServer.Log(Character.Controlled + " set the recharge speed of " + item.Name + " to " + (int)((rechargeSpeed / maxRechargeSpeed) * 100.0f) + " %", ServerLog.MessageType.ItemInteraction); + } + else if (GameMain.Client != null) + { + item.CreateClientEvent(this); + correctionTimer = CorrectionDelay; + } + + return true; + }; + } + } + + public void Draw(SpriteBatch spriteBatch, bool editing = false) + { + GUI.DrawRectangle(spriteBatch, + new Vector2(item.DrawPosition.X - 4, -item.DrawPosition.Y), + new Vector2(8, 22), Color.Black); + + if (charge > 0) + GUI.DrawRectangle(spriteBatch, + new Vector2(item.DrawPosition.X - 3, -item.DrawPosition.Y + 1 + (20.0f * (1.0f - charge / capacity))), + new Vector2(6, 20 * (charge / capacity)), Color.Green, true); + } + + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + GuiFrame.Draw(spriteBatch); + + int x = GuiFrame.Rect.X; + int y = GuiFrame.Rect.Y; + //GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true); + + GUI.Font.DrawString(spriteBatch, + "Charge: " + (int)charge + "/" + (int)capacity + " kWm (" + (int)((charge / capacity) * 100.0f) + " %)", + new Vector2(x + 30, y + 30), Color.White); + + GUI.Font.DrawString(spriteBatch, "Recharge rate: " + (int)((rechargeSpeed / maxRechargeSpeed) * 100.0f) + " %", new Vector2(x + 30, y + 95), Color.White); + } + + public override void AddToGUIUpdateList() + { + GuiFrame.AddToGUIUpdateList(); + } + + public override void UpdateHUD(Character character) + { + GuiFrame.Update(1.0f / 60.0f); + } + + public void ClientWrite(NetBuffer msg, object[] extraData) + { + msg.WriteRangedInteger(0, 10, (int)(rechargeSpeed / MaxRechargeSpeed * 10)); + } + + public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) + { + if (correctionTimer > 0.0f) + { + StartDelayedCorrection(type, msg.ExtractBits(4 + 8), sendingTime); + return; + } + + RechargeSpeed = msg.ReadRangedInteger(0, 10) / 10.0f * maxRechargeSpeed; + Charge = msg.ReadRangedSingle(0.0f, 1.0f, 8) * capacity; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Power/PowerTransfer.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Power/PowerTransfer.cs new file mode 100644 index 000000000..977762f01 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Power/PowerTransfer.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Xml.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Globalization; +using System.Linq; + +namespace Barotrauma.Items.Components +{ + partial class PowerTransfer : Powered + { + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + if (!canBeSelected) return; + + int x = GuiFrame.Rect.X; + int y = GuiFrame.Rect.Y; + + GuiFrame.Draw(spriteBatch); + + GUI.Font.DrawString(spriteBatch, "Power: " + (int)(-currPowerConsumption) + " kW", new Vector2(x + 30, y + 30), Color.White); + GUI.Font.DrawString(spriteBatch, "Load: " + (int)powerLoad + " kW", new Vector2(x + 30, y + 100), Color.White); + } + + public override void AddToGUIUpdateList() + { + GuiFrame.AddToGUIUpdateList(); + } + + public override void UpdateHUD(Character character) + { + GuiFrame.Update(1.0f / 60.0f); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Power/Powered.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Power/Powered.cs new file mode 100644 index 000000000..7ccebf862 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Power/Powered.cs @@ -0,0 +1,14 @@ +using System; +using System.Xml.Linq; + +namespace Barotrauma.Items.Components +{ + partial class Powered : ItemComponent + { + protected static Sound[] sparkSounds; + + private bool powerOnSoundPlayed; + + private static Sound powerOnSound; + } +} diff --git a/Barotrauma/Source/Items/Components/Signal/Connection.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs similarity index 65% rename from Barotrauma/Source/Items/Components/Signal/Connection.cs rename to Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs index ef968c749..85b8f4723 100644 --- a/Barotrauma/Source/Items/Components/Signal/Connection.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs @@ -7,190 +7,12 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { - - class Connection + partial class Connection { private static Texture2D panelTexture; private static Sprite connector; private static Sprite wireVertical; - //how many wires can be linked to a single connector - public const int MaxLinked = 5; - - public readonly string Name; - - public Wire[] Wires; - - private Item item; - - public readonly bool IsOutput; - - private static Wire draggingConnected; - - private List effects; - - public readonly ushort[] wireId; - - public bool IsPower - { - get; - private set; - } - - public List Recipients - { - get - { - List recipients = new List(); - for (int i = 0; i < MaxLinked; i++) - { - if (Wires[i] == null) continue; - Connection recipient = Wires[i].OtherConnection(this); - if (recipient != null) recipients.Add(recipient); - } - return recipients; - } - } - - public Item Item - { - get { return item; } - } - - public Connection(XElement element, Item item) - { - - if (connector == null) - { - panelTexture = Sprite.LoadTexture("Content/Items/connectionpanel.png"); - - connector = new Sprite(panelTexture, new Rectangle(470, 102, 19, 43), Vector2.Zero, 0.0f); - connector.Origin = new Vector2(9.5f, 10.0f); - - wireVertical = new Sprite(panelTexture, new Rectangle(408, 1, 11, 102), Vector2.Zero, 0.0f); - } - - this.item = item; - - //recipient = new Connection[MaxLinked]; - Wires = new Wire[MaxLinked]; - - IsOutput = (element.Name.ToString() == "output"); - Name = ToolBox.GetAttributeString(element, "name", (IsOutput) ? "output" : "input"); - - IsPower = Name == "power_in" || Name == "power" || Name == "power_out"; - - effects = new List(); - - wireId = new ushort[MaxLinked]; - - foreach (XElement subElement in element.Elements()) - { - switch (subElement.Name.ToString().ToLowerInvariant()) - { - case "link": - int index = -1; - for (int i = 0; i < MaxLinked; i++) - { - if (wireId[i] < 1) index = i; - } - if (index == -1) break; - - int id = ToolBox.GetAttributeInt(subElement, "w", 0); - if (id < 0) id = 0; - wireId[index] = (ushort)id; - - break; - - case "statuseffect": - effects.Add(StatusEffect.Load(subElement)); - break; - } - } - } - - public int FindEmptyIndex() - { - for (int i = 0; i < MaxLinked; i++) - { - if (Wires[i] == null) return i; - } - return -1; - } - - //public int FindLinkIndex(Item item) - //{ - // for (int i = 0; i < MaxLinked; i++) - // { - // if (item == null && recipient[i] == null) return i; - // if (recipient[i]!=null && recipient[i].item == item) return i; - // } - // return -1; - //} - - public int FindWireIndex(Item wireItem) - { - for (int i = 0; i < MaxLinked; i++) - { - if (Wires[i] == null && wireItem == null) return i; - if (Wires[i] != null && Wires[i].Item == wireItem) return i; - } - return -1; - } - - public void TryAddLink(Wire wire) - { - for (int i = 0; i < MaxLinked; i++) - { - if (Wires[i] == null) - { - Wires[i] = wire; - return; - } - } - } - - public void AddLink(int index, Wire wire) - { - Wires[index] = wire; - } - - public void SendSignal(int stepsTaken, string signal, Item source, Character sender, float power) - { - for (int i = 0; i < MaxLinked; i++) - { - if (Wires[i] == null) continue; - - Connection recipient = Wires[i].OtherConnection(this); - if (recipient == null) continue; - if (recipient.item == this.item || recipient.item == source) continue; - - foreach (ItemComponent ic in recipient.item.components) - { - ic.ReceiveSignal(stepsTaken, signal, recipient, item, sender, power); - } - - foreach (StatusEffect effect in recipient.effects) - { - - //effect.Apply(ActionType.OnUse, 1.0f, recipient.item, recipient.item); - recipient.item.ApplyStatusEffect(effect, ActionType.OnUse, 1.0f); - } - } - } - - public void ClearConnections() - { - for (int i = 0; i < MaxLinked; i++) - { - if (Wires[i] == null) continue; - - Wires[i].RemoveConnection(this); - Wires[i] = null; - } - } - - public static void DrawConnections(SpriteBatch spriteBatch, ConnectionPanel panel, Character character) { @@ -438,7 +260,7 @@ namespace Barotrauma.Items.Components { XElement newElement = new XElement(IsOutput ? "output" : "input", new XAttribute("name", Name)); - Array.Sort(Wires, delegate(Wire wire1, Wire wire2) + Array.Sort(Wires, delegate (Wire wire1, Wire wire2) { if (wire1 == null) return 1; if (wire2 == null) return -1; @@ -458,29 +280,5 @@ namespace Barotrauma.Items.Components parentElement.Add(newElement); } - - - - public void ConnectLinked() - { - if (wireId == null) return; - - for (int i = 0; i < MaxLinked; i++) - { - if (wireId[i] == 0) continue; - - Item wireItem = MapEntity.FindEntityByID(wireId[i]) as Item; - - if (wireItem == null) continue; - Wires[i] = wireItem.GetComponent(); - - if (Wires[i] != null) - { - if (Wires[i].Item.body != null) Wires[i].Item.body.Enabled = false; - Wires[i].Connect(this, false, false); - } - } - } - } -} \ No newline at end of file +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/ConnectionPanel.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/ConnectionPanel.cs new file mode 100644 index 000000000..0f8382f2c --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/ConnectionPanel.cs @@ -0,0 +1,51 @@ +using Barotrauma.Networking; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using System.Collections.Generic; +using System.Xml.Linq; +using Lidgren.Network; + +namespace Barotrauma.Items.Components +{ + partial class ConnectionPanel : ItemComponent, IServerSerializable, IClientSerializable + { + public override void UpdateHUD(Character character) + { + if (character != Character.Controlled || character != user) return; + + if (Screen.Selected != GameMain.EditMapScreen && + character.IsKeyHit(InputType.Select) && + character.SelectedConstruction == this.item) character.SelectedConstruction = null; + + if (HighlightedWire != null) + { + HighlightedWire.Item.IsHighlighted = true; + if (HighlightedWire.Connections[0] != null && HighlightedWire.Connections[0].Item != null) HighlightedWire.Connections[0].Item.IsHighlighted = true; + if (HighlightedWire.Connections[1] != null && HighlightedWire.Connections[1].Item != null) HighlightedWire.Connections[1].Item.IsHighlighted = true; + } + } + + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + if (character != Character.Controlled || character != user) return; + + HighlightedWire = null; + Connection.DrawConnections(spriteBatch, this, character); + + } + + public override XElement Save(XElement parentElement) + { + XElement componentElement = base.Save(parentElement); + + foreach (Connection c in Connections) + { + c.Save(componentElement); + } + + return componentElement; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Wire.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Wire.cs new file mode 100644 index 000000000..34af1192a --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Wire.cs @@ -0,0 +1,256 @@ +using Barotrauma.Networking; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Xml.Linq; + +namespace Barotrauma.Items.Components +{ + partial class Wire : ItemComponent, IDrawableComponent, IServerSerializable + { + partial class WireSection + { + public void Draw(SpriteBatch spriteBatch, Color color, Vector2 offset, float depth, float width = 0.3f) + { + spriteBatch.Draw(wireSprite.Texture, + new Vector2(start.X + offset.X, -(start.Y + offset.Y)), null, color, + -angle, + new Vector2(0.0f, wireSprite.size.Y / 2.0f), + new Vector2(length / wireSprite.Texture.Width, width), + SpriteEffects.None, + depth); + } + + public static void Draw(SpriteBatch spriteBatch, Vector2 start, Vector2 end, Color color, float depth, float width = 0.3f) + { + start.Y = -start.Y; + end.Y = -end.Y; + + spriteBatch.Draw(wireSprite.Texture, + start, null, color, + MathUtils.VectorToAngle(end - start), + new Vector2(0.0f, wireSprite.size.Y / 2.0f), + new Vector2((Vector2.Distance(start, end)) / wireSprite.Texture.Width, width), + SpriteEffects.None, + depth); + } + } + + public void Draw(SpriteBatch spriteBatch, bool editing) + { + if (sections.Count == 0 && !IsActive) + { + Drawable = false; + return; + } + + Vector2 drawOffset = Vector2.Zero; + if (item.Submarine != null) + { + drawOffset = item.Submarine.DrawPosition + item.Submarine.HiddenSubPosition; + } + + float depth = item.IsSelected ? 0.0f : wireSprite.Depth + ((item.ID % 100) * 0.00001f); + + if (item.IsHighlighted) + { + foreach (WireSection section in sections) + { + section.Draw(spriteBatch, Color.Gold, drawOffset, depth + 0.00001f, 0.7f); + } + } + else if (item.IsSelected) + { + foreach (WireSection section in sections) + { + section.Draw(spriteBatch, Color.Red, drawOffset, depth + 0.00001f, 0.7f); + } + } + + foreach (WireSection section in sections) + { + section.Draw(spriteBatch, item.Color, drawOffset, depth, 0.3f); + } + + if (IsActive && nodes.Count > 0 && Vector2.Distance(newNodePos, nodes[nodes.Count - 1]) > nodeDistance) + { + WireSection.Draw( + spriteBatch, + new Vector2(nodes[nodes.Count - 1].X, nodes[nodes.Count - 1].Y) + drawOffset, + new Vector2(newNodePos.X, newNodePos.Y) + drawOffset, + item.Color * 0.5f, + depth, + 0.3f); + } + + if (!editing || !GameMain.EditMapScreen.WiringMode) return; + + for (int i = 0; i < nodes.Count; i++) + { + Vector2 drawPos = nodes[i]; + if (item.Submarine != null) drawPos += item.Submarine.Position + item.Submarine.HiddenSubPosition; + drawPos.Y = -drawPos.Y; + + if (item.IsSelected) + { + GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-5, -5), new Vector2(10, 10), item.Color, true, 0.0f); + + if (highlightedNodeIndex == i) + { + GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f); + } + } + else + { + GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-3, -3), new Vector2(6, 6), item.Color, true, 0.0f); + } + } + } + + public static void UpdateEditing(List wires) + { + //dragging a node of some wire + if (draggingWire != null) + { + //cancel dragging + if (!PlayerInput.LeftButtonHeld()) + { + draggingWire = null; + selectedNodeIndex = null; + } + //update dragging + else + { + MapEntity.DisableSelect = true; + + Submarine sub = null; + if (draggingWire.connections[0] != null && draggingWire.connections[0].Item.Submarine != null) sub = draggingWire.connections[0].Item.Submarine; + if (draggingWire.connections[1] != null && draggingWire.connections[1].Item.Submarine != null) sub = draggingWire.connections[1].Item.Submarine; + + Vector2 nodeWorldPos = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition) - sub.HiddenSubPosition - sub.Position;// Nodes[(int)selectedNodeIndex]; + + nodeWorldPos.X = MathUtils.Round(nodeWorldPos.X, Submarine.GridSize.X / 2.0f); + nodeWorldPos.Y = MathUtils.Round(nodeWorldPos.Y, Submarine.GridSize.Y / 2.0f); + + draggingWire.nodes[(int)selectedNodeIndex] = nodeWorldPos; + draggingWire.UpdateSections(); + + MapEntity.SelectEntity(draggingWire.item); + } + + return; + } + + //a wire has been selected -> check if we should start dragging one of the nodes + float nodeSelectDist = 10, sectionSelectDist = 5; + highlightedNodeIndex = null; + if (MapEntity.SelectedList.Count == 1 && MapEntity.SelectedList[0] is Item) + { + Wire selectedWire = ((Item)MapEntity.SelectedList[0]).GetComponent(); + + if (selectedWire != null) + { + Vector2 mousePos = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition); + if (selectedWire.item.Submarine != null) mousePos -= (selectedWire.item.Submarine.Position + selectedWire.item.Submarine.HiddenSubPosition); + + //left click while holding ctrl -> check if the cursor is on a wire section, + //and add a new node if it is + if (PlayerInput.KeyDown(Keys.RightControl) || PlayerInput.KeyDown(Keys.LeftControl)) + { + if (PlayerInput.LeftButtonClicked()) + { + float temp = 0.0f; + int closestSectionIndex = selectedWire.GetClosestSectionIndex(mousePos, sectionSelectDist, out temp); + + if (closestSectionIndex > -1) + { + selectedWire.nodes.Insert(closestSectionIndex + 1, mousePos); + selectedWire.UpdateSections(); + } + } + } + else + { + //check if close enough to a node + float temp = 0.0f; + int closestIndex = selectedWire.GetClosestNodeIndex(mousePos, nodeSelectDist, out temp); + if (closestIndex > -1) + { + highlightedNodeIndex = closestIndex; + //start dragging the node + if (PlayerInput.LeftButtonHeld()) + { + draggingWire = selectedWire; + selectedNodeIndex = closestIndex; + } + //remove the node + else if (PlayerInput.RightButtonClicked() && closestIndex > 0 && closestIndex < selectedWire.nodes.Count - 1) + { + selectedWire.nodes.RemoveAt(closestIndex); + selectedWire.UpdateSections(); + } + } + } + } + } + + //check which wire is highlighted with the cursor + Wire highlighted = null; + float closestDist = 0.0f; + foreach (Wire w in wires) + { + Vector2 mousePos = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition); + if (w.item.Submarine != null) mousePos -= (w.item.Submarine.Position + w.item.Submarine.HiddenSubPosition); + + float dist = 0.0f; + if (w.GetClosestNodeIndex(mousePos, highlighted == null ? nodeSelectDist : closestDist, out dist) > -1) + { + highlighted = w; + closestDist = dist; + } + + if (w.GetClosestSectionIndex(mousePos, highlighted == null ? sectionSelectDist : closestDist, out dist) > -1) + { + highlighted = w; + closestDist = dist; + } + + } + + + if (highlighted != null) + { + highlighted.item.IsHighlighted = true; + + if (PlayerInput.LeftButtonClicked()) + { + MapEntity.DisableSelect = true; + MapEntity.SelectEntity(highlighted.item); + } + } + } + + public override XElement Save(XElement parentElement) + { + XElement componentElement = base.Save(parentElement); + + if (nodes == null || nodes.Count == 0) return componentElement; + + string[] nodeCoords = new string[nodes.Count * 2]; + for (int i = 0; i < nodes.Count; i++) + { + nodeCoords[i * 2] = nodes[i].X.ToString(CultureInfo.InvariantCulture); + nodeCoords[i * 2 + 1] = nodes[i].Y.ToString(CultureInfo.InvariantCulture); + } + + componentElement.Add(new XAttribute("nodes", string.Join(";", nodeCoords))); + + return componentElement; + } + } +} diff --git a/Barotrauma/Source/Items/Components/StatusHUD.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/StatusHUD.cs similarity index 78% rename from Barotrauma/Source/Items/Components/StatusHUD.cs rename to Barotrauma/BarotraumaClient/Source/Items/Components/StatusHUD.cs index d4f2de7da..9d4c274e5 100644 --- a/Barotrauma/Source/Items/Components/StatusHUD.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/StatusHUD.cs @@ -8,19 +8,8 @@ using Microsoft.Xna.Framework; namespace Barotrauma.Items.Components { - class StatusHUD : ItemComponent + partial class StatusHUD : ItemComponent { - private static readonly string[] BleedingTexts = {"Minor bleeding", "Bleeding", "Bleeding heavily", "Catastrophic Bleeding"}; - - private static readonly string[] HealthTexts = { "No visible injuries", "Minor injuries", "Injured", "Major injuries", "Critically injured" }; - - private static readonly string[] OxygenTexts = { "Oxygen level normal", "Gasping for air", "Signs of oxygen deprivation", "Not breathing" }; - - public StatusHUD(Item item, XElement element) - : base(item, element) - { - } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) { if (character == null) return; diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs new file mode 100644 index 000000000..2ec831fc0 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using FarseerPhysics; +using Barotrauma.Networking; +using Lidgren.Network; + +namespace Barotrauma.Items.Components +{ + partial class Turret : Powered, IDrawableComponent, IServerSerializable + { + public void Draw(SpriteBatch spriteBatch, bool editing = false) + { + Vector2 drawPos = new Vector2(item.Rect.X, item.Rect.Y); + if (item.Submarine != null) drawPos += item.Submarine.DrawPosition; + drawPos.Y = -drawPos.Y; + + if (barrelSprite != null) + { + barrelSprite.Draw(spriteBatch, + drawPos + barrelPos, Color.White, + rotation + MathHelper.PiOver2, 1.0f, + SpriteEffects.None, item.Sprite.Depth + 0.01f); + } + + if (!editing) return; + + GUI.DrawLine(spriteBatch, + drawPos + barrelPos, + drawPos + barrelPos + new Vector2((float)Math.Cos(minRotation), (float)Math.Sin(minRotation)) * 60.0f, + Color.Green); + + GUI.DrawLine(spriteBatch, + drawPos + barrelPos, + drawPos + barrelPos + new Vector2((float)Math.Cos(maxRotation), (float)Math.Sin(maxRotation)) * 60.0f, + Color.Green); + + GUI.DrawLine(spriteBatch, + drawPos + barrelPos, + drawPos + barrelPos + new Vector2((float)Math.Cos((maxRotation + minRotation) / 2), (float)Math.Sin((maxRotation + minRotation) / 2)) * 60.0f, + Color.LightGreen); + + } + + public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) + { + UInt16 projectileID = msg.ReadUInt16(); + Item projectile = Entity.FindEntityByID(projectileID) as Item; + + if (projectile == null) + { + DebugConsole.ThrowError("Failed to launch a projectile - item with the ID \"" + projectileID + " not found"); + return; + } + + Launch(projectile); + PlaySound(ActionType.OnUse, item.WorldPosition); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/DockingPort.cs b/Barotrauma/BarotraumaClient/Source/Items/DockingPort.cs new file mode 100644 index 000000000..699b05976 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/DockingPort.cs @@ -0,0 +1,75 @@ +using Barotrauma.Networking; +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Dynamics.Joints; +using FarseerPhysics.Factories; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace Barotrauma.Items.Components +{ + partial class DockingPort : ItemComponent, IDrawableComponent, IServerSerializable + { + public void Draw(SpriteBatch spriteBatch, bool editing) + { + if (dockingState == 0.0f) return; + + Vector2 drawPos = item.DrawPosition; + drawPos.Y = -drawPos.Y; + + var rect = overlaySprite.SourceRect; + + if (IsHorizontal) + { + drawPos.Y -= rect.Height / 2; + + if (dockingDir == 1) + { + spriteBatch.Draw(overlaySprite.Texture, + drawPos, + new Rectangle( + rect.Center.X + (int)(rect.Width / 2 * (1.0f - dockingState)), rect.Y, + (int)(rect.Width / 2 * dockingState), rect.Height), Color.White); + + } + else + { + spriteBatch.Draw(overlaySprite.Texture, + drawPos - Vector2.UnitX * (rect.Width / 2 * dockingState), + new Rectangle( + rect.X, rect.Y, + (int)(rect.Width / 2 * dockingState), rect.Height), Color.White); + } + } + else + { + drawPos.X -= rect.Width / 2; + + if (dockingDir == 1) + { + spriteBatch.Draw(overlaySprite.Texture, + drawPos - Vector2.UnitY * (rect.Height / 2 * dockingState), + new Rectangle( + rect.X, rect.Y, + rect.Width, (int)(rect.Height / 2 * dockingState)), Color.White); + } + else + { + spriteBatch.Draw(overlaySprite.Texture, + drawPos, + new Rectangle( + rect.X, rect.Y + rect.Height / 2 + (int)(rect.Height / 2 * (1.0f - dockingState)), + rect.Width, (int)(rect.Height / 2 * dockingState)), Color.White); + } + } + } + + } +} diff --git a/Barotrauma/Source/Items/FixRequirement.cs b/Barotrauma/BarotraumaClient/Source/Items/FixRequirement.cs similarity index 79% rename from Barotrauma/Source/Items/FixRequirement.cs rename to Barotrauma/BarotraumaClient/Source/Items/FixRequirement.cs index 15ae83dbb..bd3a3b9c6 100644 --- a/Barotrauma/Source/Items/FixRequirement.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/FixRequirement.cs @@ -9,58 +9,20 @@ using System.Xml.Linq; namespace Barotrauma { - class FixRequirement + partial class FixRequirement { - string name; - private static GUIFrame frame; - List requiredSkills; - List requiredItems; - - public bool Fixed; - - public FixRequirement(XElement element) - { - name = ToolBox.GetAttributeString(element, "name", ""); - - requiredSkills = new List(); - requiredItems = new List(); - - foreach (XElement subElement in element.Elements()) - { - switch (subElement.Name.ToString().ToLowerInvariant()) - { - case "skill": - string skillName = ToolBox.GetAttributeString(subElement, "name", ""); - int level = ToolBox.GetAttributeInt(subElement, "level", 1); - - requiredSkills.Add(new Skill(skillName, level)); - break; - case "item": - string itemName = ToolBox.GetAttributeString(subElement, "name", ""); - - requiredItems.Add(itemName); - break; - } - } - } - public bool CanBeFixed(Character character, GUIComponent reqFrame = null) { - if (character == null) return false; - - bool success = true; foreach (string itemName in requiredItems) { Item item = character.Inventory.FindItem(itemName); bool itemFound = (item != null); - - if (!itemFound) success = false; - + if (reqFrame != null) { - GUIComponent component = reqFrame.children.Find(c => c.UserData as string == itemName); + GUIComponent component = reqFrame.children.Find(c => c.UserData as string == itemName); GUITextBlock text = component as GUITextBlock; if (text != null) text.TextColor = itemFound ? Color.LightGreen : Color.Red; } @@ -71,8 +33,6 @@ namespace Barotrauma float characterSkill = character.GetSkillLevel(skill.Name); bool sufficientSkill = characterSkill >= skill.Level; - if (!sufficientSkill) success = false; - if (reqFrame != null) { GUIComponent component = reqFrame.children.Find(c => c.UserData as Skill == skill); @@ -81,9 +41,9 @@ namespace Barotrauma } } - return success; + return CanBeFixed(character); } - + private static void CreateGUIFrame(Item item) { int width = 400, height = 500; @@ -93,13 +53,13 @@ namespace Barotrauma frame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f); frame.UserData = item; - new GUITextBlock(new Rectangle(0,0,200,20), "Attempting to fix " + item.Name, "", frame); + new GUITextBlock(new Rectangle(0, 0, 200, 20), "Attempting to fix " + item.Name, "", frame); y = y + 40; foreach (FixRequirement requirement in item.FixRequirements) { GUIFrame reqFrame = new GUIFrame( - new Rectangle(0, y, 0, 20 + Math.Max(requirement.requiredItems.Count, requirement.requiredSkills.Count) * 15), + new Rectangle(0, y, 0, 20 + Math.Max(requirement.requiredItems.Count, requirement.requiredSkills.Count) * 15), Color.Transparent, null, frame); reqFrame.UserData = requirement; @@ -108,7 +68,7 @@ namespace Barotrauma fixButton.OnClicked = FixButtonPressed; fixButton.UserData = requirement; - var tickBox = new GUITickBox(new Rectangle(70, 0, 20,20), requirement.name, Alignment.Left, reqFrame); + var tickBox = new GUITickBox(new Rectangle(70, 0, 20, 20), requirement.name, Alignment.Left, reqFrame); tickBox.Enabled = false; int y2 = 20; @@ -117,10 +77,10 @@ namespace Barotrauma var itemBlock = new GUITextBlock(new Rectangle(30, y2, 200, 15), itemName, "", reqFrame); itemBlock.Font = GUI.SmallFont; itemBlock.UserData = itemName; - + y2 += 15; } - + y2 = 20; foreach (Skill skill in requirement.requiredSkills) { @@ -148,7 +108,7 @@ namespace Barotrauma if (GameMain.Client != null) { - GameMain.Client.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.Repair, item.FixRequirements.IndexOf(requirement)}); + GameMain.Client.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.Repair, item.FixRequirements.IndexOf(requirement) }); } else if (GameMain.Server != null) { @@ -159,7 +119,7 @@ namespace Barotrauma { requirement.Fixed = true; } - + return true; } diff --git a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs new file mode 100644 index 000000000..58dc4034f --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs @@ -0,0 +1,203 @@ +using System.Linq; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Barotrauma.Networking; +using System; +using System.Collections.Generic; +using Barotrauma.Items.Components; + +namespace Barotrauma +{ + partial class InventorySlot + { + public GUIComponent.ComponentState State; + + public bool IsHighlighted + { + get + { + return State == GUIComponent.ComponentState.Hover; + } + } + + public Color Color; + + public Color BorderHighlightColor; + private CoroutineHandle BorderHighlightCoroutine; + + public void ShowBorderHighlight(Color color, float fadeInDuration, float fadeOutDuration) + { + if (BorderHighlightCoroutine != null) + { + BorderHighlightCoroutine = null; + } + + BorderHighlightCoroutine = CoroutineManager.StartCoroutine(UpdateBorderHighlight(color, fadeInDuration, fadeOutDuration)); + } + + private IEnumerable UpdateBorderHighlight(Color color, float fadeInDuration, float fadeOutDuration) + { + float t = 0.0f; + while (t < fadeInDuration + fadeOutDuration) + { + BorderHighlightColor = (t < fadeInDuration) ? + Color.Lerp(Color.Transparent, color, t / fadeInDuration) : + Color.Lerp(color, Color.Transparent, (t - fadeInDuration) / fadeOutDuration); + + t += CoroutineManager.DeltaTime; + + yield return CoroutineStatus.Running; + } + + yield return CoroutineStatus.Success; + } + } + + partial class Inventory + { + public virtual void Draw(SpriteBatch spriteBatch, bool subInventory = false) + { + if (slots == null || isSubInventory != subInventory) return; + + for (int i = 0; i < capacity; i++) + { + if (slots[i].Disabled) continue; + + //don't draw the item if it's being dragged out of the slot + bool drawItem = draggingItem == null || draggingItem != Items[i] || slots[i].IsHighlighted; + + DrawSlot(spriteBatch, slots[i], Items[i], drawItem); + } + + if (draggingItem != null && + (draggingSlot == null || (!draggingSlot.Rect.Contains(PlayerInput.MousePosition) && draggingItem.ParentInventory == this))) + { + Rectangle dragRect = new Rectangle( + (int)PlayerInput.MousePosition.X - 10, + (int)PlayerInput.MousePosition.Y - 10, + 40, 40); + + DrawSlot(spriteBatch, new InventorySlot(dragRect), draggingItem); + } + + for (int i = 0; i < capacity; i++) + { + if (slots[i].IsHighlighted && !slots[i].Disabled && Items[i] != null) + { + string toolTip = ""; + if (GameMain.DebugDraw) + { + toolTip = Items[i].ToString(); + } + else + { + toolTip = string.IsNullOrEmpty(Items[i].Description) ? + Items[i].Name : + Items[i].Name + '\n' + Items[i].Description; + } + + DrawToolTip(spriteBatch, toolTip, slots[i].Rect); + break; + } + } + } + + protected void DrawToolTip(SpriteBatch spriteBatch, string toolTip, Rectangle highlightedSlot) + { + int maxWidth = 300; + + toolTip = ToolBox.WrapText(toolTip, maxWidth, GUI.Font); + + Vector2 textSize = GUI.Font.MeasureString(toolTip); + Vector2 rectSize = textSize * 1.2f; + + Vector2 pos = new Vector2(highlightedSlot.Right, highlightedSlot.Y - rectSize.Y); + pos.X = (int)(pos.X + 3); + pos.Y = (int)pos.Y; + + GUI.DrawRectangle(spriteBatch, pos, rectSize, Color.Black * 0.8f, true); + GUI.Font.DrawString(spriteBatch, toolTip, + new Vector2((int)(pos.X + rectSize.X * 0.5f), (int)(pos.Y + rectSize.Y * 0.5f)), + Color.White, 0.0f, + new Vector2((int)(textSize.X * 0.5f), (int)(textSize.Y * 0.5f)), + 1.0f, SpriteEffects.None, 0.0f); + } + + + public void DrawSubInventory(SpriteBatch spriteBatch, int slotIndex) + { + var item = Items[slotIndex]; + if (item == null) return; + + var container = item.GetComponent(); + if (container == null) return; + + if (container.Inventory.slots == null || !container.Inventory.isSubInventory) return; + + int itemCapacity = container.Capacity; + +#if DEBUG + System.Diagnostics.Debug.Assert(slotIndex >= 0 && slotIndex < Items.Length); +#else + if (slotIndex < 0 || slotIndex >= Items.Length) return; +#endif + + var slot = slots[slotIndex]; + Rectangle containerRect = new Rectangle(slot.Rect.X - 5, slot.Rect.Y - (40 + 10) * itemCapacity - 5, + slot.Rect.Width + 10, slot.Rect.Height + (40 + 10) * itemCapacity + 10); + + GUI.DrawRectangle(spriteBatch, new Rectangle(containerRect.X, containerRect.Y, containerRect.Width, containerRect.Height - slot.Rect.Height - 5), Color.Black * 0.8f, true); + GUI.DrawRectangle(spriteBatch, containerRect, Color.White); + + container.Inventory.Draw(spriteBatch, true); + + if (!containerRect.Contains(PlayerInput.MousePosition)) + { + if (draggingItem == null || draggingItem.Container != item) selectedSlot = -1; + } + } + + protected void DrawSlot(SpriteBatch spriteBatch, InventorySlot slot, Item item, bool drawItem = true) + { + Rectangle rect = slot.Rect; + + GUI.DrawRectangle(spriteBatch, rect, (slot.IsHighlighted ? Color.Red * 0.4f : slot.Color), true); + + if (item != null && drawItem) + { + if (item.Condition < 100.0f) + { + GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Bottom - 8, rect.Width, 8), Color.Black * 0.8f, true); + GUI.DrawRectangle(spriteBatch, + new Rectangle(rect.X, rect.Bottom - 8, (int)(rect.Width * item.Condition / 100.0f), 8), + Color.Lerp(Color.Red, Color.Green, item.Condition / 100.0f) * 0.8f, true); + } + + var containedItems = item.ContainedItems; + if (containedItems != null && containedItems.Length == 1 && containedItems[0].Condition < 100.0f) + { + GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Y, rect.Width, 8), Color.Black * 0.8f, true); + GUI.DrawRectangle(spriteBatch, + new Rectangle(rect.X, rect.Y, (int)(rect.Width * containedItems[0].Condition / 100.0f), 8), + Color.Lerp(Color.Red, Color.Green, containedItems[0].Condition / 100.0f) * 0.8f, true); + } + } + + GUI.DrawRectangle(spriteBatch, rect, (slot.IsHighlighted ? Color.Red * 0.4f : slot.Color), false); + + if (slot.BorderHighlightColor != Color.Transparent) + { + Rectangle highlightRect = slot.Rect; + highlightRect.Inflate(3, 3); + + GUI.DrawRectangle(spriteBatch, highlightRect, slot.BorderHighlightColor, false, 0, 5); + } + + if (item == null || !drawItem) return; + + item.Sprite.Draw(spriteBatch, new Vector2(rect.X + rect.Width / 2, rect.Y + rect.Height / 2), item.Color); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Item.cs b/Barotrauma/BarotraumaClient/Source/Items/Item.cs new file mode 100644 index 000000000..aa385d788 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Item.cs @@ -0,0 +1,575 @@ +using Barotrauma.Items.Components; +using Barotrauma.Networking; +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Dynamics.Contacts; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Xml.Linq; + +namespace Barotrauma +{ + partial class Item : MapEntity, IDamageable, IPropertyObject, IServerSerializable, IClientSerializable + { + public override Sprite Sprite + { + get { return prefab.sprite; } + } + + + public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) + { + if (!Visible) return; + Color color = (IsSelected && editing) ? color = Color.Red : spriteColor; + if (isHighlighted) color = Color.Orange; + + SpriteEffects oldEffects = prefab.sprite.effects; + prefab.sprite.effects ^= SpriteEffects; + + if (prefab.sprite != null) + { + float depth = Sprite.Depth; + depth += (ID % 255) * 0.000001f; + + if (body == null) + { + if (prefab.ResizeHorizontal || prefab.ResizeVertical || SpriteEffects.HasFlag(SpriteEffects.FlipHorizontally) || SpriteEffects.HasFlag(SpriteEffects.FlipVertically)) + { + prefab.sprite.DrawTiled(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y + rect.Height / 2)), new Vector2(rect.Width, rect.Height), color); + } + else + { + prefab.sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y), color, 0.0f, 1.0f, SpriteEffects.None, depth); + } + + } + else if (body.Enabled) + { + var holdable = GetComponent(); + if (holdable != null && holdable.Picker?.AnimController != null) + { + if (holdable.Picker.SelectedItems[0] == this) + { + depth = holdable.Picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.000001f; + } + else if (holdable.Picker.SelectedItems[1] == this) + { + depth = holdable.Picker.AnimController.GetLimb(LimbType.LeftArm).sprite.Depth - 0.000001f; + } + + body.Draw(spriteBatch, prefab.sprite, color, depth); + } + else + { + body.Draw(spriteBatch, prefab.sprite, color, depth); + } + } + } + + prefab.sprite.effects = oldEffects; + + List staticDrawableComponents = new List(drawableComponents); //static list to compensate for drawable toggling + for (int i = 0; i < staticDrawableComponents.Count; i++) + { + staticDrawableComponents[i].Draw(spriteBatch, editing); + } + + if (GameMain.DebugDraw && aiTarget != null) aiTarget.Draw(spriteBatch); + + if (!editing || (body != null && !body.Enabled)) + { + return; + } + + if (IsSelected || isHighlighted) + { + GUI.DrawRectangle(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y + rect.Height / 2)), new Vector2(rect.Width, rect.Height), Color.Green, false, 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + + foreach (Rectangle t in prefab.Triggers) + { + Rectangle transformedTrigger = TransformTrigger(t); + + Vector2 rectWorldPos = new Vector2(transformedTrigger.X, transformedTrigger.Y); + if (Submarine != null) rectWorldPos += Submarine.Position; + rectWorldPos.Y = -rectWorldPos.Y; + + GUI.DrawRectangle(spriteBatch, + rectWorldPos, + new Vector2(transformedTrigger.Width, transformedTrigger.Height), + Color.Green, + false, + 0, + (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + } + } + + if (!ShowLinks) return; + + foreach (MapEntity e in linkedTo) + { + GUI.DrawLine(spriteBatch, + new Vector2(WorldPosition.X, -WorldPosition.Y), + new Vector2(e.WorldPosition.X, -e.WorldPosition.Y), + Color.Red * 0.3f); + } + } + + public override void UpdateEditing(Camera cam) + { + if (editingHUD == null || editingHUD.UserData as Item != this) + { + editingHUD = CreateEditingHUD(Screen.Selected != GameMain.EditMapScreen); + } + + editingHUD.Update((float)Timing.Step); + + if (Screen.Selected != GameMain.EditMapScreen) return; + + if (!prefab.IsLinkable) return; + + if (!PlayerInput.LeftButtonClicked() || !PlayerInput.KeyDown(Keys.Space)) return; + + Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition); + + foreach (MapEntity entity in mapEntityList) + { + if (entity == this || !entity.IsHighlighted) continue; + if (linkedTo.Contains(entity)) continue; + if (!entity.IsMouseOn(position)) continue; + + linkedTo.Add(entity); + if (entity.IsLinkable && entity.linkedTo != null) entity.linkedTo.Add(this); + } + } + + public override void DrawEditing(SpriteBatch spriteBatch, Camera cam) + { + if (editingHUD != null) editingHUD.Draw(spriteBatch); + } + + private GUIComponent CreateEditingHUD(bool inGame = false) + { + List editableProperties = inGame ? GetProperties() : GetProperties(); + + int requiredItemCount = 0; + if (!inGame) + { + foreach (ItemComponent ic in components) + { + requiredItemCount += ic.requiredItems.Count; + } + } + + int width = 450; + int height = 80 + requiredItemCount * 20; + int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10; + foreach (var objectProperty in editableProperties) + { + var editable = objectProperty.Attributes.OfType().FirstOrDefault(); + if (editable != null) height += (int)(Math.Ceiling(editable.MaxLength / 40.0f) * 18.0f) + 5; + } + + editingHUD = new GUIFrame(new Rectangle(x, y, width, height), ""); + editingHUD.Padding = new Vector4(10, 10, 0, 0); + editingHUD.UserData = this; + + new GUITextBlock(new Rectangle(0, 0, 100, 20), prefab.Name, "", + Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont); + + y += 25; + + if (!inGame) + { + if (prefab.IsLinkable) + { + new GUITextBlock(new Rectangle(0, 5, 0, 20), "Hold space to link to another item", + "", Alignment.TopRight, Alignment.TopRight, editingHUD).Font = GUI.SmallFont; + } + foreach (ItemComponent ic in components) + { + foreach (RelatedItem relatedItem in ic.requiredItems) + { + new GUITextBlock(new Rectangle(0, y, 100, 15), ic.Name + ": " + relatedItem.Type.ToString() + " required", "", Alignment.TopLeft, Alignment.CenterLeft, editingHUD, false, GUI.SmallFont); + GUITextBox namesBox = new GUITextBox(new Rectangle(-10, y, 160, 15), Alignment.Right, "", editingHUD); + namesBox.Font = GUI.SmallFont; + + PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(relatedItem); + PropertyDescriptor property = properties.Find("JoinedNames", false); + + namesBox.Text = relatedItem.JoinedNames; + namesBox.UserData = new ObjectProperty(property, relatedItem); + namesBox.OnEnterPressed = EnterProperty; + namesBox.OnTextChanged = PropertyChanged; + + y += 20; + } + } + if (requiredItemCount > 0) y += 10; + } + + foreach (var objectProperty in editableProperties) + { + int boxHeight = 18; + var editable = objectProperty.Attributes.OfType().FirstOrDefault(); + if (editable != null) boxHeight = (int)(Math.Ceiling(editable.MaxLength / 40.0f) * 18.0f); + + object value = objectProperty.GetValue(); + + if (value is bool) + { + GUITickBox propertyTickBox = new GUITickBox(new Rectangle(10, y, 18, 18), objectProperty.Name, + Alignment.Left, editingHUD); + propertyTickBox.Font = GUI.SmallFont; + + propertyTickBox.Selected = (bool)value; + + propertyTickBox.UserData = objectProperty; + propertyTickBox.OnSelected = EnterProperty; + } + else + { + new GUITextBlock(new Rectangle(0, y, 100, 18), objectProperty.Name, "", Alignment.TopLeft, Alignment.Left, editingHUD, false, GUI.SmallFont); + + GUITextBox propertyBox = new GUITextBox(new Rectangle(180, y, 250, boxHeight), "", editingHUD); + propertyBox.Font = GUI.SmallFont; + if (boxHeight > 18) propertyBox.Wrap = true; + + if (value != null) + { + if (value is float) + { + propertyBox.Text = ((float)value).ToString("G", System.Globalization.CultureInfo.InvariantCulture); + } + else + { + + propertyBox.Text = value.ToString(); + } + } + + propertyBox.UserData = objectProperty; + propertyBox.OnEnterPressed = EnterProperty; + propertyBox.OnTextChanged = PropertyChanged; + + } + y = y + boxHeight + 5; + + } + return editingHUD; + } + + public virtual void UpdateHUD(Camera cam, Character character) + { + if (condition <= 0.0f) + { + FixRequirement.UpdateHud(this, character); + return; + } + + if (HasInGameEditableProperties) + { + UpdateEditing(cam); + } + + foreach (ItemComponent ic in components) + { + if (ic.CanBeSelected) ic.UpdateHUD(character); + } + } + + public virtual void DrawHUD(SpriteBatch spriteBatch, Camera cam, Character character) + { + if (condition <= 0.0f) + { + FixRequirement.DrawHud(spriteBatch, this, character); + return; + } + + if (HasInGameEditableProperties) + { + DrawEditing(spriteBatch, cam); + } + + foreach (ItemComponent ic in components) + { + if (ic.CanBeSelected) ic.DrawHUD(spriteBatch, character); + } + } + + public override void AddToGUIUpdateList() + { + if (Screen.Selected is EditMapScreen) + { + if (editingHUD != null) editingHUD.AddToGUIUpdateList(); + } + else + { + if (HasInGameEditableProperties) + { + if (editingHUD != null) editingHUD.AddToGUIUpdateList(); + } + } + + if (Character.Controlled != null && Character.Controlled.SelectedConstruction == this) + { + if (condition <= 0.0f) + { + FixRequirement.AddToGUIUpdateList(); + return; + } + + foreach (ItemComponent ic in components) + { + if (ic.CanBeSelected) ic.AddToGUIUpdateList(); + } + } + } + + private bool EnterProperty(GUITickBox tickBox) + { + var objectProperty = tickBox.UserData as ObjectProperty; + if (objectProperty == null) return false; + + objectProperty.TrySetValue(tickBox.Selected); + + return true; + } + + private bool EnterProperty(GUITextBox textBox, string text) + { + textBox.Color = Color.DarkGreen; + + var objectProperty = textBox.UserData as ObjectProperty; + if (objectProperty == null) return false; + + object prevValue = objectProperty.GetValue(); + + textBox.Deselect(); + + if (objectProperty.TrySetValue(text)) + { + textBox.Text = text; + + if (GameMain.Server != null) + { + GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.ChangeProperty, objectProperty }); + } + else if (GameMain.Client != null) + { + GameMain.Client.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.ChangeProperty, objectProperty }); + } + + return true; + } + else + { + if (prevValue != null) + { + textBox.Text = prevValue.ToString(); + } + return false; + } + } + + private bool PropertyChanged(GUITextBox textBox, string text) + { + textBox.Color = Color.Red; + + return true; + } + + public override XElement Save(XElement parentElement) + { + XElement element = new XElement("Item"); + + element.Add(new XAttribute("name", prefab.Name), + new XAttribute("ID", ID)); + + System.Diagnostics.Debug.Assert(Submarine != null); + + if (ResizeHorizontal || ResizeVertical) + { + element.Add(new XAttribute("rect", + (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + + (int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," + + rect.Width + "," + rect.Height)); + } + else + { + element.Add(new XAttribute("rect", + (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + + (int)(rect.Y - Submarine.HiddenSubPosition.Y))); + } + + if (linkedTo != null && linkedTo.Count > 0) + { + string[] linkedToIDs = new string[linkedTo.Count]; + + for (int i = 0; i < linkedTo.Count; i++) + { + linkedToIDs[i] = linkedTo[i].ID.ToString(); + } + + element.Add(new XAttribute("linked", string.Join(",", linkedToIDs))); + } + + + ObjectProperty.SaveProperties(this, element); + + foreach (ItemComponent ic in components) + { + ic.Save(element); + } + + parentElement.Add(element); + + return element; + } + + + public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) + { + if (type == ServerNetObject.ENTITY_POSITION) + { + ClientReadPosition(type, msg, sendingTime); + return; + } + + NetEntityEvent.Type eventType = + (NetEntityEvent.Type)msg.ReadRangedInteger(0, Enum.GetValues(typeof(NetEntityEvent.Type)).Length - 1); + + switch (eventType) + { + case NetEntityEvent.Type.ComponentState: + int componentIndex = msg.ReadRangedInteger(0, components.Count - 1); + (components[componentIndex] as IServerSerializable).ClientRead(type, msg, sendingTime); + break; + case NetEntityEvent.Type.InventoryState: + ownInventory.ClientRead(type, msg, sendingTime); + break; + case NetEntityEvent.Type.Status: + condition = msg.ReadRangedSingle(0.0f, 100.0f, 8); + + if (FixRequirements.Count > 0) + { + if (Condition <= 0.0f) + { + for (int i = 0; i < FixRequirements.Count; i++) + FixRequirements[i].Fixed = msg.ReadBoolean(); + } + else + { + for (int i = 0; i < FixRequirements.Count; i++) + FixRequirements[i].Fixed = true; + } + } + break; + case NetEntityEvent.Type.ApplyStatusEffect: + ActionType actionType = (ActionType)msg.ReadRangedInteger(0, Enum.GetValues(typeof(ActionType)).Length - 1); + ushort targetID = msg.ReadUInt16(); + + Character target = FindEntityByID(targetID) as Character; + ApplyStatusEffects(actionType, (float)Timing.Step, target, true); + break; + case NetEntityEvent.Type.ChangeProperty: + ReadPropertyChange(msg); + break; + } + } + + public void ClientWrite(NetBuffer msg, object[] extraData = null) + { + if (extraData == null || extraData.Length == 0 || !(extraData[0] is NetEntityEvent.Type)) + { + return; + } + + NetEntityEvent.Type eventType = (NetEntityEvent.Type)extraData[0]; + msg.WriteRangedInteger(0, Enum.GetValues(typeof(NetEntityEvent.Type)).Length - 1, (int)eventType); + switch (eventType) + { + case NetEntityEvent.Type.ComponentState: + int componentIndex = (int)extraData[1]; + msg.WriteRangedInteger(0, components.Count - 1, componentIndex); + + (components[componentIndex] as IClientSerializable).ClientWrite(msg, extraData); + break; + case NetEntityEvent.Type.InventoryState: + ownInventory.ClientWrite(msg, extraData); + break; + case NetEntityEvent.Type.Repair: + if (FixRequirements.Count > 0) + { + int requirementIndex = (int)extraData[1]; + msg.WriteRangedInteger(0, FixRequirements.Count - 1, requirementIndex); + } + break; + case NetEntityEvent.Type.ApplyStatusEffect: + //no further data needed, the server applies the effect + //on the character of the client who sent the message + break; + case NetEntityEvent.Type.ChangeProperty: + WritePropertyChange(msg, extraData); + break; + } + msg.WritePadBits(); + } + + public void ClientReadPosition(ServerNetObject type, NetBuffer msg, float sendingTime) + { + Vector2 newPosition = new Vector2(msg.ReadFloat(), msg.ReadFloat()); + float newRotation = msg.ReadRangedSingle(0.0f, MathHelper.TwoPi, 7); + bool awake = msg.ReadBoolean(); + Vector2 newVelocity = Vector2.Zero; + + if (awake) + { + newVelocity = new Vector2( + msg.ReadRangedSingle(-MaxVel, MaxVel, 12), + msg.ReadRangedSingle(-MaxVel, MaxVel, 12)); + } + + if (body == null) + { + DebugConsole.ThrowError("Received a position update for an item with no physics body (" + Name + ")"); + return; + } + + body.FarseerBody.Awake = awake; + if (body.FarseerBody.Awake) + { + if ((newVelocity - body.LinearVelocity).Length() > 8.0f) body.LinearVelocity = newVelocity; + } + else + { + body.FarseerBody.Enabled = false; + } + + if ((newPosition - SimPosition).Length() > body.LinearVelocity.Length() * 2.0f) + { + body.SetTransform(newPosition, newRotation); + + Vector2 displayPos = ConvertUnits.ToDisplayUnits(body.SimPosition); + rect.X = (int)(displayPos.X - rect.Width / 2.0f); + rect.Y = (int)(displayPos.Y + rect.Height / 2.0f); + } + } + + public void CreateClientEvent(T ic) where T : ItemComponent, IClientSerializable + { + if (GameMain.Client == null) return; + + int index = components.IndexOf(ic); + if (index == -1) return; + + GameMain.Client.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.ComponentState, index }); + } + } +} \ No newline at end of file diff --git a/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs new file mode 100644 index 000000000..16142e255 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; +using FarseerPhysics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace Barotrauma +{ + partial class ItemPrefab : MapEntityPrefab + { + public override void DrawPlacing(SpriteBatch spriteBatch, Camera cam) + { + Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub); + + if (PlayerInput.RightButtonClicked()) + { + selected = null; + return; + } + + if (!resizeHorizontal && !resizeVertical) + { + sprite.Draw(spriteBatch, new Vector2(position.X + sprite.size.X / 2.0f, -position.Y + sprite.size.Y / 2.0f), SpriteColor); + } + else + { + Vector2 placeSize = size; + + if (placePosition == Vector2.Zero) + { + if (PlayerInput.LeftButtonHeld()) placePosition = position; + } + else + { + if (resizeHorizontal) + placeSize.X = Math.Max(position.X - placePosition.X, size.X); + if (resizeVertical) + placeSize.Y = Math.Max(placePosition.Y - position.Y, size.Y); + + position = placePosition; + } + + if (sprite != null) sprite.DrawTiled(spriteBatch, new Vector2(position.X, -position.Y), placeSize, SpriteColor); + } + + //if (PlayerInput.GetMouseState.RightButton == ButtonState.Pressed) selected = null; + + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Items/Rope.cs b/Barotrauma/BarotraumaClient/Source/Items/Rope.cs new file mode 100644 index 000000000..2db3e76e4 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Items/Rope.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using FarseerPhysics; +using FarseerPhysics.Collision.Shapes; +using FarseerPhysics.Common; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Dynamics.Joints; +using FarseerPhysics.Factories; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Barotrauma.Items.Components +{ + partial class Rope : ItemComponent, IDrawableComponent + { + public void Draw(SpriteBatch spriteBatch, bool editing = false) + { + if (!IsActive) return; + + RevoluteJoint firstJoint = null; + + for (int i = 0; i < ropeBodies.Length - 1; i++) + { + if (!ropeBodies[i].Enabled) continue; + + if (firstJoint == null) firstJoint = ropeJoints[i]; + + DrawSection(spriteBatch, ropeJoints[i].WorldAnchorA, ropeJoints[i + 1].WorldAnchorA, i); + } + + if (gunJoint == null || firstJoint == null) return; + + DrawSection(spriteBatch, gunJoint.WorldAnchorA, firstJoint.WorldAnchorA, 0); + + } + + private void DrawSection(SpriteBatch spriteBatch, Vector2 start, Vector2 end, int i) + { + start.Y = -start.Y; + end.Y = -end.Y; + + spriteBatch.Draw(sprite.Texture, + ConvertUnits.ToDisplayUnits(start), null, Color.White, + MathUtils.VectorToAngle(end - start), + new Vector2(0.0f, sprite.size.Y / 2.0f), + new Vector2((ConvertUnits.ToDisplayUnits(Vector2.Distance(start, end))) / sprite.Texture.Width, 1.0f), + SpriteEffects.None, + sprite.Depth + i * 0.00001f); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/Explosion.cs b/Barotrauma/BarotraumaClient/Source/Map/Explosion.cs new file mode 100644 index 000000000..364a357b4 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Explosion.cs @@ -0,0 +1,73 @@ +using Microsoft.Xna.Framework; +using Barotrauma.Lights; +using System; +using System.Collections.Generic; +using System.Xml.Linq; +using Barotrauma.Networking; +using FarseerPhysics; + +namespace Barotrauma +{ + partial class Explosion + { + partial void ExplodeProjSpecific(Vector2 worldPosition,Hull hull) + { + + if (shockwave) + { + GameMain.ParticleManager.CreateParticle("shockwave", worldPosition, + Vector2.Zero, 0.0f, hull); + } + + for (int i = 0; i < attack.Range * 0.1f; i++) + { + Vector2 bubblePos = Rand.Vector(attack.Range * 0.5f); + GameMain.ParticleManager.CreateParticle("bubbles", worldPosition + bubblePos, + bubblePos, 0.0f, hull); + + if (sparks) + { + GameMain.ParticleManager.CreateParticle("spark", worldPosition, + Rand.Vector(Rand.Range(500.0f, 800.0f)), 0.0f, hull); + } + if (flames) + { + GameMain.ParticleManager.CreateParticle("explosionfire", ClampParticlePos(worldPosition + Rand.Vector(50f), hull), + Rand.Vector(Rand.Range(50.0f, 100.0f)), 0.0f, hull); + } + if (smoke) + { + GameMain.ParticleManager.CreateParticle("smoke", ClampParticlePos(worldPosition + Rand.Vector(50f), hull), + Rand.Vector(Rand.Range(1.0f, 10.0f)), 0.0f, hull); + } + } + + float displayRange = attack.Range; + if (displayRange < 0.1f) return; + + var light = new LightSource(worldPosition, displayRange, Color.LightYellow, null); + CoroutineManager.StartCoroutine(DimLight(light)); + + } + + private IEnumerable DimLight(LightSource light) + { + float currBrightness = 1.0f; + float startRange = light.Range; + + while (light.Color.A > 0.0f) + { + light.Color = new Color(light.Color.R, light.Color.G, light.Color.B, currBrightness); + light.Range = startRange * currBrightness; + + currBrightness -= CoroutineManager.DeltaTime * 20.0f; + + yield return CoroutineStatus.Running; + } + + light.Remove(); + + yield return CoroutineStatus.Success; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/FireSource.cs b/Barotrauma/BarotraumaClient/Source/Map/FireSource.cs new file mode 100644 index 000000000..8ae3b14d6 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/FireSource.cs @@ -0,0 +1,86 @@ +using Barotrauma.Lights; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Barotrauma.Networking; + +namespace Barotrauma +{ + partial class FireSource + { + static Sound fireSoundBasic, fireSoundLarge; + + private LightSource lightSource; + + partial void UpdateProjSpecific(float growModifier) + { + if (hull.FireSources.Any(fs => fs != this && fs.size.X > size.X)) + { + if (basicSoundIndex > 0) + { + Sounds.SoundManager.Stop(basicSoundIndex); + basicSoundIndex = -1; + } + if (largeSoundIndex > 0) + { + Sounds.SoundManager.Stop(largeSoundIndex); + largeSoundIndex = -1; + } + } + else + { + if (fireSoundBasic != null) + { + basicSoundIndex = fireSoundBasic.Loop(basicSoundIndex, + Math.Min(size.X / 100.0f, 1.0f), WorldPosition + size / 2.0f, 1000.0f); + + } + if (fireSoundLarge != null) + { + largeSoundIndex = fireSoundLarge.Loop(largeSoundIndex, + MathHelper.Clamp((size.X - 200.0f) / 100.0f, 0.0f, 1.0f), WorldPosition + size / 2.0f, 1000.0f); + } + } + + float count = Rand.Range(0.0f, size.X / 50.0f); + + for (int i = 0; i < count; i++) + { + Vector2 particlePos = new Vector2( + WorldPosition.X + Rand.Range(0.0f, size.X), + Rand.Range(WorldPosition.Y - size.Y, WorldPosition.Y + 20.0f)); + + Vector2 particleVel = new Vector2( + (particlePos.X - (WorldPosition.X + size.X / 2.0f)), + (float)Math.Sqrt(size.X) * Rand.Range(0.0f, 15.0f) * growModifier); + + var particle = GameMain.ParticleManager.CreateParticle("flame", + particlePos, particleVel, 0.0f, hull); + + if (particle == null) continue; + + //make some of the particles create another firesource when they enter another hull + if (Rand.Int(20) == 1) particle.OnChangeHull = OnChangeHull; + + particle.Size *= MathHelper.Clamp(size.X / 60.0f * Math.Max(hull.Oxygen / hull.FullVolume, 0.4f), 0.5f, 1.0f); + + if (Rand.Int(5) == 1) + { + var smokeParticle = GameMain.ParticleManager.CreateParticle("smoke", + particlePos, new Vector2(particleVel.X, particleVel.Y * 0.1f), 0.0f, hull); + + if (smokeParticle != null) + { + smokeParticle.Size *= MathHelper.Clamp(size.X / 100.0f * Math.Max(hull.Oxygen / hull.FullVolume, 0.4f), 0.5f, 1.0f); + } + } + } + + lightSource.Range = Math.Max(size.X, size.Y) * 10.0f / 2.0f; + lightSource.Color = new Color(1.0f, 0.45f, 0.3f) * Rand.Range(0.8f, 1.0f); + lightSource.Position = position + Vector2.UnitY * 30.0f; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/Gap.cs b/Barotrauma/BarotraumaClient/Source/Map/Gap.cs new file mode 100644 index 000000000..5bc347cdc --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Gap.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Xml.Linq; +using FarseerPhysics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.ObjectModel; +using Barotrauma.Items.Components; + +namespace Barotrauma +{ + partial class Gap : MapEntity + { + public override void Draw(SpriteBatch sb, bool editing, bool back = true) + { + if (GameMain.DebugDraw) + { + Vector2 center = new Vector2(WorldRect.X + rect.Width / 2.0f, -(WorldRect.Y - rect.Height / 2.0f)); + + GUI.DrawLine(sb, center, center + new Vector2(flowForce.X, -flowForce.Y) / 10.0f, Color.Red); + + GUI.DrawLine(sb, center + Vector2.One * 5.0f, center + new Vector2(lerpedFlowForce.X, -lerpedFlowForce.Y) / 10.0f + Vector2.One * 5.0f, Color.Orange); + } + + if (!editing || !ShowGaps) return; + + Color clr = (open == 0.0f) ? Color.Red : Color.Cyan; + if (isHighlighted) clr = Color.Gold; + + float depth = (ID % 255) * 0.000001f; + + GUI.DrawRectangle( + sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), + clr * 0.5f, true, + depth, + (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + + for (int i = 0; i < linkedTo.Count; i++) + { + Vector2 dir = isHorizontal ? + new Vector2(Math.Sign(linkedTo[i].Rect.Center.X - rect.Center.X), 0.0f) + : new Vector2(0.0f, Math.Sign((linkedTo[i].Rect.Y - linkedTo[i].Rect.Height / 2.0f) - (rect.Y - rect.Height / 2.0f))); + + Vector2 arrowPos = new Vector2(WorldRect.Center.X, -(WorldRect.Y - WorldRect.Height / 2)); + arrowPos += new Vector2(dir.X * (WorldRect.Width / 2 + 10), dir.Y * (WorldRect.Height / 2 + 10)); + + GUI.Arrow.Draw(sb, + arrowPos, clr * 0.8f, + GUI.Arrow.Origin, MathUtils.VectorToAngle(dir) + MathHelper.PiOver2, + isHorizontal ? new Vector2(rect.Height / 16.0f, 1.0f) : new Vector2(rect.Width / 16.0f, 1.0f), + SpriteEffects.None, depth); + } + + if (IsSelected) + { + GUI.DrawRectangle(sb, + new Vector2(WorldRect.X - 5, -WorldRect.Y - 5), + new Vector2(rect.Width + 10, rect.Height + 10), + Color.Red, + false, + depth, + (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + } + } + + public override XElement Save(XElement parentElement) + { + XElement element = new XElement("Gap"); + + element.Add( + new XAttribute("ID", ID), + new XAttribute("horizontal", isHorizontal ? "true" : "false")); + + element.Add(new XAttribute("rect", + (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + + (int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," + + rect.Width + "," + rect.Height)); + + //if (linkedTo != null) + //{ + // int i = 0; + // foreach (Entity e in linkedTo) + // { + // if (e == null) continue; + // element.Add(new XAttribute("linkedto" + i, e.ID)); + // i += 1; + // } + //} + + parentElement.Add(element); + + return element; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/Hull.cs b/Barotrauma/BarotraumaClient/Source/Map/Hull.cs new file mode 100644 index 000000000..79814ac16 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Hull.cs @@ -0,0 +1,205 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Xml.Linq; +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Lidgren.Network; +using Barotrauma.Networking; + +namespace Barotrauma +{ + partial class Hull : MapEntity, IPropertyObject, IServerSerializable + { + public static WaterRenderer renderer; + + private Sound currentFlowSound; + private int soundIndex; + private float soundVolume; + + public override bool IsMouseOn(Vector2 position) + { + if (!GameMain.DebugDraw && !ShowHulls) return false; + + return (Submarine.RectContains(WorldRect, position) && + !Submarine.RectContains(MathUtils.ExpandRect(WorldRect, -8), position)); + } + + public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) + { + //if (back) return; + Rectangle drawRect; + if (!Visible) + { + drawRect = + Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height); + + GUI.DrawRectangle(spriteBatch, + new Vector2(drawRect.X, -drawRect.Y), + new Vector2(rect.Width, rect.Height), + Color.Black, true, + 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + } + + if (!ShowHulls && !GameMain.DebugDraw) return; + + if (!editing && !GameMain.DebugDraw) return; + + if (aiTarget != null) aiTarget.Draw(spriteBatch); + + drawRect = + Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height); + + GUI.DrawRectangle(spriteBatch, + new Vector2(drawRect.X, -drawRect.Y), + new Vector2(rect.Width, rect.Height), + Color.Blue, false, (ID % 255) * 0.000001f, (int)Math.Max((1.5f / Screen.Selected.Cam.Zoom), 1.0f)); + + GUI.DrawRectangle(spriteBatch, + new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), + Color.Red * ((100.0f - OxygenPercentage) / 400.0f), true, 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + + if (GameMain.DebugDraw) + { + GUI.SmallFont.DrawString(spriteBatch, "Pressure: " + ((int)pressure - rect.Y).ToString() + + " - Oxygen: " + ((int)OxygenPercentage), new Vector2(drawRect.X + 5, -drawRect.Y + 5), Color.White); + GUI.SmallFont.DrawString(spriteBatch, volume + " / " + FullVolume, new Vector2(drawRect.X + 5, -drawRect.Y + 20), Color.White); + + foreach (FireSource fs in fireSources) + { + GUI.DrawRectangle(spriteBatch, new Rectangle((int)fs.WorldPosition.X, (int)-fs.WorldPosition.Y, (int)fs.Size.X, (int)fs.Size.Y), Color.Orange, false); + } + } + + if ((IsSelected || isHighlighted) && editing) + { + GUI.DrawRectangle(spriteBatch, + new Vector2(drawRect.X + 5, -drawRect.Y + 5), + new Vector2(rect.Width - 10, rect.Height - 10), + isHighlighted ? Color.LightBlue * 0.5f : Color.Red * 0.5f, true, 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + } + } + + public void Render(GraphicsDevice graphicsDevice, Camera cam) + { + if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return; + + Vector2 submarinePos = Submarine == null ? Vector2.Zero : Submarine.DrawPosition; + + //calculate where the surface should be based on the water volume + float top = rect.Y + submarinePos.Y; + float bottom = top - rect.Height; + + float drawSurface = surface + submarinePos.Y; + + Matrix transform = cam.Transform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f; + + if (bottom > cam.WorldView.Y || top < cam.WorldView.Y - cam.WorldView.Height) return; + + if (!update) + { + // create the four corners of our triangle. + + Vector3[] corners = new Vector3[4]; + + corners[0] = new Vector3(rect.X, rect.Y, 0.0f); + corners[1] = new Vector3(rect.X + rect.Width, rect.Y, 0.0f); + + corners[2] = new Vector3(corners[1].X, rect.Y - rect.Height, 0.0f); + corners[3] = new Vector3(corners[0].X, corners[2].Y, 0.0f); + + Vector2[] uvCoords = new Vector2[4]; + for (int i = 0; i < 4; i++) + { + corners[i] += new Vector3(submarinePos, 0.0f); + uvCoords[i] = Vector2.Transform(new Vector2(corners[i].X, -corners[i].Y), transform); + } + + renderer.vertices[renderer.PositionInBuffer] = new VertexPositionTexture(corners[0], uvCoords[0]); + renderer.vertices[renderer.PositionInBuffer + 1] = new VertexPositionTexture(corners[1], uvCoords[1]); + renderer.vertices[renderer.PositionInBuffer + 2] = new VertexPositionTexture(corners[2], uvCoords[2]); + + renderer.vertices[renderer.PositionInBuffer + 3] = new VertexPositionTexture(corners[0], uvCoords[0]); + renderer.vertices[renderer.PositionInBuffer + 4] = new VertexPositionTexture(corners[2], uvCoords[2]); + renderer.vertices[renderer.PositionInBuffer + 5] = new VertexPositionTexture(corners[3], uvCoords[3]); + + renderer.PositionInBuffer += 6; + + return; + } + + float x = rect.X + Submarine.DrawPosition.X; + int start = (int)Math.Floor((cam.WorldView.X - x) / WaveWidth); + start = Math.Max(start, 0); + + int end = (waveY.Length - 1) + - (int)Math.Floor((float)((x + rect.Width) - (cam.WorldView.X + cam.WorldView.Width)) / WaveWidth); + end = Math.Min(end, waveY.Length - 1); + + x += start * WaveWidth; + + for (int i = start; i < end; i++) + { + if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return; + + Vector3[] corners = new Vector3[4]; + + corners[0] = new Vector3(x, top, 0.0f); + corners[3] = new Vector3(corners[0].X, drawSurface + waveY[i], 0.0f); + + //skip adjacent "water rects" if the surface of the water is roughly at the same position + int width = WaveWidth; + while (i < end - 1 && Math.Abs(waveY[i + 1] - waveY[i]) < 1.0f) + { + width += WaveWidth; + i++; + } + + corners[1] = new Vector3(x + width, top, 0.0f); + corners[2] = new Vector3(corners[1].X, drawSurface + waveY[i + 1], 0.0f); + + Vector2[] uvCoords = new Vector2[4]; + for (int n = 0; n < 4; n++) + { + uvCoords[n] = Vector2.Transform(new Vector2(corners[n].X, -corners[n].Y), transform); + } + + renderer.vertices[renderer.PositionInBuffer] = new VertexPositionTexture(corners[0], uvCoords[0]); + renderer.vertices[renderer.PositionInBuffer + 1] = new VertexPositionTexture(corners[1], uvCoords[1]); + renderer.vertices[renderer.PositionInBuffer + 2] = new VertexPositionTexture(corners[2], uvCoords[2]); + + renderer.vertices[renderer.PositionInBuffer + 3] = new VertexPositionTexture(corners[0], uvCoords[0]); + renderer.vertices[renderer.PositionInBuffer + 4] = new VertexPositionTexture(corners[2], uvCoords[2]); + renderer.vertices[renderer.PositionInBuffer + 5] = new VertexPositionTexture(corners[3], uvCoords[3]); + + renderer.PositionInBuffer += 6; + + x += width; + } + + } + + + public override XElement Save(XElement parentElement) + { + XElement element = new XElement("Hull"); + + element.Add + ( + new XAttribute("ID", ID), + new XAttribute("rect", + (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + + (int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," + + rect.Width + "," + rect.Height), + new XAttribute("water", volume) + ); + + parentElement.Add(element); + + return element; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/Levels/CaveGenerator.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/CaveGenerator.cs new file mode 100644 index 000000000..8c318a2b4 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Levels/CaveGenerator.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Voronoi2; +using Microsoft.Xna.Framework.Graphics; +using FarseerPhysics; +using FarseerPhysics.Common; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Factories; + +namespace Barotrauma +{ + static partial class CaveGenerator + { + public static List GenerateRenderVerticeList(List triangles) + { + var verticeList = new List(); + for (int i = 0; i < triangles.Count; i++) + { + foreach (Vector2 vertex in triangles[i]) + { + //shift the coordinates around a bit to make the texture repetition less obvious + Vector2 uvCoords = new Vector2( + vertex.X / 2000.0f + (float)Math.Sin(vertex.X / 500.0f) * 0.15f, + vertex.Y / 2000.0f + (float)Math.Sin(vertex.Y / 700.0f) * 0.15f); + + verticeList.Add(new VertexPositionTexture(new Vector3(vertex, 1.0f), uvCoords)); + } + } + + return verticeList; + } + + public static VertexPositionTexture[] GenerateWallShapes(List cells) + { + float inwardThickness = 500.0f, outWardThickness = 30.0f; + + List verticeList = new List(); + + foreach (VoronoiCell cell in cells) + { + //if (cell.body == null) continue; + foreach (GraphEdge edge in cell.edges) + { + if (edge.cell1 != null && edge.cell1.body == null && edge.cell1.CellType != CellType.Empty) edge.cell1 = null; + if (edge.cell2 != null && edge.cell2.body == null && edge.cell2.CellType != CellType.Empty) edge.cell2 = null; + + CompareCCW compare = new CompareCCW(cell.Center); + if (compare.Compare(edge.point1, edge.point2) == -1) + { + var temp = edge.point1; + edge.point1 = edge.point2; + edge.point2 = temp; + } + } + } + + foreach (VoronoiCell cell in cells) + { + //if (cell.body == null) continue; + foreach (GraphEdge edge in cell.edges) + { + if (!edge.isSolid) continue; + + GraphEdge leftEdge = cell.edges.Find(e => e != edge && (edge.point1 == e.point1 || edge.point1 == e.point2)); + GraphEdge rightEdge = cell.edges.Find(e => e != edge && (edge.point2 == e.point1 || edge.point2 == e.point2)); + + Vector2 leftNormal = Vector2.Zero, rightNormal = Vector2.Zero; + + if (leftEdge == null) + { + leftNormal = GetEdgeNormal(edge, cell); + } + else + { + leftNormal = (leftEdge.isSolid) ? + Vector2.Normalize(GetEdgeNormal(leftEdge) + GetEdgeNormal(edge, cell)) : + Vector2.Normalize(leftEdge.Center - edge.point1); + } + + + if (!MathUtils.IsValid(leftNormal)) + { +#if DEBUG + DebugConsole.ThrowError("Invalid left normal"); +#endif + if (cell.body != null) + { + GameMain.World.RemoveBody(cell.body); + cell.body = null; + } + leftNormal = Vector2.UnitX; + break; + } + + + if (rightEdge == null) + { + rightNormal = GetEdgeNormal(edge, cell); + } + else + { + rightNormal = (rightEdge.isSolid) ? + Vector2.Normalize(GetEdgeNormal(rightEdge) + GetEdgeNormal(edge, cell)) : + Vector2.Normalize(rightEdge.Center - edge.point2); + } + + if (!MathUtils.IsValid(rightNormal)) + { +#if DEBUG + DebugConsole.ThrowError("Invalid right normal"); +#endif + if (cell.body != null) + { + GameMain.World.RemoveBody(cell.body); + cell.body = null; + } + rightNormal = Vector2.UnitX; + break; + } + + for (int i = 0; i < 2; i++) + { + Vector2[] verts = new Vector2[3]; + VertexPositionTexture[] vertPos = new VertexPositionTexture[3]; + + + if (i == 0) + { + verts[0] = edge.point1 - leftNormal * outWardThickness; + verts[1] = edge.point2 - rightNormal * outWardThickness; + verts[2] = edge.point1 + leftNormal * inwardThickness; + + vertPos[0] = new VertexPositionTexture(new Vector3(verts[0], 0.0f), Vector2.Zero); + vertPos[1] = new VertexPositionTexture(new Vector3(verts[1], 0.0f), Vector2.UnitX); + vertPos[2] = new VertexPositionTexture(new Vector3(verts[2], 0.0f), new Vector2(0, 0.5f)); + } + else + { + verts[0] = edge.point1 + leftNormal * inwardThickness; + verts[1] = edge.point2 - rightNormal * outWardThickness; + verts[2] = edge.point2 + rightNormal * inwardThickness; + + vertPos[0] = new VertexPositionTexture(new Vector3(verts[0], 0.0f), new Vector2(0.0f, 0.5f)); + vertPos[1] = new VertexPositionTexture(new Vector3(verts[1], 0.0f), Vector2.UnitX); + vertPos[2] = new VertexPositionTexture(new Vector3(verts[2], 0.0f), new Vector2(1.0f, 0.5f)); + } + + var comparer = new CompareCCW((verts[0] + verts[1] + verts[2]) / 3.0f); + Array.Sort(verts, vertPos, comparer); + + for (int j = 0; j < 3; j++) + { + verticeList.Add(vertPos[j]); + } + } + } + } + + return verticeList.ToArray(); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/Levels/Level.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/Level.cs new file mode 100644 index 000000000..a3cd883fb --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Levels/Level.cs @@ -0,0 +1,59 @@ +using FarseerPhysics; +using FarseerPhysics.Common; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Factories; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using System.Collections.Generic; +using System.Diagnostics; +using Voronoi2; +using Barotrauma.RuinGeneration; + +namespace Barotrauma +{ + partial class Level + { + private LevelRenderer renderer; + + public void DrawFront(SpriteBatch spriteBatch) + { + if (renderer == null) return; + renderer.Draw(spriteBatch); + + if (GameMain.DebugDraw) + { + foreach (InterestingPosition pos in positionsOfInterest) + { + Color color = Color.Yellow; + if (pos.PositionType == PositionType.Cave) + { + color = Color.DarkOrange; + } + else if (pos.PositionType == PositionType.Ruin) + { + color = Color.LightGray; + } + + + GUI.DrawRectangle(spriteBatch, new Vector2(pos.Position.X - 15.0f, -pos.Position.Y - 15.0f), new Vector2(30.0f, 30.0f), color, true); + } + } + } + + public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundSpriteManager = null) + { + float brightness = MathHelper.Clamp(50.0f + (cam.Position.Y - Size.Y) / 2000.0f, 10.0f, 40.0f); + + float avgValue = (backgroundColor.R + backgroundColor.G + backgroundColor.G) / 3; + GameMain.LightManager.AmbientLight = new Color(backgroundColor * (brightness / avgValue), 1.0f); + + graphics.Clear(backgroundColor); + + if (renderer == null) return; + renderer.DrawBackground(spriteBatch, cam, backgroundSpriteManager); + } + } +} diff --git a/Barotrauma/Source/Map/Levels/LevelRenderer.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs similarity index 100% rename from Barotrauma/Source/Map/Levels/LevelRenderer.cs rename to Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs diff --git a/Barotrauma/BarotraumaClient/Source/Map/Levels/Ruins/RuinGenerator.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/Ruins/RuinGenerator.cs new file mode 100644 index 000000000..5a5e343b7 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Levels/Ruins/RuinGenerator.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Voronoi2; + +namespace Barotrauma.RuinGeneration +{ + partial class Ruin + { + public void Draw(SpriteBatch spriteBatch) + { + //foreach (BTRoom room in leaves) + //{ + // GUI.DrawRectangle(spriteBatch, room.Rect, Color.White); + //} + + //foreach (Corridor corr in corridors) + //{ + // GUI.DrawRectangle(spriteBatch, corr.Rect, Color.Blue); + //} + + foreach (Line line in walls) + { + GUI.DrawLine(spriteBatch, new Vector2(line.A.X, -line.A.Y), new Vector2(line.B.X, -line.B.Y), Color.Red, 0.0f, 10); + } + } + } +} diff --git a/Barotrauma/Source/Map/Levels/WaterRenderer.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/WaterRenderer.cs similarity index 100% rename from Barotrauma/Source/Map/Levels/WaterRenderer.cs rename to Barotrauma/BarotraumaClient/Source/Map/Levels/WaterRenderer.cs diff --git a/Barotrauma/BarotraumaClient/Source/Map/Levels/WrappingWall.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/WrappingWall.cs new file mode 100644 index 000000000..c1e2fb655 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Levels/WrappingWall.cs @@ -0,0 +1,39 @@ +using FarseerPhysics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using Voronoi2; + +namespace Barotrauma +{ + partial class WrappingWall : IDisposable + { + private VertexBuffer wallVertices, bodyVertices; + + public VertexBuffer WallVertices + { + get { return wallVertices; } + } + + public VertexBuffer BodyVertices + { + get { return bodyVertices; } + } + + public void SetWallVertices(VertexPositionTexture[] vertices) + { + wallVertices = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly); + wallVertices.SetData(vertices); + } + + public void SetBodyVertices(VertexPositionColor[] vertices) + { + bodyVertices = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColor.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly); + bodyVertices.SetData(vertices); + } + } +} diff --git a/Barotrauma/Source/Map/Lights/ConvexHull.cs b/Barotrauma/BarotraumaClient/Source/Map/Lights/ConvexHull.cs similarity index 100% rename from Barotrauma/Source/Map/Lights/ConvexHull.cs rename to Barotrauma/BarotraumaClient/Source/Map/Lights/ConvexHull.cs diff --git a/Barotrauma/Source/Map/Lights/LightManager.cs b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs similarity index 100% rename from Barotrauma/Source/Map/Lights/LightManager.cs rename to Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs diff --git a/Barotrauma/Source/Map/Lights/LightSource.cs b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs similarity index 100% rename from Barotrauma/Source/Map/Lights/LightSource.cs rename to Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs diff --git a/Barotrauma/BarotraumaClient/Source/Map/LinkedSubmarine.cs b/Barotrauma/BarotraumaClient/Source/Map/LinkedSubmarine.cs new file mode 100644 index 000000000..1a42db8dc --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/LinkedSubmarine.cs @@ -0,0 +1,234 @@ +using Barotrauma.Items.Components; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace Barotrauma +{ + partial class LinkedSubmarine : MapEntity + { + public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) + { + if (!editing || wallVertices == null) return; + + Color color = (isHighlighted) ? Color.Orange : Color.Green; + if (IsSelected) color = Color.Red; + + Vector2 pos = Position; + + for (int i = 0; i < wallVertices.Count; i++) + { + Vector2 startPos = wallVertices[i] + pos; + startPos.Y = -startPos.Y; + + Vector2 endPos = wallVertices[(i + 1) % wallVertices.Count] + pos; + endPos.Y = -endPos.Y; + + GUI.DrawLine(spriteBatch, + startPos, + endPos, + color, 0.0f, 5); + } + + pos.Y = -pos.Y; + GUI.DrawLine(spriteBatch, pos + Vector2.UnitY * 50.0f, pos - Vector2.UnitY * 50.0f, color, 0.0f, 5); + GUI.DrawLine(spriteBatch, pos + Vector2.UnitX * 50.0f, pos - Vector2.UnitX * 50.0f, color, 0.0f, 5); + + Rectangle drawRect = rect; + drawRect.Y = -rect.Y; + GUI.DrawRectangle(spriteBatch, drawRect, Color.Red, true); + + foreach (MapEntity e in linkedTo) + { + GUI.DrawLine(spriteBatch, + new Vector2(WorldPosition.X, -WorldPosition.Y), + new Vector2(e.WorldPosition.X, -e.WorldPosition.Y), + Color.Red * 0.3f); + } + } + + public override void UpdateEditing(Camera cam) + { + if (editingHUD == null || editingHUD.UserData as LinkedSubmarine != this) + { + editingHUD = CreateEditingHUD(); + } + + editingHUD.Update((float)Timing.Step); + + if (!PlayerInput.LeftButtonClicked() || !PlayerInput.KeyDown(Keys.Space)) return; + + Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition); + + foreach (MapEntity entity in mapEntityList) + { + if (entity == this || !entity.IsHighlighted || !(entity is Item) || !entity.IsMouseOn(position)) continue; + if (((Item)entity).GetComponent() == null) continue; + if (linkedTo.Contains(entity)) + { + linkedTo.Remove(entity); + } + else + { + linkedTo.Add(entity); + } + } + } + + public override void DrawEditing(SpriteBatch spriteBatch, Camera cam) + { + if (editingHUD == null) return; + + editingHUD.Draw(spriteBatch); + } + + + private GUIComponent CreateEditingHUD(bool inGame = false) + { + int width = 450; + int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10; + + editingHUD = new GUIFrame(new Rectangle(x, y, width, 100), ""); + editingHUD.Padding = new Vector4(10, 10, 0, 0); + editingHUD.UserData = this; + + new GUITextBlock(new Rectangle(0, 0, 100, 20), "Linked submarine", "", + Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont); + + var pathBox = new GUITextBox(new Rectangle(10, 30, 300, 20), "", editingHUD); + pathBox.Font = GUI.SmallFont; + pathBox.Text = filePath; + + var reloadButton = new GUIButton(new Rectangle(320, 30, 80, 20), "Refresh", "", editingHUD); + reloadButton.OnClicked = Reload; + reloadButton.UserData = pathBox; + + reloadButton.ToolTip = "Reload the linked submarine from the specified file"; + + y += 20; + + if (!inGame) + { + new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to a docking port", + "", Alignment.TopRight, Alignment.TopRight, editingHUD, false, GUI.SmallFont); + y += 25; + + } + return editingHUD; + } + + private bool Reload(GUIButton button, object obj) + { + var pathBox = obj as GUITextBox; + + if (!File.Exists(pathBox.Text)) + { + new GUIMessageBox("Error", "Submarine file \"" + pathBox.Text + "\" not found!"); + pathBox.Flash(Color.Red); + pathBox.Text = filePath; + return false; + } + + XDocument doc = Submarine.OpenFile(pathBox.Text); + if (doc == null || doc.Root == null) return false; + + pathBox.Flash(Color.Green); + + GenerateWallVertices(doc.Root); + saveElement = doc.Root; + saveElement.Name = "LinkedSubmarine"; + + filePath = pathBox.Text; + + return true; + } + + public override XElement Save(XElement parentElement) + { + XElement saveElement = null; + + if (sub == null) + { + if (this.saveElement == null) + { + var doc = Submarine.OpenFile(filePath); + saveElement = doc.Root; + + saveElement.Name = "LinkedSubmarine"; + + saveElement.Add(new XAttribute("filepath", filePath)); + } + else + { + saveElement = this.saveElement; + } + + if (saveElement.Attribute("pos") != null) saveElement.Attribute("pos").Remove(); + saveElement.Add(new XAttribute("pos", ToolBox.Vector2ToString(Position - Submarine.HiddenSubPosition))); + + + + var linkedPort = linkedTo.FirstOrDefault(lt => (lt is Item) && ((Item)lt).GetComponent() != null); + if (linkedPort != null) + { + if (saveElement.Attribute("linkedto") != null) saveElement.Attribute("linkedto").Remove(); + + saveElement.Add(new XAttribute("linkedto", linkedPort.ID)); + } + } + else + { + + saveElement = new XElement("LinkedSubmarine"); + + + sub.SaveToXElement(saveElement); + } + + if (sub != null) + { + bool leaveBehind = false; + if (!sub.DockedTo.Contains(Submarine.MainSub)) + { + System.Diagnostics.Debug.Assert(Submarine.MainSub.AtEndPosition || Submarine.MainSub.AtStartPosition); + if (Submarine.MainSub.AtEndPosition) + { + leaveBehind = sub.AtEndPosition != Submarine.MainSub.AtEndPosition; + } + else + { + leaveBehind = sub.AtStartPosition != Submarine.MainSub.AtStartPosition; + } + } + + + if (leaveBehind) + { + saveElement.SetAttributeValue("location", Level.Loaded.Seed); + saveElement.SetAttributeValue("worldpos", ToolBox.Vector2ToString(sub.SubBody.Position)); + + } + else + { + if (saveElement.Attribute("location") != null) saveElement.Attribute("location").Remove(); + if (saveElement.Attribute("worldpos") != null) saveElement.Attribute("worldpos").Remove(); + } + + saveElement.SetAttributeValue("pos", ToolBox.Vector2ToString(Position - Submarine.HiddenSubPosition)); + } + + + + parentElement.Add(saveElement); + + return saveElement; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/Map.cs b/Barotrauma/BarotraumaClient/Source/Map/Map.cs new file mode 100644 index 000000000..14d4da9f0 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Map.cs @@ -0,0 +1,210 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using Voronoi2; + +namespace Barotrauma +{ + partial class Map + { + private static Sprite iceTexture; + private static Texture2D iceCraters; + private static Texture2D iceCrack; + + public void Update(float deltaTime, Rectangle rect, float scale = 1.0f) + { + Vector2 rectCenter = new Vector2(rect.Center.X, rect.Center.Y); + Vector2 offset = -currentLocation.MapPosition; + + float maxDist = 20.0f; + float closestDist = 0.0f; + highlightedLocation = null; + for (int i = 0; i < locations.Count; i++) + { + Location location = locations[i]; + Vector2 pos = rectCenter + (location.MapPosition + offset) * scale; + + if (!rect.Contains(pos)) continue; + + float dist = Vector2.Distance(PlayerInput.MousePosition, pos); + if (dist < maxDist && (highlightedLocation == null || dist < closestDist)) + { + closestDist = dist; + highlightedLocation = location; + } + } + + foreach (LocationConnection connection in connections) + { + if (highlightedLocation != currentLocation && + connection.Locations.Contains(highlightedLocation) && connection.Locations.Contains(currentLocation)) + { + if (PlayerInput.LeftButtonClicked() && + selectedLocation != highlightedLocation && highlightedLocation != null) + { + selectedConnection = connection; + selectedLocation = highlightedLocation; + GameMain.LobbyScreen.SelectLocation(highlightedLocation, connection); + } + } + } + } + + public void Draw(SpriteBatch spriteBatch, Rectangle rect, float scale = 1.0f) + { + Vector2 rectCenter = new Vector2(rect.Center.X, rect.Center.Y); + Vector2 offset = -currentLocation.MapPosition; + + iceTexture.DrawTiled(spriteBatch, new Vector2(rect.X, rect.Y), new Vector2(rect.Width, rect.Height), Vector2.Zero, Color.White * 0.8f); + + foreach (LocationConnection connection in connections) + { + Color crackColor = Color.White * Math.Max(connection.Difficulty / 100.0f, 1.5f); + + if (selectedLocation != currentLocation && + (connection.Locations.Contains(selectedLocation) && connection.Locations.Contains(currentLocation))) + { + crackColor = Color.Red; + } + else if (highlightedLocation != currentLocation && + (connection.Locations.Contains(highlightedLocation) && connection.Locations.Contains(currentLocation))) + { + crackColor = Color.Red * 0.5f; + } + else if (!connection.Passed) + { + crackColor *= 0.2f; + } + + for (int i = 0; i < connection.CrackSegments.Count; i++) + { + var segment = connection.CrackSegments[i]; + + Vector2 start = rectCenter + (segment[0] + offset) * scale; + Vector2 end = rectCenter + (segment[1] + offset) * scale; + + if (!rect.Contains(start) && !rect.Contains(end)) + { + continue; + } + else + { + Vector2? intersection = MathUtils.GetLineRectangleIntersection(start, end, new Rectangle(rect.X, rect.Y + rect.Height, rect.Width, rect.Height)); + if (intersection != null) + { + if (!rect.Contains(start)) + { + start = (Vector2)intersection; + } + else + { + end = (Vector2)intersection; + } + } + } + + float dist = Vector2.Distance(start, end); + + int width = (int)(MathHelper.Clamp(connection.Difficulty, 2.0f, 20.0f) * scale); + + spriteBatch.Draw(iceCrack, + new Rectangle((int)start.X, (int)start.Y, (int)dist + 2, width), + new Rectangle(0, 0, iceCrack.Width, 60), crackColor, MathUtils.VectorToAngle(end - start), + new Vector2(0, 30), SpriteEffects.None, 0.01f); + } + } + + rect.Inflate(8, 8); + GUI.DrawRectangle(spriteBatch, rect, Color.Black, false, 0.0f, 8); + GUI.DrawRectangle(spriteBatch, rect, Color.LightGray); + + for (int i = 0; i < locations.Count; i++) + { + Location location = locations[i]; + Vector2 pos = rectCenter + (location.MapPosition + offset) * scale; + + Rectangle drawRect = location.Type.Sprite.SourceRect; + Rectangle sourceRect = drawRect; + drawRect.X = (int)pos.X - drawRect.Width / 2; + drawRect.Y = (int)pos.Y - drawRect.Width / 2; + + if (!rect.Intersects(drawRect)) continue; + + Color color = location.Connections.Find(c => c.Locations.Contains(currentLocation)) == null ? Color.White : Color.Green; + + color *= (location.Discovered) ? 0.8f : 0.2f; + + if (location == currentLocation) color = Color.Orange; + + if (drawRect.X < rect.X) + { + sourceRect.X += rect.X - drawRect.X; + sourceRect.Width -= sourceRect.X; + drawRect.X = rect.X; + } + else if (drawRect.Right > rect.Right) + { + sourceRect.Width -= (drawRect.Right - rect.Right); + } + + if (drawRect.Y < rect.Y) + { + sourceRect.Y += rect.Y - drawRect.Y; + sourceRect.Height -= sourceRect.Y; + drawRect.Y = rect.Y; + } + else if (drawRect.Bottom > rect.Bottom) + { + sourceRect.Height -= drawRect.Bottom - rect.Bottom; + } + + drawRect.Width = sourceRect.Width; + drawRect.Height = sourceRect.Height; + + spriteBatch.Draw(location.Type.Sprite.Texture, drawRect, sourceRect, color); + } + + for (int i = 0; i < 3; i++) + { + Location location = (i == 0) ? highlightedLocation : selectedLocation; + if (i == 2) location = currentLocation; + + if (location == null) continue; + + Vector2 pos = rectCenter + (location.MapPosition + offset) * scale; + pos.X = (int)(pos.X + location.Type.Sprite.SourceRect.Width * 0.6f); + pos.Y = (int)(pos.Y - 10); + GUI.DrawString(spriteBatch, pos, location.Name, Color.White, Color.Black * 0.8f, 3); + } + + } + + public void Save(XElement element) + { + XElement mapElement = new XElement("map"); + + mapElement.Add(new XAttribute("currentlocation", CurrentLocationIndex)); + mapElement.Add(new XAttribute("seed", Seed)); + mapElement.Add(new XAttribute("size", size)); + + List discoveredLocations = new List(); + for (int i = 0; i < locations.Count; i++) + { + if (locations[i].Discovered) discoveredLocations.Add(i); + } + mapElement.Add(new XAttribute("discovered", string.Join(",", discoveredLocations))); + + List passedConnections = new List(); + for (int i = 0; i < connections.Count; i++) + { + if (connections[i].Passed) passedConnections.Add(i); + } + mapElement.Add(new XAttribute("passed", string.Join(",", passedConnections))); + + element.Add(mapElement); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/Map/Location.cs b/Barotrauma/BarotraumaClient/Source/Map/Map/Location.cs new file mode 100644 index 000000000..98f463cdc --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Map/Location.cs @@ -0,0 +1,15 @@ +using Microsoft.Xna.Framework; +using System.Collections.Generic; + +namespace Barotrauma +{ + partial class Location + { + private HireManager hireManager; + + public HireManager HireManager + { + get { return hireManager; } + } + } +} diff --git a/Barotrauma/Source/Map/MapEntity.cs b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs similarity index 65% rename from Barotrauma/Source/Map/MapEntity.cs rename to Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs index 2727c4054..3a4b59fff 100644 --- a/Barotrauma/Source/Map/MapEntity.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs @@ -12,10 +12,13 @@ using Barotrauma.Items.Components; namespace Barotrauma { - abstract class MapEntity : Entity + abstract partial class MapEntity : Entity { - public static List mapEntityList = new List(); - + protected static Vector2 selectionPos = Vector2.Zero; + protected static Vector2 selectionSize = Vector2.Zero; + + protected static Vector2 startMovingPos = Vector2.Zero; + //which entities have been selected for editing private static List selectedList = new List(); public static List SelectedList @@ -35,7 +38,7 @@ namespace Barotrauma public static GUIListBox HighlightedListBox { get { return highlightedListBox; } - } + } protected static GUIComponent editingHUD; @@ -47,33 +50,15 @@ namespace Barotrauma } } - protected static Vector2 selectionPos = Vector2.Zero; - protected static Vector2 selectionSize = Vector2.Zero; - - protected static Vector2 startMovingPos = Vector2.Zero; - - private MapEntityPrefab prefab; - - protected List linkedToID; - - //observable collection because some entities may need to be notified when the collection is modified - public ObservableCollection linkedTo; - - //protected float soundRange; - //protected float sightRange; - - //is the mouse inside the rect - protected bool isHighlighted; - //protected bool isSelected; private static bool disableSelect; public static bool DisableSelect { get { return disableSelect; } - set - { - disableSelect = value; + set + { + disableSelect = value; if (disableSelect) { startMovingPos = Vector2.Zero; @@ -82,123 +67,12 @@ namespace Barotrauma } } } - + public static bool SelectedAny { get { return selectedList.Count > 0; } } - public bool MoveWithLevel - { - get; - set; - } - - //the position and dimensions of the entity - protected Rectangle rect; - - private static bool resizing; - private int resizeDirX, resizeDirY; - - public virtual Rectangle Rect { - get { return rect; } - set { rect = value; } - } - - public Rectangle WorldRect - { - get { return Submarine == null ? rect : new Rectangle((int)(Submarine.Position.X + rect.X), (int)(Submarine.Position.Y + rect.Y), rect.Width, rect.Height); } - } - - public virtual Sprite Sprite - { - get { return null; } - } - - public virtual bool DrawBelowWater - { - get - { - return Sprite != null && Sprite.Depth > 0.5f; - } - } - - public virtual bool DrawOverWater - { - get - { - return !DrawBelowWater; - } - } - - public virtual bool DrawDamageEffect - { - get - { - return false; - } - } - - public virtual bool IsLinkable - { - get { return false; } - } - - public virtual bool SelectableInEditor - { - get { return true; } - } - - public override Vector2 Position - { - get - { - Vector2 rectPos = new Vector2( - rect.X + rect.Width / 2.0f, - rect.Y - rect.Height / 2.0f); - - //if (MoveWithLevel) rectPos += Level.Loaded.Position; - return rectPos; - } - } - - public override Vector2 SimPosition - { - get - { - return ConvertUnits.ToSimUnits(Position); - } - } - - public float SoundRange - { - get - { - if (aiTarget == null) return 0.0f; - return aiTarget.SoundRange; - } - set - { - if (aiTarget == null) return; - aiTarget.SoundRange = value; - } - } - - public float SightRange - { - get - { - if (aiTarget == null) return 0.0f; - return aiTarget.SightRange; - } - set { aiTarget.SightRange = value; } - } - - public bool IsHighlighted { - get { return isHighlighted; } - set { isHighlighted = value; } - } - public bool IsSelected { get { return selectedList.Contains(this); } @@ -213,180 +87,10 @@ namespace Barotrauma get { return prefab != null && prefab.ResizeVertical; } } - public virtual string Name - { - get { return ""; } - } + public virtual void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) { } - public MapEntity(MapEntityPrefab prefab, Submarine submarine) : base(submarine) - { - this.prefab = prefab; - } + public virtual void DrawDamage(SpriteBatch spriteBatch, Effect damageEffect) { } - public virtual void Move(Vector2 amount) - { - rect.X += (int)amount.X; - rect.Y += (int)amount.Y; - } - - public virtual bool IsMouseOn(Vector2 position) - { - return (Submarine.RectContains(WorldRect, position)); - } - - public virtual MapEntity Clone() - { - throw new NotImplementedException(); - } - - public static List Clone(List entitiesToClone) - { - List clones = new List(); - foreach (MapEntity e in entitiesToClone) - { - Debug.Assert(e != null); - clones.Add(e.Clone()); - Debug.Assert(clones.Last() != null); - } - - Debug.Assert(clones.Count == entitiesToClone.Count); - - //clone links between the entities - for (int i = 0; i < clones.Count; i++) - { - if (entitiesToClone[i].linkedTo == null) continue; - foreach (MapEntity linked in entitiesToClone[i].linkedTo) - { - if (!entitiesToClone.Contains(linked)) continue; - - clones[i].linkedTo.Add(clones[entitiesToClone.IndexOf(linked)]); - } - } - - //connect clone wires to the clone items - for (int i = 0; i < clones.Count; i++) - { - var cloneItem = clones[i] as Item; - if (cloneItem == null) continue; - - var cloneWire = cloneItem.GetComponent(); - if (cloneWire == null) continue; - - var originalWire = ((Item)entitiesToClone[i]).GetComponent(); - - cloneWire.SetNodes(originalWire.GetNodes()); - - for (int n = 0; n < 2; n++) - { - if (originalWire.Connections[n] == null) continue; - - var connectedItem = originalWire.Connections[n].Item; - if (connectedItem == null) continue; - - //index of the item the wire is connected to - int itemIndex = entitiesToClone.IndexOf(connectedItem); - //index of the connection in the connectionpanel of the target item - int connectionIndex = connectedItem.Connections.IndexOf(originalWire.Connections[n]); - - (clones[itemIndex] as Item).GetComponent().Connections[connectionIndex].TryAddLink(cloneWire); - cloneWire.Connect((clones[itemIndex] as Item).Connections[connectionIndex], false); - - } - } - - return clones; - } - - protected void InsertToList() - { - int i = 0; - - if (Sprite==null) - { - mapEntityList.Add(this); - return; - } - - while (i - /// Remove the entity from the entity list without removing links to other entities - /// - public virtual void ShallowRemove() - { - base.Remove(); - - mapEntityList.Remove(this); - - if (aiTarget != null) aiTarget.Remove(); - } - - public override void Remove() - { - base.Remove(); - - mapEntityList.Remove(this); - - if (selectedList.Contains(this)) - { - selectedList = selectedList.FindAll(e => e != this); - } - - if (aiTarget != null) aiTarget.Remove(); - - if (linkedTo != null) - { - for (int i = linkedTo.Count - 1; i >= 0; i-- ) - { - linkedTo[i].RemoveLinked(this); - } - linkedTo.Clear(); - } - } - - /// - /// Call Update() on every object in Entity.list - /// - public static void UpdateAll(Camera cam, float deltaTime) - { - foreach (Hull hull in Hull.hullList) - { - hull.Update(cam, deltaTime); - } - - foreach (Gap gap in Gap.GapList) - { - gap.Update(cam, deltaTime); - } - - foreach (Item item in Item.ItemList) - { - item.Update(cam, deltaTime); - } - - Spawner?.Update(); - } - - public virtual void Update(Camera cam, float deltaTime) { } /// /// Update the selection logic in submarine editor @@ -412,14 +116,14 @@ namespace Barotrauma if (GUIComponent.MouseOn != null || !PlayerInput.MouseInsideWindow) { - if (highlightedListBox == null || + if (highlightedListBox == null || (GUIComponent.MouseOn != highlightedListBox && !highlightedListBox.IsParentOf(GUIComponent.MouseOn))) { UpdateHighlightedListBox(null); return; } } - + if (MapEntityPrefab.Selected != null) { selectionPos = Vector2.Zero; @@ -465,7 +169,7 @@ namespace Barotrauma { clone.Move(moveAmount); clone.Submarine = Submarine.MainSub; - } + } } } @@ -489,7 +193,7 @@ namespace Barotrauma if (e.IsMouseOn(position)) { int i = 0; - while (i < highlightedEntities.Count && + while (i < highlightedEntities.Count && e.Sprite != null && (highlightedEntities[i].Sprite == null || highlightedEntities[i].Sprite.Depth < e.Sprite.Depth)) { @@ -498,7 +202,7 @@ namespace Barotrauma highlightedEntities.Insert(i, e); - if (i == 0) highLightedEntity = e; + if (i == 0) highLightedEntity = e; } } @@ -532,7 +236,7 @@ namespace Barotrauma if (highLightedEntity != null) highLightedEntity.isHighlighted = true; } - + //started moving selected entities if (startMovingPos != Vector2.Zero) { @@ -558,9 +262,9 @@ namespace Barotrauma } } - startMovingPos = Vector2.Zero; + startMovingPos = Vector2.Zero; } - + } //started dragging a "selection rectangle" else if (selectionPos != Vector2.Zero) @@ -614,7 +318,7 @@ namespace Barotrauma } } } - + selectionPos = Vector2.Zero; selectionSize = Vector2.Zero; } @@ -623,7 +327,7 @@ namespace Barotrauma else { if (PlayerInput.LeftButtonHeld() && - PlayerInput.KeyUp(Keys.Space) && + PlayerInput.KeyUp(Keys.Space) && (highlightedListBox == null || (GUIComponent.MouseOn != highlightedListBox && !highlightedListBox.IsParentOf(GUIComponent.MouseOn)))) { //if clicking a selected entity, start moving it @@ -634,7 +338,7 @@ namespace Barotrauma selectionPos = position; } - } + } } private static void UpdateHighlightedListBox(List highlightedEntities) @@ -653,9 +357,9 @@ namespace Barotrauma highlightedList = highlightedEntities; highlightedListBox = new GUIListBox( - new Rectangle((int)PlayerInput.MousePosition.X+15, (int)PlayerInput.MousePosition.Y+15, 150, highlightedEntities.Count * 18 + 5), + new Rectangle((int)PlayerInput.MousePosition.X + 15, (int)PlayerInput.MousePosition.Y + 15, 150, highlightedEntities.Count * 18 + 5), null, Alignment.TopLeft, "GUIToolTip", null, false); - + foreach (MapEntity entity in highlightedEntities) { var textBlock = new GUITextBlock( @@ -664,7 +368,7 @@ namespace Barotrauma textBlock.UserData = entity; } - + highlightedListBox.OnSelected = (GUIComponent component, object obj) => { MapEntity entity = obj as MapEntity; @@ -675,7 +379,7 @@ namespace Barotrauma if (selectedList.Contains(entity)) selectedList.Remove(entity); else - selectedList.Add(entity); + selectedList.Add(entity); } else { @@ -706,24 +410,24 @@ namespace Barotrauma if (moveAmount != Vector2.Zero) { foreach (MapEntity e in selectedList) - GUI.DrawRectangle(spriteBatch, - new Vector2(e.WorldRect.X, -e.WorldRect.Y) + moveAmount, - new Vector2(e.rect.Width, e.rect.Height), - Color.DarkRed,false,0,(int)Math.Max(1.5f/GameScreen.Selected.Cam.Zoom,1.0f)); - + GUI.DrawRectangle(spriteBatch, + new Vector2(e.WorldRect.X, -e.WorldRect.Y) + moveAmount, + new Vector2(e.rect.Width, e.rect.Height), + Color.DarkRed, false, 0, (int)Math.Max(1.5f / GameScreen.Selected.Cam.Zoom, 1.0f)); + //stop dragging the "selection rectangle" selectionPos = Vector2.Zero; } } if (selectionPos != null && selectionPos != Vector2.Zero) - { - GUI.DrawRectangle(spriteBatch, new Vector2(selectionPos.X, -selectionPos.Y), selectionSize, Color.DarkRed,false,0,(int)Math.Max(1.5f / GameScreen.Selected.Cam.Zoom, 1.0f)); + { + GUI.DrawRectangle(spriteBatch, new Vector2(selectionPos.X, -selectionPos.Y), selectionSize, Color.DarkRed, false, 0, (int)Math.Max(1.5f / GameScreen.Selected.Cam.Zoom, 1.0f)); } } public static void UpdateEditor(Camera cam) { - if (highlightedListBox != null) highlightedListBox.Update((float)Timing.Step); + if (highlightedListBox != null) highlightedListBox.Update((float)Timing.Step); if (selectedList.Count == 1) { @@ -782,7 +486,7 @@ namespace Barotrauma selectedList.Add(entity); } - + /// /// copies a list of entities to the "clipboard" (copiedList) /// @@ -800,20 +504,6 @@ namespace Barotrauma newEntities.ForEach(e => e.ShallowRemove()); } - public virtual void FlipX() - { - if (Submarine == null) - { - DebugConsole.ThrowError("Couldn't flip MapEntity \""+Name+"\", submarine==null"); - return; - } - - Vector2 relative = WorldPosition - Submarine.WorldPosition; - relative.Y = 0.0f; - - Move(-relative * 2.0f); - } - public virtual void AddToGUIUpdateList() { if (editingHUD != null && editingHUD.UserData == this) editingHUD.AddToGUIUpdateList(); @@ -821,7 +511,7 @@ namespace Barotrauma public virtual void UpdateEditing(Camera cam) { } - public virtual void DrawEditing(SpriteBatch spriteBatch, Camera cam) {} + public virtual void DrawEditing(SpriteBatch spriteBatch, Camera cam) { } private void UpdateResizing(Camera cam) { @@ -902,10 +592,10 @@ namespace Barotrauma for (int x = startX; x < 2; x += 2) { for (int y = StartY; y < 2; y += 2) - { + { Vector2 handlePos = cam.WorldToScreen(Position + new Vector2(x * (rect.Width * 0.5f + 5), y * (rect.Height * 0.5f + 5))); - bool highlighted = Vector2.Distance(PlayerInput.MousePosition, handlePos)<5.0f; + bool highlighted = Vector2.Distance(PlayerInput.MousePosition, handlePos) < 5.0f; GUI.DrawRectangle(spriteBatch, handlePos - new Vector2(3.0f, 3.0f), @@ -916,7 +606,7 @@ namespace Barotrauma } } } - + /// /// Find entities whose rect intersects with the "selection rect" /// @@ -925,7 +615,7 @@ namespace Barotrauma List foundEntities = new List(); Rectangle selectionRect = Submarine.AbsRect(pos, size); - + foreach (MapEntity e in mapEntityList) { if (!e.SelectableInEditor) continue; @@ -943,62 +633,5 @@ namespace Barotrauma return null; } - /// - /// Update the linkedTo-lists of the entities based on the linkedToID-lists - /// Has to be done after all the entities have been loaded (an entity can't - /// be linked to some other entity that hasn't been loaded yet) - /// - public static void MapLoaded(Submarine sub) - { - foreach (MapEntity e in mapEntityList) - { - if (e.Submarine != sub) continue; - if (e.linkedToID == null) continue; - if (e.linkedToID.Count == 0) continue; - - e.linkedTo.Clear(); - - foreach (ushort i in e.linkedToID) - { - MapEntity linked = FindEntityByID(i) as MapEntity; - - if (linked != null) e.linkedTo.Add(linked); - } - } - - List linkedSubs = new List(); - - for (int i = 0; i convexHulls; + + private void GenerateConvexHull() + { + // If not null and not empty , remove the hulls from the system + if (convexHulls != null && convexHulls.Any()) + convexHulls.ForEach(x => x.Remove()); + + // list all of hulls for this structure + convexHulls = new List(); + + var mergedSections = new List(); + foreach (var section in sections) + { + if (mergedSections.Count > 5) + { + mergedSections.Add(section); + GenerateMergedHull(mergedSections); + continue; + } + + // if there is a gap and we have sections to merge, do it. + if (section.gap != null) + { + GenerateMergedHull(mergedSections); + } + else + { + mergedSections.Add(section); + } + } + + // take care of any leftover pieces + if (mergedSections.Count > 0) + { + GenerateMergedHull(mergedSections); + } + } + + private void GenerateMergedHull(List mergedSections) + { + if (!mergedSections.Any()) return; + Rectangle mergedRect = GenerateMergedRect(mergedSections); + + var h = new ConvexHull(CalculateExtremes(mergedRect), Color.Black, this); + mergedSections.ForEach(x => x.hull = h); + convexHulls.Add(h); + mergedSections.Clear(); + } + + public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) + { + if (prefab.sprite == null) return; + + Draw(spriteBatch, editing, back, null); + } + + public override void DrawDamage(SpriteBatch spriteBatch, Effect damageEffect) + { + Draw(spriteBatch, false, false, damageEffect); + } + + private void Draw(SpriteBatch spriteBatch, bool editing, bool back = true, Effect damageEffect = null) + { + if (prefab.sprite == null) return; + + Color color = (isHighlighted) ? Color.Orange : Color.White; + if (IsSelected && editing) + { + color = Color.Red; + + GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height), color); + } + + Vector2 drawOffset = Submarine == null ? Vector2.Zero : Submarine.DrawPosition; + + float depth = prefab.sprite.Depth; + depth -= (ID % 255) * 0.000001f; + + if (back && damageEffect == null) + { + if (prefab.BackgroundSprite != null) + { + prefab.BackgroundSprite.DrawTiled( + spriteBatch, + new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)), + new Vector2(rect.Width, rect.Height), + color, Point.Zero); + } + } + + SpriteEffects oldEffects = prefab.sprite.effects; + prefab.sprite.effects ^= SpriteEffects; + + if (back == prefab.sprite.Depth > 0.5f || editing) + { + for (int i = 0; i < sections.Length; i++) + { + if (damageEffect != null) + { + float newCutoff = Math.Min((sections[i].damage / prefab.MaxHealth), 0.65f); + + if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f) + { + damageEffect.Parameters["aCutoff"].SetValue(newCutoff); + damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f); + + damageEffect.CurrentTechnique.Passes[0].Apply(); + + Submarine.DamageEffectCutoff = newCutoff; + } + } + + Point textureOffset = new Point( + Math.Abs(rect.Location.X - sections[i].rect.Location.X), + Math.Abs(rect.Location.Y - sections[i].rect.Location.Y)); + + if (flippedX && isHorizontal) + { + textureOffset.X = rect.Width - textureOffset.X - sections[i].rect.Width; + } + + prefab.sprite.DrawTiled( + spriteBatch, + new Vector2(sections[i].rect.X + drawOffset.X, -(sections[i].rect.Y + drawOffset.Y)), + new Vector2(sections[i].rect.Width, sections[i].rect.Height), + color, + textureOffset, depth); + } + } + + prefab.sprite.effects = oldEffects; + } + + + public override XElement Save(XElement parentElement) + { + XElement element = new XElement("Structure"); + + element.Add(new XAttribute("name", prefab.Name), + new XAttribute("ID", ID), + new XAttribute("rect", + (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + + (int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," + + rect.Width + "," + rect.Height)); + + for (int i = 0; i < sections.Length; i++) + { + if (sections[i].damage == 0.0f) continue; + + var sectionElement = + new XElement("section", + new XAttribute("i", i), + new XAttribute("damage", sections[i].damage)); + + if (sections[i].gap != null) + { + sectionElement.Add(new XAttribute("gap", sections[i].gap.ID)); + } + + element.Add(sectionElement); + } + + parentElement.Add(element); + + return element; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/StructurePrefab.cs b/Barotrauma/BarotraumaClient/Source/Map/StructurePrefab.cs new file mode 100644 index 000000000..61af7e934 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/StructurePrefab.cs @@ -0,0 +1,44 @@ +using System; +using System.Xml.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; + +namespace Barotrauma +{ + partial class StructurePrefab : MapEntityPrefab + { + public override void DrawPlacing(SpriteBatch spriteBatch, Camera cam) + { + Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub); + //Vector2 placeSize = size; + + Rectangle newRect = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y); + + + if (placePosition == Vector2.Zero) + { + if (PlayerInput.LeftButtonHeld()) + placePosition = Submarine.MouseToWorldGrid(cam, Submarine.MainSub); + + newRect.X = (int)position.X; + newRect.Y = (int)position.Y; + + //sprite.Draw(spriteBatch, new Vector2(position.X, -position.Y), placeSize, Color.White); + } + else + { + Vector2 placeSize = size; + if (resizeHorizontal) placeSize.X = position.X - placePosition.X; + if (resizeVertical) placeSize.Y = placePosition.Y - position.Y; + + newRect = Submarine.AbsRect(placePosition, placeSize); + } + + sprite.DrawTiled(spriteBatch, new Vector2(newRect.X, -newRect.Y), new Vector2(newRect.Width, newRect.Height), Color.White); + + GUI.DrawRectangle(spriteBatch, new Rectangle(newRect.X - GameMain.GraphicsWidth, -newRect.Y, newRect.Width + GameMain.GraphicsWidth * 2, newRect.Height), Color.White); + GUI.DrawRectangle(spriteBatch, new Rectangle(newRect.X, -newRect.Y - GameMain.GraphicsHeight, newRect.Width, newRect.Height + GameMain.GraphicsHeight * 2), Color.White); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs b/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs new file mode 100644 index 000000000..a16c7fa8c --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs @@ -0,0 +1,228 @@ +using Barotrauma.Networking; +using FarseerPhysics; +using FarseerPhysics.Common; +using FarseerPhysics.Dynamics; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; +using Voronoi2; + +namespace Barotrauma +{ + partial class Submarine : Entity, IServerSerializable + { + public static void Draw(SpriteBatch spriteBatch, bool editing = false) + { + var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList; + + foreach (MapEntity e in entitiesToRender) + { + e.Draw(spriteBatch, editing); + } + } + + public static void DrawFront(SpriteBatch spriteBatch, bool editing = false, Predicate predicate = null) + { + var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList; + + foreach (MapEntity e in entitiesToRender) + { + if (!e.DrawOverWater) continue; + + if (predicate != null) + { + if (!predicate(e)) continue; + } + + e.Draw(spriteBatch, editing, false); + } + + if (GameMain.DebugDraw) + { + foreach (Submarine sub in Submarine.Loaded) + { + Rectangle worldBorders = sub.Borders; + worldBorders.Location += sub.WorldPosition.ToPoint(); + worldBorders.Y = -worldBorders.Y; + + GUI.DrawRectangle(spriteBatch, worldBorders, Color.White, false, 0, 5); + + if (sub.subBody.MemPos.Count < 2) continue; + + Vector2 prevPos = ConvertUnits.ToDisplayUnits(sub.subBody.MemPos[0].Position); + prevPos.Y = -prevPos.Y; + + for (int i = 1; i < sub.subBody.MemPos.Count; i++) + { + Vector2 currPos = ConvertUnits.ToDisplayUnits(sub.subBody.MemPos[i].Position); + currPos.Y = -currPos.Y; + + GUI.DrawRectangle(spriteBatch, new Rectangle((int)currPos.X - 10, (int)currPos.Y - 10, 20, 20), Color.Blue * 0.6f, true, 0.01f); + GUI.DrawLine(spriteBatch, prevPos, currPos, Color.Cyan * 0.5f, 0, 5); + + prevPos = currPos; + } + } + } + } + + public static float DamageEffectCutoff; + + public static void DrawDamageable(SpriteBatch spriteBatch, Effect damageEffect, bool editing = false) + { + var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList; + + foreach (MapEntity e in entitiesToRender) + { + if (e.DrawDamageEffect) + e.DrawDamage(spriteBatch, damageEffect); + } + if (damageEffect != null) + { + damageEffect.Parameters["aCutoff"].SetValue(0.0f); + damageEffect.Parameters["cCutoff"].SetValue(0.0f); + + DamageEffectCutoff = 0.0f; + } + } + + public static void DrawBack(SpriteBatch spriteBatch, bool editing = false, Predicate predicate = null) + { + var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList; + + foreach (MapEntity e in entitiesToRender) + { + if (!e.DrawBelowWater) continue; + + if (predicate != null) + { + if (!predicate(e)) continue; + } + + e.Draw(spriteBatch, editing, true); + } + } + + public bool Save() + { + return SaveAs(filePath); + } + + public bool SaveAs(string filePath) + { + name = System.IO.Path.GetFileNameWithoutExtension(filePath); + + XDocument doc = new XDocument(new XElement("Submarine")); + SaveToXElement(doc.Root); + + hash = new Md5Hash(doc); + doc.Root.Add(new XAttribute("md5hash", hash.Hash)); + + try + { + SaveUtil.CompressStringToFile(filePath, doc.ToString()); + } + catch (Exception e) + { + DebugConsole.ThrowError("Saving submarine \"" + filePath + "\" failed!", e); + return false; + } + + return true; + } + + public void SaveToXElement(XElement element) + { + element.Add(new XAttribute("name", name)); + element.Add(new XAttribute("description", Description == null ? "" : Description)); + + element.Add(new XAttribute("tags", tags.ToString())); + + foreach (MapEntity e in MapEntity.mapEntityList) + { + if (e.MoveWithLevel || e.Submarine != this) continue; + e.Save(element); + } + } + + public static bool SaveCurrent(string filePath) + { + if (Submarine.MainSub == null) + { + Submarine.MainSub = new Submarine(filePath); + // return; + } + + Submarine.MainSub.filePath = filePath; + + return Submarine.MainSub.SaveAs(filePath); + } + + public void CheckForErrors() + { + List errorMsgs = new List(); + + if (!Hull.hullList.Any()) + { + errorMsgs.Add("No hulls found in the submarine. Hulls determine the \"borders\" of an individual room and are required for water and air distribution to work correctly."); + } + + foreach (Item item in Item.ItemList) + { + if (item.GetComponent() == null) continue; + + if (!item.linkedTo.Any()) + { + errorMsgs.Add("The submarine contains vents which haven't been linked to an oxygen generator. Select a vent and click an oxygen generator while holding space to link them."); + break; + } + } + + if (WayPoint.WayPointList.Find(wp => !wp.MoveWithLevel && wp.SpawnType == SpawnType.Path) == null) + { + errorMsgs.Add("No waypoints found in the submarine. AI controlled crew members won't be able to navigate without waypoints."); + } + + if (WayPoint.WayPointList.Find(wp => wp.SpawnType == SpawnType.Cargo) == null) + { + errorMsgs.Add("The submarine doesn't have spawnpoints for cargo (which are used for determining where to place bought items). " + + "To fix this, create a new spawnpoint and change its \"spawn type\" parameter to \"cargo\"."); + } + + if (errorMsgs.Any()) + { + new GUIMessageBox("Warning", string.Join("\n\n", errorMsgs), 400, 0); + } + + foreach (MapEntity e in MapEntity.mapEntityList) + { + if (Vector2.Distance(e.Position, HiddenSubPosition) > 20000) + { + var msgBox = new GUIMessageBox( + "Warning", + "One or more structures have been placed very far from the submarine. Show the structures?", + new string[] { "Yes", "No" }); + + msgBox.Buttons[0].OnClicked += (btn, obj) => + { + GameMain.EditMapScreen.Cam.Position = e.WorldPosition; + return true; + }; + msgBox.Buttons[0].OnClicked += msgBox.Close; + msgBox.Buttons[1].OnClicked += msgBox.Close; + + break; + + } + } + } + + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Map/WayPoint.cs b/Barotrauma/BarotraumaClient/Source/Map/WayPoint.cs new file mode 100644 index 000000000..03a84a51b --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Map/WayPoint.cs @@ -0,0 +1,249 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using FarseerPhysics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +//using Microsoft.Xna.Framework.Input; +using System.Collections.ObjectModel; +using Barotrauma.Items.Components; +using FarseerPhysics.Dynamics; + +namespace Barotrauma +{ + partial class WayPoint : MapEntity + { + private static Texture2D iconTexture; + private const int IconSize = 32; + private static int[] iconIndices = { 3, 0, 1, 2 }; + + public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) + { + if (!editing && !GameMain.DebugDraw) return; + + if (IsHidden()) return; + + //Rectangle drawRect = + // Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height); + + Vector2 drawPos = Position; + if (Submarine != null) drawPos += Submarine.DrawPosition; + drawPos.Y = -drawPos.Y; + + Color clr = currentHull == null ? Color.Blue : Color.White; + if (IsSelected) clr = Color.Red; + if (isHighlighted) clr = Color.DarkRed; + + int iconX = iconIndices[(int)spawnType] * IconSize % iconTexture.Width; + int iconY = (int)(Math.Floor(iconIndices[(int)spawnType] * IconSize / (float)iconTexture.Width)) * IconSize; + + int iconSize = ConnectedGap == null && Ladders == null ? IconSize : (int)(IconSize * 1.5f); + + spriteBatch.Draw(iconTexture, + new Rectangle((int)(drawPos.X - iconSize / 2), (int)(drawPos.Y - iconSize / 2), iconSize, iconSize), + new Rectangle(iconX, iconY, IconSize, IconSize), clr); + + //GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), clr, true); + + //GUI.SmallFont.DrawString(spriteBatch, Position.ToString(), new Vector2(Position.X, -Position.Y), Color.White); + + foreach (MapEntity e in linkedTo) + { + GUI.DrawLine(spriteBatch, + drawPos, + new Vector2(e.DrawPosition.X, -e.DrawPosition.Y), + Color.Green); + } + } + + private bool IsHidden() + { + if (spawnType == SpawnType.Path) + { + return (!GameMain.DebugDraw && !ShowWayPoints); + } + else + { + return (!GameMain.DebugDraw && !ShowSpawnPoints); + } + } + + public override void UpdateEditing(Camera cam) + { + if (editingHUD == null || editingHUD.UserData != this) + { + editingHUD = CreateEditingHUD(); + } + + editingHUD.Update((float)Timing.Step); + + if (PlayerInput.LeftButtonClicked()) + { + Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition); + + foreach (MapEntity e in mapEntityList) + { + if (e.GetType() != typeof(WayPoint)) continue; + if (e == this) continue; + + if (!Submarine.RectContains(e.Rect, position)) continue; + + linkedTo.Add(e); + e.linkedTo.Add(this); + } + } + } + + public override void DrawEditing(SpriteBatch spriteBatch, Camera cam) + { + if (editingHUD != null) editingHUD.Draw(spriteBatch); + } + + private bool ChangeSpawnType(GUIButton button, object obj) + { + GUITextBlock spawnTypeText = button.Parent as GUITextBlock; + + spawnType += (int)button.UserData; + + if (spawnType > SpawnType.Cargo) spawnType = SpawnType.Human; + if (spawnType < SpawnType.Human) spawnType = SpawnType.Cargo; + + spawnTypeText.Text = spawnType.ToString(); + + return true; + } + + private bool EnterIDCardTags(GUITextBox textBox, string text) + { + IdCardTags = text.Split(','); + textBox.Text = text; + textBox.Color = Color.Green; + + textBox.Deselect(); + + return true; + } + + private bool EnterAssignedJob(GUITextBox textBox, string text) + { + string trimmedName = text.ToLowerInvariant().Trim(); + assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == trimmedName); + + if (assignedJob != null && trimmedName != "none") + { + textBox.Color = Color.Green; + textBox.Text = (assignedJob == null) ? "None" : assignedJob.Name; + } + + textBox.Deselect(); + + return true; + } + + private bool TextBoxChanged(GUITextBox textBox, string text) + { + textBox.Color = Color.Red; + + return true; + } + + private GUIComponent CreateEditingHUD(bool inGame = false) + { + int width = 500; + int height = spawnType == SpawnType.Path ? 100 : 140; + int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10; + + editingHUD = new GUIFrame(new Rectangle(x, y, width, height), Color.Black * 0.5f); + editingHUD.Padding = new Vector4(10, 10, 0, 0); + editingHUD.UserData = this; + + if (spawnType == SpawnType.Path) + { + new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", "", editingHUD); + new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another waypoint", "", editingHUD); + } + else + { + new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing spawnpoint", "", editingHUD); + new GUITextBlock(new Rectangle(0, 25, 100, 20), "Spawn type: ", "", editingHUD); + + var spawnTypeText = new GUITextBlock(new Rectangle(0, 25, 200, 20), spawnType.ToString(), "", Alignment.Right, Alignment.TopLeft, editingHUD); + + var button = new GUIButton(new Rectangle(-30, 0, 20, 20), "-", Alignment.Right, "", spawnTypeText); + button.UserData = -1; + button.OnClicked = ChangeSpawnType; + + button = new GUIButton(new Rectangle(0, 0, 20, 20), "+", Alignment.Right, "", spawnTypeText); + button.UserData = 1; + button.OnClicked = ChangeSpawnType; + + y = 40 + 20; + + new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card tags:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD); + GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), "", editingHUD); + propertyBox.Text = string.Join(", ", idCardTags); + propertyBox.OnEnterPressed = EnterIDCardTags; + propertyBox.OnTextChanged = TextBoxChanged; + propertyBox.ToolTip = "Characters spawning at this spawnpoint will have the specified tags added to their ID card. You can, for example, use these tags to limit access to some parts of the sub."; + + y = y + 30; + + new GUITextBlock(new Rectangle(0, y, 100, 20), "Assigned job:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD); + propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), "", editingHUD); + propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name; + propertyBox.OnEnterPressed = EnterAssignedJob; + propertyBox.OnTextChanged = TextBoxChanged; + propertyBox.ToolTip = "Only characters with the specified job will spawn at this spawnpoint."; + + } + + + + + + //GUI.Font.DrawString(spriteBatch, "Spawnpoint: " + spawnType.ToString() + " +/-", new Vector2(x, y + 40), Color.Black); + + + y = y + 30; + + return editingHUD; + } + + public override XElement Save(XElement parentElement) + { + if (MoveWithLevel) return null; + XElement element = new XElement("WayPoint"); + + element.Add(new XAttribute("ID", ID), + new XAttribute("x", (int)(rect.X - Submarine.HiddenSubPosition.X)), + new XAttribute("y", (int)(rect.Y - Submarine.HiddenSubPosition.Y)), + new XAttribute("spawn", spawnType)); + + if (idCardTags.Length > 0) + { + element.Add(new XAttribute("idcardtags", string.Join(",", idCardTags))); + } + + if (assignedJob != null) element.Add(new XAttribute("job", assignedJob.Name)); + + + if (ConnectedGap != null) element.Add(new XAttribute("gap", ConnectedGap.ID)); + if (Ladders != null) element.Add(new XAttribute("ladders", Ladders.Item.ID)); + + parentElement.Add(element); + + if (linkedTo != null) + { + int i = 0; + foreach (MapEntity e in linkedTo) + { + element.Add(new XAttribute("linkedto" + i, e.ID)); + i += 1; + } + } + + return element; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Networking/BanList.cs b/Barotrauma/BarotraumaClient/Source/Networking/BanList.cs new file mode 100644 index 000000000..fc43b01bc --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Networking/BanList.cs @@ -0,0 +1,86 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace Barotrauma.Networking +{ + partial class BanList + { + private GUIComponent banFrame; + + public GUIComponent BanFrame + { + get { return banFrame; } + } + + public GUIComponent CreateBanFrame(GUIComponent parent) + { + banFrame = new GUIListBox(new Rectangle(0, 0, 0, 0), "", parent); + + foreach (BannedPlayer bannedPlayer in bannedPlayers) + { + GUITextBlock textBlock = new GUITextBlock( + new Rectangle(0, 0, 0, 25), + bannedPlayer.IP + " (" + bannedPlayer.Name + ")", + "", + Alignment.Left, Alignment.Left, banFrame); + textBlock.Padding = new Vector4(10.0f, 10.0f, 0.0f, 0.0f); + textBlock.UserData = banFrame; + + var removeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Remove", Alignment.Right | Alignment.CenterY, "", textBlock); + removeButton.UserData = bannedPlayer; + removeButton.OnClicked = RemoveBan; + if (bannedPlayer.IP.IndexOf(".x") <= -1) + { + var rangeBanButton = new GUIButton(new Rectangle(-100, 0, 100, 20), "Ban range", Alignment.Right | Alignment.CenterY, "", textBlock); + rangeBanButton.UserData = bannedPlayer; + rangeBanButton.OnClicked = RangeBan; + } + } + + return banFrame; + } + + private bool RemoveBan(GUIButton button, object obj) + { + BannedPlayer banned = obj as BannedPlayer; + if (banned == null) return false; + + RemoveBan(banned); + + if (banFrame != null) + { + banFrame.Parent.RemoveChild(banFrame); + CreateBanFrame(banFrame.Parent); + } + + return true; + } + + private bool RangeBan(GUIButton button, object obj) + { + BannedPlayer banned = obj as BannedPlayer; + if (banned == null) return false; + + RangeBan(banned); + + if (banFrame != null) + { + banFrame.Parent.RemoveChild(banFrame); + CreateBanFrame(banFrame.Parent); + } + + return true; + } + + private bool CloseFrame(GUIButton button, object obj) + { + banFrame = null; + + return true; + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Networking/EntitySpawner.cs b/Barotrauma/BarotraumaClient/Source/Networking/EntitySpawner.cs new file mode 100644 index 000000000..62165c7a3 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Networking/EntitySpawner.cs @@ -0,0 +1,44 @@ +using Barotrauma.Networking; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Barotrauma +{ + partial class EntitySpawner : Entity, IServerSerializable + { + public void ClientRead(ServerNetObject type, Lidgren.Network.NetBuffer message, float sendingTime) + { + if (GameMain.Server != null) return; + + bool remove = message.ReadBoolean(); + + if (remove) + { + ushort entityId = message.ReadUInt16(); + + var entity = FindEntityByID(entityId); + if (entity != null) + { + entity.Remove(); + } + } + else + { + switch (message.ReadByte()) + { + case (byte)SpawnableType.Item: + Item.ReadSpawnData(message, true); + break; + case (byte)SpawnableType.Character: + Character.ReadSpawnData(message, true); + break; + default: + DebugConsole.ThrowError("Received invalid entity spawn message (unknown spawnable type)"); + break; + } + } + } + } +} diff --git a/Barotrauma/Source/Networking/FileTransfer/FileReceiver.cs b/Barotrauma/BarotraumaClient/Source/Networking/FileTransfer/FileReceiver.cs similarity index 100% rename from Barotrauma/Source/Networking/FileTransfer/FileReceiver.cs rename to Barotrauma/BarotraumaClient/Source/Networking/FileTransfer/FileReceiver.cs diff --git a/Barotrauma/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs similarity index 99% rename from Barotrauma/Source/Networking/GameClient.cs rename to Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs index 121601014..31e8be477 100644 --- a/Barotrauma/Source/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs @@ -92,7 +92,7 @@ namespace Barotrauma.Networking fileReceiver = new FileReceiver("Submarines/Downloaded"); fileReceiver.OnFinished += OnFileReceived; - characterInfo = new CharacterInfo(Character.HumanConfigFile, name); + characterInfo = new CharacterInfo(Character.HumanConfigFile, name,Gender.None,null); characterInfo.Job = null; otherClients = new List(); diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameServer.cs new file mode 100644 index 000000000..025401c59 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameServer.cs @@ -0,0 +1,217 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using RestSharp; +using Barotrauma.Items.Components; + +namespace Barotrauma.Networking +{ + partial class GameServer : NetworkMember + { + private NetStats netStats; + + private GUIButton showLogButton; + + private GUIScrollBar clientListScrollBar; + + void InitProjSpecific() + { + //---------------------------------------- + + var endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170, 20, 150, 20), "End round", Alignment.TopLeft, "", inGameHUD); + endRoundButton.OnClicked = (btn, userdata) => { EndGame(); return true; }; + + showLogButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170, 20, 150, 20), "Server Log", Alignment.TopLeft, "", inGameHUD); + showLogButton.OnClicked = (GUIButton button, object userData) => + { + if (log.LogFrame == null) + { + log.CreateLogFrame(); + } + else + { + log.LogFrame = null; + GUIComponent.KeyboardDispatcher.Subscriber = null; + } + return true; + }; + + GUIButton settingsButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170 - 170, 20, 150, 20), "Settings", Alignment.TopLeft, "", inGameHUD); + settingsButton.OnClicked = ToggleSettingsFrame; + settingsButton.UserData = "settingsButton"; + + //---------------------------------------- + } + + public override void AddToGUIUpdateList() + { + if (started) base.AddToGUIUpdateList(); + + if (settingsFrame != null) settingsFrame.AddToGUIUpdateList(); + if (log.LogFrame != null) log.LogFrame.AddToGUIUpdateList(); + } + + public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + + if (settingsFrame != null) + { + settingsFrame.Draw(spriteBatch); + } + else if (log.LogFrame != null) + { + log.LogFrame.Draw(spriteBatch); + } + + if (!ShowNetStats) return; + + GUI.Font.DrawString(spriteBatch, "Unique Events: " + entityEventManager.UniqueEvents.Count, new Vector2(10, 50), Color.White); + + int width = 200, height = 300; + int x = GameMain.GraphicsWidth - width, y = (int)(GameMain.GraphicsHeight * 0.3f); + + + if (clientListScrollBar == null) + { + clientListScrollBar = new GUIScrollBar(new Rectangle(x + width - 10, y, 10, height), "", 1.0f); + } + + + GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black * 0.7f, true); + GUI.Font.DrawString(spriteBatch, "Network statistics:", new Vector2(x + 10, y + 10), Color.White); + + GUI.SmallFont.DrawString(spriteBatch, "Connections: " + server.ConnectionsCount, new Vector2(x + 10, y + 30), Color.White); + GUI.SmallFont.DrawString(spriteBatch, "Received bytes: " + MathUtils.GetBytesReadable(server.Statistics.ReceivedBytes), new Vector2(x + 10, y + 45), Color.White); + GUI.SmallFont.DrawString(spriteBatch, "Received packets: " + server.Statistics.ReceivedPackets, new Vector2(x + 10, y + 60), Color.White); + + GUI.SmallFont.DrawString(spriteBatch, "Sent bytes: " + MathUtils.GetBytesReadable(server.Statistics.SentBytes), new Vector2(x + 10, y + 75), Color.White); + GUI.SmallFont.DrawString(spriteBatch, "Sent packets: " + server.Statistics.SentPackets, new Vector2(x + 10, y + 90), Color.White); + + int resentMessages = 0; + + int clientListHeight = connectedClients.Count * 40; + float scrollBarHeight = (height - 110) / (float)Math.Max(clientListHeight, 110); + + if (clientListScrollBar.BarSize != scrollBarHeight) + { + clientListScrollBar.BarSize = scrollBarHeight; + } + + int startY = y + 110; + y = (startY - (int)(clientListScrollBar.BarScroll * (clientListHeight - (height - 110)))); + foreach (Client c in connectedClients) + { + Color clientColor = c.Connection.AverageRoundtripTime > 0.3f ? Color.Red : Color.White; + + if (y >= startY && y < startY + height - 120) + { + GUI.SmallFont.DrawString(spriteBatch, c.name + " (" + c.Connection.RemoteEndPoint.Address.ToString() + ")", new Vector2(x + 10, y), clientColor); + GUI.SmallFont.DrawString(spriteBatch, "Ping: " + (int)(c.Connection.AverageRoundtripTime * 1000.0f) + " ms", new Vector2(x + 20, y + 10), clientColor); + } + if (y + 25 >= startY && y < startY + height - 130) GUI.SmallFont.DrawString(spriteBatch, "Resent messages: " + c.Connection.Statistics.ResentMessages, new Vector2(x + 20, y + 20), clientColor); + + resentMessages += (int)c.Connection.Statistics.ResentMessages; + + y += 40; + } + + clientListScrollBar.Update(1.0f / 60.0f); + clientListScrollBar.Draw(spriteBatch); + + netStats.AddValue(NetStats.NetStatType.ResentMessages, Math.Max(resentMessages, 0)); + netStats.AddValue(NetStats.NetStatType.SentBytes, server.Statistics.SentBytes); + netStats.AddValue(NetStats.NetStatType.ReceivedBytes, server.Statistics.ReceivedBytes); + + netStats.Draw(spriteBatch, new Rectangle(200, 0, 800, 200), this); + } + + + private void UpdateFileTransferIndicator(Client client) + { + var transfers = fileSender.ActiveTransfers.FindAll(t => t.Connection == client.Connection); + + var clientNameBox = GameMain.NetLobbyScreen.PlayerList.FindChild(client.name); + + var clientInfo = clientNameBox.FindChild("filetransfer"); + if (clientInfo == null) + { + clientNameBox.ClearChildren(); + clientInfo = new GUIFrame(new Rectangle(0, 0, 180, 0), Color.Transparent, Alignment.TopRight, null, clientNameBox); + clientInfo.UserData = "filetransfer"; + } + else if (transfers.Count == 0) + { + clientInfo.Parent.RemoveChild(clientInfo); + } + + clientInfo.ClearChildren(); + + var progressBar = new GUIProgressBar(new Rectangle(0, 4, 160, clientInfo.Rect.Height - 8), Color.Green, "", 0.0f, Alignment.Left, clientInfo); + progressBar.IsHorizontal = true; + progressBar.ProgressGetter = () => { return transfers.Sum(t => t.Progress) / transfers.Count; }; + + var textBlock = new GUITextBlock(new Rectangle(0, 2, 160, 0), "", "", Alignment.TopLeft, Alignment.Left | Alignment.CenterY, clientInfo, true, GUI.SmallFont); + textBlock.TextGetter = () => + { return MathUtils.GetBytesReadable(transfers.Sum(t => t.SentOffset)) + " / " + MathUtils.GetBytesReadable(transfers.Sum(t => t.Data.Length)); }; + + var cancelButton = new GUIButton(new Rectangle(-5, 0, 14, 0), "X", Alignment.Right, "", clientInfo); + cancelButton.OnClicked = (GUIButton button, object userdata) => + { + transfers.ForEach(t => fileSender.CancelTransfer(t)); + return true; + }; + } + + public override bool SelectCrewCharacter(Character character, GUIComponent crewFrame) + { + if (character == null) return false; + + var characterFrame = crewFrame.FindChild("selectedcharacter"); + if (character != myCharacter) + { + var banButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Ban", Alignment.BottomRight, "", characterFrame); + banButton.UserData = character.Name; + banButton.OnClicked += GameMain.NetLobbyScreen.BanPlayer; + + var rangebanButton = new GUIButton(new Rectangle(0, -25, 100, 20), "Ban range", Alignment.BottomRight, "", characterFrame); + rangebanButton.UserData = character.Name; + rangebanButton.OnClicked += GameMain.NetLobbyScreen.BanPlayerRange; + + var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.BottomLeft, "", characterFrame); + kickButton.UserData = character.Name; + kickButton.OnClicked += GameMain.NetLobbyScreen.KickPlayer; + } + + return true; + } + + private GUIMessageBox upnpBox; + void InitUPnP() + { + server.UPnP.ForwardPort(config.Port, "barotrauma"); + + upnpBox = new GUIMessageBox("Please wait...", "Attempting UPnP port forwarding", new string[] { "Cancel" }); + upnpBox.Buttons[0].OnClicked = upnpBox.Close; + } + + bool DiscoveringUPnP() + { + return server.UPnP.Status == UPnPStatus.Discovering && GUIMessageBox.VisibleBox == upnpBox; + } + + void FinishUPnP() + { + upnpBox.Close(null, null); + } + + public bool StartGameClicked(GUIButton button, object obj) + { + return StartGame(); + } + } +} diff --git a/Barotrauma/Source/Networking/GameServerSettings.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameServerSettings.cs similarity index 69% rename from Barotrauma/Source/Networking/GameServerSettings.cs rename to Barotrauma/BarotraumaClient/Source/Networking/GameServerSettings.cs index 375b337ca..e6bab34d4 100644 --- a/Barotrauma/Source/Networking/GameServerSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameServerSettings.cs @@ -9,294 +9,12 @@ using System.Xml.Linq; namespace Barotrauma.Networking { - enum SelectionMode - { - Manual = 0, Random = 1, Vote = 2 - } - - enum YesNoMaybe - { - No = 0, Maybe = 1, Yes = 2 - } - partial class GameServer : NetworkMember, IPropertyObject { - private class SavedClientPermission - { - public readonly string IP; - public readonly string Name; - - public ClientPermissions Permissions; - - public SavedClientPermission(string name, string ip, ClientPermissions permissions) - { - this.Name = name; - this.IP = ip; - - this.Permissions = permissions; - } - } - - public const string SettingsFile = "serversettings.xml"; - public static readonly string ClientPermissionsFile = "Data" + Path.DirectorySeparatorChar + "clientpermissions.txt"; - - public Dictionary ObjectProperties - { - get; - private set; - } - - public Dictionary extraCargo; - - public bool ShowNetStats; - - private TimeSpan refreshMasterInterval = new TimeSpan(0, 0, 30); - private TimeSpan sparseUpdateInterval = new TimeSpan(0, 0, 0, 3); - - private SelectionMode subSelectionMode, modeSelectionMode; - - private bool registeredToMaster; - - private WhiteList whitelist; - private BanList banList; - - private string password; - - private string adminAuthPass = ""; - public string AdminAuthPass - { - set - { - DebugConsole.NewMessage("Admin auth pass changed!",Color.Yellow); - adminAuthPass = ""; - if (value.Length > 0) - { - adminAuthPass = Encoding.UTF8.GetString(Lidgren.Network.NetUtility.ComputeSHAHash(Encoding.UTF8.GetBytes(value))); - } - } - } - private GUIFrame settingsFrame; private GUIFrame[] settingsTabs; private int settingsTabIndex; - public float AutoRestartTimer; - - private bool autoRestart; - - private List clientPermissions = new List(); - - [HasDefaultValue(true, true)] - public bool RandomizeSeed - { - get; - private set; - } - - - [HasDefaultValue(300.0f, true)] - public float RespawnInterval - { - get; - private set; - } - - [HasDefaultValue(180.0f, true)] - public float MaxTransportTime - { - get; - private set; - } - - [HasDefaultValue(0.2f, true)] - public float MinRespawnRatio - { - get; - private set; - } - - - [HasDefaultValue(60.0f, true)] - public float AutoRestartInterval - { - get; - private set; - } - - [HasDefaultValue(true, true)] - public bool AllowSpectating - { - get; - private set; - } - - [HasDefaultValue(true, true)] - public bool EndRoundAtLevelEnd - { - get; - private set; - } - - [HasDefaultValue(true, true)] - public bool SaveServerLogs - { - get; - private set; - } - - [HasDefaultValue(true, true)] - public bool AllowFileTransfers - { - get; - private set; - } - - [HasDefaultValue(800, true)] - private int LinesPerLogFile - { - get - { - return log.LinesPerFile; - } - set - { - log.LinesPerFile = value; - } - } - - public bool AutoRestart - { - get { return (connectedClients.Count != 0) && autoRestart; } - set - { - autoRestart = value; - - AutoRestartTimer = autoRestart ? AutoRestartInterval : 0.0f; - } - } - - public YesNoMaybe TraitorsEnabled - { - get; - set; - } - - [HasDefaultValue(true, true)] - public bool AllowRespawn - { - get; - set; - } - - public SelectionMode SubSelectionMode - { - get { return subSelectionMode; } - } - - public SelectionMode ModeSelectionMode - { - get { return modeSelectionMode; } - } - - public BanList BanList - { - get { return banList; } - } - - [HasDefaultValue(true, true)] - public bool AllowVoteKick - { - get; - private set; - } - - [HasDefaultValue(0.6f, true)] - public float EndVoteRequiredRatio - { - get; - private set; - } - - [HasDefaultValue(0.6f, true)] - public float KickVoteRequiredRatio - { - get; - private set; - } - - private void SaveSettings() - { - XDocument doc = new XDocument(new XElement("serversettings")); - - ObjectProperty.SaveProperties(this, doc.Root, true); - - doc.Root.SetAttributeValue("SubSelection", subSelectionMode.ToString()); - doc.Root.SetAttributeValue("ModeSelection", modeSelectionMode.ToString()); - - doc.Root.SetAttributeValue("TraitorsEnabled", TraitorsEnabled.ToString()); - - if (GameMain.NetLobbyScreen != null && GameMain.NetLobbyScreen.ServerMessage != null) - { - doc.Root.SetAttributeValue("ServerMessage", GameMain.NetLobbyScreen.ServerMessage.Text); - } - - XmlWriterSettings settings = new XmlWriterSettings(); - settings.Indent = true; - settings.NewLineOnAttributes = true; - - using (var writer = XmlWriter.Create(SettingsFile, settings)) - { - doc.Save(writer); - } - } - - private void LoadSettings() - { - XDocument doc = null; - if (File.Exists(SettingsFile)) - { - doc = ToolBox.TryLoadXml(SettingsFile); - } - - if (doc == null || doc.Root == null) - { - doc = new XDocument(new XElement("serversettings")); - } - - ObjectProperties = ObjectProperty.InitProperties(this, doc.Root); - - subSelectionMode = SelectionMode.Manual; - Enum.TryParse(ToolBox.GetAttributeString(doc.Root, "SubSelection", "Manual"), out subSelectionMode); - Voting.AllowSubVoting = subSelectionMode == SelectionMode.Vote; - - modeSelectionMode = SelectionMode.Manual; - Enum.TryParse(ToolBox.GetAttributeString(doc.Root, "ModeSelection", "Manual"), out modeSelectionMode); - Voting.AllowModeVoting = modeSelectionMode == SelectionMode.Vote; - - var traitorsEnabled = TraitorsEnabled; - Enum.TryParse(ToolBox.GetAttributeString(doc.Root, "TraitorsEnabled", "No"), out traitorsEnabled); - TraitorsEnabled = traitorsEnabled; - GameMain.NetLobbyScreen.SetTraitorsEnabled(traitorsEnabled); - - if (GameMain.NetLobbyScreen != null && GameMain.NetLobbyScreen.ServerMessage != null) - { - GameMain.NetLobbyScreen.ServerMessage.Text = ToolBox.GetAttributeString(doc.Root, "ServerMessage", ""); - } - - showLogButton.Visible = SaveServerLogs; - - List monsterNames = Directory.GetDirectories("Content/Characters").ToList(); - for (int i = 0; i < monsterNames.Count; i++) - { - monsterNames[i] = monsterNames[i].Replace("Content/Characters", "").Replace("/", "").Replace("\\", ""); - } - monsterEnabled = new Dictionary(); - foreach (string s in monsterNames) - { - monsterEnabled.Add(s, true); - } - extraCargo = new Dictionary(); - } private void CreateSettingsFrame() { @@ -322,7 +40,7 @@ namespace Barotrauma.Networking settingsTabs[2].Padding = Vector4.Zero; SelectSettingsTab(null, 0); - + var closeButton = new GUIButton(new Rectangle(10, 0, 100, 20), "Close", Alignment.BottomRight, "", innerFrame); closeButton.OnClicked = ToggleSettingsFrame; @@ -389,7 +107,7 @@ namespace Barotrauma.Networking return true; }; votesRequiredSlider.OnMoved(votesRequiredSlider, votesRequiredSlider.BarScroll); - + y += 35; var respawnBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Allow respawning", Alignment.Left, settingsTabs[0]); @@ -416,7 +134,7 @@ namespace Barotrauma.Networking return true; }; respawnIntervalSlider.OnMoved(respawnIntervalSlider, respawnIntervalSlider.BarScroll); - + y += 35; var minRespawnText = new GUITextBlock(new Rectangle(0, y, 200, 20), "Minimum players to respawn", "", settingsTabs[0]); @@ -546,7 +264,7 @@ namespace Barotrauma.Networking if (pf.sprite != null) { float scale = Math.Min(Math.Min(30.0f / pf.sprite.SourceRect.Width, 30.0f / pf.sprite.SourceRect.Height), 1.0f); - GUIImage img = new GUIImage(new Rectangle(-20-(int)(pf.sprite.SourceRect.Width*scale*0.5f), 12-(int)(pf.sprite.SourceRect.Height*scale*0.5f), 40, 40), pf.sprite, Alignment.Left, textBlock); + GUIImage img = new GUIImage(new Rectangle(-20 - (int)(pf.sprite.SourceRect.Width * scale * 0.5f), 12 - (int)(pf.sprite.SourceRect.Height * scale * 0.5f), 40, 40), pf.sprite, Alignment.Left, textBlock); img.Color = pf.SpriteColor; img.Scale = scale; } @@ -570,7 +288,7 @@ namespace Barotrauma.Networking } else { - extraCargo.Add(pf.Name,1); val = 1; + extraCargo.Add(pf.Name, 1); val = 1; } ((GUITextBlock)obj).Text = val.ToString(); ((GUITextBlock)obj).SetTextPos(); @@ -594,11 +312,11 @@ namespace Barotrauma.Networking ((GUITextBlock)obj).Text = val.ToString(); ((GUITextBlock)obj).SetTextPos(); } - + return true; }; } - + //-------------------------------------------------------------------------------- // server settings @@ -624,7 +342,7 @@ namespace Barotrauma.Networking startIntervalSlider.OnMoved(startIntervalSlider, startIntervalSlider.BarScroll); y += 45; - + var allowSpecBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Allow spectating", Alignment.Left, settingsTabs[1]); allowSpecBox.Selected = AllowSpectating; allowSpecBox.OnSelected = (GUITickBox) => @@ -681,7 +399,7 @@ namespace Barotrauma.Networking }; y += 40; - + var saveLogsBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Save server logs", Alignment.Left, settingsTabs[1]); saveLogsBox.Selected = SaveServerLogs; saveLogsBox.OnSelected = (GUITickBox) => @@ -704,61 +422,9 @@ namespace Barotrauma.Networking //-------------------------------------------------------------------------------- whitelist.CreateWhiteListFrame(settingsTabs[3]); - + } - public void LoadClientPermissions() - { - if (!File.Exists(ClientPermissionsFile)) return; - - string[] lines; - try - { - lines = File.ReadAllLines(ClientPermissionsFile); - } - catch (Exception e) - { - DebugConsole.ThrowError("Failed to open client permission file " + ClientPermissionsFile, e); - return; - } - - clientPermissions.Clear(); - foreach (string line in lines) - { - string[] separatedLine = line.Split('|'); - if (separatedLine.Length < 3) continue; - - string name = String.Join("|", separatedLine.Take(separatedLine.Length - 2)); - string ip = separatedLine[separatedLine.Length - 2]; - - ClientPermissions permissions = ClientPermissions.None; - if (Enum.TryParse(separatedLine.Last(), out permissions)) - { - clientPermissions.Add(new SavedClientPermission(name, ip, permissions)); - } - } - } - - public void SaveClientPermissions() - { - GameServer.Log("Saving client permissions", ServerLog.MessageType.ServerMessage); - - List lines = new List(); - - foreach (SavedClientPermission clientPermission in clientPermissions) - { - lines.Add(clientPermission.Name + "|" + clientPermission.IP+"|"+clientPermission.Permissions.ToString()); - } - - try - { - File.WriteAllLines(ClientPermissionsFile, lines); - } - catch (Exception e) - { - DebugConsole.ThrowError("Saving client permissions to " + ClientPermissionsFile + " failed", e); - } - } private bool SwitchSubSelection(GUITickBox tickBox) { @@ -784,7 +450,7 @@ namespace Barotrauma.Networking { settingsTabIndex = (int)obj; - for (int i = 0; i < settingsTabs.Length; i++ ) + for (int i = 0; i < settingsTabs.Length; i++) { settingsTabs[i].Visible = i == settingsTabIndex; } @@ -815,7 +481,7 @@ namespace Barotrauma.Networking public bool ToggleSettingsFrame(GUIButton button, object obj) { - if (settingsFrame==null) + if (settingsFrame == null) { CreateSettingsFrame(); } @@ -827,7 +493,7 @@ namespace Barotrauma.Networking return false; } - + public void ManagePlayersFrame(GUIFrame infoFrame) { GUIListBox cList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, "", infoFrame); @@ -838,7 +504,7 @@ namespace Barotrauma.Networking { GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, null, cList); frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); - frame.Color = (c.inGame && c.Character!=null && !c.Character.IsDead) ? Color.Gold * 0.2f : Color.Transparent; + frame.Color = (c.inGame && c.Character != null && !c.Character.IsDead) ? Color.Gold * 0.2f : Color.Transparent; frame.HoverColor = Color.LightGray * 0.5f; frame.SelectedColor = Color.Gold * 0.5f; diff --git a/Barotrauma/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs b/Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs similarity index 99% rename from Barotrauma/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs rename to Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs index 1153e0b1a..3f66e4cf2 100644 --- a/Barotrauma/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs @@ -190,7 +190,7 @@ namespace Barotrauma.Networking { if (GameSettings.VerboseLogging) { - DebugConsole.ThrowError("Failed to read event for entity \"" + entity.ToString() + "!", e); + DebugConsole.ThrowError("Failed to read event for entity \"" + entity.ToString() + "\"!", e); } msg.Position = msgPosition + msgLength * 8; } diff --git a/Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/NetEntityEvent.cs b/Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/NetEntityEvent.cs new file mode 100644 index 000000000..15e2c9cde --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/NetEntityEvent.cs @@ -0,0 +1,24 @@ +using Lidgren.Network; +using System; + +namespace Barotrauma.Networking +{ + class ClientEntityEvent : NetEntityEvent + { + private IClientSerializable serializable; + + public UInt16 CharacterStateID; + + public ClientEntityEvent(IClientSerializable entity, UInt16 id) + : base(entity, id) + { + serializable = entity; + } + + public void Write(NetBuffer msg) + { + msg.Write(CharacterStateID); + serializable.ClientWrite(msg, Data); + } + } +} diff --git a/Barotrauma/Source/Networking/NetStats.cs b/Barotrauma/BarotraumaClient/Source/Networking/NetStats.cs similarity index 100% rename from Barotrauma/Source/Networking/NetStats.cs rename to Barotrauma/BarotraumaClient/Source/Networking/NetStats.cs diff --git a/Barotrauma/BarotraumaClient/Source/Networking/NetworkMember.cs b/Barotrauma/BarotraumaClient/Source/Networking/NetworkMember.cs new file mode 100644 index 000000000..6ec1fede1 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Networking/NetworkMember.cs @@ -0,0 +1,165 @@ +using System; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System.Collections.Generic; +using Lidgren.Network; +using Barotrauma.Items.Components; + +namespace Barotrauma.Networking +{ + abstract partial class NetworkMember + { + protected CharacterInfo characterInfo; + + protected Character myCharacter; + + public CharacterInfo CharacterInfo + { + get { return characterInfo; } + set { characterInfo = value; } + } + + public Character Character + { + get { return myCharacter; } + set { myCharacter = value; } + } + + protected GUIFrame inGameHUD; + protected GUIListBox chatBox; + protected GUITextBox chatMsgBox; + + public GUIFrame InGameHUD + { + get { return inGameHUD; } + } + + private void InitProjSpecific() + { + inGameHUD = new GUIFrame(new Rectangle(0, 0, 0, 0), null, null); + inGameHUD.CanBeFocused = false; + + int width = (int)MathHelper.Clamp(GameMain.GraphicsWidth * 0.35f, 350, 500); + int height = (int)MathHelper.Clamp(GameMain.GraphicsHeight * 0.15f, 100, 200); + chatBox = new GUIListBox(new Rectangle( + GameMain.GraphicsWidth - 20 - width, + GameMain.GraphicsHeight - 40 - 25 - height, + width, height), + Color.White * 0.5f, "", inGameHUD); + chatBox.Padding = Vector4.Zero; + + chatMsgBox = new GUITextBox( + new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25), + Color.White * 0.5f, Color.Black, Alignment.TopLeft, Alignment.Left, "", inGameHUD); + chatMsgBox.Font = GUI.SmallFont; + chatMsgBox.MaxTextLength = ChatMessage.MaxLength; + chatMsgBox.Padding = Vector4.Zero; + chatMsgBox.OnEnterPressed = EnterChatMessage; + chatMsgBox.OnTextChanged = TypingChatMessage; + } + + public bool TypingChatMessage(GUITextBox textBox, string text) + { + string tempStr; + string command = ChatMessage.GetChatMessageCommand(text, out tempStr); + switch (command) + { + case "r": + case "radio": + textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Radio]; + break; + case "d": + case "dead": + textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Dead]; + break; + default: + textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default]; + break; + } + + return true; + } + + public bool EnterChatMessage(GUITextBox textBox, string message) + { + textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default]; + + if (string.IsNullOrWhiteSpace(message)) return false; + + if (this == GameMain.Server) + { + GameMain.Server.SendChatMessage(message, null, null); + } + else if (this == GameMain.Client) + { + GameMain.Client.SendChatMessage(message); + } + + if (textBox == chatMsgBox) textBox.Deselect(); + + return true; + } + + public virtual void AddToGUIUpdateList() + { + if (gameStarted && Screen.Selected == GameMain.GameScreen) + { + inGameHUD.AddToGUIUpdateList(); + } + } + + public virtual void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) + { + if (!gameStarted || Screen.Selected != GameMain.GameScreen) return; + + GameMain.GameSession.CrewManager.Draw(spriteBatch); + + inGameHUD.Draw(spriteBatch); + + if (EndVoteCount > 0) + { + if (GameMain.NetworkMember.myCharacter == null) + { + GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 180.0f, 40), + "Votes to end the round (y/n): " + EndVoteCount + "/" + (EndVoteMax - EndVoteCount), Color.White, null, 0, GUI.SmallFont); + } + else + { + GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 140.0f, 40), + "Votes (y/n): " + EndVoteCount + "/" + (EndVoteMax - EndVoteCount), Color.White, null, 0, GUI.SmallFont); + } + } + + if (respawnManager != null) + { + string respawnInfo = ""; + + if (respawnManager.CurrentState == RespawnManager.State.Waiting && + respawnManager.CountdownStarted) + { + respawnInfo = respawnManager.RespawnTimer <= 0.0f ? "" : "Respawn Shuttle dispatching in " + ToolBox.SecondsToReadableTime(respawnManager.RespawnTimer); + + } + else if (respawnManager.CurrentState == RespawnManager.State.Transporting) + { + respawnInfo = respawnManager.TransportTimer <= 0.0f ? "" : "Shuttle leaving in " + ToolBox.SecondsToReadableTime(respawnManager.TransportTimer); + } + + if (!string.IsNullOrEmpty(respawnInfo)) + { + GUI.DrawString(spriteBatch, + new Vector2(120.0f, 10), + respawnInfo, Color.White, null, 0, GUI.SmallFont); + } + + } + } + + public virtual bool SelectCrewCharacter(Character character, GUIComponent crewFrame) + { + return false; + } + } +} diff --git a/Barotrauma/Source/Networking/ServerLog.cs b/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs similarity index 54% rename from Barotrauma/Source/Networking/ServerLog.cs rename to Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs index 1018b9527..d461ce03a 100644 --- a/Barotrauma/Source/Networking/ServerLog.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs @@ -6,114 +6,12 @@ using System.Linq; namespace Barotrauma.Networking { - class ServerLog + partial class ServerLog { - private struct LogMessage - { - public readonly string Text; - public readonly MessageType Type; - - public LogMessage(string text, MessageType type) - { - Text = "[" + DateTime.Now.ToString() + "] " + text; - Type = type; - } - } - - public enum MessageType - { - Chat, - ItemInteraction, - Inventory, - Attack, - ServerMessage, - Error - } - - private readonly Color[] messageColor = - { - Color.LightBlue, - new Color(255, 142, 0), - new Color(238, 208, 0), - new Color(204, 74, 78), - new Color(157, 225, 160), - Color.Red - }; - - private readonly string[] messageTypeName = - { - "Chat message", - "Item interaction", - "Inventory usage", - "Attack & death", - "Server message", - "Error" - }; - - private int linesPerFile = 800; - - public const string SavePath = "ServerLogs"; - - private string serverName; - public GUIFrame LogFrame; private GUIListBox listBox; - private readonly Queue lines; - - private int unsavedLineCount; - - private string msgFilter; - private bool[] msgTypeHidden = new bool[Enum.GetValues(typeof(MessageType)).Length]; - - public int LinesPerFile - { - get { return linesPerFile; } - set { linesPerFile = Math.Max(value, 10); } - } - - public ServerLog(string serverName) - { - this.serverName = serverName; - - lines = new Queue(); - } - - public void WriteLine(string line, MessageType messageType) - { - //string logLine = "[" + DateTime.Now.ToLongTimeString() + "] " + line; - - var newText = new LogMessage(line, messageType); - - lines.Enqueue(newText); - - if (LogFrame != null) - { - AddLine(newText); - - listBox.UpdateScrollBarSize(); - } - - unsavedLineCount++; - - if (unsavedLineCount >= LinesPerFile) - { - Save(); - unsavedLineCount = 0; - } - - while (lines.Count > LinesPerFile) - { - lines.Dequeue(); - } - - while (listBox != null && listBox.children.Count > LinesPerFile) - { - listBox.RemoveChild(listBox.children[0]); - } - } - public void CreateLogFrame() { LogFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f); @@ -182,7 +80,7 @@ namespace Barotrauma.Networking float prevSize = listBox.BarSize; var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, "", Alignment.TopLeft, Alignment.TopLeft, listBox, true, GUI.SmallFont); - textBlock.Rect = new Rectangle(textBlock.Rect.X, textBlock.Rect.Y, textBlock.Rect.Width, Math.Max(13, textBlock.Rect.Height)); + textBlock.Rect = new Rectangle(textBlock.Rect.X, textBlock.Rect.Y, textBlock.Rect.Width, Math.Max(13, textBlock.Rect.Height)); textBlock.TextColor = messageColor[(int)line.Type]; textBlock.CanBeFocused = false; textBlock.UserData = line; @@ -226,37 +124,5 @@ namespace Barotrauma.Networking return true; } - public void Save() - { - if (!Directory.Exists(SavePath)) - { - try - { - Directory.CreateDirectory(SavePath); - } - catch (Exception e) - { - DebugConsole.ThrowError("Failed to create a folder for server logs", e); - return; - } - } - - string fileName = serverName+"_"+DateTime.Now.ToShortDateString()+"_"+DateTime.Now.ToShortTimeString()+".txt"; - - fileName = fileName.Replace(":", ""); - fileName = fileName.Replace("../", ""); - fileName = fileName.Replace("/", ""); - - string filePath = Path.Combine(SavePath, fileName); - - try - { - File.WriteAllLines(filePath, lines.Select(l => l.Text)); - } - catch (Exception e) - { - DebugConsole.ThrowError("Saving the server log to " + filePath + " failed", e); - } - } } } diff --git a/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs b/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs new file mode 100644 index 000000000..dcf11f2f2 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs @@ -0,0 +1,169 @@ +using Barotrauma.Networking; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Barotrauma +{ + partial class Voting + { + public bool AllowSubVoting + { + get { return allowSubVoting; } + set + { + if (value == allowSubVoting) return; + allowSubVoting = value; + GameMain.NetLobbyScreen.SubList.Enabled = value || GameMain.Server != null; + GameMain.NetLobbyScreen.InfoFrame.FindChild("subvotes").Visible = value; + + if (GameMain.Server != null) + { + UpdateVoteTexts(GameMain.Server.ConnectedClients, VoteType.Sub); + GameMain.Server.UpdateVoteStatus(); + } + else + { + GameMain.NetLobbyScreen.SubList.Deselect(); + } + } + } + public bool AllowModeVoting + { + get { return allowModeVoting; } + set + { + if (value == allowModeVoting) return; + allowModeVoting = value; + GameMain.NetLobbyScreen.ModeList.Enabled = value || GameMain.Server != null; + GameMain.NetLobbyScreen.InfoFrame.FindChild("modevotes").Visible = value; + if (GameMain.Server != null) + { + UpdateVoteTexts(GameMain.Server.ConnectedClients, VoteType.Mode); + GameMain.Server.UpdateVoteStatus(); + } + else + { + GameMain.NetLobbyScreen.ModeList.Deselect(); + } + } + } + + public void UpdateVoteTexts(List clients, VoteType voteType) + { + GUIListBox listBox = (voteType == VoteType.Sub) ? + GameMain.NetLobbyScreen.SubList : GameMain.NetLobbyScreen.ModeList; + + foreach (GUIComponent comp in listBox.children) + { + GUITextBlock voteText = comp.FindChild("votes") as GUITextBlock; + if (voteText != null) comp.RemoveChild(voteText); + } + + List> voteList = GetVoteList(voteType, clients); + foreach (Pair votable in voteList) + { + SetVoteText(listBox, votable.First, votable.Second); + } + } + + private void SetVoteText(GUIListBox listBox, object userData, int votes) + { + if (userData == null) return; + foreach (GUIComponent comp in listBox.children) + { + if (comp.UserData != userData) continue; + GUITextBlock voteText = comp.FindChild("votes") as GUITextBlock; + if (voteText == null) + { + voteText = new GUITextBlock(new Rectangle(0, 0, 30, 0), "", "", Alignment.Right, Alignment.Right, comp); + voteText.UserData = "votes"; + } + + voteText.Text = votes == 0 ? "" : votes.ToString(); + } + } + + public void ClientWrite(NetBuffer msg, VoteType voteType, object data) + { + if (GameMain.Server != null) return; + + msg.Write((byte)voteType); + + switch (voteType) + { + case VoteType.Sub: + Submarine sub = data as Submarine; + if (sub == null) return; + + msg.Write(sub.Name); + break; + case VoteType.Mode: + GameModePreset gameMode = data as GameModePreset; + if (gameMode == null) return; + + msg.Write(gameMode.Name); + break; + case VoteType.EndRound: + if (!(data is bool)) return; + + msg.Write((bool)data); + break; + case VoteType.Kick: + Client votedClient = data as Client; + if (votedClient == null) return; + + msg.Write(votedClient.ID); + break; + } + + msg.WritePadBits(); + } + + public void ClientRead(NetIncomingMessage inc) + { + if (GameMain.Server != null) return; + + AllowSubVoting = inc.ReadBoolean(); + if (allowSubVoting) + { + foreach (Submarine sub in Submarine.SavedSubmarines) + { + SetVoteText(GameMain.NetLobbyScreen.SubList, sub, 0); + } + int votableCount = inc.ReadByte(); + for (int i = 0; i < votableCount; i++) + { + int votes = inc.ReadByte(); + string subName = inc.ReadString(); + Submarine sub = Submarine.SavedSubmarines.Find(sm => sm.Name == subName); + SetVoteText(GameMain.NetLobbyScreen.SubList, sub, votes); + } + } + AllowModeVoting = inc.ReadBoolean(); + if (allowModeVoting) + { + int votableCount = inc.ReadByte(); + for (int i = 0; i < votableCount; i++) + { + int votes = inc.ReadByte(); + string modeName = inc.ReadString(); + GameModePreset mode = GameModePreset.list.Find(m => m.Name == modeName); + SetVoteText(GameMain.NetLobbyScreen.ModeList, mode, votes); + } + } + AllowEndVoting = inc.ReadBoolean(); + if (AllowEndVoting) + { + GameMain.NetworkMember.EndVoteCount = inc.ReadByte(); + GameMain.NetworkMember.EndVoteMax = inc.ReadByte(); + } + AllowVoteKick = inc.ReadBoolean(); + + inc.ReadPadBits(); + } + } +} diff --git a/Barotrauma/Source/Networking/WhiteList.cs b/Barotrauma/BarotraumaClient/Source/Networking/WhiteList.cs similarity index 50% rename from Barotrauma/Source/Networking/WhiteList.cs rename to Barotrauma/BarotraumaClient/Source/Networking/WhiteList.cs index e3a22253d..6dffa40ee 100644 --- a/Barotrauma/Source/Networking/WhiteList.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/WhiteList.cs @@ -7,124 +7,16 @@ using System.Text; namespace Barotrauma.Networking { - class WhiteListedPlayer + partial class WhiteList { - public string Name; - public string IP; - - public WhiteListedPlayer(string name,string ip) - { - Name = name; - IP = ip; - } - } - - class WhiteList - { - const string SavePath = "Data/whitelist.txt"; - - private List whitelistedPlayers; - public List WhiteListedPlayers - { - get { return whitelistedPlayers; } - } - private GUIComponent whitelistFrame; private GUITextBox nameBox; private GUITextBox ipBox; - public bool Enabled; - - public WhiteList() - { - Enabled = false; - whitelistedPlayers = new List(); - - if (File.Exists(SavePath)) - { - string[] lines; - try - { - lines = File.ReadAllLines(SavePath); - } - catch (Exception e) - { - DebugConsole.ThrowError("Failed to open whitelist in " + SavePath, e); - return; - } - - foreach (string line in lines) - { - if (line[0] == '#') - { - string lineval = line.Substring(1, line.Length - 1); - int intVal = 0; - Int32.TryParse(lineval, out intVal); - if (lineval.ToLower() == "true" || intVal != 0) - { - Enabled = true; - } - else - { - Enabled = false; - } - } - else - { - string[] separatedLine = line.Split(','); - if (separatedLine.Length < 2) continue; - - string name = String.Join(",", separatedLine.Take(separatedLine.Length - 1)); - string ip = separatedLine.Last(); - - whitelistedPlayers.Add(new WhiteListedPlayer(name, ip)); - } - } - } - } - - public void Save() - { - GameServer.Log("Saving whitelist", ServerLog.MessageType.ServerMessage); - - List lines = new List(); - - if (Enabled) - { - lines.Add("#true"); - } - else - { - lines.Add("#false"); - } - foreach (WhiteListedPlayer wlp in whitelistedPlayers) - { - lines.Add(wlp.Name + "," + wlp.IP); - } - - try - { - File.WriteAllLines(SavePath, lines); - } - catch (Exception e) - { - DebugConsole.ThrowError("Saving the whitelist to " + SavePath + " failed", e); - } - } - - public bool IsWhiteListed(string name, string ip) - { - if (!Enabled) return true; - WhiteListedPlayer wlp = whitelistedPlayers.Find(p => p.Name == name); - if (wlp == null) return false; - if (wlp.IP != ip && !string.IsNullOrWhiteSpace(wlp.IP)) return false; - return true; - } - public GUIComponent CreateWhiteListFrame(GUIComponent parent) { - if (whitelistFrame!=null) + if (whitelistFrame != null) { whitelistFrame.Parent.ClearChildren(); whitelistFrame = null; @@ -142,14 +34,14 @@ namespace Barotrauma.Networking { foreach (Client c in GameMain.Server.ConnectedClients) { - if (!IsWhiteListed(c.name,c.Connection.RemoteEndPoint.Address.ToString())) + if (!IsWhiteListed(c.name, c.Connection.RemoteEndPoint.Address.ToString())) { whitelistedPlayers.Add(new WhiteListedPlayer(c.name, c.Connection.RemoteEndPoint.Address.ToString())); if (whitelistFrame != null) CreateWhiteListFrame(whitelistFrame.Parent); } } } - + Save(); return true; }; @@ -165,7 +57,7 @@ namespace Barotrauma.Networking var addnewButton = new GUIButton(new Rectangle(0, 35, 150, 20), "Add to whitelist", Alignment.BottomLeft, "", parent); addnewButton.OnClicked = AddToWhiteList; - whitelistFrame = new GUIListBox(new Rectangle(0, 30, 0, parent.Rect.Height-110), "", parent); + whitelistFrame = new GUIListBox(new Rectangle(0, 30, 0, parent.Rect.Height - 110), "", parent); foreach (WhiteListedPlayer wlp in whitelistedPlayers) { @@ -192,12 +84,8 @@ namespace Barotrauma.Networking WhiteListedPlayer wlp = obj as WhiteListedPlayer; if (wlp == null) return false; - DebugConsole.Log("Removing " + wlp.Name + " from whitelist"); - GameServer.Log("Removing " + wlp.Name + " from whitelist", ServerLog.MessageType.ServerMessage); + RemoveFromWhiteList(wlp); - whitelistedPlayers.Remove(wlp); - Save(); - if (whitelistFrame != null) { whitelistFrame.Parent.ClearChildren(); @@ -211,8 +99,8 @@ namespace Barotrauma.Networking { if (string.IsNullOrWhiteSpace(nameBox.Text)) return false; if (whitelistedPlayers.Any(x => x.Name.ToLower() == nameBox.Text.ToLower() && x.IP == ipBox.Text)) return false; - whitelistedPlayers.Add(new WhiteListedPlayer(nameBox.Text,ipBox.Text)); - Save(); + + AddToWhiteList(nameBox.Text, ipBox.Text); if (whitelistFrame != null) { diff --git a/Barotrauma/Source/Particles/Particle.cs b/Barotrauma/BarotraumaClient/Source/Particles/Particle.cs similarity index 100% rename from Barotrauma/Source/Particles/Particle.cs rename to Barotrauma/BarotraumaClient/Source/Particles/Particle.cs diff --git a/Barotrauma/Source/Particles/ParticleEmitter.cs b/Barotrauma/BarotraumaClient/Source/Particles/ParticleEmitter.cs similarity index 100% rename from Barotrauma/Source/Particles/ParticleEmitter.cs rename to Barotrauma/BarotraumaClient/Source/Particles/ParticleEmitter.cs diff --git a/Barotrauma/Source/Particles/ParticleManager.cs b/Barotrauma/BarotraumaClient/Source/Particles/ParticleManager.cs similarity index 100% rename from Barotrauma/Source/Particles/ParticleManager.cs rename to Barotrauma/BarotraumaClient/Source/Particles/ParticleManager.cs diff --git a/Barotrauma/Source/Particles/ParticlePrefab.cs b/Barotrauma/BarotraumaClient/Source/Particles/ParticlePrefab.cs similarity index 100% rename from Barotrauma/Source/Particles/ParticlePrefab.cs rename to Barotrauma/BarotraumaClient/Source/Particles/ParticlePrefab.cs diff --git a/Barotrauma/BarotraumaClient/Source/Physics/PhysicsBody.cs b/Barotrauma/BarotraumaClient/Source/Physics/PhysicsBody.cs new file mode 100644 index 000000000..e78b244e3 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Physics/PhysicsBody.cs @@ -0,0 +1,107 @@ +using System.Xml.Linq; +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Factories; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System; + +namespace Barotrauma +{ + partial class PhysicsBody + { + private Texture2D bodyShapeTexture; + public Texture2D BodyShapeTexture + { + get { return bodyShapeTexture; } + } + + public void Draw(SpriteBatch spriteBatch, Sprite sprite, Color color, float? depth = null, float scale = 1.0f) + { + if (!Enabled) return; + + UpdateDrawPosition(); + + if (sprite == null) return; + + SpriteEffects spriteEffect = (dir == 1.0f) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + if (GameMain.DebugDraw) + { + if (!body.Awake) color = Color.Blue; + + if (targetPosition != null) + { + Vector2 pos = ConvertUnits.ToDisplayUnits((Vector2)targetPosition); + if (Submarine != null) pos += Submarine.DrawPosition; + + GUI.DrawRectangle(spriteBatch, + new Vector2(pos.X - 5, -(pos.Y + 5)), + Vector2.One * 10.0f, Color.Red, false, 0, 3); + } + + if (offsetFromTargetPos != Vector2.Zero) + { + Vector2 pos = ConvertUnits.ToDisplayUnits(body.Position); + if (Submarine != null) pos += Submarine.DrawPosition; + + GUI.DrawLine(spriteBatch, + new Vector2(pos.X, -pos.Y), + new Vector2(DrawPosition.X, -DrawPosition.Y), + Color.Cyan, 0, 5); + } + } + + sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y), color, -drawRotation, scale, spriteEffect, depth); + } + + public void DebugDraw(SpriteBatch spriteBatch, Color color) + { + if (bodyShapeTexture == null) + { + switch (BodyShape) + { + case PhysicsBody.Shape.Rectangle: + bodyShapeTexture = GUI.CreateRectangle( + (int)ConvertUnits.ToDisplayUnits(width), + (int)ConvertUnits.ToDisplayUnits(height)); + break; + + case PhysicsBody.Shape.Capsule: + bodyShapeTexture = GUI.CreateCapsule( + (int)ConvertUnits.ToDisplayUnits(radius), + (int)ConvertUnits.ToDisplayUnits(Math.Max(height, width))); + break; + case PhysicsBody.Shape.Circle: + bodyShapeTexture = GUI.CreateCircle((int)ConvertUnits.ToDisplayUnits(radius)); + break; + } + } + + float rot = -DrawRotation; + if (bodyShape == PhysicsBody.Shape.Capsule && width > height) + { + rot -= MathHelper.PiOver2; + } + + spriteBatch.Draw( + bodyShapeTexture, + new Vector2(DrawPosition.X, -DrawPosition.Y), + null, + color, + rot, + new Vector2(bodyShapeTexture.Width / 2, bodyShapeTexture.Height / 2), + 1.0f, SpriteEffects.None, 0.0f); + } + + partial void DisposeProjSpecific() + { + if (bodyShapeTexture != null) + { + bodyShapeTexture.Dispose(); + bodyShapeTexture = null; + } + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/PlayerInput.cs b/Barotrauma/BarotraumaClient/Source/PlayerInput.cs new file mode 100644 index 000000000..eb63c8b82 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/PlayerInput.cs @@ -0,0 +1,166 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace Barotrauma +{ + public static class PlayerInput + { + static MouseState mouseState, oldMouseState; + static MouseState latestMouseState; //the absolute latest state, do NOT use for player interaction + static KeyboardState keyboardState, oldKeyboardState; + + static double timeSinceClick; + + const double doubleClickDelay = 0.4; + + static bool doubleClicked; + + public static Keys selectKey = Keys.E; + + public static Vector2 MousePosition + { + get { return new Vector2(mouseState.Position.X, mouseState.Position.Y); } + } + + public static Vector2 LatestMousePosition + { + get { return new Vector2(latestMouseState.Position.X, latestMouseState.Position.Y); } + } + + //public static MouseState GetMouseState + //{ + // get { return mouseState; } + //} + //public static MouseState GetOldMouseState + //{ + // get { return oldMouseState; } + //} + + public static bool MouseInsideWindow + { + get { return new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight).Contains(MousePosition); } + } + + public static Vector2 MouseSpeed + { + get + { + return GameMain.WindowActive ? MousePosition - new Vector2(oldMouseState.X, oldMouseState.Y) : Vector2.Zero; + } + } + + public static KeyboardState GetKeyboardState + { + get { return keyboardState; } + } + + public static KeyboardState GetOldKeyboardState + { + get { return oldKeyboardState; } + } + + public static int ScrollWheelSpeed + { + get { return GameMain.WindowActive ? mouseState.ScrollWheelValue - oldMouseState.ScrollWheelValue : 0; } + + } + + public static bool LeftButtonHeld() + { + return GameMain.WindowActive && mouseState.LeftButton == ButtonState.Pressed; + } + + public static bool LeftButtonDown() + { + return GameMain.WindowActive && + oldMouseState.LeftButton == ButtonState.Released && + mouseState.LeftButton == ButtonState.Pressed; + } + + public static bool LeftButtonReleased() + { + return GameMain.WindowActive && mouseState.LeftButton == ButtonState.Released; + } + + + public static bool LeftButtonClicked() + { + return (GameMain.WindowActive && + oldMouseState.LeftButton == ButtonState.Pressed + && mouseState.LeftButton == ButtonState.Released); + } + + public static bool RightButtonHeld() + { + return GameMain.WindowActive && mouseState.RightButton == ButtonState.Pressed; + } + + public static bool RightButtonClicked() + { + return (GameMain.WindowActive && + oldMouseState.RightButton == ButtonState.Pressed + && mouseState.RightButton == ButtonState.Released); + } + + public static bool DoubleClicked() + { + return GameMain.WindowActive && doubleClicked; + } + + public static bool KeyHit(InputType inputType) + { + return GameMain.WindowActive && GameMain.Config.KeyBind(inputType).IsHit(); + } + + public static bool KeyDown(InputType inputType) + { + return GameMain.WindowActive && GameMain.Config.KeyBind(inputType).IsDown(); + } + + public static bool KeyUp(InputType inputType) + { + return GameMain.WindowActive && !GameMain.Config.KeyBind(inputType).IsDown(); + } + + public static bool KeyHit(Keys button) + { + return (GameMain.WindowActive && oldKeyboardState.IsKeyDown(button) && keyboardState.IsKeyUp(button)); + } + + public static bool KeyDown(Keys button) + { + return (GameMain.WindowActive && keyboardState.IsKeyDown(button)); + } + + public static bool KeyUp(Keys button) + { + return GameMain.WindowActive && keyboardState.IsKeyUp(button); + } + + public static void Update(double deltaTime) + { + timeSinceClick += deltaTime; + + oldMouseState = mouseState; + mouseState = latestMouseState; + UpdateVariable(); + + oldKeyboardState = keyboardState; + keyboardState = Keyboard.GetState(); + + doubleClicked = false; + if (LeftButtonClicked()) + { + if (timeSinceClick < doubleClickDelay) doubleClicked = true; + timeSinceClick = 0.0; + } + } + + public static void UpdateVariable() + { + //do NOT use this for actual interaction with the game, this is to be used for debugging and rendering ONLY + + latestMouseState = Mouse.GetState(); + } + } +} diff --git a/Barotrauma/Source/Program.cs b/Barotrauma/BarotraumaClient/Source/Program.cs similarity index 98% rename from Barotrauma/Source/Program.cs rename to Barotrauma/BarotraumaClient/Source/Program.cs index eaf57c560..ca47685cb 100644 --- a/Barotrauma/Source/Program.cs +++ b/Barotrauma/BarotraumaClient/Source/Program.cs @@ -125,7 +125,7 @@ namespace Barotrauma StreamWriter sw = new StreamWriter(filePath); StringBuilder sb = new StringBuilder(); - sb.AppendLine("Barotrauma crash report (generated on " + DateTime.Now + ")"); + sb.AppendLine("Barotrauma Client crash report (generated on " + DateTime.Now + ")"); sb.AppendLine("\n"); sb.AppendLine("Barotrauma seems to have crashed. Sorry for the inconvenience! "); sb.AppendLine("If you'd like to help fix the bug that caused the crash, please send this file to the developers on the Undertow Games forums."); @@ -164,7 +164,7 @@ namespace Barotrauma sw.WriteLine(sb.ToString()); - sw.Close(); + sw.Close(); CrashMessageBox( "A crash report (\"crashreport.txt\") was saved in the root folder of the game."+ " If you'd like to help fix this bug, please post the report on the Undertow Games forums."); diff --git a/Barotrauma/Source/Screens/BlurEffect.cs b/Barotrauma/BarotraumaClient/Source/Screens/BlurEffect.cs similarity index 100% rename from Barotrauma/Source/Screens/BlurEffect.cs rename to Barotrauma/BarotraumaClient/Source/Screens/BlurEffect.cs diff --git a/Barotrauma/Source/Screens/EditCharacterScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/EditCharacterScreen.cs similarity index 99% rename from Barotrauma/Source/Screens/EditCharacterScreen.cs rename to Barotrauma/BarotraumaClient/Source/Screens/EditCharacterScreen.cs index 6cae14af2..8404c7aa9 100644 --- a/Barotrauma/Source/Screens/EditCharacterScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/EditCharacterScreen.cs @@ -103,7 +103,7 @@ namespace Barotrauma { Character.UpdateAnimAll((float)deltaTime); - Ragdoll.UpdateAll(cam, (float)deltaTime); + Ragdoll.UpdateAll((float)deltaTime, cam); GameMain.World.Step((float)deltaTime); } diff --git a/Barotrauma/Source/Screens/EditMapScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/EditMapScreen.cs similarity index 99% rename from Barotrauma/Source/Screens/EditMapScreen.cs rename to Barotrauma/BarotraumaClient/Source/Screens/EditMapScreen.cs index fe7a802e6..9214cb9da 100644 --- a/Barotrauma/Source/Screens/EditMapScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/EditMapScreen.cs @@ -1061,7 +1061,7 @@ namespace Barotrauma if (item == null) continue; item.SetTransform(dummyCharacter.SimPosition, 0.0f); - item.Update(cam, (float)deltaTime); + item.Update((float)deltaTime, cam); item.SetTransform(item.body.SimPosition, 0.0f); } diff --git a/Barotrauma/Source/Screens/GameScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/GameScreen.cs similarity index 72% rename from Barotrauma/Source/Screens/GameScreen.cs rename to Barotrauma/BarotraumaClient/Source/Screens/GameScreen.cs index d35cddc8c..b8c95f332 100644 --- a/Barotrauma/Source/Screens/GameScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/GameScreen.cs @@ -6,42 +6,35 @@ using Microsoft.Xna.Framework.Input; namespace Barotrauma { - class GameScreen : Screen + partial class GameScreen : Screen { - private Camera cam; - private Color waterColor = new Color(0.75f, 0.8f, 0.9f, 1.0f); + private BlurEffect lightBlur; + readonly RenderTarget2D renderTargetBackground; readonly RenderTarget2D renderTarget; readonly RenderTarget2D renderTargetWater; readonly RenderTarget2D renderTargetAir; - private BlurEffect lightBlur; - private Effect damageEffect; private Texture2D damageStencil; public BackgroundCreatureManager BackgroundCreatureManager; - - public override Camera Cam - { - get { return cam; } - } - + public GameScreen(GraphicsDevice graphics, ContentManager content) { cam = new Camera(); cam.Translate(new Vector2(-10.0f, 50.0f)); - renderTargetBackground = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight); - renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight); - renderTargetWater = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight); - renderTargetAir = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight); + renderTargetBackground = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight); + renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight); + renderTargetWater = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight); + renderTargetAir = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight); var files = GameMain.SelectedPackage.GetFilesOfType(ContentType.BackgroundCreaturePrefabs); - if(files.Count > 0) + if (files.Count > 0) BackgroundCreatureManager = new BackgroundCreatureManager(files); else BackgroundCreatureManager = new BackgroundCreatureManager("Content/BackgroundSprites/BackgroundCreaturePrefabs.xml"); @@ -61,33 +54,7 @@ namespace Barotrauma lightBlur = new BlurEffect(blurEffect, 0.001f, 0.001f); } - - public override void Select() - { - base.Select(); - - if (Character.Controlled!=null) - { - cam.Position = Character.Controlled.WorldPosition; - cam.UpdateTransform(); - } - else if (Submarine.MainSub != null) - { - cam.Position = Submarine.MainSub.WorldPosition; - cam.UpdateTransform(); - } - - foreach (MapEntity entity in MapEntity.mapEntityList) - entity.IsHighlighted = false; - } - - public override void Deselect() - { - base.Deselect(); - - Sounds.SoundManager.LowPassHFGain = 1.0f; - } - + public override void AddToGUIUpdateList() { if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null) @@ -103,92 +70,7 @@ namespace Barotrauma Character.AddAllToGUIUpdateList(); } - /// - /// Allows the game to run logic such as updating the world, - /// checking for collisions, gathering input, and playing audio. - /// - public override void Update(double deltaTime) - { -#if DEBUG - if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null && - !DebugConsole.IsOpen) - { - var closestSub = Submarine.FindClosest(cam.WorldViewCenter); - if (closestSub == null) closestSub = GameMain.GameSession.Submarine; - - Vector2 targetMovement = Vector2.Zero; - if (PlayerInput.KeyDown(Keys.I)) targetMovement.Y += 1.0f; - if (PlayerInput.KeyDown(Keys.K)) targetMovement.Y -= 1.0f; - if (PlayerInput.KeyDown(Keys.J)) targetMovement.X -= 1.0f; - if (PlayerInput.KeyDown(Keys.L)) targetMovement.X += 1.0f; - - if (targetMovement != Vector2.Zero) - closestSub.ApplyForce(targetMovement * closestSub.SubBody.Body.Mass * 100.0f); - } -#endif - - foreach (MapEntity e in MapEntity.mapEntityList) - { - e.IsHighlighted = false; - } - - if (GameMain.GameSession != null) GameMain.GameSession.Update((float)deltaTime); - - if (Level.Loaded != null) Level.Loaded.Update((float)deltaTime); - - if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null) - { - if (Character.Controlled.SelectedConstruction == Character.Controlled.ClosestItem) - { - Character.Controlled.SelectedConstruction.UpdateHUD(cam, Character.Controlled); - } - } - Character.UpdateAll(cam, (float)deltaTime); - - BackgroundCreatureManager.Update(cam, (float)deltaTime); - - GameMain.ParticleManager.Update((float)deltaTime); - - StatusEffect.UpdateAll((float)deltaTime); - - if (Character.Controlled != null && Lights.LightManager.ViewTarget != null) - { - cam.TargetPos = Lights.LightManager.ViewTarget.WorldPosition; - } - - GameMain.LightManager.Update((float)deltaTime); - cam.MoveCamera((float)deltaTime); - - foreach (Submarine sub in Submarine.Loaded) - { - sub.SetPrevTransform(sub.Position); - } - - foreach (PhysicsBody pb in PhysicsBody.list) - { - pb.SetPrevTransform(pb.SimPosition, pb.Rotation); - } - - MapEntity.UpdateAll(cam, (float)deltaTime); - - Character.UpdateAnimAll((float)deltaTime); - - Ragdoll.UpdateAll(cam, (float)deltaTime); - - foreach (Submarine sub in Submarine.Loaded) - { - sub.Update((float)deltaTime); - } - - GameMain.World.Step((float)deltaTime); - - if (!PlayerInput.LeftButtonHeld()) - { - Inventory.draggingSlot = null; - Inventory.draggingItem = null; - } - } public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { @@ -222,9 +104,9 @@ namespace Barotrauma } } } - + GUI.Draw((float)deltaTime, spriteBatch, cam); - + spriteBatch.End(); } @@ -251,7 +133,7 @@ namespace Barotrauma //---------------------------------------------------------------------------------------- graphics.SetRenderTarget(renderTargetBackground); - + if (Level.Loaded == null) { graphics.Clear(new Color(11, 18, 26, 255)); @@ -367,7 +249,7 @@ namespace Barotrauma Submarine.DrawFront(spriteBatch, false, s => s is Structure); spriteBatch.End(); - + GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, true); } @@ -387,7 +269,7 @@ namespace Barotrauma } Hull.renderer.Render(graphics, cam, renderTargetAir, Cam.ShaderTransform); - + //---------------------------------------------------------------------------------------- //3. draw the sections of the map that are on top of the water //---------------------------------------------------------------------------------------- @@ -398,17 +280,17 @@ namespace Barotrauma cam.Transform); Submarine.DrawFront(spriteBatch, false, null); - + spriteBatch.End(); - + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.LinearWrap, - null, null, + null, null, damageEffect, cam.Transform); Submarine.DrawDamageable(spriteBatch, damageEffect, false); - + spriteBatch.End(); GameMain.LightManager.DrawLightMap(spriteBatch, lightBlur.Effect); @@ -418,22 +300,22 @@ namespace Barotrauma null, null, null, cam.Transform); - if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch); + if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch); - foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch,cam); + foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam); spriteBatch.End(); if (Character.Controlled != null && GameMain.LightManager.LosEnabled) { - GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect,false); + GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, false); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, RasterizerState.CullNone, null); float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.5f, 0.5f); spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), - Color.Lerp(GameMain.LightManager.AmbientLight*0.5f, Color.Red, r)); + Color.Lerp(GameMain.LightManager.AmbientLight * 0.5f, Color.Red, r)); spriteBatch.End(); } diff --git a/Barotrauma/Source/Screens/LobbyScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/LobbyScreen.cs similarity index 100% rename from Barotrauma/Source/Screens/LobbyScreen.cs rename to Barotrauma/BarotraumaClient/Source/Screens/LobbyScreen.cs diff --git a/Barotrauma/Source/Screens/MainMenuScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs similarity index 100% rename from Barotrauma/Source/Screens/MainMenuScreen.cs rename to Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs diff --git a/Barotrauma/Source/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs similarity index 90% rename from Barotrauma/Source/Screens/NetLobbyScreen.cs rename to Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs index e4e8a2ad7..4734b8d59 100644 --- a/Barotrauma/Source/Screens/NetLobbyScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs @@ -9,7 +9,7 @@ using System.ComponentModel; namespace Barotrauma { - class NetLobbyScreen : Screen + partial class NetLobbyScreen : Screen { private GUIFrame menu; private GUIFrame infoFrame; @@ -29,7 +29,7 @@ namespace Barotrauma private GUIButton[] missionTypeButtons; private GUIComponent missionTypeBlock; - + private GUIListBox jobList; private GUITextBox textBox, seedBox; @@ -44,15 +44,6 @@ namespace Barotrauma private GUIDropDown shuttleList; - public bool IsServer; - public string ServerName = "Server"; - - private UInt16 lastUpdateID; - public UInt16 LastUpdateID - { - get { if (GameMain.Server != null && lastUpdateID < 1) lastUpdateID++; return lastUpdateID; } - set { if (GameMain.Server != null) return; lastUpdateID = value; } - } private Sprite backgroundSprite; @@ -63,6 +54,12 @@ namespace Barotrauma get { return serverMessage; } } + public string ServerMessageText + { + get { return serverMessage.Text; } + set { serverMessage.Text = value; } + } + public GUIListBox SubList { get { return subList; } @@ -77,6 +74,11 @@ namespace Barotrauma { get { return modeList; } } + public int SelectedModeIndex + { + get { return modeList.SelectedIndex; } + set { modeList.Select(value); } + } public GUIListBox PlayerList { @@ -89,6 +91,12 @@ namespace Barotrauma private set; } + public bool StartButtonEnabled + { + get { return StartButton.Enabled; } + set { StartButton.Enabled = value; } + } + public GUIFrame InfoFrame { get { return infoFrame; } @@ -114,12 +122,6 @@ namespace Barotrauma get { return (int)missionTypeBlock.UserData; } set { missionTypeBlock.UserData = value; } } - - //for guitextblock delegate - public string GetServerName() - { - return ServerName; - } public List JobPreferences { @@ -136,8 +138,6 @@ namespace Barotrauma } } - private string levelSeed; - public string LevelSeed { get @@ -154,26 +154,13 @@ namespace Barotrauma } } - private float autoRestartTimer; - public string AutoRestartText() - { - if (GameMain.Server != null) - { - if (!GameMain.Server.AutoRestart) return ""; - return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(GameMain.Server.AutoRestartTimer, 0)); - } - - if (autoRestartTimer == 0.0f) return ""; - return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(autoRestartTimer, 0)); - } - public NetLobbyScreen() { int width = Math.Min(GameMain.GraphicsWidth - 80, 1500); int height = Math.Min(GameMain.GraphicsHeight - 80, 800); - Rectangle panelRect = new Rectangle(0,0,width,height); + Rectangle panelRect = new Rectangle(0, 0, width, height); menu = new GUIFrame(panelRect, Color.Transparent, Alignment.Center, null); //menu.Padding = GUI.style.smallPadding; @@ -182,7 +169,7 @@ namespace Barotrauma infoFrame = new GUIFrame(new Rectangle(0, 0, (int)(panelRect.Width * 0.7f), (int)(panelRect.Height * 0.6f)), "", menu); infoFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f); - + //chatbox ---------------------------------------------------------------------- GUIFrame chatFrame = new GUIFrame( new Rectangle(0, (int)(panelRect.Height * 0.6f + 20), @@ -191,7 +178,7 @@ namespace Barotrauma "", menu); chatFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 40.0f); - chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, "", chatFrame); + chatBox = new GUIListBox(new Rectangle(0, 0, 0, chatFrame.Rect.Height - 80), Color.White, "", chatFrame); textBox = new GUITextBox(new Rectangle(0, 25, 0, 25), Alignment.Bottom, "", chatFrame); textBox.MaxTextLength = ChatMessage.MaxLength; textBox.Font = GUI.SmallFont; @@ -213,7 +200,7 @@ namespace Barotrauma playerListFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 40.0f); - playerList = new GUIListBox(new Rectangle(0,0,0,0), null, "", playerListFrame); + playerList = new GUIListBox(new Rectangle(0, 0, 0, 0), null, "", playerListFrame); playerList.OnSelected = SelectPlayer; //submarine list ------------------------------------------------------------------ @@ -238,14 +225,14 @@ namespace Barotrauma new GUITextBlock(new Rectangle(columnX, 120, 20, 20), "Respawn shuttle:", "", infoFrame); shuttleList = new GUIDropDown(new Rectangle(columnX, 150, 200, 20), "", "", infoFrame); - + //gamemode ------------------------------------------------------------------ new GUITextBlock(new Rectangle(columnX, 180, 0, 30), "Game mode: ", "", infoFrame); modeList = new GUIListBox(new Rectangle(columnX, 200, columnWidth, infoFrame.Rect.Height - 300), "", infoFrame); modeList.OnSelected = VotableClicked; - + voteText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Votes: ", "", Alignment.TopLeft, Alignment.TopRight, infoFrame); voteText.UserData = "modevotes"; voteText.Visible = false; @@ -263,13 +250,13 @@ namespace Barotrauma textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f); textBlock.UserData = mode; } - + //mission type ------------------------------------------------------------------ missionTypeBlock = new GUITextBlock(new Rectangle(columnX, -10, 300, 20), "Mission type:", "", Alignment.BottomLeft, Alignment.CenterLeft, infoFrame); missionTypeBlock.Padding = Vector4.Zero; missionTypeBlock.UserData = 0; - + missionTypeButtons = new GUIButton[2]; missionTypeButtons[0] = new GUIButton(new Rectangle(100, 0, 20, 20), "<", Alignment.BottomLeft, "", missionTypeBlock); @@ -279,13 +266,13 @@ namespace Barotrauma missionTypeButtons[1] = new GUIButton(new Rectangle(200, 0, 20, 20), ">", Alignment.BottomLeft, "", missionTypeBlock); missionTypeButtons[1].UserData = 1; - + missionTypeBlock.Visible = false; columnX += columnWidth + 20; //gamemode description ------------------------------------------------------------------ - + //var modeDescription = new GUITextBlock( // new Rectangle(columnX, 150, (int)(columnWidth * 1.2f), infoFrame.Rect.Height - 150 - 80), // "", "", Alignment.TopLeft, Alignment.TopLeft, infoFrame, true, GUI.SmallFont); @@ -296,11 +283,11 @@ namespace Barotrauma //columnX += modeDescription.Rect.Width + 20; //seed ------------------------------------------------------------------ - + new GUITextBlock(new Rectangle(columnX, 120, 180, 20), "Level Seed: ", "", Alignment.Left, Alignment.TopLeft, infoFrame); - seedBox = new GUITextBox(new Rectangle(columnX, 150, columnWidth/2, 20), + seedBox = new GUITextBox(new Rectangle(columnX, 150, columnWidth / 2, 20), Alignment.TopLeft, "", infoFrame); seedBox.OnTextChanged = SelectSeed; LevelSeed = ToolBox.RandomSeed(8); @@ -314,7 +301,7 @@ namespace Barotrauma traitorProbabilityButtons[0] = new GUIButton(new Rectangle(columnX, 205, 20, 20), "<", "", infoFrame); traitorProbabilityButtons[0].UserData = -1; - traitorProbabilityText = new GUITextBlock(new Rectangle(columnX+20, 205, 80, 20), "No", null,null, Alignment.Center, "", infoFrame); + traitorProbabilityText = new GUITextBlock(new Rectangle(columnX + 20, 205, 80, 20), "No", null, null, Alignment.Center, "", infoFrame); traitorProbabilityButtons[1] = new GUIButton(new Rectangle(columnX + 100, 205, 20, 20), ">", "", infoFrame); traitorProbabilityButtons[1].UserData = 1; @@ -330,7 +317,7 @@ namespace Barotrauma restartText.TextGetter = AutoRestartText; //server info ------------------------------------------------------------------ - + var serverName = new GUITextBox(new Rectangle(0, 0, 200, 20), null, null, Alignment.TopLeft, Alignment.TopLeft, "", infoFrame); serverName.TextGetter = GetServerName; serverName.Enabled = GameMain.Server != null; @@ -339,7 +326,7 @@ namespace Barotrauma serverMessage = new GUITextBox(new Rectangle(0, 30, 360, 70), null, null, Alignment.TopLeft, Alignment.TopLeft, "", infoFrame); serverMessage.Wrap = true; serverMessage.OnTextChanged = UpdateServerMessage; - + var showLogButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Server Log", Alignment.TopRight, "", infoFrame); showLogButton.UserData = "showlog"; showLogButton.OnClicked = (GUIButton button, object userData) => @@ -367,22 +354,22 @@ namespace Barotrauma if (GameMain.NetworkMember == null) return; GameMain.LightManager.LosEnabled = false; - + textBox.Select(); - + textBox.OnEnterPressed = GameMain.NetworkMember.EnterChatMessage; textBox.OnTextChanged = GameMain.NetworkMember.TypingChatMessage; Character.Controlled = null; //GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; - subList.Enabled = GameMain.Server != null || GameMain.NetworkMember.Voting.AllowSubVoting; - shuttleList.Enabled = subList.Enabled; + subList.Enabled = GameMain.Server != null || GameMain.NetworkMember.Voting.AllowSubVoting; + shuttleList.Enabled = subList.Enabled; //playerList.Enabled = GameMain.Server != null; - modeList.Enabled = GameMain.Server != null || GameMain.NetworkMember.Voting.AllowModeVoting; - seedBox.Enabled = GameMain.Server != null; - serverMessage.Enabled = GameMain.Server != null; - autoRestartBox.Enabled = GameMain.Server != null; + modeList.Enabled = GameMain.Server != null || GameMain.NetworkMember.Voting.AllowModeVoting; + seedBox.Enabled = GameMain.Server != null; + serverMessage.Enabled = GameMain.Server != null; + autoRestartBox.Enabled = GameMain.Server != null; traitorProbabilityButtons[0].Enabled = GameMain.Server != null; traitorProbabilityButtons[1].Enabled = GameMain.Server != null; @@ -434,7 +421,7 @@ namespace Barotrauma if (shuttleList.Selected == null) { var shuttles = shuttleList.GetChildren().FindAll(c => c.UserData is Submarine && ((Submarine)c.UserData).HasTag(SubmarineTag.Shuttle)); - if (prevSelectedShuttle==-1 && shuttles.Any()) + if (prevSelectedShuttle == -1 && shuttles.Any()) { shuttleList.SelectItem(shuttles[0].UserData); } @@ -483,7 +470,7 @@ namespace Barotrauma base.Select(); } - + public void ShowSpectateButton() { if (GameMain.Client == null) return; @@ -560,12 +547,12 @@ namespace Barotrauma GUIButton upButton = new GUIButton(new Rectangle(30, 2, 15, 15), "", "", jobText); //TODO: make GUIImages align correctly when scaled/rotated //so there's no need to do this ↓ - new GUIImage(new Rectangle(3,2,0,0), GUI.Arrow, Alignment.Center, upButton).Scale = 0.6f; + new GUIImage(new Rectangle(3, 2, 0, 0), GUI.Arrow, Alignment.Center, upButton).Scale = 0.6f; upButton.UserData = -1; upButton.OnClicked += ChangeJobPreference; GUIButton downButton = new GUIButton(new Rectangle(50, 2, 15, 15), "", "", jobText); - var downArrow = new GUIImage(new Rectangle(13,14,0,0), GUI.Arrow, Alignment.Center, downButton); + var downArrow = new GUIImage(new Rectangle(13, 14, 0, 0), GUI.Arrow, Alignment.Center, downButton); downArrow.Rotation = MathHelper.Pi; downArrow.Scale = 0.6f; @@ -583,7 +570,7 @@ namespace Barotrauma { if (tickBox.Selected) { - GameMain.Server.CharacterInfo = new CharacterInfo(Character.HumanConfigFile, GameMain.Server.Name); + GameMain.Server.CharacterInfo = new CharacterInfo(Character.HumanConfigFile, GameMain.Server.Name,Gender.None,null); UpdatePlayerFrame(GameMain.Server.CharacterInfo); } else @@ -612,7 +599,7 @@ namespace Barotrauma private bool ToggleAutoRestart(GUITickBox tickBox) { if (GameMain.Server == null) return false; - + GameMain.Server.AutoRestart = tickBox.Selected; lastUpdateID++; @@ -635,8 +622,8 @@ namespace Barotrauma int missionTypeIndex = (int)missionTypeBlock.UserData; missionTypeIndex += (int)userData; - if (missionTypeIndex<0) missionTypeIndex = Mission.MissionTypes.Count-1; - if (missionTypeIndex>=Mission.MissionTypes.Count) missionTypeIndex=0; + if (missionTypeIndex < 0) missionTypeIndex = Mission.MissionTypes.Count - 1; + if (missionTypeIndex >= Mission.MissionTypes.Count) missionTypeIndex = 0; SetMissionType(missionTypeIndex); @@ -647,39 +634,10 @@ namespace Barotrauma public bool ToggleTraitorsEnabled(GUIButton button, object userData) { - if (GameMain.Server == null) return false; - - lastUpdateID++; - - int dir = (int)userData; - - int index = (int)GameMain.Server.TraitorsEnabled + dir; - if (index < 0) index = 2; - if (index > 2) index = 0; - - SetTraitorsEnabled((YesNoMaybe)index); - - + ToggleTraitorsEnabled((int)userData); return true; } - - public void SetTraitorsEnabled(YesNoMaybe enabled) - { - if (GameMain.Server != null) GameMain.Server.TraitorsEnabled = enabled; - (traitorProbabilityText as GUITextBlock).Text = enabled.ToString(); - } - - public List GetSubList() - { - List subs = new List(); - foreach (GUIComponent component in subList.children) - { - if (component.UserData is Submarine) subs.Add((Submarine)component.UserData); - } - - return subs; - } - + private bool SelectSub(GUIComponent component, object obj) { if (GameMain.Server == null) return false; @@ -687,14 +645,14 @@ namespace Barotrauma lastUpdateID++; var hash = obj is Submarine ? ((Submarine)obj).MD5Hash.Hash : ""; - + //hash will be null if opening the sub file failed -> don't select the sub if (string.IsNullOrWhiteSpace(hash)) { (component as GUITextBlock).TextColor = Color.DarkRed * 0.8f; component.CanBeFocused = false; - - StartButton.Enabled = false; + + StartButton.Enabled = false; return false; } @@ -714,7 +672,7 @@ namespace Barotrauma { DebugConsole.ThrowError("No submarines found!"); } - + foreach (Submarine sub in submarines) { AddSubmarine(subList, sub); @@ -761,8 +719,7 @@ namespace Barotrauma shuttleText.ToolTip = subTextBlock.ToolTip; } } - - + public bool VotableClicked(GUIComponent component, object userData) { if (GameMain.Client == null) return false; @@ -809,7 +766,7 @@ namespace Barotrauma public void AddPlayer(string name) { GUITextBlock textBlock = new GUITextBlock( - new Rectangle(0, 0, playerList.Rect.Width-20, 25), name, + new Rectangle(0, 0, playerList.Rect.Width - 20, 25), name, "", Alignment.Left, Alignment.Left, playerList); @@ -874,25 +831,25 @@ namespace Barotrauma permissionTick.Selected = selectedClient.HasPermission(permission); permissionTick.OnSelected = (tickBox) => - { - var client = tickBox.Parent.UserData as Client; - if (client == null) return false; + { + var client = tickBox.Parent.UserData as Client; + if (client == null) return false; - var thisPermission = (ClientPermissions)tickBox.UserData; + var thisPermission = (ClientPermissions)tickBox.UserData; - if (tickBox.Selected) - client.GivePermission(thisPermission); - else - client.RemovePermission(thisPermission); + if (tickBox.Selected) + client.GivePermission(thisPermission); + else + client.RemovePermission(thisPermission); - GameMain.Server.UpdateClientPermissions(client); + GameMain.Server.UpdateClientPermissions(client); - return true; - }; + return true; + }; y += 20; - if (y >= permissionsBox.Rect.Height-40) + if (y >= permissionsBox.Rect.Height - 40) { y = 0; x += 100; @@ -938,15 +895,15 @@ namespace Barotrauma { if (userData == null) return false; - if (GameMain.Server!=null) + if (GameMain.Server != null) { GameMain.Server.KickPlayer(userData.ToString(), false); } else if (GameMain.Client != null && GameMain.Client.HasPermission(ClientPermissions.Kick)) { GameMain.Client.KickPlayer(userData.ToString(), false); - } - + } + return false; } @@ -1006,11 +963,22 @@ namespace Barotrauma menu.AddToGUIUpdateList(); } } + + public List GetSubList() + { + List subs = new List(); + foreach (GUIComponent component in subList.children) + { + if (component.UserData is Submarine) subs.Add((Submarine)component.UserData); + } + + return subs; + } public override void Update(double deltaTime) { base.Update(deltaTime); - + if (jobInfoFrame != null) { jobInfoFrame.Update((float)deltaTime); @@ -1029,28 +997,27 @@ namespace Barotrauma autoRestartTimer = Math.Max(autoRestartTimer - (float)deltaTime, 0.0f); } } - public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { graphics.Clear(Color.Black); - + spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable); - if (backgroundSprite!=null) + if (backgroundSprite != null) { spriteBatch.Draw(backgroundSprite.Texture, Vector2.Zero, null, Color.White, 0.0f, Vector2.Zero, - Math.Max((float)GameMain.GraphicsWidth / backgroundSprite.SourceRect.Width, (float)GameMain.GraphicsHeight / backgroundSprite.SourceRect.Height), + Math.Max((float)GameMain.GraphicsWidth / backgroundSprite.SourceRect.Width, (float)GameMain.GraphicsHeight / backgroundSprite.SourceRect.Height), SpriteEffects.None, 0.0f); } menu.Draw(spriteBatch); - + if (jobInfoFrame != null) jobInfoFrame.Draw(spriteBatch); //if (previewPlayer!=null) previewPlayer.Draw(spriteBatch); if (playerFrame != null) playerFrame.Draw(spriteBatch); - + GUI.Draw((float)deltaTime, spriteBatch, null); spriteBatch.End(); @@ -1064,10 +1031,10 @@ namespace Barotrauma { chatBox.RemoveChild(chatBox.children[1]); } - - GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width-20, 0), - message.TextWithSender, - ((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.1f, message.Color, + + GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width - 20, 0), + message.TextWithSender, + ((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, message.Color, Alignment.Left, Alignment.TopLeft, "", null, true, GUI.SmallFont); msg.UserData = message; msg.CanBeFocused = false; @@ -1104,7 +1071,7 @@ namespace Barotrauma { Gender gender = (Gender)obj; GameMain.NetworkMember.CharacterInfo.Gender = gender; - + UpdatePreviewPlayer(GameMain.NetworkMember.CharacterInfo); return true; } @@ -1113,7 +1080,7 @@ namespace Barotrauma { modeList.Select(modeIndex, true); - missionTypeBlock.Visible = SelectedMode != null && SelectedMode.Name == "Mission"; + missionTypeBlock.Visible = SelectedMode != null && SelectedMode.Name == "Mission"; } private bool SelectMode(GUIComponent component, object obj) @@ -1134,7 +1101,6 @@ namespace Barotrauma return true; } - private bool SelectSeed(GUITextBox textBox, string seed) { if (GameMain.Server == null) return false; @@ -1173,7 +1139,7 @@ namespace Barotrauma if (jobPrefab == null) return false; jobInfoFrame = jobPrefab.CreateInfoFrame(); - GUIButton closeButton = new GUIButton(new Rectangle(0,0,100,20), "Close", Alignment.BottomRight, "", jobInfoFrame.children[0]); + GUIButton closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, "", jobInfoFrame.children[0]); closeButton.OnClicked = CloseJobInfo; return true; } @@ -1216,7 +1182,7 @@ namespace Barotrauma listBox.children[i].Color = color; listBox.children[i].HoverColor = color; listBox.children[i].SelectedColor = color; - + (listBox.children[i] as GUITextBlock).Text = (i+1) + ". " + (listBox.children[i].UserData as JobPrefab).Name; jobNamePreferences.Add((listBox.children[i].UserData as JobPrefab).Name); @@ -1271,7 +1237,7 @@ namespace Barotrauma //already showing a message about the same sub if (GUIMessageBox.MessageBoxes.Any(mb => mb.UserData as string == "request" + subName)) { - return false; + return false; } var requestFileBox = new GUIMessageBox("Submarine not found!", errorMsg, new string[] { "Yes", "No" }, 400, 300); @@ -1279,18 +1245,18 @@ namespace Barotrauma requestFileBox.Buttons[0].UserData = new string[] { subName, md5Hash }; requestFileBox.Buttons[0].OnClicked += requestFileBox.Close; requestFileBox.Buttons[0].OnClicked += (GUIButton button, object userdata) => - { - string[] fileInfo = (string[])userdata; - GameMain.Client.RequestFile(FileTransferType.Submarine, fileInfo[0], fileInfo[1]); - return true; - }; + { + string[] fileInfo = (string[])userdata; + GameMain.Client.RequestFile(FileTransferType.Submarine, fileInfo[0], fileInfo[1]); + return true; + }; requestFileBox.Buttons[1].OnClicked += requestFileBox.Close; - + return false; } return true; } - + } } diff --git a/Barotrauma/Source/Screens/Screen.cs b/Barotrauma/BarotraumaClient/Source/Screens/Screen.cs similarity index 77% rename from Barotrauma/Source/Screens/Screen.cs rename to Barotrauma/BarotraumaClient/Source/Screens/Screen.cs index 56dfa3421..b155070a3 100644 --- a/Barotrauma/Source/Screens/Screen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/Screen.cs @@ -5,42 +5,12 @@ using System.Collections.Generic; namespace Barotrauma { - class Screen + partial class Screen { - private static Screen selected; - - public static Screen Selected - { - get { return selected; } - } - - public virtual void Deselect() - { - } - - public virtual void Select() - { - if (selected != null && selected != this) - { - selected.Deselect(); - GUIComponent.KeyboardDispatcher.Subscriber = null; - } - selected = this; - } - - public virtual Camera Cam - { - get { return null; } - } - public virtual void AddToGUIUpdateList() { } - public virtual void Update(double deltaTime) - { - } - public virtual void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { } @@ -94,6 +64,5 @@ namespace Barotrauma GUI.Arrow.Draw(spriteBatch, iconPos + arrowOffset, color, MathUtils.VectorToAngle(arrowOffset) + MathHelper.PiOver2); } } - } } diff --git a/Barotrauma/Source/Screens/ServerListScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs similarity index 100% rename from Barotrauma/Source/Screens/ServerListScreen.cs rename to Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs diff --git a/Barotrauma/Source/Sounds/OggSound.cs b/Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs similarity index 100% rename from Barotrauma/Source/Sounds/OggSound.cs rename to Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs diff --git a/Barotrauma/Source/Sounds/OggStream.cs b/Barotrauma/BarotraumaClient/Source/Sounds/OggStream.cs similarity index 100% rename from Barotrauma/Source/Sounds/OggStream.cs rename to Barotrauma/BarotraumaClient/Source/Sounds/OggStream.cs diff --git a/Barotrauma/Source/Sounds/Sound.cs b/Barotrauma/BarotraumaClient/Source/Sounds/Sound.cs similarity index 100% rename from Barotrauma/Source/Sounds/Sound.cs rename to Barotrauma/BarotraumaClient/Source/Sounds/Sound.cs diff --git a/Barotrauma/Source/Sounds/SoundManager.cs b/Barotrauma/BarotraumaClient/Source/Sounds/SoundManager.cs similarity index 100% rename from Barotrauma/Source/Sounds/SoundManager.cs rename to Barotrauma/BarotraumaClient/Source/Sounds/SoundManager.cs diff --git a/Barotrauma/Source/Sounds/SoundPlayer.cs b/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs similarity index 100% rename from Barotrauma/Source/Sounds/SoundPlayer.cs rename to Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs diff --git a/Barotrauma/Source/Sprite.cs b/Barotrauma/BarotraumaClient/Source/Sprite/Sprite.cs similarity index 70% rename from Barotrauma/Source/Sprite.cs rename to Barotrauma/BarotraumaClient/Source/Sprite/Sprite.cs index 4369d2dbc..ce9146202 100644 --- a/Barotrauma/Source/Sprite.cs +++ b/Barotrauma/BarotraumaClient/Source/Sprite/Sprite.cs @@ -7,130 +7,15 @@ using System.Xml.Linq; namespace Barotrauma { - public class Sprite + public partial class Sprite { - static List list = new List(); - //the file from which the texture is loaded - //if two sprites use the same file, they share the same texture - string file; - protected Texture2D texture; - //the area in the texture that is supposed to be drawn - Rectangle sourceRect; - - //the offset used when drawing the sprite - protected Vector2 offset; - - protected Vector2 origin; - - //the size of the drawn sprite, if larger than the source, - //the sprite is tiled to fill the target size - public Vector2 size; - - public float rotation; - - public SpriteEffects effects; - - protected float depth; - - public Rectangle SourceRect - { - get { return sourceRect; } - set { sourceRect = value; } - } - - public float Depth - { - get { return depth; } - set { depth = MathHelper.Clamp(value, 0.0f, 1.0f); } - } - - public Vector2 Origin - { - get { return origin; } - set { origin = value; } - } - public Texture2D Texture { get { return texture; } } - public string FilePath - { - get { return file; } - } - - public override string ToString() - { - return FilePath + ": " + sourceRect; - } - - public Sprite(XElement element, string path = "", string file = "") - { - if (file == "") - { - file = ToolBox.GetAttributeString(element, "texture", ""); - } - - if (file == "") - { - DebugConsole.ThrowError("Sprite " + element + " doesn't have a texture specified!"); - return; - } - - if (!string.IsNullOrEmpty(path)) - { - if (!path.EndsWith("/")) path += "/"; - } - - this.file = path + file; - - texture = LoadTexture(this.file); - - if (texture == null) return; - - Vector4 sourceVector = ToolBox.GetAttributeVector4(element, "sourcerect", Vector4.Zero); - - if (sourceVector.Z == 0.0f) sourceVector.Z = texture.Width; - if (sourceVector.W == 0.0f) sourceVector.W = texture.Height; - - sourceRect = new Rectangle( - (int)sourceVector.X, (int)sourceVector.Y, - (int)sourceVector.Z, (int)sourceVector.W); - - origin = ToolBox.GetAttributeVector2(element, "origin", new Vector2(0.5f, 0.5f)); - origin.X = origin.X * sourceRect.Width; - origin.Y = origin.Y * sourceRect.Height; - - size = ToolBox.GetAttributeVector2(element, "size", Vector2.One); - size.X *= sourceRect.Width; - size.Y *= sourceRect.Height; - - Depth = ToolBox.GetAttributeFloat(element, "depth", 0.0f); - - list.Add(this); - } - - public Sprite(string newFile, Vector2 newOrigin) - { - file = newFile; - texture = LoadTexture(file); - - if (texture == null) return; - - sourceRect = new Rectangle(0, 0, texture.Width, texture.Height); - - size = new Vector2(sourceRect.Width, sourceRect.Height); - - origin = new Vector2((float)texture.Width * newOrigin.X, (float)texture.Height * newOrigin.Y); - - effects = SpriteEffects.None; - - list.Add(this); - } - public Sprite(Texture2D texture, Rectangle? sourceRectangle, Vector2? newOffset, float newRotation = 0.0f) { this.texture = texture; @@ -150,51 +35,53 @@ namespace Barotrauma list.Add(this); } - public Sprite(string newFile, Rectangle? sourceRectangle, Vector2? newOffset, float newRotation = 0.0f) + partial void LoadTexture(ref Vector4 sourceVector,ref bool shouldReturn) { - file = newFile; - texture = LoadTexture(file); + texture = LoadTexture(this.file); - sourceRect = sourceRectangle ?? new Rectangle(0, 0, texture.Width, texture.Height); - - offset = newOffset ?? Vector2.Zero; - - size = new Vector2(sourceRect.Width, sourceRect.Height); + if (texture == null) + { + shouldReturn = true; + return; + } - origin = Vector2.Zero; - - rotation = newRotation; - - list.Add(this); + if (sourceVector.Z == 0.0f) sourceVector.Z = texture.Width; + if (sourceVector.W == 0.0f) sourceVector.W = texture.Height; } - + + partial void CalculateSourceRect() + { + sourceRect = new Rectangle(0, 0, texture.Width, texture.Height); + } + + public static Texture2D LoadTexture(string file) { foreach (Sprite s in list) { - if (s.file == file) return s.texture; + if (s.file == file) return s.texture; } - + if (File.Exists(file)) { return TextureLoader.FromFile(file); } else { - DebugConsole.ThrowError("Sprite \""+file+"\" not found!"); + DebugConsole.ThrowError("Sprite \"" + file + "\" not found!"); } return null; } - public void Draw(SpriteBatch spriteBatch, Vector2 pos, float rotate=0.0f, float scale=1.0f, SpriteEffects spriteEffect = SpriteEffects.None) + public void Draw(SpriteBatch spriteBatch, Vector2 pos, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None) { this.Draw(spriteBatch, pos, Color.White, rotate, scale, spriteEffect); } public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null) { - this.Draw(spriteBatch, pos, color, this.origin, rotate, new Vector2(scale,scale), spriteEffect, depth); + this.Draw(spriteBatch, pos, color, this.origin, rotate, new Vector2(scale, scale), spriteEffect, depth); } public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null) @@ -217,12 +104,12 @@ namespace Barotrauma spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth); } - + public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Color color) { DrawTiled(spriteBatch, pos, targetSize, Vector2.Zero, color); } - + public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Color color, Point offset, float? overrideDepth = null) { //how many times the texture needs to be drawn on the x-axis @@ -242,12 +129,12 @@ namespace Barotrauma float top = pos.Y; texPerspective.Height = (int)Math.Min(targetSize.Y, sourceRect.Height); - + for (int y = 0; y < yTiles; y++) { var movementY = texPerspective.Height; texPerspective.Height = Math.Min((int)(targetSize.Y - texPerspective.Height * y), texPerspective.Height); - + float left = pos.X; texPerspective.Width = (int)Math.Min(targetSize.X, sourceRect.Width); @@ -303,16 +190,16 @@ namespace Barotrauma { DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color); } - + public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color) { //pos.X = (int)pos.X; //pos.Y = (int)pos.Y; //how many times the texture needs to be drawn on the x-axis - int xTiles = (int)Math.Ceiling((targetSize.X+startOffset.X) / sourceRect.Width); + int xTiles = (int)Math.Ceiling((targetSize.X + startOffset.X) / sourceRect.Width); //how many times the texture needs to be drawn on the y-axis - int yTiles = (int)Math.Ceiling((targetSize.Y+startOffset.Y) / sourceRect.Height); + int yTiles = (int)Math.Ceiling((targetSize.Y + startOffset.Y) / sourceRect.Height); Vector2 position = pos - startOffset; Rectangle drawRect = sourceRect; @@ -372,13 +259,10 @@ namespace Barotrauma position.X += sourceRect.Width; } - } - public void Remove() + partial void DisposeTexture() { - list.Remove(this); - //check if another sprite is using the same texture foreach (Sprite s in list) { @@ -392,7 +276,6 @@ namespace Barotrauma texture = null; } } - } } diff --git a/Barotrauma/BarotraumaClient/Source/Sprite/SpriteSheet.cs b/Barotrauma/BarotraumaClient/Source/Sprite/SpriteSheet.cs new file mode 100644 index 000000000..3dc8436a7 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Sprite/SpriteSheet.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using System; +using System.Xml.Linq; +using Microsoft.Xna.Framework.Graphics; + +namespace Barotrauma +{ + partial class SpriteSheet : Sprite + { + public override void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = default(float?)) + { + if (texture == null) return; + + spriteBatch.Draw(texture, pos + offset, sourceRects[0], color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth); + } + + public void Draw(SpriteBatch spriteBatch, int spriteIndex, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = default(float?)) + { + if (texture == null) return; + + spriteBatch.Draw(texture, pos + offset, sourceRects[spriteIndex], color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth); + } + } +} diff --git a/Barotrauma/BarotraumaClient/Source/Utils/MathUtils.cs b/Barotrauma/BarotraumaClient/Source/Utils/MathUtils.cs new file mode 100644 index 000000000..fbf1e9e30 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Utils/MathUtils.cs @@ -0,0 +1,22 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Barotrauma +{ + class CompareSegmentPointCW : IComparer + { + private Vector2 center; + + public CompareSegmentPointCW(Vector2 center) + { + this.center = center; + } + public int Compare(Lights.SegmentPoint a, Lights.SegmentPoint b) + { + return -CompareCCW.Compare(a.WorldPos, b.WorldPos, center); + } + } +} diff --git a/Barotrauma/Source/Utils/SaveUtil.cs b/Barotrauma/BarotraumaClient/Source/Utils/SaveUtil.cs similarity index 72% rename from Barotrauma/Source/Utils/SaveUtil.cs rename to Barotrauma/BarotraumaClient/Source/Utils/SaveUtil.cs index d7a9a7bcd..1b5570ded 100644 --- a/Barotrauma/Source/Utils/SaveUtil.cs +++ b/Barotrauma/BarotraumaClient/Source/Utils/SaveUtil.cs @@ -6,17 +6,8 @@ using System.Xml.Linq; namespace Barotrauma { - public class SaveUtil + public partial class SaveUtil { - public static string SaveFolder = "Data"+Path.DirectorySeparatorChar+"Saves"; - - public delegate void ProgressDelegate(string sMessage); - - public static string TempPath - { - get { return Path.Combine(SaveFolder, "temp"); } - } - public static void SaveGame(string fileName) { fileName = Path.Combine(SaveFolder, fileName); @@ -185,26 +176,6 @@ namespace Barotrauma gz.Write(b, 0, b.Length); } } - - public static Stream DecompressFiletoStream(string fileName) - { - if (!File.Exists(fileName)) - { - DebugConsole.ThrowError("File \""+fileName+" doesn't exist!"); - return null; - } - - using (FileStream originalFileStream = new FileStream(fileName, FileMode.Open)) - { - MemoryStream decompressedFileStream = new MemoryStream(); - - using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress)) - { - decompressionStream.CopyTo(decompressedFileStream); - return decompressedFileStream; - } - } - } public static void CompressFile(string sDir, string sRelativePath, GZipStream zipStream) { @@ -219,47 +190,7 @@ namespace Barotrauma zipStream.Write(BitConverter.GetBytes(bytes.Length), 0, sizeof(int)); zipStream.Write(bytes, 0, bytes.Length); } - - public static bool DecompressFile(string sDir, GZipStream zipStream, ProgressDelegate progress) - { - //Decompress file name - byte[] bytes = new byte[sizeof(int)]; - int Readed = zipStream.Read(bytes, 0, sizeof(int)); - if (Readed < sizeof(int)) - return false; - - int iNameLen = BitConverter.ToInt32(bytes, 0); - bytes = new byte[sizeof(char)]; - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < iNameLen; i++) - { - zipStream.Read(bytes, 0, sizeof(char)); - char c = BitConverter.ToChar(bytes, 0); - sb.Append(c); - } - string sFileName = sb.ToString(); - if (progress != null) - progress(sFileName); - - //Decompress file content - bytes = new byte[sizeof(int)]; - zipStream.Read(bytes, 0, sizeof(int)); - int iFileLen = BitConverter.ToInt32(bytes, 0); - - bytes = new byte[iFileLen]; - zipStream.Read(bytes, 0, bytes.Length); - - string sFilePath = Path.Combine(sDir, sFileName); - string sFinalDir = Path.GetDirectoryName(sFilePath); - if (!Directory.Exists(sFinalDir)) - Directory.CreateDirectory(sFinalDir); - - using (FileStream outFile = new FileStream(sFilePath, FileMode.Create, FileAccess.Write, FileShare.None)) - outFile.Write(bytes, 0, iFileLen); - - return true; - } - + public static void CompressDirectory(string sInDir, string sOutFile, ProgressDelegate progress) { string[] sFiles = Directory.GetFiles(sInDir, "*.*", SearchOption.AllDirectories); @@ -275,14 +206,7 @@ namespace Barotrauma CompressFile(sInDir, sRelativePath, str); } } - - public static void DecompressToDirectory(string sCompressedFile, string sDir, ProgressDelegate progress) - { - using (FileStream inFile = new FileStream(sCompressedFile, FileMode.Open, FileAccess.Read, FileShare.None)) - using (GZipStream zipStream = new GZipStream(inFile, CompressionMode.Decompress, true)) - while (DecompressFile(sDir, zipStream, progress)) ; - } - + private static void ClearFolder(string FolderName, string[] ignoredFiles = null) { DirectoryInfo dir = new DirectoryInfo(FolderName); diff --git a/Barotrauma/Source/Utils/TextureLoader.cs b/Barotrauma/BarotraumaClient/Source/Utils/TextureLoader.cs similarity index 100% rename from Barotrauma/Source/Utils/TextureLoader.cs rename to Barotrauma/BarotraumaClient/Source/Utils/TextureLoader.cs diff --git a/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs b/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs new file mode 100644 index 000000000..0937240c9 --- /dev/null +++ b/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs @@ -0,0 +1,103 @@ +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Xml; +using System.Xml.Linq; + +namespace Barotrauma +{ + public static partial class ToolBox + { + public static string LimitString(string str, ScalableFont font, int maxWidth) + { + if (maxWidth <= 0 || string.IsNullOrWhiteSpace(str)) return ""; + + float currWidth = font.MeasureString("...").X; + for (int i = 0; i < str.Length; i++) + { + currWidth += font.MeasureString(str[i].ToString()).X; + + if (currWidth > maxWidth) + { + return str.Substring(0, Math.Max(i - 2, 1)) + "..."; + } + } + + return str; + } + + public static string WrapText(string text, float lineLength, ScalableFont font, float textScale = 1.0f) //TODO: could integrate this into the ScalableFont class directly + { + if (font.MeasureString(text).X < lineLength) return text; + + text = text.Replace("\n", " \n "); + + string[] words = text.Split(' '); + + StringBuilder wrappedText = new StringBuilder(); + float linePos = 0f; + float spaceWidth = font.MeasureString(" ").X * textScale; + for (int i = 0; i < words.Length; ++i) + { + if (string.IsNullOrWhiteSpace(words[i]) && words[i] != "\n") continue; + + Vector2 size = font.MeasureString(words[i]) * textScale; + if (size.X > lineLength) + { + if (linePos == 0.0f) + { + wrappedText.AppendLine(words[i]); + } + else + { + do + { + if (words[i].Length == 0) break; + + wrappedText.Append(words[i][0]); + words[i] = words[i].Remove(0, 1); + + linePos += size.X; + } while (words[i].Length > 0 && (size = font.MeasureString((words[i][0]).ToString()) * textScale).X + linePos < lineLength); + + wrappedText.Append("\n"); + linePos = 0.0f; + i--; + } + + continue; + } + + if (linePos + size.X < lineLength) + { + wrappedText.Append(words[i]); + if (words[i] == "\n") + { + linePos = 0.0f; + } + else + { + + linePos += size.X + spaceWidth; + } + } + else + { + wrappedText.Append("\n"); + wrappedText.Append(words[i]); + + linePos = size.X + spaceWidth; + } + + if (i < words.Length - 1) wrappedText.Append(" "); + } + + return wrappedText.ToString(); + } + } +} diff --git a/Barotrauma/freetype6.dll b/Barotrauma/BarotraumaClient/freetype6.dll similarity index 100% rename from Barotrauma/freetype6.dll rename to Barotrauma/BarotraumaClient/freetype6.dll diff --git a/Barotrauma/BarotraumaClient/packages.config b/Barotrauma/BarotraumaClient/packages.config new file mode 100644 index 000000000..826869719 --- /dev/null +++ b/Barotrauma/BarotraumaClient/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Barotrauma/wrap_oal.dll b/Barotrauma/BarotraumaClient/wrap_oal.dll similarity index 100% rename from Barotrauma/wrap_oal.dll rename to Barotrauma/BarotraumaClient/wrap_oal.dll diff --git a/Barotrauma/BarotraumaServer/BarotraumaServer.csproj b/Barotrauma/BarotraumaServer/BarotraumaServer.csproj new file mode 100644 index 000000000..aa93102bf --- /dev/null +++ b/Barotrauma/BarotraumaServer/BarotraumaServer.csproj @@ -0,0 +1,135 @@ + + + + Debug + AnyCPU + {85232B20-074D-4723-B0C6-91495391E448} + Exe + Properties + BarotraumaServer + BarotraumaServer + v4.5 + 512 + true + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + ..\bin\Windows\Debug\ + TRACE;DEBUG;WINDOWS;SERVER + full + x86 + prompt + MinimumRecommendedRules.ruleset + true + + + ..\bin\Windows\Release\ + TRACE;WINDOWS;SERVER + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + true + + + ..\BarotraumaShared\Icon.ico + + + + False + ..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {a4610e4c-dd34-428b-babb-779ca0b5993a} + Farseer Physics + + + {3b8f9edb-6e5e-450c-abc2-ec49075d0b50} + Hyper.ComponentModel + + + {49ba1c69-6104-41ac-a5d8-b54fa9f696e8} + Lidgren.Network + + + + + False + Microsoft .NET Framework 4.5 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + + + + + + + + \ No newline at end of file diff --git a/Barotrauma/BarotraumaServer/BarotraumaServer.csproj.user b/Barotrauma/BarotraumaServer/BarotraumaServer.csproj.user new file mode 100644 index 000000000..1991869a0 --- /dev/null +++ b/Barotrauma/BarotraumaServer/BarotraumaServer.csproj.user @@ -0,0 +1,14 @@ + + + + ShowAllFiles + publish\ + + + + + + en-US + false + + \ No newline at end of file diff --git a/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs b/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..563768cf9 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Barotrauma Dedicated Server")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Copyright © Undertow Games 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("85232b20-074d-4723-b0c6-91495391e448")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.6.0.1000")] +[assembly: AssemblyFileVersion("0.6.0.1000")] diff --git a/Barotrauma/BarotraumaServer/Source/Camera.cs b/Barotrauma/BarotraumaServer/Source/Camera.cs new file mode 100644 index 000000000..35d930cd5 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Camera.cs @@ -0,0 +1,234 @@ +using System; +using Microsoft.Xna.Framework; +using System.Linq; +//TODO: this class still does things that the server doesn't need, cleanup + +namespace Barotrauma +{ + public class Camera + { + public static bool FollowSub = true; + + const float DefaultZoom = 1.0f; + const float ZoomSmoothness = 8.0f; + const float MoveSmoothness = 8.0f; + + private float zoom; + + private float offsetAmount; + + private Matrix transform, shaderTransform, viewMatrix; + private Vector2 position; + private float rotation; + + private Vector2 prevPosition; + private float prevZoom; + + public float Shake; + private Vector2 shakePosition; + private Vector2 shakeTargetPosition; + + //the area of the world inside the camera view + private Rectangle worldView; + + private Point resolution; + + private Vector2 targetPos; + + public float Zoom + { + get { return zoom; } + set + { + zoom = value; + + Vector2 center = WorldViewCenter; + float newWidth = resolution.X / zoom; + float newHeight = resolution.Y / zoom; + + worldView = new Rectangle( + (int)(center.X - newWidth / 2.0f), + (int)(center.Y + newHeight / 2.0f), + (int)newWidth, + (int)newHeight); + + //UpdateTransform(); + } + } + + public float Rotation + { + get { return rotation; } + set { rotation = value; } + } + + public float OffsetAmount + { + get { return offsetAmount; } + set { offsetAmount = value; } + } + + public Point Resolution + { + get { return resolution; } + } + + public Rectangle WorldView + { + get { return worldView; } + } + + public Vector2 WorldViewCenter + { + get + { + return new Vector2( + worldView.X + worldView.Width / 2.0f, + worldView.Y - worldView.Height / 2.0f); + } + } + + public Matrix Transform + { + get { return transform; } + } + + public Matrix ShaderTransform + { + get { return shaderTransform; } + } + + public Camera() + { + zoom = 1.0f; + rotation = 0.0f; + position = Vector2.Zero; + + worldView = new Rectangle(0,0, + 1, + 1); + + resolution = new Point(1,1); + + viewMatrix = + Matrix.CreateTranslation(new Vector3(0.5f, 0.5f, 0)); + + UpdateTransform(); + } + + public Vector2 TargetPos + { + get { return targetPos; } + set { targetPos = value; } + } + + // Auxiliary function to move the camera + public void Translate(Vector2 amount) + { + position += amount; + + } + + public void UpdateTransform(bool interpolate = true, bool clampPos = false) + { + Vector2 interpolatedPosition = interpolate ? Timing.Interpolate(prevPosition, position) : position; + + float interpolatedZoom = interpolate ? Timing.Interpolate(prevZoom, zoom) : zoom; + + worldView.X = (int)(interpolatedPosition.X - worldView.Width / 2.0); + worldView.Y = (int)(interpolatedPosition.Y + worldView.Height / 2.0); + + if (Level.Loaded != null && clampPos) + { + position.Y -= Math.Max(worldView.Y - Level.Loaded.Size.Y, 0.0f); + interpolatedPosition.Y -= Math.Max(worldView.Y - Level.Loaded.Size.Y, 0.0f); + + worldView.Y = Math.Min((int)Level.Loaded.Size.Y, worldView.Y); + } + + transform = Matrix.CreateTranslation( + new Vector3(-interpolatedPosition.X, interpolatedPosition.Y, 0)) * + Matrix.CreateScale(new Vector3(interpolatedZoom, interpolatedZoom, 1)) * + viewMatrix; + + shaderTransform = Matrix.CreateTranslation( + new Vector3( + -interpolatedPosition.X - resolution.X / interpolatedZoom / 2.0f, + -interpolatedPosition.Y - resolution.Y / interpolatedZoom / 2.0f, 0)) * + Matrix.CreateScale(new Vector3(interpolatedZoom, interpolatedZoom, 1)) * + viewMatrix; + + if (!interpolate) + { + prevPosition = position; + prevZoom = zoom; + } + } + + public void MoveCamera(float deltaTime, bool allowMove = true, bool allowZoom = true) + { + prevPosition = position; + prevZoom = zoom; + + float moveSpeed = 20.0f/zoom; + + Vector2 moveCam = Vector2.Zero; + if (targetPos == Vector2.Zero) + { + + } + else + { + Vector2 mousePos = PlayerInput.MousePosition; + + Vector2 offset = mousePos - new Vector2(resolution.X / 2.0f, resolution.Y / 2.0f); + + offset.X = offset.X / (resolution.X * 0.4f); + offset.Y = -offset.Y / (resolution.Y * 0.3f); + + if (offset.Length() > 1.0f) offset.Normalize(); + + offset = offset * offsetAmount; + + float newZoom = Math.Min(DefaultZoom - Math.Min(offset.Length() / resolution.Y, 1.0f),1.0f); + Zoom += (newZoom - zoom) / ZoomSmoothness; + + Vector2 diff = (targetPos + offset) - position; + + moveCam = diff / MoveSmoothness; + } + + shakeTargetPosition = Rand.Vector(Shake); + shakePosition = Vector2.Lerp(shakePosition, shakeTargetPosition, 0.5f); + Shake = MathHelper.Lerp(Shake, 0.0f, deltaTime * 2.0f); + + Translate(moveCam + shakePosition); + } + + public Vector2 Position + { + get { return position; } + set + { + if (!MathUtils.IsValid(value)) + { + return; + } + position = value; + } + } + + public Vector2 ScreenToWorld(Vector2 coords) + { + Vector2 worldCoords = Vector2.Transform(coords, Matrix.Invert(transform)); + return new Vector2(worldCoords.X, -worldCoords.Y); + } + + public Vector2 WorldToScreen(Vector2 coords) + { + coords.Y = -coords.Y; + //Vector2 screenCoords = Vector2.Transform(coords, transform); + return Vector2.Transform(coords, transform); + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Characters/Character.cs b/Barotrauma/BarotraumaServer/Source/Characters/Character.cs new file mode 100644 index 000000000..58d517c7d --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Characters/Character.cs @@ -0,0 +1,32 @@ +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Dynamics.Joints; +using Barotrauma.Networking; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using Microsoft.Xna.Framework; + +namespace Barotrauma +{ + partial class Character : Entity, IDamageable, IPropertyObject, IClientSerializable, IServerSerializable + { + //the Character that the player is currently controlling + private const Character controlled = null; + + public static Character Controlled + { + get { return controlled; } + set + { + //do nothing + } + } + + partial void InitProjSpecific(XDocument doc) + { + keys = null; + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/DebugConsole.cs b/Barotrauma/BarotraumaServer/Source/DebugConsole.cs new file mode 100644 index 000000000..9ca53c56f --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/DebugConsole.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Barotrauma.Networking; +using Barotrauma.Items.Components; +using System.Text; +using FarseerPhysics; + +namespace Barotrauma +{ + static partial class DebugConsole + { + public static List QueuedCommands = new List(); + + public static void Update() + { + lock (QueuedCommands) + { + while (QueuedCommands.Count>0) + { + ExecuteCommand(QueuedCommands[0], GameMain.Instance); + QueuedCommands.RemoveAt(0); + } + } + } + + private static bool ExecProjSpecific(string[] commands) + { + switch (commands[0].ToLower()) + { + case "restart": + case "reset": + DebugConsole.NewMessage("*****************", Color.Lime); + DebugConsole.NewMessage("RESTARTING SERVER", Color.Lime); + DebugConsole.NewMessage("*****************", Color.Lime); + GameMain.Instance.CloseServer(); + GameMain.Instance.StartServer(); + break; + case "exit": + case "close": + case "quit": + GameMain.ShouldRun = false; + break; + case "say": + case "msg": + string text = string.Join(" ", commands.Skip(1)); + if (commands[0].ToLower() == "say") text = "HOST: " + text; + GameMain.Server.SendChatMessage(text, ChatMessageType.Server); + break; + case "servername": + GameMain.Server.Name = string.Join(" ", commands.Skip(1)); + GameMain.NetLobbyScreen.ChangeServerName(string.Join(" ", commands.Skip(1))); + break; + case "servermsg": + GameMain.NetLobbyScreen.ChangeServerMessage(string.Join(" ", commands.Skip(1))); + break; + case "seed": + GameMain.NetLobbyScreen.LevelSeed = string.Join(" ", commands.Skip(1)); + break; + case "gamemode": + { + int index = -1; + if (int.TryParse(string.Join(" ", commands.Skip(1)), out index)) + { + GameMain.NetLobbyScreen.SelectedModeIndex = index; + } + else + { + GameMain.NetLobbyScreen.SelectedModeName = string.Join(" ", commands.Skip(1)); + } + DebugConsole.NewMessage("Set gamemode to " + GameMain.NetLobbyScreen.SelectedModeName, Color.Cyan); + } + break; + case "mission": + { + int index = -1; + if (int.TryParse(string.Join(" ", commands.Skip(1)), out index)) + { + GameMain.NetLobbyScreen.MissionTypeIndex = index; + } + else + { + GameMain.NetLobbyScreen.MissionTypeName = string.Join(" ", commands.Skip(1)); + } + DebugConsole.NewMessage("Set mission to " + GameMain.NetLobbyScreen.MissionTypeName, Color.Cyan); + } + break; + case "sub": + case "submarine": + { + Submarine sub = GameMain.NetLobbyScreen.GetSubList().Find(s => s.Name.ToLower() == string.Join(" ", commands.Skip(1)).ToLower()); + + if (sub != null) + { + GameMain.NetLobbyScreen.SelectedSub = sub; + } + sub = GameMain.NetLobbyScreen.SelectedSub; + DebugConsole.NewMessage("Selected sub: " + sub.Name + (sub.HasTag(SubmarineTag.Shuttle) ? " (shuttle)" : ""), Color.Cyan); + } + break; + case "shuttle": + { + Submarine shuttle = GameMain.NetLobbyScreen.GetSubList().Find(s => s.Name.ToLower() == string.Join(" ", commands.Skip(1)).ToLower()); + + if (shuttle != null) + { + GameMain.NetLobbyScreen.SelectedShuttle = shuttle; + } + shuttle = GameMain.NetLobbyScreen.SelectedShuttle; + DebugConsole.NewMessage("Selected shuttle: " + shuttle.Name + (shuttle.HasTag(SubmarineTag.Shuttle) ? "" : " (not shuttle)"), Color.Cyan); + } + break; + case "startgame": + case "startround": + case "start": + if (Screen.Selected == GameMain.GameScreen) break; + if (!GameMain.Server.StartGame()) NewMessage("Failed to start server",Color.Yellow); + break; + case "endgame": + case "endround": + case "end": + if (Screen.Selected == GameMain.NetLobbyScreen) break; + GameMain.Server.EndGame(); + break; + case "entitydata": + Entity ent = Entity.FindEntityByID(Convert.ToUInt16(commands[1])); + if (ent != null) + { + NewMessage(ent.ToString(), Color.Lime); + } + break; +#if DEBUG + case "eventdata": + ServerEntityEvent ev = GameMain.Server.EntityEventManager.Events[Convert.ToUInt16(commands[1])]; + if (ev != null) + { + NewMessage(ev.StackTrace, Color.Lime); + } + break; +#endif + default: + return false; + break; + } + return true; //command found + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/GameMain.cs b/Barotrauma/BarotraumaServer/Source/GameMain.cs new file mode 100644 index 000000000..066f69790 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/GameMain.cs @@ -0,0 +1,158 @@ +using System; +using System.Diagnostics; +using System.Reflection; +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using Barotrauma.Networking; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using System.Threading; + +namespace Barotrauma +{ + class GameMain + { + public static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version; + + public static World World; + public static GameSettings Config; + + public static GameServer Server; + public const GameClient Client = null; + public static NetworkMember NetworkMember + { + get { return Server as NetworkMember; } + } + + public static GameSession GameSession; + + public static GameMain Instance + { + get; + private set; + } + + //only screens the server implements + public static GameScreen GameScreen; + public static NetLobbyScreen NetLobbyScreen; + + //null screens because they are not implemented by the server, + //but they're checked for all over the place + //TODO: maybe clean up instead of having these constants + public static readonly Screen MainMenuScreen = UnimplementedScreen.Instance; + public static readonly Screen LobbyScreen = UnimplementedScreen.Instance; + + public static readonly Screen ServerListScreen = UnimplementedScreen.Instance; + + public static readonly Screen EditMapScreen = UnimplementedScreen.Instance; + public static readonly Screen EditCharacterScreen = UnimplementedScreen.Instance; + + // + public static bool ShouldRun = true; + + public static ContentPackage SelectedPackage + { + get { return Config.SelectedContentPackage; } + } + + public GameMain() + { + Instance = this; + + World = new World(new Vector2(0, -9.82f)); + FarseerPhysics.Settings.AllowSleep = true; + FarseerPhysics.Settings.ContinuousPhysics = false; + FarseerPhysics.Settings.VelocityIterations = 1; + FarseerPhysics.Settings.PositionIterations = 1; + + Config = new GameSettings("serverconfig.xml"); + if (Config.WasGameUpdated) + { + UpdaterUtil.CleanOldFiles(); + Config.WasGameUpdated = false; + Config.Save("serverconfig.xml"); + } + + GameScreen = new GameScreen(); + } + + public void Init() + { + Mission.Init(); + MapEntityPrefab.Init(); + LevelGenerationParams.LoadPresets(); + + JobPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Jobs)); + StructurePrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Structure)); + + ItemPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Item)); + + GameModePreset.Init(); + + LocationType.Init(); + + Submarine.RefreshSavedSubs(); + + Screen.SelectNull(); + + NetLobbyScreen = new NetLobbyScreen(); + } + + public void StartServer() + { + Server = new GameServer("Dedicated Server Test", 14242, false, "asd", false, 10); + } + + public void CloseServer() + { + Server.Disconnect(); + Server = null; + } + + public void Run() + { + Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Character)); + Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Item)); + Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Items.Components.ItemComponent)); + Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Hull)); + + Init(); + StartServer(); + + DateTime prevTime = DateTime.Now; + + while (ShouldRun) + { + prevTime = DateTime.Now; + + DebugConsole.Update(); + if (Screen.Selected != null) Screen.Selected.Update((float)Timing.Step); + Server.Update((float)Timing.Step); + CoroutineManager.Update((float)Timing.Step, (float)Timing.Step); + + int frameTime = DateTime.Now.Subtract(prevTime).Milliseconds; + Thread.Sleep(Math.Max((int)(Timing.Step * 1000.0) - frameTime,0)); + } + + CloseServer(); + + } + + public void ProcessInput() + { + while (true) + { + string input = Console.ReadLine(); + lock (DebugConsole.QueuedCommands) + { + DebugConsole.QueuedCommands.Add(input); + } + } + } + + public CoroutineHandle ShowLoading(IEnumerable loader, bool waitKeyHit = true) + { + return CoroutineManager.StartCoroutine(loader); + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/GameSession/GameSession.cs b/Barotrauma/BarotraumaServer/Source/GameSession/GameSession.cs new file mode 100644 index 000000000..fd607435e --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/GameSession/GameSession.cs @@ -0,0 +1,12 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Xml.Linq; + +namespace Barotrauma +{ + partial class GameSession + { + public const Map Map = null; + } +} diff --git a/Barotrauma/BarotraumaServer/Source/GameSettings.cs b/Barotrauma/BarotraumaServer/Source/GameSettings.cs new file mode 100644 index 000000000..ccbabfb26 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/GameSettings.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace Barotrauma +{ + public enum WindowMode + { + Windowed, Fullscreen, BorderlessWindowed + } + + public partial class GameSettings + { + public void Save(string filePath) + { + XDocument doc = new XDocument(); + + if (doc.Root == null) + { + doc.Add(new XElement("config")); + } + + doc.Root.Add( + new XAttribute("masterserverurl", MasterServerUrl), + new XAttribute("autocheckupdates", AutoCheckUpdates), + new XAttribute("verboselogging", VerboseLogging)); + + if (WasGameUpdated) + { + doc.Root.Add(new XAttribute("wasgameupdated", true)); + } + + if (SelectedContentPackage != null) + { + doc.Root.Add(new XElement("contentpackage", + new XAttribute("path", SelectedContentPackage.Path))); + } + + doc.Save(filePath); + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaServer/Source/Items/Components/ItemComponent.cs new file mode 100644 index 000000000..87844a6c6 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Items/Components/ItemComponent.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Barotrauma.Networking; +using System.IO; + +namespace Barotrauma.Items.Components +{ + partial class ItemComponent : IPropertyObject + { + private bool LoadElemProjSpecific(XElement subElement) + { + switch (subElement.Name.ToString().ToLowerInvariant()) + { + case "guiframe": + break; + case "sound": + break; + default: + return false; //unknown element + } + return true; //element processed + } + } + +} diff --git a/Barotrauma/BarotraumaServer/Source/Items/Components/ItemLabel.cs b/Barotrauma/BarotraumaServer/Source/Items/Components/ItemLabel.cs new file mode 100644 index 000000000..d402d04be --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Items/Components/ItemLabel.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework; +using System.Xml.Linq; + +namespace Barotrauma.Items.Components +{ + partial class ItemLabel : ItemComponent, IDrawableComponent + { + [HasDefaultValue("", true), Editable(100)] + public string Text + { + get; + set; + } + + [Editable, HasDefaultValue("0.0,0.0,0.0,1.0", true)] + public string TextColor + { + get; + set; + } + + [Editable, HasDefaultValue(1.0f, true)] + public float TextScale + { + get; + set; + } + + public override void Move(Vector2 amount) + { + //do nothing + } + + public ItemLabel(Item item, XElement element) + : base(item, element) + { + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Items/Components/Machines/Steering.cs b/Barotrauma/BarotraumaServer/Source/Items/Components/Machines/Steering.cs new file mode 100644 index 000000000..bfc446b67 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Items/Components/Machines/Steering.cs @@ -0,0 +1,21 @@ +using Barotrauma.Networking; +using FarseerPhysics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Xml.Linq; +using Voronoi2; + +namespace Barotrauma.Items.Components +{ + partial class Steering : Powered, IServerSerializable, IClientSerializable + { + public bool MaintainPos; + public bool LevelStartSelected; + public bool LevelEndSelected; + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Map/Hull.cs b/Barotrauma/BarotraumaServer/Source/Map/Hull.cs new file mode 100644 index 000000000..b8e392291 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Map/Hull.cs @@ -0,0 +1,16 @@ +using FarseerPhysics.Dynamics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Lidgren.Network; +using Barotrauma.Networking; + +namespace Barotrauma +{ + partial class Hull : MapEntity, IPropertyObject, IServerSerializable + { + public override bool IsMouseOn(Vector2 position) + { + return false; + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaServer/Source/Networking/GameClient.cs new file mode 100644 index 000000000..253738e8d --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Networking/GameClient.cs @@ -0,0 +1,19 @@ +using System; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.ComponentModel; +using System.Linq; + +namespace Barotrauma.Networking +{ + class GameClient : NetworkMember + { + public GameClient(string newName) + { + throw new Exception("Tried to create GameClient in dedicated server build"); + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs new file mode 100644 index 000000000..bca8dad3c --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using RestSharp; +using Barotrauma.Items.Components; + +namespace Barotrauma.Networking +{ + partial class GameServer : NetworkMember + { + void InitProjSpecific() + { + //do nothing + } + + void InitUPnP() + { + server.UPnP.ForwardPort(config.Port, "barotrauma"); + } + + bool DiscoveringUPnP() + { + return server.UPnP.Status == UPnPStatus.Discovering; + } + + void FinishUPnP() + { + //do nothing + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Networking/NetworkMember.cs b/Barotrauma/BarotraumaServer/Source/Networking/NetworkMember.cs new file mode 100644 index 000000000..960fd2909 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Networking/NetworkMember.cs @@ -0,0 +1,32 @@ +using System; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Lidgren.Network; +using Barotrauma.Items.Components; + +namespace Barotrauma.Networking +{ + abstract partial class NetworkMember + { + protected const CharacterInfo characterInfo = null; + + protected const Character myCharacter = null; + + public CharacterInfo CharacterInfo + { + get { return null; } + } + + public Character Character + { + get { return null; } + } + + private void InitProjSpecific() + { + //do nothing + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Networking/Voting.cs b/Barotrauma/BarotraumaServer/Source/Networking/Voting.cs new file mode 100644 index 000000000..9b64e7198 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Networking/Voting.cs @@ -0,0 +1,25 @@ +using Barotrauma.Networking; +using Lidgren.Network; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Barotrauma +{ + partial class Voting + { + public bool AllowSubVoting + { + get { return allowSubVoting; } + set { allowSubVoting = value; } + } + public bool AllowModeVoting + { + get { return allowModeVoting; } + set { allowModeVoting = value; } + } + + } +} diff --git a/Barotrauma/BarotraumaServer/Source/PlayerInput.cs b/Barotrauma/BarotraumaServer/Source/PlayerInput.cs new file mode 100644 index 000000000..e915284bd --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/PlayerInput.cs @@ -0,0 +1,134 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace Barotrauma +{ + public static class PlayerInput + { + public static Keys selectKey = Keys.E; + + public static Vector2 MousePosition + { + get { return Vector2.Zero; } + } + + public static Vector2 LatestMousePosition + { + get { return Vector2.Zero; } + } + + //public static MouseState GetMouseState + //{ + // get { return mouseState; } + //} + //public static MouseState GetOldMouseState + //{ + // get { return oldMouseState; } + //} + + public static bool MouseInsideWindow + { + get { return false; } + } + + public static Vector2 MouseSpeed + { + get + { + return Vector2.Zero; + } + } + + public static KeyboardState GetKeyboardState + { + get { return new KeyboardState(); } + } + + public static KeyboardState GetOldKeyboardState + { + get { return new KeyboardState(); } + } + + public static int ScrollWheelSpeed + { + get { return 0; } + + } + + public static bool LeftButtonHeld() + { + return false; + } + + public static bool LeftButtonDown() + { + return false; + } + + public static bool LeftButtonReleased() + { + return false; + } + + + public static bool LeftButtonClicked() + { + return false; + } + + public static bool RightButtonHeld() + { + return false; + } + + public static bool RightButtonClicked() + { + return false; + } + + public static bool DoubleClicked() + { + return false; + } + + public static bool KeyHit(InputType inputType) + { + return false; + } + + public static bool KeyDown(InputType inputType) + { + return false; + } + + public static bool KeyUp(InputType inputType) + { + return false; + } + + public static bool KeyHit(Keys button) + { + return false; + } + + public static bool KeyDown(Keys button) + { + return false; + } + + public static bool KeyUp(Keys button) + { + return false; + } + + public static void Update(double deltaTime) + { + + } + + public static void UpdateVariable() + { + + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Program.cs b/Barotrauma/BarotraumaServer/Source/Program.cs new file mode 100644 index 000000000..46cf9171b --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Program.cs @@ -0,0 +1,92 @@ +#region Using Statements + +using System; +using System.IO; +using System.Reflection; +using System.Text; +using System.Threading; + +#if WINDOWS +using System.Management; +#endif + +#endregion + +namespace Barotrauma +{ +#if WINDOWS || LINUX + /// + /// The main class. + /// + public static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + GameMain game = null; + Thread inputThread = null; + + try + { + game = new GameMain(); + inputThread = new Thread(new ThreadStart(game.ProcessInput)); + inputThread.Start(); + game.Run(); + inputThread.Abort(); inputThread.Join(); + } + catch (Exception e) + { + CrashDump(game, "servercrashreport.txt", e); + inputThread.Abort(); inputThread.Join(); + } + } + + static void CrashDump(GameMain game, string filePath, Exception exception) + { + StreamWriter sw = new StreamWriter(filePath); + + StringBuilder sb = new StringBuilder(); + sb.AppendLine("Barotrauma Dedicated Server crash report (generated on " + DateTime.Now + ")"); + sb.AppendLine("\n"); + sb.AppendLine("Barotrauma seems to have crashed. Sorry for the inconvenience! "); + sb.AppendLine("If you'd like to help fix the bug that caused the crash, please send this file to the developers on the Undertow Games forums."); + sb.AppendLine("\n"); + sb.AppendLine("Game version " + GameMain.Version); + sb.AppendLine("Selected content package: " + GameMain.SelectedPackage.Name); + sb.AppendLine("Level seed: " + ((Level.Loaded == null) ? "no level loaded" : Level.Loaded.Seed)); + sb.AppendLine("Loaded submarine: " + ((Submarine.MainSub == null) ? "None" : Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash + ")")); + sb.AppendLine("Selected screen: " + (Screen.Selected == null ? "None" : Screen.Selected.ToString())); + + if (GameMain.Server != null) + { + sb.AppendLine("Server (" + (GameMain.Server.GameStarted ? "Round had started)" : "Round hadn't been started)")); + } + + sb.AppendLine("\n"); + sb.AppendLine("System info:"); + sb.AppendLine(" Operating system: " + System.Environment.OSVersion + (System.Environment.Is64BitOperatingSystem ? " 64 bit" : " x86")); + sb.AppendLine("\n"); + sb.AppendLine("Exception: "+exception.Message); + sb.AppendLine("Target site: " +exception.TargetSite.ToString()); + sb.AppendLine("Stack trace: "); + sb.AppendLine(exception.StackTrace); + sb.AppendLine("\n"); + + sb.AppendLine("Last debug messages:"); + for (int i = DebugConsole.Messages.Count - 1; i > 0 && i > DebugConsole.Messages.Count - 15; i-- ) + { + sb.AppendLine(" "+DebugConsole.Messages[i].Time+" - "+DebugConsole.Messages[i].Text); + } + + Console.ForegroundColor = ConsoleColor.Red; + Console.Write(sb.ToString()); + + sw.WriteLine(sb.ToString()); + sw.Close(); + } + } +#endif +} diff --git a/Barotrauma/BarotraumaServer/Source/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaServer/Source/Screens/NetLobbyScreen.cs new file mode 100644 index 000000000..5b57c9d39 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Screens/NetLobbyScreen.cs @@ -0,0 +1,160 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Barotrauma.Networking; +using System.Linq; +using System.Collections.Generic; +using System.Reflection; +using System.ComponentModel; + +namespace Barotrauma +{ + partial class NetLobbyScreen : Screen + { + private Submarine selectedSub; + private Submarine selectedShuttle; + + public Submarine SelectedSub + { + get { return selectedSub; } + set { selectedSub = value; lastUpdateID++; } + } + public Submarine SelectedShuttle + { + get { return selectedShuttle; } + set { selectedShuttle = value; lastUpdateID++; } + } + + private GameModePreset[] GameModes; + + private int selectedModeIndex; + public int SelectedModeIndex + { + get { return selectedModeIndex; } + set { + lastUpdateID++; + selectedModeIndex = Math.Max(0, Math.Min(GameModes.Count()-1, value)); + } + } + + public string SelectedModeName + { + get { return GameModes[SelectedModeIndex].Name; } + set + { + for (int i = 0; i < GameModes.Count(); i++) + { + if (GameModes[i].Name.ToLower() == value.ToLower()) + { + SelectedModeIndex = i; + break; + } + } + } + } + + public GameModePreset SelectedMode + { + get { return GameModes[SelectedModeIndex]; } + } + + public string ServerMessageText; + + private int missionTypeIndex; + public int MissionTypeIndex + { + get { return missionTypeIndex; } + set { + lastUpdateID++; + missionTypeIndex = Math.Max(0, Math.Min(Mission.MissionTypes.Count()-1, value)); + } + } + + public string MissionTypeName + { + get { return Mission.MissionTypes[MissionTypeIndex]; } + set + { + for (int i = 0; i < Mission.MissionTypes.Count(); i++) + { + if (Mission.MissionTypes[i].ToLower() == value.ToLower()) + { + MissionTypeIndex = i; + break; + } + } + } + } + + public void ChangeServerName(string n) + { + ServerName = n; lastUpdateID++; + } + + public void ChangeServerMessage(string m) + { + ServerMessageText = m; lastUpdateID++; + } + + public List JobPreferences + { + get + { + return null; + } + } + + public NetLobbyScreen() + { + LevelSeed = ToolBox.RandomSeed(8); + + subs = Submarine.SavedSubmarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus)).ToList(); + + if (subs == null || subs.Count()==0) + { + throw new Exception("No submarines are available."); + } + + selectedSub = subs.First(s => !s.HasTag(SubmarineTag.Shuttle)); + selectedShuttle = subs.First(s => s.HasTag(SubmarineTag.Shuttle)); + + DebugConsole.NewMessage("Selected sub: " + SelectedSub.Name, Color.White); + DebugConsole.NewMessage("Selected shuttle: " + SelectedShuttle.Name, Color.White); + + GameModes = GameModePreset.list.ToArray(); + } + + public override void Select() + { + base.Select(); + } + + private List subs; + public List GetSubList() + { + return subs; + } + + public string LevelSeed + { + get + { + return levelSeed; + } + set + { + if (levelSeed == value) return; + + lastUpdateID++; + levelSeed = value; + LocationType.Random(levelSeed); //call to sync up with clients + } + } + + public bool StartButtonEnabled + { + get { return true; } + set { /* do nothing */ } + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Screens/UnimplementedScreen.cs b/Barotrauma/BarotraumaServer/Source/Screens/UnimplementedScreen.cs new file mode 100644 index 000000000..0c00104da --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Screens/UnimplementedScreen.cs @@ -0,0 +1,21 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Barotrauma.Networking; +using System.Linq; +using System.Collections.Generic; +using System.Reflection; +using System.ComponentModel; + +namespace Barotrauma +{ + class UnimplementedScreen : Screen + { + public static readonly UnimplementedScreen Instance = new UnimplementedScreen(); + + public override void Select() + { + throw new Exception("Tried to select unimplemented screen"); + } + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Color.cs b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Color.cs new file mode 100644 index 000000000..35d05167f --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Color.cs @@ -0,0 +1,1856 @@ +// MIT License - Copyright (C) The Mono.Xna Team +// This file is subject to the terms and conditions defined in +// file 'LICENSE.txt', which is part of this source code package. + +// Modified by juanjp600 to remove LerpPrecise, as it is not +// available in Farseer's implementation of MathHelper. + +using System; +using System.Text; +using System.Runtime.Serialization; +using System.Diagnostics; + +namespace Microsoft.Xna.Framework +{ + /// + /// Describes a 32-bit packed color. + /// + [DebuggerDisplay("{DebugDisplayString,nq}")] + public struct Color : IEquatable + { + static Color() + { + TransparentBlack = new Color(0); + Transparent = new Color(0); + AliceBlue = new Color(0xfffff8f0); + AntiqueWhite = new Color(0xffd7ebfa); + Aqua = new Color(0xffffff00); + Aquamarine = new Color(0xffd4ff7f); + Azure = new Color(0xfffffff0); + Beige = new Color(0xffdcf5f5); + Bisque = new Color(0xffc4e4ff); + Black = new Color(0xff000000); + BlanchedAlmond = new Color(0xffcdebff); + Blue = new Color(0xffff0000); + BlueViolet = new Color(0xffe22b8a); + Brown = new Color(0xff2a2aa5); + BurlyWood = new Color(0xff87b8de); + CadetBlue = new Color(0xffa09e5f); + Chartreuse = new Color(0xff00ff7f); + Chocolate = new Color(0xff1e69d2); + Coral = new Color(0xff507fff); + CornflowerBlue = new Color(0xffed9564); + Cornsilk = new Color(0xffdcf8ff); + Crimson = new Color(0xff3c14dc); + Cyan = new Color(0xffffff00); + DarkBlue = new Color(0xff8b0000); + DarkCyan = new Color(0xff8b8b00); + DarkGoldenrod = new Color(0xff0b86b8); + DarkGray = new Color(0xffa9a9a9); + DarkGreen = new Color(0xff006400); + DarkKhaki = new Color(0xff6bb7bd); + DarkMagenta = new Color(0xff8b008b); + DarkOliveGreen = new Color(0xff2f6b55); + DarkOrange = new Color(0xff008cff); + DarkOrchid = new Color(0xffcc3299); + DarkRed = new Color(0xff00008b); + DarkSalmon = new Color(0xff7a96e9); + DarkSeaGreen = new Color(0xff8bbc8f); + DarkSlateBlue = new Color(0xff8b3d48); + DarkSlateGray = new Color(0xff4f4f2f); + DarkTurquoise = new Color(0xffd1ce00); + DarkViolet = new Color(0xffd30094); + DeepPink = new Color(0xff9314ff); + DeepSkyBlue = new Color(0xffffbf00); + DimGray = new Color(0xff696969); + DodgerBlue = new Color(0xffff901e); + Firebrick = new Color(0xff2222b2); + FloralWhite = new Color(0xfff0faff); + ForestGreen = new Color(0xff228b22); + Fuchsia = new Color(0xffff00ff); + Gainsboro = new Color(0xffdcdcdc); + GhostWhite = new Color(0xfffff8f8); + Gold = new Color(0xff00d7ff); + Goldenrod = new Color(0xff20a5da); + Gray = new Color(0xff808080); + Green = new Color(0xff008000); + GreenYellow = new Color(0xff2fffad); + Honeydew = new Color(0xfff0fff0); + HotPink = new Color(0xffb469ff); + IndianRed = new Color(0xff5c5ccd); + Indigo = new Color(0xff82004b); + Ivory = new Color(0xfff0ffff); + Khaki = new Color(0xff8ce6f0); + Lavender = new Color(0xfffae6e6); + LavenderBlush = new Color(0xfff5f0ff); + LawnGreen = new Color(0xff00fc7c); + LemonChiffon = new Color(0xffcdfaff); + LightBlue = new Color(0xffe6d8ad); + LightCoral = new Color(0xff8080f0); + LightCyan = new Color(0xffffffe0); + LightGoldenrodYellow = new Color(0xffd2fafa); + LightGray = new Color(0xffd3d3d3); + LightGreen = new Color(0xff90ee90); + LightPink = new Color(0xffc1b6ff); + LightSalmon = new Color(0xff7aa0ff); + LightSeaGreen = new Color(0xffaab220); + LightSkyBlue = new Color(0xffface87); + LightSlateGray = new Color(0xff998877); + LightSteelBlue = new Color(0xffdec4b0); + LightYellow = new Color(0xffe0ffff); + Lime = new Color(0xff00ff00); + LimeGreen = new Color(0xff32cd32); + Linen = new Color(0xffe6f0fa); + Magenta = new Color(0xffff00ff); + Maroon = new Color(0xff000080); + MediumAquamarine = new Color(0xffaacd66); + MediumBlue = new Color(0xffcd0000); + MediumOrchid = new Color(0xffd355ba); + MediumPurple = new Color(0xffdb7093); + MediumSeaGreen = new Color(0xff71b33c); + MediumSlateBlue = new Color(0xffee687b); + MediumSpringGreen = new Color(0xff9afa00); + MediumTurquoise = new Color(0xffccd148); + MediumVioletRed = new Color(0xff8515c7); + MidnightBlue = new Color(0xff701919); + MintCream = new Color(0xfffafff5); + MistyRose = new Color(0xffe1e4ff); + Moccasin = new Color(0xffb5e4ff); + MonoGameOrange = new Color(0xff003ce7); + NavajoWhite = new Color(0xffaddeff); + Navy = new Color(0xff800000); + OldLace = new Color(0xffe6f5fd); + Olive = new Color(0xff008080); + OliveDrab = new Color(0xff238e6b); + Orange = new Color(0xff00a5ff); + OrangeRed = new Color(0xff0045ff); + Orchid = new Color(0xffd670da); + PaleGoldenrod = new Color(0xffaae8ee); + PaleGreen = new Color(0xff98fb98); + PaleTurquoise = new Color(0xffeeeeaf); + PaleVioletRed = new Color(0xff9370db); + PapayaWhip = new Color(0xffd5efff); + PeachPuff = new Color(0xffb9daff); + Peru = new Color(0xff3f85cd); + Pink = new Color(0xffcbc0ff); + Plum = new Color(0xffdda0dd); + PowderBlue = new Color(0xffe6e0b0); + Purple = new Color(0xff800080); + Red = new Color(0xff0000ff); + RosyBrown = new Color(0xff8f8fbc); + RoyalBlue = new Color(0xffe16941); + SaddleBrown = new Color(0xff13458b); + Salmon= new Color(0xff7280fa); + SandyBrown = new Color(0xff60a4f4); + SeaGreen = new Color(0xff578b2e); + SeaShell = new Color(0xffeef5ff); + Sienna = new Color(0xff2d52a0); + Silver = new Color(0xffc0c0c0); + SkyBlue = new Color(0xffebce87); + SlateBlue= new Color(0xffcd5a6a); + SlateGray= new Color(0xff908070); + Snow= new Color(0xfffafaff); + SpringGreen= new Color(0xff7fff00); + SteelBlue= new Color(0xffb48246); + Tan= new Color(0xff8cb4d2); + Teal= new Color(0xff808000); + Thistle= new Color(0xffd8bfd8); + Tomato= new Color(0xff4763ff); + Turquoise= new Color(0xffd0e040); + Violet= new Color(0xffee82ee); + Wheat= new Color(0xffb3def5); + White= new Color(uint.MaxValue); + WhiteSmoke= new Color(0xfff5f5f5); + Yellow = new Color(0xff00ffff); + YellowGreen = new Color(0xff32cd9a); + } + + // Stored as RGBA with R in the least significant octet: + // |-------|-------|-------|------- + // A B G R + private uint _packedValue; + + /// + /// Constructs an RGBA color from a packed value. + /// The value is a 32-bit unsigned integer, with R in the least significant octet. + /// + /// The packed value. + [CLSCompliant(false)] + public Color(uint packedValue) + { + _packedValue = packedValue; + } + + /// + /// Constructs an RGBA color from the XYZW unit length components of a vector. + /// + /// A representing color. + public Color(Vector4 color) + : this((int)(color.X * 255), (int)(color.Y * 255), (int)(color.Z * 255), (int)(color.W * 255)) + { + } + + /// + /// Constructs an RGBA color from the XYZ unit length components of a vector. Alpha value will be opaque. + /// + /// A representing color. + public Color(Vector3 color) + : this((int)(color.X * 255), (int)(color.Y * 255), (int)(color.Z * 255)) + { + } + + /// + /// Constructs an RGBA color from a and an alpha value. + /// + /// A for RGB values of new instance. + /// The alpha component value from 0 to 255. + public Color(Color color, int alpha) + { + if ((alpha & 0xFFFFFF00) != 0) + { + var clampedA = (uint)MathHelper.Clamp(alpha, Byte.MinValue, Byte.MaxValue); + + _packedValue = (color._packedValue & 0x00FFFFFF) | (clampedA << 24); + } + else + { + _packedValue = (color._packedValue & 0x00FFFFFF) | ((uint)alpha << 24); + } + } + + /// + /// Constructs an RGBA color from color and alpha value. + /// + /// A for RGB values of new instance. + /// Alpha component value from 0.0f to 1.0f. + public Color(Color color, float alpha): + this(color, (int)(alpha * 255)) + { + } + + /// + /// Constructs an RGBA color from scalars representing red, green and blue values. Alpha value will be opaque. + /// + /// Red component value from 0.0f to 1.0f. + /// Green component value from 0.0f to 1.0f. + /// Blue component value from 0.0f to 1.0f. + public Color(float r, float g, float b) + : this((int)(r * 255), (int)(g * 255), (int)(b * 255)) + { + } + + /// + /// Constructs an RGBA color from scalars representing red, green, blue and alpha values. + /// + /// Red component value from 0.0f to 1.0f. + /// Green component value from 0.0f to 1.0f. + /// Blue component value from 0.0f to 1.0f. + /// Alpha component value from 0.0f to 1.0f. + public Color(float r, float g, float b, float alpha) + : this((int)(r * 255), (int)(g * 255), (int)(b * 255), (int)(alpha * 255)) + { + } + + /// + /// Constructs an RGBA color from scalars representing red, green and blue values. Alpha value will be opaque. + /// + /// Red component value from 0 to 255. + /// Green component value from 0 to 255. + /// Blue component value from 0 to 255. + public Color(int r, int g, int b) + { + _packedValue = 0xFF000000; // A = 255 + + if (((r | g | b) & 0xFFFFFF00) != 0) + { + var clampedR = (uint)MathHelper.Clamp(r, Byte.MinValue, Byte.MaxValue); + var clampedG = (uint)MathHelper.Clamp(g, Byte.MinValue, Byte.MaxValue); + var clampedB = (uint)MathHelper.Clamp(b, Byte.MinValue, Byte.MaxValue); + + _packedValue |= (clampedB << 16) | (clampedG << 8) | (clampedR); + } + else + { + _packedValue |= ((uint)b << 16) | ((uint)g << 8) | ((uint)r); + } + } + + /// + /// Constructs an RGBA color from scalars representing red, green, blue and alpha values. + /// + /// Red component value from 0 to 255. + /// Green component value from 0 to 255. + /// Blue component value from 0 to 255. + /// Alpha component value from 0 to 255. + public Color(int r, int g, int b, int alpha) + { + if (((r | g | b | alpha) & 0xFFFFFF00) != 0) + { + var clampedR = (uint)MathHelper.Clamp(r, Byte.MinValue, Byte.MaxValue); + var clampedG = (uint)MathHelper.Clamp(g, Byte.MinValue, Byte.MaxValue); + var clampedB = (uint)MathHelper.Clamp(b, Byte.MinValue, Byte.MaxValue); + var clampedA = (uint)MathHelper.Clamp(alpha, Byte.MinValue, Byte.MaxValue); + + _packedValue = (clampedA << 24) | (clampedB << 16) | (clampedG << 8) | (clampedR); + } + else + { + _packedValue = ((uint)alpha << 24) | ((uint)b << 16) | ((uint)g << 8) | ((uint)r); + } + } + + /// + /// Constructs an RGBA color from scalars representing red, green, blue and alpha values. + /// + /// + /// This overload sets the values directly without clamping, and may therefore be faster than the other overloads. + /// + /// + /// + /// + /// + public Color(byte r, byte g, byte b, byte alpha) + { + _packedValue = ((uint)alpha << 24) | ((uint)b << 16) | ((uint)g << 8) | (r); + } + + /// + /// Gets or sets the blue component. + /// + public byte B + { + get + { + unchecked + { + return (byte) (this._packedValue >> 16); + } + } + set + { + this._packedValue = (this._packedValue & 0xff00ffff) | ((uint)value << 16); + } + } + + /// + /// Gets or sets the green component. + /// + public byte G + { + get + { + unchecked + { + return (byte)(this._packedValue >> 8); + } + } + set + { + this._packedValue = (this._packedValue & 0xffff00ff) | ((uint)value << 8); + } + } + + /// + /// Gets or sets the red component. + /// + public byte R + { + get + { + unchecked + { + return (byte) this._packedValue; + } + } + set + { + this._packedValue = (this._packedValue & 0xffffff00) | value; + } + } + + /// + /// Gets or sets the alpha component. + /// + public byte A + { + get + { + unchecked + { + return (byte)(this._packedValue >> 24); + } + } + set + { + this._packedValue = (this._packedValue & 0x00ffffff) | ((uint)value << 24); + } + } + + /// + /// Compares whether two instances are equal. + /// + /// instance on the left of the equal sign. + /// instance on the right of the equal sign. + /// true if the instances are equal; false otherwise. + public static bool operator ==(Color a, Color b) + { + return (a._packedValue == b._packedValue); + } + + /// + /// Compares whether two instances are not equal. + /// + /// instance on the left of the not equal sign. + /// instance on the right of the not equal sign. + /// true if the instances are not equal; false otherwise. + public static bool operator !=(Color a, Color b) + { + return (a._packedValue != b._packedValue); + } + + /// + /// Gets the hash code of this . + /// + /// Hash code of this . + public override int GetHashCode() + { + return this._packedValue.GetHashCode(); + } + + /// + /// Compares whether current instance is equal to specified object. + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public override bool Equals(object obj) + { + return ((obj is Color) && this.Equals((Color)obj)); + } + + #region Color Bank + /// + /// TransparentBlack color (R:0,G:0,B:0,A:0). + /// + public static Color TransparentBlack + { + get; + private set; + } + + /// + /// Transparent color (R:0,G:0,B:0,A:0). + /// + public static Color Transparent + { + get; + private set; + } + + /// + /// AliceBlue color (R:240,G:248,B:255,A:255). + /// + public static Color AliceBlue + { + get; + private set; + } + + /// + /// AntiqueWhite color (R:250,G:235,B:215,A:255). + /// + public static Color AntiqueWhite + { + get; + private set; + } + + /// + /// Aqua color (R:0,G:255,B:255,A:255). + /// + public static Color Aqua + { + get; + private set; + } + + /// + /// Aquamarine color (R:127,G:255,B:212,A:255). + /// + public static Color Aquamarine + { + get; + private set; + } + + /// + /// Azure color (R:240,G:255,B:255,A:255). + /// + public static Color Azure + { + get; + private set; + } + + /// + /// Beige color (R:245,G:245,B:220,A:255). + /// + public static Color Beige + { + get; + private set; + } + + /// + /// Bisque color (R:255,G:228,B:196,A:255). + /// + public static Color Bisque + { + get; + private set; + } + + /// + /// Black color (R:0,G:0,B:0,A:255). + /// + public static Color Black + { + get; + private set; + } + + /// + /// BlanchedAlmond color (R:255,G:235,B:205,A:255). + /// + public static Color BlanchedAlmond + { + get; + private set; + } + + /// + /// Blue color (R:0,G:0,B:255,A:255). + /// + public static Color Blue + { + get; + private set; + } + + /// + /// BlueViolet color (R:138,G:43,B:226,A:255). + /// + public static Color BlueViolet + { + get; + private set; + } + + /// + /// Brown color (R:165,G:42,B:42,A:255). + /// + public static Color Brown + { + get; + private set; + } + + /// + /// BurlyWood color (R:222,G:184,B:135,A:255). + /// + public static Color BurlyWood + { + get; + private set; + } + + /// + /// CadetBlue color (R:95,G:158,B:160,A:255). + /// + public static Color CadetBlue + { + get; + private set; + } + + /// + /// Chartreuse color (R:127,G:255,B:0,A:255). + /// + public static Color Chartreuse + { + get; + private set; + } + + /// + /// Chocolate color (R:210,G:105,B:30,A:255). + /// + public static Color Chocolate + { + get; + private set; + } + + /// + /// Coral color (R:255,G:127,B:80,A:255). + /// + public static Color Coral + { + get; + private set; + } + + /// + /// CornflowerBlue color (R:100,G:149,B:237,A:255). + /// + public static Color CornflowerBlue + { + get; + private set; + } + + /// + /// Cornsilk color (R:255,G:248,B:220,A:255). + /// + public static Color Cornsilk + { + get; + private set; + } + + /// + /// Crimson color (R:220,G:20,B:60,A:255). + /// + public static Color Crimson + { + get; + private set; + } + + /// + /// Cyan color (R:0,G:255,B:255,A:255). + /// + public static Color Cyan + { + get; + private set; + } + + /// + /// DarkBlue color (R:0,G:0,B:139,A:255). + /// + public static Color DarkBlue + { + get; + private set; + } + + /// + /// DarkCyan color (R:0,G:139,B:139,A:255). + /// + public static Color DarkCyan + { + get; + private set; + } + + /// + /// DarkGoldenrod color (R:184,G:134,B:11,A:255). + /// + public static Color DarkGoldenrod + { + get; + private set; + } + + /// + /// DarkGray color (R:169,G:169,B:169,A:255). + /// + public static Color DarkGray + { + get; + private set; + } + + /// + /// DarkGreen color (R:0,G:100,B:0,A:255). + /// + public static Color DarkGreen + { + get; + private set; + } + + /// + /// DarkKhaki color (R:189,G:183,B:107,A:255). + /// + public static Color DarkKhaki + { + get; + private set; + } + + /// + /// DarkMagenta color (R:139,G:0,B:139,A:255). + /// + public static Color DarkMagenta + { + get; + private set; + } + + /// + /// DarkOliveGreen color (R:85,G:107,B:47,A:255). + /// + public static Color DarkOliveGreen + { + get; + private set; + } + + /// + /// DarkOrange color (R:255,G:140,B:0,A:255). + /// + public static Color DarkOrange + { + get; + private set; + } + + /// + /// DarkOrchid color (R:153,G:50,B:204,A:255). + /// + public static Color DarkOrchid + { + get; + private set; + } + + /// + /// DarkRed color (R:139,G:0,B:0,A:255). + /// + public static Color DarkRed + { + get; + private set; + } + + /// + /// DarkSalmon color (R:233,G:150,B:122,A:255). + /// + public static Color DarkSalmon + { + get; + private set; + } + + /// + /// DarkSeaGreen color (R:143,G:188,B:139,A:255). + /// + public static Color DarkSeaGreen + { + get; + private set; + } + + /// + /// DarkSlateBlue color (R:72,G:61,B:139,A:255). + /// + public static Color DarkSlateBlue + { + get; + private set; + } + + /// + /// DarkSlateGray color (R:47,G:79,B:79,A:255). + /// + public static Color DarkSlateGray + { + get; + private set; + } + + /// + /// DarkTurquoise color (R:0,G:206,B:209,A:255). + /// + public static Color DarkTurquoise + { + get; + private set; + } + + /// + /// DarkViolet color (R:148,G:0,B:211,A:255). + /// + public static Color DarkViolet + { + get; + private set; + } + + /// + /// DeepPink color (R:255,G:20,B:147,A:255). + /// + public static Color DeepPink + { + get; + private set; + } + + /// + /// DeepSkyBlue color (R:0,G:191,B:255,A:255). + /// + public static Color DeepSkyBlue + { + get; + private set; + } + + /// + /// DimGray color (R:105,G:105,B:105,A:255). + /// + public static Color DimGray + { + get; + private set; + } + + /// + /// DodgerBlue color (R:30,G:144,B:255,A:255). + /// + public static Color DodgerBlue + { + get; + private set; + } + + /// + /// Firebrick color (R:178,G:34,B:34,A:255). + /// + public static Color Firebrick + { + get; + private set; + } + + /// + /// FloralWhite color (R:255,G:250,B:240,A:255). + /// + public static Color FloralWhite + { + get; + private set; + } + + /// + /// ForestGreen color (R:34,G:139,B:34,A:255). + /// + public static Color ForestGreen + { + get; + private set; + } + + /// + /// Fuchsia color (R:255,G:0,B:255,A:255). + /// + public static Color Fuchsia + { + get; + private set; + } + + /// + /// Gainsboro color (R:220,G:220,B:220,A:255). + /// + public static Color Gainsboro + { + get; + private set; + } + + /// + /// GhostWhite color (R:248,G:248,B:255,A:255). + /// + public static Color GhostWhite + { + get; + private set; + } + /// + /// Gold color (R:255,G:215,B:0,A:255). + /// + public static Color Gold + { + get; + private set; + } + + /// + /// Goldenrod color (R:218,G:165,B:32,A:255). + /// + public static Color Goldenrod + { + get; + private set; + } + + /// + /// Gray color (R:128,G:128,B:128,A:255). + /// + public static Color Gray + { + get; + private set; + } + + /// + /// Green color (R:0,G:128,B:0,A:255). + /// + public static Color Green + { + get; + private set; + } + + /// + /// GreenYellow color (R:173,G:255,B:47,A:255). + /// + public static Color GreenYellow + { + get; + private set; + } + + /// + /// Honeydew color (R:240,G:255,B:240,A:255). + /// + public static Color Honeydew + { + get; + private set; + } + + /// + /// HotPink color (R:255,G:105,B:180,A:255). + /// + public static Color HotPink + { + get; + private set; + } + + /// + /// IndianRed color (R:205,G:92,B:92,A:255). + /// + public static Color IndianRed + { + get; + private set; + } + + /// + /// Indigo color (R:75,G:0,B:130,A:255). + /// + public static Color Indigo + { + get; + private set; + } + + /// + /// Ivory color (R:255,G:255,B:240,A:255). + /// + public static Color Ivory + { + get; + private set; + } + + /// + /// Khaki color (R:240,G:230,B:140,A:255). + /// + public static Color Khaki + { + get; + private set; + } + + /// + /// Lavender color (R:230,G:230,B:250,A:255). + /// + public static Color Lavender + { + get; + private set; + } + + /// + /// LavenderBlush color (R:255,G:240,B:245,A:255). + /// + public static Color LavenderBlush + { + get; + private set; + } + + /// + /// LawnGreen color (R:124,G:252,B:0,A:255). + /// + public static Color LawnGreen + { + get; + private set; + } + + /// + /// LemonChiffon color (R:255,G:250,B:205,A:255). + /// + public static Color LemonChiffon + { + get; + private set; + } + + /// + /// LightBlue color (R:173,G:216,B:230,A:255). + /// + public static Color LightBlue + { + get; + private set; + } + + /// + /// LightCoral color (R:240,G:128,B:128,A:255). + /// + public static Color LightCoral + { + get; + private set; + } + + /// + /// LightCyan color (R:224,G:255,B:255,A:255). + /// + public static Color LightCyan + { + get; + private set; + } + + /// + /// LightGoldenrodYellow color (R:250,G:250,B:210,A:255). + /// + public static Color LightGoldenrodYellow + { + get; + private set; + } + + /// + /// LightGray color (R:211,G:211,B:211,A:255). + /// + public static Color LightGray + { + get; + private set; + } + + /// + /// LightGreen color (R:144,G:238,B:144,A:255). + /// + public static Color LightGreen + { + get; + private set; + } + + /// + /// LightPink color (R:255,G:182,B:193,A:255). + /// + public static Color LightPink + { + get; + private set; + } + + /// + /// LightSalmon color (R:255,G:160,B:122,A:255). + /// + public static Color LightSalmon + { + get; + private set; + } + + /// + /// LightSeaGreen color (R:32,G:178,B:170,A:255). + /// + public static Color LightSeaGreen + { + get; + private set; + } + + /// + /// LightSkyBlue color (R:135,G:206,B:250,A:255). + /// + public static Color LightSkyBlue + { + get; + private set; + } + + /// + /// LightSlateGray color (R:119,G:136,B:153,A:255). + /// + public static Color LightSlateGray + { + get; + private set; + } + + /// + /// LightSteelBlue color (R:176,G:196,B:222,A:255). + /// + public static Color LightSteelBlue + { + get; + private set; + } + + /// + /// LightYellow color (R:255,G:255,B:224,A:255). + /// + public static Color LightYellow + { + get; + private set; + } + + /// + /// Lime color (R:0,G:255,B:0,A:255). + /// + public static Color Lime + { + get; + private set; + } + + /// + /// LimeGreen color (R:50,G:205,B:50,A:255). + /// + public static Color LimeGreen + { + get; + private set; + } + + /// + /// Linen color (R:250,G:240,B:230,A:255). + /// + public static Color Linen + { + get; + private set; + } + + /// + /// Magenta color (R:255,G:0,B:255,A:255). + /// + public static Color Magenta + { + get; + private set; + } + + /// + /// Maroon color (R:128,G:0,B:0,A:255). + /// + public static Color Maroon + { + get; + private set; + } + + /// + /// MediumAquamarine color (R:102,G:205,B:170,A:255). + /// + public static Color MediumAquamarine + { + get; + private set; + } + + /// + /// MediumBlue color (R:0,G:0,B:205,A:255). + /// + public static Color MediumBlue + { + get; + private set; + } + + /// + /// MediumOrchid color (R:186,G:85,B:211,A:255). + /// + public static Color MediumOrchid + { + get; + private set; + } + + /// + /// MediumPurple color (R:147,G:112,B:219,A:255). + /// + public static Color MediumPurple + { + get; + private set; + } + + /// + /// MediumSeaGreen color (R:60,G:179,B:113,A:255). + /// + public static Color MediumSeaGreen + { + get; + private set; + } + + /// + /// MediumSlateBlue color (R:123,G:104,B:238,A:255). + /// + public static Color MediumSlateBlue + { + get; + private set; + } + + /// + /// MediumSpringGreen color (R:0,G:250,B:154,A:255). + /// + public static Color MediumSpringGreen + { + get; + private set; + } + + /// + /// MediumTurquoise color (R:72,G:209,B:204,A:255). + /// + public static Color MediumTurquoise + { + get; + private set; + } + + /// + /// MediumVioletRed color (R:199,G:21,B:133,A:255). + /// + public static Color MediumVioletRed + { + get; + private set; + } + + /// + /// MidnightBlue color (R:25,G:25,B:112,A:255). + /// + public static Color MidnightBlue + { + get; + private set; + } + + /// + /// MintCream color (R:245,G:255,B:250,A:255). + /// + public static Color MintCream + { + get; + private set; + } + + /// + /// MistyRose color (R:255,G:228,B:225,A:255). + /// + public static Color MistyRose + { + get; + private set; + } + + /// + /// Moccasin color (R:255,G:228,B:181,A:255). + /// + public static Color Moccasin + { + get; + private set; + } + + /// + /// MonoGame orange theme color (R:231,G:60,B:0,A:255). + /// + public static Color MonoGameOrange + { + get; + private set; + } + + /// + /// NavajoWhite color (R:255,G:222,B:173,A:255). + /// + public static Color NavajoWhite + { + get; + private set; + } + + /// + /// Navy color (R:0,G:0,B:128,A:255). + /// + public static Color Navy + { + get; + private set; + } + + /// + /// OldLace color (R:253,G:245,B:230,A:255). + /// + public static Color OldLace + { + get; + private set; + } + + /// + /// Olive color (R:128,G:128,B:0,A:255). + /// + public static Color Olive + { + get; + private set; + } + + /// + /// OliveDrab color (R:107,G:142,B:35,A:255). + /// + public static Color OliveDrab + { + get; + private set; + } + + /// + /// Orange color (R:255,G:165,B:0,A:255). + /// + public static Color Orange + { + get; + private set; + } + + /// + /// OrangeRed color (R:255,G:69,B:0,A:255). + /// + public static Color OrangeRed + { + get; + private set; + } + + /// + /// Orchid color (R:218,G:112,B:214,A:255). + /// + public static Color Orchid + { + get; + private set; + } + + /// + /// PaleGoldenrod color (R:238,G:232,B:170,A:255). + /// + public static Color PaleGoldenrod + { + get; + private set; + } + + /// + /// PaleGreen color (R:152,G:251,B:152,A:255). + /// + public static Color PaleGreen + { + get; + private set; + } + + /// + /// PaleTurquoise color (R:175,G:238,B:238,A:255). + /// + public static Color PaleTurquoise + { + get; + private set; + } + /// + /// PaleVioletRed color (R:219,G:112,B:147,A:255). + /// + public static Color PaleVioletRed + { + get; + private set; + } + + /// + /// PapayaWhip color (R:255,G:239,B:213,A:255). + /// + public static Color PapayaWhip + { + get; + private set; + } + + /// + /// PeachPuff color (R:255,G:218,B:185,A:255). + /// + public static Color PeachPuff + { + get; + private set; + } + + /// + /// Peru color (R:205,G:133,B:63,A:255). + /// + public static Color Peru + { + get; + private set; + } + + /// + /// Pink color (R:255,G:192,B:203,A:255). + /// + public static Color Pink + { + get; + private set; + } + + /// + /// Plum color (R:221,G:160,B:221,A:255). + /// + public static Color Plum + { + get; + private set; + } + + /// + /// PowderBlue color (R:176,G:224,B:230,A:255). + /// + public static Color PowderBlue + { + get; + private set; + } + + /// + /// Purple color (R:128,G:0,B:128,A:255). + /// + public static Color Purple + { + get; + private set; + } + + /// + /// Red color (R:255,G:0,B:0,A:255). + /// + public static Color Red + { + get; + private set; + } + + /// + /// RosyBrown color (R:188,G:143,B:143,A:255). + /// + public static Color RosyBrown + { + get; + private set; + } + + /// + /// RoyalBlue color (R:65,G:105,B:225,A:255). + /// + public static Color RoyalBlue + { + get; + private set; + } + + /// + /// SaddleBrown color (R:139,G:69,B:19,A:255). + /// + public static Color SaddleBrown + { + get; + private set; + } + + /// + /// Salmon color (R:250,G:128,B:114,A:255). + /// + public static Color Salmon + { + get; + private set; + } + + /// + /// SandyBrown color (R:244,G:164,B:96,A:255). + /// + public static Color SandyBrown + { + get; + private set; + } + + /// + /// SeaGreen color (R:46,G:139,B:87,A:255). + /// + public static Color SeaGreen + { + get; + private set; + } + + /// + /// SeaShell color (R:255,G:245,B:238,A:255). + /// + public static Color SeaShell + { + get; + private set; + } + + /// + /// Sienna color (R:160,G:82,B:45,A:255). + /// + public static Color Sienna + { + get; + private set; + } + + /// + /// Silver color (R:192,G:192,B:192,A:255). + /// + public static Color Silver + { + get; + private set; + } + + /// + /// SkyBlue color (R:135,G:206,B:235,A:255). + /// + public static Color SkyBlue + { + get; + private set; + } + + /// + /// SlateBlue color (R:106,G:90,B:205,A:255). + /// + public static Color SlateBlue + { + get; + private set; + } + + /// + /// SlateGray color (R:112,G:128,B:144,A:255). + /// + public static Color SlateGray + { + get; + private set; + } + + /// + /// Snow color (R:255,G:250,B:250,A:255). + /// + public static Color Snow + { + get; + private set; + } + + /// + /// SpringGreen color (R:0,G:255,B:127,A:255). + /// + public static Color SpringGreen + { + get; + private set; + } + + /// + /// SteelBlue color (R:70,G:130,B:180,A:255). + /// + public static Color SteelBlue + { + get; + private set; + } + + /// + /// Tan color (R:210,G:180,B:140,A:255). + /// + public static Color Tan + { + get; + private set; + } + + /// + /// Teal color (R:0,G:128,B:128,A:255). + /// + public static Color Teal + { + get; + private set; + } + + /// + /// Thistle color (R:216,G:191,B:216,A:255). + /// + public static Color Thistle + { + get; + private set; + } + + /// + /// Tomato color (R:255,G:99,B:71,A:255). + /// + public static Color Tomato + { + get; + private set; + } + + /// + /// Turquoise color (R:64,G:224,B:208,A:255). + /// + public static Color Turquoise + { + get; + private set; + } + + /// + /// Violet color (R:238,G:130,B:238,A:255). + /// + public static Color Violet + { + get; + private set; + } + + /// + /// Wheat color (R:245,G:222,B:179,A:255). + /// + public static Color Wheat + { + get; + private set; + } + + /// + /// White color (R:255,G:255,B:255,A:255). + /// + public static Color White + { + get; + private set; + } + + /// + /// WhiteSmoke color (R:245,G:245,B:245,A:255). + /// + public static Color WhiteSmoke + { + get; + private set; + } + + /// + /// Yellow color (R:255,G:255,B:0,A:255). + /// + public static Color Yellow + { + get; + private set; + } + + /// + /// YellowGreen color (R:154,G:205,B:50,A:255). + /// + public static Color YellowGreen + { + get; + private set; + } + #endregion + + /// + /// Performs linear interpolation of . + /// + /// Source . + /// Destination . + /// Interpolation factor. + /// Interpolated . + public static Color Lerp(Color value1, Color value2, Single amount) + { + amount = MathHelper.Clamp(amount, 0, 1); + return new Color( + (int)MathHelper.Lerp(value1.R, value2.R, amount), + (int)MathHelper.Lerp(value1.G, value2.G, amount), + (int)MathHelper.Lerp(value1.B, value2.B, amount), + (int)MathHelper.Lerp(value1.A, value2.A, amount) ); + } + + /// + /// Multiply by value. + /// + /// Source . + /// Multiplicator. + /// Multiplication result. + public static Color Multiply(Color value, float scale) + { + return new Color((int)(value.R * scale), (int)(value.G * scale), (int)(value.B * scale), (int)(value.A * scale)); + } + + /// + /// Multiply by value. + /// + /// Source . + /// Multiplicator. + /// Multiplication result. + public static Color operator *(Color value, float scale) + { + return new Color((int)(value.R * scale), (int)(value.G * scale), (int)(value.B * scale), (int)(value.A * scale)); + } + + /// + /// Gets a representation for this object. + /// + /// A representation for this object. + public Vector3 ToVector3() + { + return new Vector3(R / 255.0f, G / 255.0f, B / 255.0f); + } + + /// + /// Gets a representation for this object. + /// + /// A representation for this object. + public Vector4 ToVector4() + { + return new Vector4(R / 255.0f, G / 255.0f, B / 255.0f, A / 255.0f); + } + + /// + /// Gets or sets packed value of this . + /// + [CLSCompliant(false)] + public UInt32 PackedValue + { + get { return _packedValue; } + set { _packedValue = value; } + } + + + internal string DebugDisplayString + { + get + { + return string.Concat( + this.R.ToString(), " ", + this.G.ToString(), " ", + this.B.ToString(), " ", + this.A.ToString() + ); + } + } + + + /// + /// Returns a representation of this in the format: + /// {R:[red] G:[green] B:[blue] A:[alpha]} + /// + /// representation of this . + public override string ToString () + { + StringBuilder sb = new StringBuilder(25); + sb.Append("{R:"); + sb.Append(R); + sb.Append(" G:"); + sb.Append(G); + sb.Append(" B:"); + sb.Append(B); + sb.Append(" A:"); + sb.Append(A); + sb.Append("}"); + return sb.ToString(); + } + + /// + /// Translate a non-premultipled alpha to a that contains premultiplied alpha. + /// + /// A representing color. + /// A which contains premultiplied alpha data. + public static Color FromNonPremultiplied(Vector4 vector) + { + return new Color(vector.X * vector.W, vector.Y * vector.W, vector.Z * vector.W, vector.W); + } + + /// + /// Translate a non-premultipled alpha to a that contains premultiplied alpha. + /// + /// Red component value. + /// Green component value. + /// Blue component value. + /// Alpha component value. + /// A which contains premultiplied alpha data. + public static Color FromNonPremultiplied(int r, int g, int b, int a) + { + return new Color(r * a / 255, g * a / 255, b * a / 255, a); + } + + #region IEquatable Members + + /// + /// Compares whether current instance is equal to specified . + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public bool Equals(Color other) + { + return this.PackedValue == other.PackedValue; + } + + #endregion + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Graphics/SpriteEffects.cs b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Graphics/SpriteEffects.cs new file mode 100644 index 000000000..10937c51c --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Graphics/SpriteEffects.cs @@ -0,0 +1,28 @@ +// MonoGame - Copyright (C) The MonoGame Team +// This file is subject to the terms and conditions defined in +// file 'LICENSE.txt', which is part of this source code package. + +using System; + +namespace Microsoft.Xna.Framework.Graphics +{ + /// + /// Defines sprite visual options for mirroring. + /// + [Flags] + public enum SpriteEffects + { + /// + /// No options specified. + /// + None = 0, + /// + /// Render the sprite reversed along the X axis. + /// + FlipHorizontally = 1, + /// + /// Render the sprite reversed along the Y axis. + /// + FlipVertically = 2 + } +} \ No newline at end of file diff --git a/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Input/KeyState.cs b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Input/KeyState.cs new file mode 100644 index 000000000..5bba7b39a --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Input/KeyState.cs @@ -0,0 +1,58 @@ +#region License +// /* +// Microsoft Public License (Ms-PL) +// MonoGame - Copyright © 2009 The MonoGame Team +// +// All rights reserved. +// +// This license governs use of the accompanying software. If you use the software, you accept this license. If you do not +// accept the license, do not use the software. +// +// 1. Definitions +// The terms "reproduce, " "reproduction, " "derivative works, " and "distribution" have the same meaning here as under +// U.S. copyright law. +// +// A "contribution" is the original software, or any additions or changes to the software. +// A "contributor" is any person that distributes its contribution under this license. +// "Licensed patents" are a contributor's patent claims that read directly on its contribution. +// +// 2. Grant of Rights +// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, +// each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. +// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, +// each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. +// +// 3. Conditions and Limitations +// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, +// your patent license from such contributor to the software ends automatically. +// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution +// notices that are present in the software. +// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including +// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object +// code form, you may only do so under a license that complies with this license. +// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees +// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent +// permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular +// purpose and non-infringement. +// */ +#endregion License + +namespace Microsoft.Xna.Framework.Input +{ + /// + /// Identifies the state of a keyboard key. + /// + public enum KeyState + { + /// + /// Key is released. + /// + Up, + + /// + /// Key is pressed. + /// + Down, + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Input/KeyboardState.cs b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Input/KeyboardState.cs new file mode 100644 index 000000000..dd78935b6 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Input/KeyboardState.cs @@ -0,0 +1,303 @@ +// MonoGame - Copyright (C) The MonoGame Team +// This file is subject to the terms and conditions defined in +// file 'LICENSE.txt', which is part of this source code package. + +using System.Collections.Generic; + +namespace Microsoft.Xna.Framework.Input +{ + /// + /// Holds the state of keystrokes by a keyboard. + /// + public struct KeyboardState + { + // Used for the common situation where GetPressedKeys will return an empty array + static Keys[] empty = new Keys[0]; + + #region Key Data + + // Array of 256 bits: + uint keys0, keys1, keys2, keys3, keys4, keys5, keys6, keys7; + + bool InternalGetKey(Keys key) + { + uint mask = (uint)1 << (((int)key) & 0x1f); + + uint element; + switch (((int)key) >> 5) + { + case 0: element = keys0; break; + case 1: element = keys1; break; + case 2: element = keys2; break; + case 3: element = keys3; break; + case 4: element = keys4; break; + case 5: element = keys5; break; + case 6: element = keys6; break; + case 7: element = keys7; break; + default: element = 0; break; + } + + return (element & mask) != 0; + } + + void InternalSetKey(Keys key) + { + uint mask = (uint)1 << (((int)key) & 0x1f); + switch (((int)key) >> 5) + { + case 0: keys0 |= mask; break; + case 1: keys1 |= mask; break; + case 2: keys2 |= mask; break; + case 3: keys3 |= mask; break; + case 4: keys4 |= mask; break; + case 5: keys5 |= mask; break; + case 6: keys6 |= mask; break; + case 7: keys7 |= mask; break; + } + } + + void InternalClearKey(Keys key) + { + uint mask = (uint)1 << (((int)key) & 0x1f); + switch (((int)key) >> 5) + { + case 0: keys0 &= ~mask; break; + case 1: keys1 &= ~mask; break; + case 2: keys2 &= ~mask; break; + case 3: keys3 &= ~mask; break; + case 4: keys4 &= ~mask; break; + case 5: keys5 &= ~mask; break; + case 6: keys6 &= ~mask; break; + case 7: keys7 &= ~mask; break; + } + } + + void InternalClearAllKeys() + { + keys0 = 0; + keys1 = 0; + keys2 = 0; + keys3 = 0; + keys4 = 0; + keys5 = 0; + keys6 = 0; + keys7 = 0; + } + + #endregion + + + #region XNA Interface + + /// + /// Gets the current state of the Caps Lock key. + /// + public bool CapsLock { get; private set; } + + /// + /// Gets the current state of the Num Lock key. + /// + public bool NumLock { get; private set; } + + internal KeyboardState(List keys, bool capsLock = false, bool numLock = false) : this() + { + CapsLock = capsLock; + NumLock = numLock; + + keys0 = 0; + keys1 = 0; + keys2 = 0; + keys3 = 0; + keys4 = 0; + keys5 = 0; + keys6 = 0; + keys7 = 0; + + if (keys != null) + foreach (Keys k in keys) + InternalSetKey(k); + } + + /// + /// Initializes a new instance of the class. + /// + /// List of keys to be flagged as pressed on initialization. + /// Caps Lock state. + /// Num Lock state. + public KeyboardState(Keys[] keys, bool capsLock = false, bool numLock = false) : this() + { + CapsLock = capsLock; + NumLock = numLock; + + keys0 = 0; + keys1 = 0; + keys2 = 0; + keys3 = 0; + keys4 = 0; + keys5 = 0; + keys6 = 0; + keys7 = 0; + + if (keys != null) + foreach (Keys k in keys) + InternalSetKey(k); + } + + /// + /// Initializes a new instance of the class. + /// + /// List of keys to be flagged as pressed on initialization. + public KeyboardState(params Keys[] keys) : this() + { + CapsLock = false; + NumLock = false; + + keys0 = 0; + keys1 = 0; + keys2 = 0; + keys3 = 0; + keys4 = 0; + keys5 = 0; + keys6 = 0; + keys7 = 0; + + if (keys != null) + foreach (Keys k in keys) + InternalSetKey(k); + } + + /// + /// Returns the state of a specified key. + /// + /// The key to query. + /// The state of the key. + public KeyState this[Keys key] + { + get { return InternalGetKey(key) ? KeyState.Down : KeyState.Up; } + } + + /// + /// Gets whether given key is currently being pressed. + /// + /// The key to query. + /// true if the key is pressed; false otherwise. + public bool IsKeyDown(Keys key) + { + return InternalGetKey(key); + } + + /// + /// Gets whether given key is currently being not pressed. + /// + /// The key to query. + /// true if the key is not pressed; false otherwise. + public bool IsKeyUp(Keys key) + { + return !InternalGetKey(key); + } + + #endregion + + + #region GetPressedKeys() + + private static uint CountBits(uint v) + { + // http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel + v = v - ((v >> 1) & 0x55555555); // reuse input as temporary + v = (v & 0x33333333) + ((v >> 2) & 0x33333333); // temp + return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; // count + } + + private static int AddKeysToArray(uint keys, int offset, Keys[] pressedKeys, int index) + { + for (int i = 0; i < 32; i++) + { + if ((keys & (1 << i)) != 0) + pressedKeys[index++] = (Keys)(offset + i); + } + return index; + } + + /// + /// Returns an array of values holding keys that are currently being pressed. + /// + /// The keys that are currently being pressed. + public Keys[] GetPressedKeys() + { + uint count = CountBits(keys0) + CountBits(keys1) + CountBits(keys2) + CountBits(keys3) + + CountBits(keys4) + CountBits(keys5) + CountBits(keys6) + CountBits(keys7); + if (count == 0) + return empty; + Keys[] keys = new Keys[count]; + + int index = 0; + if (keys0 != 0) index = AddKeysToArray(keys0, 0 * 32, keys, index); + if (keys1 != 0) index = AddKeysToArray(keys1, 1 * 32, keys, index); + if (keys2 != 0) index = AddKeysToArray(keys2, 2 * 32, keys, index); + if (keys3 != 0) index = AddKeysToArray(keys3, 3 * 32, keys, index); + if (keys4 != 0) index = AddKeysToArray(keys4, 4 * 32, keys, index); + if (keys5 != 0) index = AddKeysToArray(keys5, 5 * 32, keys, index); + if (keys6 != 0) index = AddKeysToArray(keys6, 6 * 32, keys, index); + if (keys7 != 0) index = AddKeysToArray(keys7, 7 * 32, keys, index); + + return keys; + } + + #endregion + + + #region Objet and Equality + + /// + /// Gets the hash code for instance. + /// + /// Hash code of the object. + public override int GetHashCode() + { + return (int)(keys0 ^ keys1 ^ keys2 ^ keys3 ^ keys4 ^ keys5 ^ keys6 ^ keys7); + } + + /// + /// Compares whether two instances are equal. + /// + /// instance to the left of the equality operator. + /// instance to the right of the equality operator. + /// true if the instances are equal; false otherwise. + public static bool operator ==(KeyboardState a, KeyboardState b) + { + return a.keys0 == b.keys0 + && a.keys1 == b.keys1 + && a.keys2 == b.keys2 + && a.keys3 == b.keys3 + && a.keys4 == b.keys4 + && a.keys5 == b.keys5 + && a.keys6 == b.keys6 + && a.keys7 == b.keys7; + } + + /// + /// Compares whether two instances are not equal. + /// + /// instance to the left of the inequality operator. + /// instance to the right of the inequality operator. + /// true if the instances are different; false otherwise. + public static bool operator !=(KeyboardState a, KeyboardState b) + { + return !(a == b); + } + + /// + /// Compares whether current instance is equal to specified object. + /// + /// The to compare. + /// true if the provided instance is same with current; false otherwise. + public override bool Equals(object obj) + { + return obj is KeyboardState && this == (KeyboardState)obj; + } + + #endregion + + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Input/Keys.cs b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Input/Keys.cs new file mode 100644 index 000000000..5420cd52a --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Input/Keys.cs @@ -0,0 +1,653 @@ +// MonoGame - Copyright (C) The MonoGame Team +// This file is subject to the terms and conditions defined in +// file 'LICENSE.txt', which is part of this source code package. + +namespace Microsoft.Xna.Framework.Input +{ + /// + /// Defines the keys on a keyboard. + /// + public enum Keys + { + /// + /// Reserved. + /// + None = 0, + /// + /// BACKSPACE key. + /// + Back = 8, + /// + /// TAB key. + /// + Tab = 9, + /// + /// ENTER key. + /// + Enter = 13, + /// + /// CAPS LOCK key. + /// + CapsLock = 20, + /// + /// ESC key. + /// + Escape = 27, + /// + /// SPACEBAR key. + /// + Space = 32, + /// + /// PAGE UP key. + /// + PageUp = 33, + /// + /// PAGE DOWN key. + /// + PageDown = 34, + /// + /// END key. + /// + End = 35, + /// + /// HOME key. + /// + Home = 36, + /// + /// LEFT ARROW key. + /// + Left = 37, + /// + /// UP ARROW key. + /// + Up = 38, + /// + /// RIGHT ARROW key. + /// + Right = 39, + /// + /// DOWN ARROW key. + /// + Down = 40, + /// + /// SELECT key. + /// + Select = 41, + /// + /// PRINT key. + /// + Print = 42, + /// + /// EXECUTE key. + /// + Execute = 43, + /// + /// PRINT SCREEN key. + /// + PrintScreen = 44, + /// + /// INS key. + /// + Insert = 45, + /// + /// DEL key. + /// + Delete = 46, + /// + /// HELP key. + /// + Help = 47, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D0 = 48, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D1 = 49, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D2 = 50, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D3 = 51, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D4 = 52, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D5 = 53, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D6 = 54, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D7 = 55, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D8 = 56, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + D9 = 57, + /// + /// A key. + /// + A = 65, + /// + /// B key. + /// + B = 66, + /// + /// C key. + /// + C = 67, + /// + /// D key. + /// + D = 68, + /// + /// E key. + /// + E = 69, + /// + /// F key. + /// + F = 70, + /// + /// G key. + /// + G = 71, + /// + /// H key. + /// + H = 72, + /// + /// I key. + /// + I = 73, + /// + /// J key. + /// + J = 74, + /// + /// K key. + /// + K = 75, + /// + /// L key. + /// + L = 76, + /// + /// M key. + /// + M = 77, + /// + /// N key. + /// + N = 78, + /// + /// O key. + /// + O = 79, + /// + /// P key. + /// + P = 80, + /// + /// Q key. + /// + Q = 81, + /// + /// R key. + /// + R = 82, + /// + /// S key. + /// + S = 83, + /// + /// T key. + /// + T = 84, + /// + /// U key. + /// + U = 85, + /// + /// V key. + /// + V = 86, + /// + /// W key. + /// + W = 87, + /// + /// X key. + /// + X = 88, + /// + /// Y key. + /// + Y = 89, + /// + /// Z key. + /// + Z = 90, + /// + /// Left Windows key. + /// + LeftWindows = 91, + /// + /// Right Windows key. + /// + RightWindows = 92, + /// + /// Applications key. + /// + Apps = 93, + /// + /// Computer Sleep key. + /// + Sleep = 95, + /// + /// Numeric keypad 0 key. + /// + NumPad0 = 96, + /// + /// Numeric keypad 1 key. + /// + NumPad1 = 97, + /// + /// Numeric keypad 2 key. + /// + NumPad2 = 98, + /// + /// Numeric keypad 3 key. + /// + NumPad3 = 99, + /// + /// Numeric keypad 4 key. + /// + NumPad4 = 100, + /// + /// Numeric keypad 5 key. + /// + NumPad5 = 101, + /// + /// Numeric keypad 6 key. + /// + NumPad6 = 102, + /// + /// Numeric keypad 7 key. + /// + NumPad7 = 103, + /// + /// Numeric keypad 8 key. + /// + NumPad8 = 104, + /// + /// Numeric keypad 9 key. + /// + NumPad9 = 105, + /// + /// Multiply key. + /// + Multiply = 106, + /// + /// Add key. + /// + Add = 107, + /// + /// Separator key. + /// + Separator = 108, + /// + /// Subtract key. + /// + Subtract = 109, + /// + /// Decimal key. + /// + Decimal = 110, + /// + /// Divide key. + /// + Divide = 111, + /// + /// F1 key. + /// + F1 = 112, + /// + /// F2 key. + /// + F2 = 113, + /// + /// F3 key. + /// + F3 = 114, + /// + /// F4 key. + /// + F4 = 115, + /// + /// F5 key. + /// + F5 = 116, + /// + /// F6 key. + /// + F6 = 117, + /// + /// F7 key. + /// + F7 = 118, + /// + /// F8 key. + /// + F8 = 119, + /// + /// F9 key. + /// + F9 = 120, + /// + /// F10 key. + /// + F10 = 121, + /// + /// F11 key. + /// + F11 = 122, + /// + /// F12 key. + /// + F12 = 123, + /// + /// F13 key. + /// + F13 = 124, + /// + /// F14 key. + /// + F14 = 125, + /// + /// F15 key. + /// + F15 = 126, + /// + /// F16 key. + /// + F16 = 127, + /// + /// F17 key. + /// + F17 = 128, + /// + /// F18 key. + /// + F18 = 129, + /// + /// F19 key. + /// + F19 = 130, + /// + /// F20 key. + /// + F20 = 131, + /// + /// F21 key. + /// + F21 = 132, + /// + /// F22 key. + /// + F22 = 133, + /// + /// F23 key. + /// + F23 = 134, + /// + /// F24 key. + /// + F24 = 135, + /// + /// NUM LOCK key. + /// + NumLock = 144, + /// + /// SCROLL LOCK key. + /// + Scroll = 145, + /// + /// Left SHIFT key. + /// + LeftShift = 160, + /// + /// Right SHIFT key. + /// + RightShift = 161, + /// + /// Left CONTROL key. + /// + LeftControl = 162, + /// + /// Right CONTROL key. + /// + RightControl = 163, + /// + /// Left ALT key. + /// + LeftAlt = 164, + /// + /// Right ALT key. + /// + RightAlt = 165, + /// + /// Browser Back key. + /// + BrowserBack = 166, + /// + /// Browser Forward key. + /// + BrowserForward = 167, + /// + /// Browser Refresh key. + /// + BrowserRefresh = 168, + /// + /// Browser Stop key. + /// + BrowserStop = 169, + /// + /// Browser Search key. + /// + BrowserSearch = 170, + /// + /// Browser Favorites key. + /// + BrowserFavorites = 171, + /// + /// Browser Start and Home key. + /// + BrowserHome = 172, + /// + /// Volume Mute key. + /// + VolumeMute = 173, + /// + /// Volume Down key. + /// + VolumeDown = 174, + /// + /// Volume Up key. + /// + VolumeUp = 175, + /// + /// Next Track key. + /// + MediaNextTrack = 176, + /// + /// Previous Track key. + /// + MediaPreviousTrack = 177, + /// + /// Stop Media key. + /// + MediaStop = 178, + /// + /// Play/Pause Media key. + /// + MediaPlayPause = 179, + /// + /// Start Mail key. + /// + LaunchMail = 180, + /// + /// Select Media key. + /// + SelectMedia = 181, + /// + /// Start Application 1 key. + /// + LaunchApplication1 = 182, + /// + /// Start Application 2 key. + /// + LaunchApplication2 = 183, + /// + /// The OEM Semicolon key on a US standard keyboard. + /// + OemSemicolon = 186, + /// + /// For any country/region, the '+' key. + /// + OemPlus = 187, + /// + /// For any country/region, the ',' key. + /// + OemComma = 188, + /// + /// For any country/region, the '-' key. + /// + OemMinus = 189, + /// + /// For any country/region, the '.' key. + /// + OemPeriod = 190, + /// + /// The OEM question mark key on a US standard keyboard. + /// + OemQuestion = 191, + /// + /// The OEM tilde key on a US standard keyboard. + /// + OemTilde = 192, + /// + /// The OEM open bracket key on a US standard keyboard. + /// + OemOpenBrackets = 219, + /// + /// The OEM pipe key on a US standard keyboard. + /// + OemPipe = 220, + /// + /// The OEM close bracket key on a US standard keyboard. + /// + OemCloseBrackets = 221, + /// + /// The OEM singled/double quote key on a US standard keyboard. + /// + OemQuotes = 222, + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + Oem8 = 223, + /// + /// The OEM angle bracket or backslash key on the RT 102 key keyboard. + /// + OemBackslash = 226, + /// + /// IME PROCESS key. + /// + ProcessKey = 229, + /// + /// Attn key. + /// + Attn = 246, + /// + /// CrSel key. + /// + Crsel = 247, + /// + /// ExSel key. + /// + Exsel = 248, + /// + /// Erase EOF key. + /// + EraseEof = 249, + /// + /// Play key. + /// + Play = 250, + /// + /// Zoom key. + /// + Zoom = 251, + /// + /// PA1 key. + /// + Pa1 = 253, + /// + /// CLEAR key. + /// + OemClear = 254, + /// + /// Green ChatPad key. + /// + ChatPadGreen = 0xCA, + /// + /// Orange ChatPad key. + /// + ChatPadOrange = 0xCB, + /// + /// PAUSE key. + /// + Pause = 0x13, + /// + /// IME Convert key. + /// + ImeConvert = 0x1c, + /// + /// IME NoConvert key. + /// + ImeNoConvert = 0x1d, + /// + /// Kana key on Japanese keyboards. + /// + Kana = 0x15, + /// + /// Kanji key on Japanese keyboards. + /// + Kanji = 0x19, + /// + /// OEM Auto key. + /// + OemAuto = 0xf3, + /// + /// OEM Copy key. + /// + OemCopy = 0xf2, + /// + /// OEM Enlarge Window key. + /// + OemEnlW = 0xf4 + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Point.cs b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Point.cs new file mode 100644 index 000000000..4ee354fb2 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Point.cs @@ -0,0 +1,220 @@ +// MIT License - Copyright (C) The Mono.Xna Team +// This file is subject to the terms and conditions defined in +// file 'LICENSE.txt', which is part of this source code package. + +using System; +using System.Diagnostics; +using System.Runtime.Serialization; + +namespace Microsoft.Xna.Framework +{ + /// + /// Describes a 2D-point. + /// + [DebuggerDisplay("{DebugDisplayString,nq}")] + public struct Point : IEquatable + { + #region Private Fields + + private static readonly Point zeroPoint = new Point(); + + #endregion + + #region Public Fields + + /// + /// The x coordinate of this . + /// + public int X; + + /// + /// The y coordinate of this . + /// + public int Y; + + #endregion + + #region Properties + + /// + /// Returns a with coordinates 0, 0. + /// + public static Point Zero + { + get { return zeroPoint; } + } + + #endregion + + #region Internal Properties + + internal string DebugDisplayString + { + get + { + return string.Concat( + this.X.ToString(), " ", + this.Y.ToString() + ); + } + } + + #endregion + + #region Constructors + + /// + /// Constructs a point with X and Y from two values. + /// + /// The x coordinate in 2d-space. + /// The y coordinate in 2d-space. + public Point(int x, int y) + { + this.X = x; + this.Y = y; + } + + /// + /// Constructs a point with X and Y set to the same value. + /// + /// The x and y coordinates in 2d-space. + public Point(int value) + { + this.X = value; + this.Y = value; + } + + #endregion + + #region Operators + + /// + /// Adds two points. + /// + /// Source on the left of the add sign. + /// Source on the right of the add sign. + /// Sum of the points. + public static Point operator +(Point value1, Point value2) + { + return new Point(value1.X + value2.X, value1.Y + value2.Y); + } + + /// + /// Subtracts a from a . + /// + /// Source on the left of the sub sign. + /// Source on the right of the sub sign. + /// Result of the subtraction. + public static Point operator -(Point value1, Point value2) + { + return new Point(value1.X - value2.X, value1.Y - value2.Y); + } + + /// + /// Multiplies the components of two points by each other. + /// + /// Source on the left of the mul sign. + /// Source on the right of the mul sign. + /// Result of the multiplication. + public static Point operator *(Point value1, Point value2) + { + return new Point(value1.X * value2.X, value1.Y * value2.Y); + } + + /// + /// Divides the components of a by the components of another . + /// + /// Source on the left of the div sign. + /// Divisor on the right of the div sign. + /// The result of dividing the points. + public static Point operator /(Point source, Point divisor) + { + return new Point(source.X / divisor.X, source.Y / divisor.Y); + } + + /// + /// Compares whether two instances are equal. + /// + /// instance on the left of the equal sign. + /// instance on the right of the equal sign. + /// true if the instances are equal; false otherwise. + public static bool operator ==(Point a, Point b) + { + return a.Equals(b); + } + + /// + /// Compares whether two instances are not equal. + /// + /// instance on the left of the not equal sign. + /// instance on the right of the not equal sign. + /// true if the instances are not equal; false otherwise. + public static bool operator !=(Point a, Point b) + { + return !a.Equals(b); + } + + #endregion + + #region Public methods + + /// + /// Compares whether current instance is equal to specified . + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public override bool Equals(object obj) + { + return (obj is Point) && Equals((Point)obj); + } + + /// + /// Compares whether current instance is equal to specified . + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public bool Equals(Point other) + { + return ((X == other.X) && (Y == other.Y)); + } + + /// + /// Gets the hash code of this . + /// + /// Hash code of this . + public override int GetHashCode() + { + unchecked + { + var hash = 17; + hash = hash * 23 + X.GetHashCode(); + hash = hash * 23 + Y.GetHashCode(); + return hash; + } + + } + + /// + /// Returns a representation of this in the format: + /// {X:[] Y:[]} + /// + /// representation of this . + public override string ToString() + { + return "{X:" + X + " Y:" + Y + "}"; + } + + /// + /// Gets a representation for this object. + /// + /// A representation for this object. + public Vector2 ToVector2() + { + return new Vector2(X, Y); + } + + #endregion + } +} + + diff --git a/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Quaternion.cs b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Quaternion.cs new file mode 100644 index 000000000..f758552e6 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Quaternion.cs @@ -0,0 +1,1170 @@ +// MIT License - Copyright (C) The Mono.Xna Team +// This file is subject to the terms and conditions defined in +// file 'LICENSE.txt', which is part of this source code package. + +using System; +using System.Diagnostics; +using System.Runtime.Serialization; + +namespace Microsoft.Xna.Framework +{ + /// + /// An efficient mathematical representation for three dimensional rotations. + /// + + [DebuggerDisplay("{DebugDisplayString,nq}")] + public struct Quaternion : IEquatable + { + #region Private Fields + + private static readonly Quaternion _identity = new Quaternion(0, 0, 0, 1); + + #endregion + + #region Public Fields + + /// + /// The x coordinate of this . + /// + + public float X; + + /// + /// The y coordinate of this . + /// + + public float Y; + + /// + /// The z coordinate of this . + /// + + public float Z; + + /// + /// The rotation component of this . + /// + + public float W; + + #endregion + + #region Constructors + + /// + /// Constructs a quaternion with X, Y, Z and W from four values. + /// + /// The x coordinate in 3d-space. + /// The y coordinate in 3d-space. + /// The z coordinate in 3d-space. + /// The rotation component. + public Quaternion(float x, float y, float z, float w) + { + this.X = x; + this.Y = y; + this.Z = z; + this.W = w; + } + + /// + /// Constructs a quaternion with X, Y, Z from and rotation component from a scalar. + /// + /// The x, y, z coordinates in 3d-space. + /// The rotation component. + public Quaternion(Vector3 value, float w) + { + this.X = value.X; + this.Y = value.Y; + this.Z = value.Z; + this.W = w; + } + + /// + /// Constructs a quaternion from . + /// + /// The x, y, z coordinates in 3d-space and the rotation component. + public Quaternion(Vector4 value) + { + this.X = value.X; + this.Y = value.Y; + this.Z = value.Z; + this.W = value.W; + } + + #endregion + + #region Public Properties + + /// + /// Returns a quaternion representing no rotation. + /// + public static Quaternion Identity + { + get{ return _identity; } + } + + #endregion + + #region Internal Properties + + internal string DebugDisplayString + { + get + { + if (this == Quaternion._identity) + { + return "Identity"; + } + + return string.Concat( + this.X.ToString(), " ", + this.Y.ToString(), " ", + this.Z.ToString(), " ", + this.W.ToString() + ); + } + } + + #endregion + + #region Public Methods + + #region Add + + /// + /// Creates a new that contains the sum of two quaternions. + /// + /// Source . + /// Source . + /// The result of the quaternion addition. + public static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2) + { + Quaternion quaternion; + quaternion.X = quaternion1.X + quaternion2.X; + quaternion.Y = quaternion1.Y + quaternion2.Y; + quaternion.Z = quaternion1.Z + quaternion2.Z; + quaternion.W = quaternion1.W + quaternion2.W; + return quaternion; + } + + /// + /// Creates a new that contains the sum of two quaternions. + /// + /// Source . + /// Source . + /// The result of the quaternion addition as an output parameter. + public static void Add(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) + { + result.X = quaternion1.X + quaternion2.X; + result.Y = quaternion1.Y + quaternion2.Y; + result.Z = quaternion1.Z + quaternion2.Z; + result.W = quaternion1.W + quaternion2.W; + } + + #endregion + + #region Concatenate + + /// + /// Creates a new that contains concatenation between two quaternion. + /// + /// The first to concatenate. + /// The second to concatenate. + /// The result of rotation of followed by rotation. + public static Quaternion Concatenate(Quaternion value1, Quaternion value2) + { + Quaternion quaternion; + + float x1 = value1.X; + float y1 = value1.Y; + float z1 = value1.Z; + float w1 = value1.W; + + float x2 = value2.X; + float y2 = value2.Y; + float z2 = value2.Z; + float w2 = value2.W; + + quaternion.X = ((x2 * w1) + (x1 * w2)) + ((y2 * z1) - (z2 * y1)); + quaternion.Y = ((y2 * w1) + (y1 * w2)) + ((z2 * x1) - (x2 * z1)); + quaternion.Z = ((z2 * w1) + (z1 * w2)) + ((x2 * y1) - (y2 * x1)); + quaternion.W = (w2 * w1) - (((x2 * x1) + (y2 * y1)) + (z2 * z1)); + + return quaternion; + } + + /// + /// Creates a new that contains concatenation between two quaternion. + /// + /// The first to concatenate. + /// The second to concatenate. + /// The result of rotation of followed by rotation as an output parameter. + public static void Concatenate(ref Quaternion value1, ref Quaternion value2, out Quaternion result) + { + float x1 = value1.X; + float y1 = value1.Y; + float z1 = value1.Z; + float w1 = value1.W; + + float x2 = value2.X; + float y2 = value2.Y; + float z2 = value2.Z; + float w2 = value2.W; + + result.X = ((x2 * w1) + (x1 * w2)) + ((y2 * z1) - (z2 * y1)); + result.Y = ((y2 * w1) + (y1 * w2)) + ((z2 * x1) - (x2 * z1)); + result.Z = ((z2 * w1) + (z1 * w2)) + ((x2 * y1) - (y2 * x1)); + result.W = (w2 * w1) - (((x2 * x1) + (y2 * y1)) + (z2 * z1)); + } + + #endregion + + #region Conjugate + + /// + /// Transforms this quaternion into its conjugated version. + /// + public void Conjugate() + { + X = -X; + Y = -Y; + Z = -Z; + } + + /// + /// Creates a new that contains conjugated version of the specified quaternion. + /// + /// The quaternion which values will be used to create the conjugated version. + /// The conjugate version of the specified quaternion. + public static Quaternion Conjugate(Quaternion value) + { + return new Quaternion(-value.X,-value.Y,-value.Z,value.W); + } + + /// + /// Creates a new that contains conjugated version of the specified quaternion. + /// + /// The quaternion which values will be used to create the conjugated version. + /// The conjugated version of the specified quaternion as an output parameter. + public static void Conjugate(ref Quaternion value, out Quaternion result) + { + result.X = -value.X; + result.Y = -value.Y; + result.Z = -value.Z; + result.W = value.W; + } + + #endregion + + #region CreateFromAxisAngle + + /// + /// Creates a new from the specified axis and angle. + /// + /// The axis of rotation. + /// The angle in radians. + /// The new quaternion builded from axis and angle. + public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle) + { + float half = angle * 0.5f; + float sin = (float)Math.Sin(half); + float cos = (float)Math.Cos(half); + return new Quaternion(axis.X * sin, axis.Y * sin, axis.Z * sin, cos); + } + + /// + /// Creates a new from the specified axis and angle. + /// + /// The axis of rotation. + /// The angle in radians. + /// The new quaternion builded from axis and angle as an output parameter. + public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result) + { + float half = angle * 0.5f; + float sin = (float)Math.Sin(half); + float cos = (float)Math.Cos(half); + result.X = axis.X * sin; + result.Y = axis.Y * sin; + result.Z = axis.Z * sin; + result.W = cos; + } + + #endregion + + #region CreateFromRotationMatrix + + /// + /// Creates a new from the specified . + /// + /// The rotation matrix. + /// A quaternion composed from the rotation part of the matrix. + public static Quaternion CreateFromRotationMatrix(Matrix matrix) + { + Quaternion quaternion; + float sqrt; + float half; + float scale = matrix.M11 + matrix.M22 + matrix.M33; + + if (scale > 0.0f) + { + sqrt = (float)Math.Sqrt(scale + 1.0f); + quaternion.W = sqrt * 0.5f; + sqrt = 0.5f / sqrt; + + quaternion.X = (matrix.M23 - matrix.M32) * sqrt; + quaternion.Y = (matrix.M31 - matrix.M13) * sqrt; + quaternion.Z = (matrix.M12 - matrix.M21) * sqrt; + + return quaternion; + } + if ((matrix.M11 >= matrix.M22) && (matrix.M11 >= matrix.M33)) + { + sqrt = (float) Math.Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33); + half = 0.5f / sqrt; + + quaternion.X = 0.5f * sqrt; + quaternion.Y = (matrix.M12 + matrix.M21) * half; + quaternion.Z = (matrix.M13 + matrix.M31) * half; + quaternion.W = (matrix.M23 - matrix.M32) * half; + + return quaternion; + } + if (matrix.M22 > matrix.M33) + { + sqrt = (float) Math.Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33); + half = 0.5f / sqrt; + + quaternion.X = (matrix.M21 + matrix.M12) * half; + quaternion.Y = 0.5f * sqrt; + quaternion.Z = (matrix.M32 + matrix.M23) * half; + quaternion.W = (matrix.M31 - matrix.M13) * half; + + return quaternion; + } + sqrt = (float) Math.Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22); + half = 0.5f / sqrt; + + quaternion.X = (matrix.M31 + matrix.M13) * half; + quaternion.Y = (matrix.M32 + matrix.M23) * half; + quaternion.Z = 0.5f * sqrt; + quaternion.W = (matrix.M12 - matrix.M21) * half; + + return quaternion; + } + + /// + /// Creates a new from the specified . + /// + /// The rotation matrix. + /// A quaternion composed from the rotation part of the matrix as an output parameter. + public static void CreateFromRotationMatrix(ref Matrix matrix, out Quaternion result) + { + float sqrt; + float half; + float scale = matrix.M11 + matrix.M22 + matrix.M33; + + if (scale > 0.0f) + { + sqrt = (float)Math.Sqrt(scale + 1.0f); + result.W = sqrt * 0.5f; + sqrt = 0.5f / sqrt; + + result.X = (matrix.M23 - matrix.M32) * sqrt; + result.Y = (matrix.M31 - matrix.M13) * sqrt; + result.Z = (matrix.M12 - matrix.M21) * sqrt; + } + else + if ((matrix.M11 >= matrix.M22) && (matrix.M11 >= matrix.M33)) + { + sqrt = (float)Math.Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33); + half = 0.5f / sqrt; + + result.X = 0.5f * sqrt; + result.Y = (matrix.M12 + matrix.M21) * half; + result.Z = (matrix.M13 + matrix.M31) * half; + result.W = (matrix.M23 - matrix.M32) * half; + } + else if (matrix.M22 > matrix.M33) + { + sqrt = (float) Math.Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33); + half = 0.5f/sqrt; + + result.X = (matrix.M21 + matrix.M12)*half; + result.Y = 0.5f*sqrt; + result.Z = (matrix.M32 + matrix.M23)*half; + result.W = (matrix.M31 - matrix.M13)*half; + } + else + { + sqrt = (float)Math.Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22); + half = 0.5f / sqrt; + + result.X = (matrix.M31 + matrix.M13) * half; + result.Y = (matrix.M32 + matrix.M23) * half; + result.Z = 0.5f * sqrt; + result.W = (matrix.M12 - matrix.M21) * half; + } + } + + #endregion + + #region CreateFromYawPitchRoll + + /// + /// Creates a new from the specified yaw, pitch and roll angles. + /// + /// Yaw around the y axis in radians. + /// Pitch around the x axis in radians. + /// Roll around the z axis in radians. + /// A new quaternion from the concatenated yaw, pitch, and roll angles. + public static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll) + { + float halfRoll = roll * 0.5f; + float halfPitch = pitch * 0.5f; + float halfYaw = yaw * 0.5f; + + float sinRoll = (float)Math.Sin(halfRoll); + float cosRoll = (float)Math.Cos(halfRoll); + float sinPitch = (float)Math.Sin(halfPitch); + float cosPitch = (float)Math.Cos(halfPitch); + float sinYaw = (float)Math.Sin(halfYaw); + float cosYaw = (float)Math.Cos(halfYaw); + + return new Quaternion((cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll), + (sinYaw * cosPitch * cosRoll) - (cosYaw * sinPitch * sinRoll), + (cosYaw * cosPitch * sinRoll) - (sinYaw * sinPitch * cosRoll), + (cosYaw * cosPitch * cosRoll) + (sinYaw * sinPitch * sinRoll)); + } + + /// + /// Creates a new from the specified yaw, pitch and roll angles. + /// + /// Yaw around the y axis in radians. + /// Pitch around the x axis in radians. + /// Roll around the z axis in radians. + /// A new quaternion from the concatenated yaw, pitch, and roll angles as an output parameter. + public static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Quaternion result) + { + float halfRoll = roll * 0.5f; + float halfPitch = pitch * 0.5f; + float halfYaw = yaw * 0.5f; + + float sinRoll = (float)Math.Sin(halfRoll); + float cosRoll = (float)Math.Cos(halfRoll); + float sinPitch = (float)Math.Sin(halfPitch); + float cosPitch = (float)Math.Cos(halfPitch); + float sinYaw = (float)Math.Sin(halfYaw); + float cosYaw = (float)Math.Cos(halfYaw); + + result.X = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll); + result.Y = (sinYaw * cosPitch * cosRoll) - (cosYaw * sinPitch * sinRoll); + result.Z = (cosYaw * cosPitch * sinRoll) - (sinYaw * sinPitch * cosRoll); + result.W = (cosYaw * cosPitch * cosRoll) + (sinYaw * sinPitch * sinRoll); + } + + #endregion + + #region Divide + + /// + /// Divides a by the other . + /// + /// Source . + /// Divisor . + /// The result of dividing the quaternions. + public static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2) + { + Quaternion quaternion; + float x = quaternion1.X; + float y = quaternion1.Y; + float z = quaternion1.Z; + float w = quaternion1.W; + float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W); + float num5 = 1f / num14; + float num4 = -quaternion2.X * num5; + float num3 = -quaternion2.Y * num5; + float num2 = -quaternion2.Z * num5; + float num = quaternion2.W * num5; + float num13 = (y * num2) - (z * num3); + float num12 = (z * num4) - (x * num2); + float num11 = (x * num3) - (y * num4); + float num10 = ((x * num4) + (y * num3)) + (z * num2); + quaternion.X = ((x * num) + (num4 * w)) + num13; + quaternion.Y = ((y * num) + (num3 * w)) + num12; + quaternion.Z = ((z * num) + (num2 * w)) + num11; + quaternion.W = (w * num) - num10; + return quaternion; + } + + /// + /// Divides a by the other . + /// + /// Source . + /// Divisor . + /// The result of dividing the quaternions as an output parameter. + public static void Divide(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) + { + float x = quaternion1.X; + float y = quaternion1.Y; + float z = quaternion1.Z; + float w = quaternion1.W; + float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W); + float num5 = 1f / num14; + float num4 = -quaternion2.X * num5; + float num3 = -quaternion2.Y * num5; + float num2 = -quaternion2.Z * num5; + float num = quaternion2.W * num5; + float num13 = (y * num2) - (z * num3); + float num12 = (z * num4) - (x * num2); + float num11 = (x * num3) - (y * num4); + float num10 = ((x * num4) + (y * num3)) + (z * num2); + result.X = ((x * num) + (num4 * w)) + num13; + result.Y = ((y * num) + (num3 * w)) + num12; + result.Z = ((z * num) + (num2 * w)) + num11; + result.W = (w * num) - num10; + } + + #endregion + + #region Dot + + /// + /// Returns a dot product of two quaternions. + /// + /// The first quaternion. + /// The second quaternion. + /// The dot product of two quaternions. + public static float Dot(Quaternion quaternion1, Quaternion quaternion2) + { + return ((((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W)); + } + + /// + /// Returns a dot product of two quaternions. + /// + /// The first quaternion. + /// The second quaternion. + /// The dot product of two quaternions as an output parameter. + public static void Dot(ref Quaternion quaternion1, ref Quaternion quaternion2, out float result) + { + result = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W); + } + + #endregion + + #region Equals + + /// + /// Compares whether current instance is equal to specified . + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public override bool Equals(object obj) + { + if (obj is Quaternion) + return Equals((Quaternion)obj); + return false; + } + + /// + /// Compares whether current instance is equal to specified . + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public bool Equals(Quaternion other) + { + return X == other.X && + Y == other.Y && + Z == other.Z && + W == other.W; + } + + #endregion + + /// + /// Gets the hash code of this . + /// + /// Hash code of this . + public override int GetHashCode() + { + return X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode() + W.GetHashCode(); + } + + #region Inverse + + /// + /// Returns the inverse quaternion which represents the opposite rotation. + /// + /// Source . + /// The inverse quaternion. + public static Quaternion Inverse(Quaternion quaternion) + { + Quaternion quaternion2; + float num2 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W); + float num = 1f / num2; + quaternion2.X = -quaternion.X * num; + quaternion2.Y = -quaternion.Y * num; + quaternion2.Z = -quaternion.Z * num; + quaternion2.W = quaternion.W * num; + return quaternion2; + } + + /// + /// Returns the inverse quaternion which represents the opposite rotation. + /// + /// Source . + /// The inverse quaternion as an output parameter. + public static void Inverse(ref Quaternion quaternion, out Quaternion result) + { + float num2 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W); + float num = 1f / num2; + result.X = -quaternion.X * num; + result.Y = -quaternion.Y * num; + result.Z = -quaternion.Z * num; + result.W = quaternion.W * num; + } + + #endregion + + /// + /// Returns the magnitude of the quaternion components. + /// + /// The magnitude of the quaternion components. + public float Length() + { + return (float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W)); + } + + /// + /// Returns the squared magnitude of the quaternion components. + /// + /// The squared magnitude of the quaternion components. + public float LengthSquared() + { + return (X * X) + (Y * Y) + (Z * Z) + (W * W); + } + + #region Lerp + + /// + /// Performs a linear blend between two quaternions. + /// + /// Source . + /// Source . + /// The blend amount where 0 returns and 1 . + /// The result of linear blending between two quaternions. + public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount) + { + float num = amount; + float num2 = 1f - num; + Quaternion quaternion = new Quaternion(); + float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W); + if (num5 >= 0f) + { + quaternion.X = (num2 * quaternion1.X) + (num * quaternion2.X); + quaternion.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y); + quaternion.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z); + quaternion.W = (num2 * quaternion1.W) + (num * quaternion2.W); + } + else + { + quaternion.X = (num2 * quaternion1.X) - (num * quaternion2.X); + quaternion.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y); + quaternion.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z); + quaternion.W = (num2 * quaternion1.W) - (num * quaternion2.W); + } + float num4 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W); + float num3 = 1f / ((float) Math.Sqrt((double) num4)); + quaternion.X *= num3; + quaternion.Y *= num3; + quaternion.Z *= num3; + quaternion.W *= num3; + return quaternion; + } + + /// + /// Performs a linear blend between two quaternions. + /// + /// Source . + /// Source . + /// The blend amount where 0 returns and 1 . + /// The result of linear blending between two quaternions as an output parameter. + public static void Lerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result) + { + float num = amount; + float num2 = 1f - num; + float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W); + if (num5 >= 0f) + { + result.X = (num2 * quaternion1.X) + (num * quaternion2.X); + result.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y); + result.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z); + result.W = (num2 * quaternion1.W) + (num * quaternion2.W); + } + else + { + result.X = (num2 * quaternion1.X) - (num * quaternion2.X); + result.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y); + result.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z); + result.W = (num2 * quaternion1.W) - (num * quaternion2.W); + } + float num4 = (((result.X * result.X) + (result.Y * result.Y)) + (result.Z * result.Z)) + (result.W * result.W); + float num3 = 1f / ((float) Math.Sqrt((double) num4)); + result.X *= num3; + result.Y *= num3; + result.Z *= num3; + result.W *= num3; + + } + + #endregion + + #region Slerp + + /// + /// Performs a spherical linear blend between two quaternions. + /// + /// Source . + /// Source . + /// The blend amount where 0 returns and 1 . + /// The result of spherical linear blending between two quaternions. + public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount) + { + float num2; + float num3; + Quaternion quaternion; + float num = amount; + float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W); + bool flag = false; + if (num4 < 0f) + { + flag = true; + num4 = -num4; + } + if (num4 > 0.999999f) + { + num3 = 1f - num; + num2 = flag ? -num : num; + } + else + { + float num5 = (float) Math.Acos((double) num4); + float num6 = (float) (1.0 / Math.Sin((double) num5)); + num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6; + num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6); + } + quaternion.X = (num3 * quaternion1.X) + (num2 * quaternion2.X); + quaternion.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y); + quaternion.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z); + quaternion.W = (num3 * quaternion1.W) + (num2 * quaternion2.W); + return quaternion; + } + + /// + /// Performs a spherical linear blend between two quaternions. + /// + /// Source . + /// Source . + /// The blend amount where 0 returns and 1 . + /// The result of spherical linear blending between two quaternions as an output parameter. + public static void Slerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result) + { + float num2; + float num3; + float num = amount; + float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W); + bool flag = false; + if (num4 < 0f) + { + flag = true; + num4 = -num4; + } + if (num4 > 0.999999f) + { + num3 = 1f - num; + num2 = flag ? -num : num; + } + else + { + float num5 = (float) Math.Acos((double) num4); + float num6 = (float) (1.0 / Math.Sin((double) num5)); + num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6; + num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6); + } + result.X = (num3 * quaternion1.X) + (num2 * quaternion2.X); + result.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y); + result.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z); + result.W = (num3 * quaternion1.W) + (num2 * quaternion2.W); + } + + #endregion + + #region Subtract + + /// + /// Creates a new that contains subtraction of one from another. + /// + /// Source . + /// Source . + /// The result of the quaternion subtraction. + public static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2) + { + Quaternion quaternion; + quaternion.X = quaternion1.X - quaternion2.X; + quaternion.Y = quaternion1.Y - quaternion2.Y; + quaternion.Z = quaternion1.Z - quaternion2.Z; + quaternion.W = quaternion1.W - quaternion2.W; + return quaternion; + } + + /// + /// Creates a new that contains subtraction of one from another. + /// + /// Source . + /// Source . + /// The result of the quaternion subtraction as an output parameter. + public static void Subtract(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) + { + result.X = quaternion1.X - quaternion2.X; + result.Y = quaternion1.Y - quaternion2.Y; + result.Z = quaternion1.Z - quaternion2.Z; + result.W = quaternion1.W - quaternion2.W; + } + + #endregion + + #region Multiply + + /// + /// Creates a new that contains a multiplication of two quaternions. + /// + /// Source . + /// Source . + /// The result of the quaternion multiplication. + public static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2) + { + Quaternion quaternion; + float x = quaternion1.X; + float y = quaternion1.Y; + float z = quaternion1.Z; + float w = quaternion1.W; + float num4 = quaternion2.X; + float num3 = quaternion2.Y; + float num2 = quaternion2.Z; + float num = quaternion2.W; + float num12 = (y * num2) - (z * num3); + float num11 = (z * num4) - (x * num2); + float num10 = (x * num3) - (y * num4); + float num9 = ((x * num4) + (y * num3)) + (z * num2); + quaternion.X = ((x * num) + (num4 * w)) + num12; + quaternion.Y = ((y * num) + (num3 * w)) + num11; + quaternion.Z = ((z * num) + (num2 * w)) + num10; + quaternion.W = (w * num) - num9; + return quaternion; + } + + /// + /// Creates a new that contains a multiplication of and a scalar. + /// + /// Source . + /// Scalar value. + /// The result of the quaternion multiplication with a scalar. + public static Quaternion Multiply(Quaternion quaternion1, float scaleFactor) + { + Quaternion quaternion; + quaternion.X = quaternion1.X * scaleFactor; + quaternion.Y = quaternion1.Y * scaleFactor; + quaternion.Z = quaternion1.Z * scaleFactor; + quaternion.W = quaternion1.W * scaleFactor; + return quaternion; + } + + /// + /// Creates a new that contains a multiplication of and a scalar. + /// + /// Source . + /// Scalar value. + /// The result of the quaternion multiplication with a scalar as an output parameter. + public static void Multiply(ref Quaternion quaternion1, float scaleFactor, out Quaternion result) + { + result.X = quaternion1.X * scaleFactor; + result.Y = quaternion1.Y * scaleFactor; + result.Z = quaternion1.Z * scaleFactor; + result.W = quaternion1.W * scaleFactor; + } + + /// + /// Creates a new that contains a multiplication of two quaternions. + /// + /// Source . + /// Source . + /// The result of the quaternion multiplication as an output parameter. + public static void Multiply(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) + { + float x = quaternion1.X; + float y = quaternion1.Y; + float z = quaternion1.Z; + float w = quaternion1.W; + float num4 = quaternion2.X; + float num3 = quaternion2.Y; + float num2 = quaternion2.Z; + float num = quaternion2.W; + float num12 = (y * num2) - (z * num3); + float num11 = (z * num4) - (x * num2); + float num10 = (x * num3) - (y * num4); + float num9 = ((x * num4) + (y * num3)) + (z * num2); + result.X = ((x * num) + (num4 * w)) + num12; + result.Y = ((y * num) + (num3 * w)) + num11; + result.Z = ((z * num) + (num2 * w)) + num10; + result.W = (w * num) - num9; + } + + #endregion + + #region Negate + + /// + /// Flips the sign of the all the quaternion components. + /// + /// Source . + /// The result of the quaternion negation. + public static Quaternion Negate(Quaternion quaternion) + { + return new Quaternion(-quaternion.X, -quaternion.Y, -quaternion.Z, -quaternion.W); + } + + /// + /// Flips the sign of the all the quaternion components. + /// + /// Source . + /// The result of the quaternion negation as an output parameter. + public static void Negate(ref Quaternion quaternion, out Quaternion result) + { + result.X = -quaternion.X; + result.Y = -quaternion.Y; + result.Z = -quaternion.Z; + result.W = -quaternion.W; + } + + #endregion + + #region Normalize + + /// + /// Scales the quaternion magnitude to unit length. + /// + public void Normalize() + { + float num = 1f / ((float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W))); + X *= num; + Y *= num; + Z *= num; + W *= num; + } + + /// + /// Scales the quaternion magnitude to unit length. + /// + /// Source . + /// The unit length quaternion. + public static Quaternion Normalize(Quaternion quaternion) + { + Quaternion result; + float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W))); + result.X = quaternion.X * num; + result.Y = quaternion.Y * num; + result.Z = quaternion.Z * num; + result.W = quaternion.W * num; + return result; + } + + /// + /// Scales the quaternion magnitude to unit length. + /// + /// Source . + /// The unit length quaternion an output parameter. + public static void Normalize(ref Quaternion quaternion, out Quaternion result) + { + float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W))); + result.X = quaternion.X * num; + result.Y = quaternion.Y * num; + result.Z = quaternion.Z * num; + result.W = quaternion.W * num; + } + + #endregion + + /// + /// Returns a representation of this in the format: + /// {X:[] Y:[] Z:[] W:[]} + /// + /// A representation of this . + public override string ToString() + { + return "{X:" + X + " Y:" + Y + " Z:" + Z + " W:" + W + "}"; + } + + /// + /// Gets a representation for this object. + /// + /// A representation for this object. + public Vector4 ToVector4() + { + return new Vector4(X,Y,Z,W); + } + + #endregion + + #region Operators + + /// + /// Adds two quaternions. + /// + /// Source on the left of the add sign. + /// Source on the right of the add sign. + /// Sum of the vectors. + public static Quaternion operator +(Quaternion quaternion1, Quaternion quaternion2) + { + Quaternion quaternion; + quaternion.X = quaternion1.X + quaternion2.X; + quaternion.Y = quaternion1.Y + quaternion2.Y; + quaternion.Z = quaternion1.Z + quaternion2.Z; + quaternion.W = quaternion1.W + quaternion2.W; + return quaternion; + } + + /// + /// Divides a by the other . + /// + /// Source on the left of the div sign. + /// Divisor on the right of the div sign. + /// The result of dividing the quaternions. + public static Quaternion operator /(Quaternion quaternion1, Quaternion quaternion2) + { + Quaternion quaternion; + float x = quaternion1.X; + float y = quaternion1.Y; + float z = quaternion1.Z; + float w = quaternion1.W; + float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W); + float num5 = 1f / num14; + float num4 = -quaternion2.X * num5; + float num3 = -quaternion2.Y * num5; + float num2 = -quaternion2.Z * num5; + float num = quaternion2.W * num5; + float num13 = (y * num2) - (z * num3); + float num12 = (z * num4) - (x * num2); + float num11 = (x * num3) - (y * num4); + float num10 = ((x * num4) + (y * num3)) + (z * num2); + quaternion.X = ((x * num) + (num4 * w)) + num13; + quaternion.Y = ((y * num) + (num3 * w)) + num12; + quaternion.Z = ((z * num) + (num2 * w)) + num11; + quaternion.W = (w * num) - num10; + return quaternion; + } + + /// + /// Compares whether two instances are equal. + /// + /// instance on the left of the equal sign. + /// instance on the right of the equal sign. + /// true if the instances are equal; false otherwise. + public static bool operator ==(Quaternion quaternion1, Quaternion quaternion2) + { + return ((((quaternion1.X == quaternion2.X) && (quaternion1.Y == quaternion2.Y)) && (quaternion1.Z == quaternion2.Z)) && (quaternion1.W == quaternion2.W)); + } + + /// + /// Compares whether two instances are not equal. + /// + /// instance on the left of the not equal sign. + /// instance on the right of the not equal sign. + /// true if the instances are not equal; false otherwise. + public static bool operator !=(Quaternion quaternion1, Quaternion quaternion2) + { + if (((quaternion1.X == quaternion2.X) && (quaternion1.Y == quaternion2.Y)) && (quaternion1.Z == quaternion2.Z)) + { + return (quaternion1.W != quaternion2.W); + } + return true; + } + + /// + /// Multiplies two quaternions. + /// + /// Source on the left of the mul sign. + /// Source on the right of the mul sign. + /// Result of the quaternions multiplication. + public static Quaternion operator *(Quaternion quaternion1, Quaternion quaternion2) + { + Quaternion quaternion; + float x = quaternion1.X; + float y = quaternion1.Y; + float z = quaternion1.Z; + float w = quaternion1.W; + float num4 = quaternion2.X; + float num3 = quaternion2.Y; + float num2 = quaternion2.Z; + float num = quaternion2.W; + float num12 = (y * num2) - (z * num3); + float num11 = (z * num4) - (x * num2); + float num10 = (x * num3) - (y * num4); + float num9 = ((x * num4) + (y * num3)) + (z * num2); + quaternion.X = ((x * num) + (num4 * w)) + num12; + quaternion.Y = ((y * num) + (num3 * w)) + num11; + quaternion.Z = ((z * num) + (num2 * w)) + num10; + quaternion.W = (w * num) - num9; + return quaternion; + } + + /// + /// Multiplies the components of quaternion by a scalar. + /// + /// Source on the left of the mul sign. + /// Scalar value on the right of the mul sign. + /// Result of the quaternion multiplication with a scalar. + public static Quaternion operator *(Quaternion quaternion1, float scaleFactor) + { + Quaternion quaternion; + quaternion.X = quaternion1.X * scaleFactor; + quaternion.Y = quaternion1.Y * scaleFactor; + quaternion.Z = quaternion1.Z * scaleFactor; + quaternion.W = quaternion1.W * scaleFactor; + return quaternion; + } + + /// + /// Subtracts a from a . + /// + /// Source on the left of the sub sign. + /// Source on the right of the sub sign. + /// Result of the quaternion subtraction. + public static Quaternion operator -(Quaternion quaternion1, Quaternion quaternion2) + { + Quaternion quaternion; + quaternion.X = quaternion1.X - quaternion2.X; + quaternion.Y = quaternion1.Y - quaternion2.Y; + quaternion.Z = quaternion1.Z - quaternion2.Z; + quaternion.W = quaternion1.W - quaternion2.W; + return quaternion; + + } + + /// + /// Flips the sign of the all the quaternion components. + /// + /// Source on the right of the sub sign. + /// The result of the quaternion negation. + public static Quaternion operator -(Quaternion quaternion) + { + Quaternion quaternion2; + quaternion2.X = -quaternion.X; + quaternion2.Y = -quaternion.Y; + quaternion2.Z = -quaternion.Z; + quaternion2.W = -quaternion.W; + return quaternion2; + } + + #endregion + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Rectangle.cs b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Rectangle.cs new file mode 100644 index 000000000..469f51fc0 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Rectangle.cs @@ -0,0 +1,524 @@ +// MIT License - Copyright (C) The Mono.Xna Team +// This file is subject to the terms and conditions defined in +// file 'LICENSE.txt', which is part of this source code package. + +using System; +using System.Runtime.Serialization; +using System.Diagnostics; + +namespace Microsoft.Xna.Framework +{ + /// + /// Describes a 2D-rectangle. + /// + + [DebuggerDisplay("{DebugDisplayString,nq}")] + public struct Rectangle : IEquatable + { + #region Private Fields + + private static Rectangle emptyRectangle = new Rectangle(); + + #endregion + + #region Public Fields + + /// + /// The x coordinate of the top-left corner of this . + /// + + public int X; + + /// + /// The y coordinate of the top-left corner of this . + /// + + public int Y; + + /// + /// The width of this . + /// + + public int Width; + + /// + /// The height of this . + /// + + public int Height; + + #endregion + + #region Public Properties + + /// + /// Returns a with X=0, Y=0, Width=0, Height=0. + /// + public static Rectangle Empty + { + get { return emptyRectangle; } + } + + /// + /// Returns the x coordinate of the left edge of this . + /// + public int Left + { + get { return this.X; } + } + + /// + /// Returns the x coordinate of the right edge of this . + /// + public int Right + { + get { return (this.X + this.Width); } + } + + /// + /// Returns the y coordinate of the top edge of this . + /// + public int Top + { + get { return this.Y; } + } + + /// + /// Returns the y coordinate of the bottom edge of this . + /// + public int Bottom + { + get { return (this.Y + this.Height); } + } + + /// + /// Whether or not this has a and + /// of 0, and a of (0, 0). + /// + public bool IsEmpty + { + get + { + return ((((this.Width == 0) && (this.Height == 0)) && (this.X == 0)) && (this.Y == 0)); + } + } + + /// + /// The top-left coordinates of this . + /// + public Point Location + { + get + { + return new Point(this.X, this.Y); + } + set + { + X = value.X; + Y = value.Y; + } + } + + /// + /// The width-height coordinates of this . + /// + public Point Size + { + get + { + return new Point(this.Width,this.Height); + } + set + { + Width = value.X; + Height = value.Y; + } + } + + /// + /// A located in the center of this . + /// + /// + /// If or is an odd number, + /// the center point will be rounded down. + /// + public Point Center + { + get + { + return new Point(this.X + (this.Width / 2), this.Y + (this.Height / 2)); + } + } + + #endregion + + #region Internal Properties + + internal string DebugDisplayString + { + get + { + return string.Concat( + this.X, " ", + this.Y, " ", + this.Width, " ", + this.Height + ); + } + } + + #endregion + + #region Constructors + + /// + /// Creates a new instance of struct, with the specified + /// position, width, and height. + /// + /// The x coordinate of the top-left corner of the created . + /// The y coordinate of the top-left corner of the created . + /// The width of the created . + /// The height of the created . + public Rectangle(int x, int y, int width, int height) + { + this.X = x; + this.Y = y; + this.Width = width; + this.Height = height; + } + + /// + /// Creates a new instance of struct, with the specified + /// location and size. + /// + /// The x and y coordinates of the top-left corner of the created . + /// The width and height of the created . + public Rectangle(Point location,Point size) + { + this.X = location.X; + this.Y = location.Y; + this.Width = size.X; + this.Height = size.Y; + } + + #endregion + + #region Operators + + /// + /// Compares whether two instances are equal. + /// + /// instance on the left of the equal sign. + /// instance on the right of the equal sign. + /// true if the instances are equal; false otherwise. + public static bool operator ==(Rectangle a, Rectangle b) + { + return ((a.X == b.X) && (a.Y == b.Y) && (a.Width == b.Width) && (a.Height == b.Height)); + } + + /// + /// Compares whether two instances are not equal. + /// + /// instance on the left of the not equal sign. + /// instance on the right of the not equal sign. + /// true if the instances are not equal; false otherwise. + public static bool operator !=(Rectangle a, Rectangle b) + { + return !(a == b); + } + + #endregion + + #region Public Methods + + /// + /// Gets whether or not the provided coordinates lie within the bounds of this . + /// + /// The x coordinate of the point to check for containment. + /// The y coordinate of the point to check for containment. + /// true if the provided coordinates lie inside this ; false otherwise. + public bool Contains(int x, int y) + { + return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height))); + } + + /// + /// Gets whether or not the provided coordinates lie within the bounds of this . + /// + /// The x coordinate of the point to check for containment. + /// The y coordinate of the point to check for containment. + /// true if the provided coordinates lie inside this ; false otherwise. + public bool Contains(float x, float y) + { + return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height))); + } + + /// + /// Gets whether or not the provided lies within the bounds of this . + /// + /// The coordinates to check for inclusion in this . + /// true if the provided lies inside this ; false otherwise. + public bool Contains(Point value) + { + return ((((this.X <= value.X) && (value.X < (this.X + this.Width))) && (this.Y <= value.Y)) && (value.Y < (this.Y + this.Height))); + } + + /// + /// Gets whether or not the provided lies within the bounds of this . + /// + /// The coordinates to check for inclusion in this . + /// true if the provided lies inside this ; false otherwise. As an output parameter. + public void Contains(ref Point value, out bool result) + { + result = ((((this.X <= value.X) && (value.X < (this.X + this.Width))) && (this.Y <= value.Y)) && (value.Y < (this.Y + this.Height))); + } + + /// + /// Gets whether or not the provided lies within the bounds of this . + /// + /// The coordinates to check for inclusion in this . + /// true if the provided lies inside this ; false otherwise. + public bool Contains(Vector2 value) + { + return ((((this.X <= value.X) && (value.X < (this.X + this.Width))) && (this.Y <= value.Y)) && (value.Y < (this.Y + this.Height))); + } + + /// + /// Gets whether or not the provided lies within the bounds of this . + /// + /// The coordinates to check for inclusion in this . + /// true if the provided lies inside this ; false otherwise. As an output parameter. + public void Contains(ref Vector2 value, out bool result) + { + result = ((((this.X <= value.X) && (value.X < (this.X + this.Width))) && (this.Y <= value.Y)) && (value.Y < (this.Y + this.Height))); + } + + /// + /// Gets whether or not the provided lies within the bounds of this . + /// + /// The to check for inclusion in this . + /// true if the provided 's bounds lie entirely inside this ; false otherwise. + public bool Contains(Rectangle value) + { + return ((((this.X <= value.X) && ((value.X + value.Width) <= (this.X + this.Width))) && (this.Y <= value.Y)) && ((value.Y + value.Height) <= (this.Y + this.Height))); + } + + /// + /// Gets whether or not the provided lies within the bounds of this . + /// + /// The to check for inclusion in this . + /// true if the provided 's bounds lie entirely inside this ; false otherwise. As an output parameter. + public void Contains(ref Rectangle value,out bool result) + { + result = ((((this.X <= value.X) && ((value.X + value.Width) <= (this.X + this.Width))) && (this.Y <= value.Y)) && ((value.Y + value.Height) <= (this.Y + this.Height))); + } + + /// + /// Compares whether current instance is equal to specified . + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public override bool Equals(object obj) + { + return (obj is Rectangle) && this == ((Rectangle)obj); + } + + /// + /// Compares whether current instance is equal to specified . + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public bool Equals(Rectangle other) + { + return this == other; + } + + /// + /// Gets the hash code of this . + /// + /// Hash code of this . + public override int GetHashCode() + { + unchecked + { + var hash = 17; + hash = hash * 23 + X.GetHashCode(); + hash = hash * 23 + Y.GetHashCode(); + hash = hash * 23 + Width.GetHashCode(); + hash = hash * 23 + Height.GetHashCode(); + return hash; + } + } + + /// + /// Adjusts the edges of this by specified horizontal and vertical amounts. + /// + /// Value to adjust the left and right edges. + /// Value to adjust the top and bottom edges. + public void Inflate(int horizontalAmount, int verticalAmount) + { + X -= horizontalAmount; + Y -= verticalAmount; + Width += horizontalAmount * 2; + Height += verticalAmount * 2; + } + + /// + /// Adjusts the edges of this by specified horizontal and vertical amounts. + /// + /// Value to adjust the left and right edges. + /// Value to adjust the top and bottom edges. + public void Inflate(float horizontalAmount, float verticalAmount) + { + X -= (int)horizontalAmount; + Y -= (int)verticalAmount; + Width += (int)horizontalAmount * 2; + Height += (int)verticalAmount * 2; + } + + /// + /// Gets whether or not the other intersects with this rectangle. + /// + /// The other rectangle for testing. + /// true if other intersects with this rectangle; false otherwise. + public bool Intersects(Rectangle value) + { + return value.Left < Right && + Left < value.Right && + value.Top < Bottom && + Top < value.Bottom; + } + + + /// + /// Gets whether or not the other intersects with this rectangle. + /// + /// The other rectangle for testing. + /// true if other intersects with this rectangle; false otherwise. As an output parameter. + public void Intersects(ref Rectangle value, out bool result) + { + result = value.Left < Right && + Left < value.Right && + value.Top < Bottom && + Top < value.Bottom; + } + + /// + /// Creates a new that contains overlapping region of two other rectangles. + /// + /// The first . + /// The second . + /// Overlapping region of the two rectangles. + public static Rectangle Intersect(Rectangle value1, Rectangle value2) + { + Rectangle rectangle; + Intersect(ref value1, ref value2, out rectangle); + return rectangle; + } + + /// + /// Creates a new that contains overlapping region of two other rectangles. + /// + /// The first . + /// The second . + /// Overlapping region of the two rectangles as an output parameter. + public static void Intersect(ref Rectangle value1, ref Rectangle value2, out Rectangle result) + { + if (value1.Intersects(value2)) + { + int right_side = Math.Min(value1.X + value1.Width, value2.X + value2.Width); + int left_side = Math.Max(value1.X, value2.X); + int top_side = Math.Max(value1.Y, value2.Y); + int bottom_side = Math.Min(value1.Y + value1.Height, value2.Y + value2.Height); + result = new Rectangle(left_side, top_side, right_side - left_side, bottom_side - top_side); + } + else + { + result = new Rectangle(0, 0, 0, 0); + } + } + + /// + /// Changes the of this . + /// + /// The x coordinate to add to this . + /// The y coordinate to add to this . + public void Offset(int offsetX, int offsetY) + { + X += offsetX; + Y += offsetY; + } + + /// + /// Changes the of this . + /// + /// The x coordinate to add to this . + /// The y coordinate to add to this . + public void Offset(float offsetX, float offsetY) + { + X += (int)offsetX; + Y += (int)offsetY; + } + + /// + /// Changes the of this . + /// + /// The x and y components to add to this . + public void Offset(Point amount) + { + X += amount.X; + Y += amount.Y; + } + + /// + /// Changes the of this . + /// + /// The x and y components to add to this . + public void Offset(Vector2 amount) + { + X += (int)amount.X; + Y += (int)amount.Y; + } + + /// + /// Returns a representation of this in the format: + /// {X:[] Y:[] Width:[] Height:[]} + /// + /// representation of this . + public override string ToString() + { + return "{X:" + X + " Y:" + Y + " Width:" + Width + " Height:" + Height + "}"; + } + + /// + /// Creates a new that completely contains two other rectangles. + /// + /// The first . + /// The second . + /// The union of the two rectangles. + public static Rectangle Union(Rectangle value1, Rectangle value2) + { + int x = Math.Min(value1.X, value2.X); + int y = Math.Min(value1.Y, value2.Y); + return new Rectangle(x, y, + Math.Max(value1.Right, value2.Right) - x, + Math.Max(value1.Bottom, value2.Bottom) - y); + } + + /// + /// Creates a new that completely contains two other rectangles. + /// + /// The first . + /// The second . + /// The union of the two rectangles as an output parameter. + public static void Union(ref Rectangle value1, ref Rectangle value2, out Rectangle result) + { + result.X = Math.Min(value1.X, value2.X); + result.Y = Math.Min(value1.Y, value2.Y); + result.Width = Math.Max(value1.Right, value2.Right) - result.X; + result.Height = Math.Max(value1.Bottom, value2.Bottom) - result.Y; + } + + #endregion + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Vector4.cs b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Vector4.cs new file mode 100644 index 000000000..257829a34 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/MonogameTypes/Vector4.cs @@ -0,0 +1,1238 @@ +// MIT License - Copyright (C) The Mono.Xna Team +// This file is subject to the terms and conditions defined in +// file 'LICENSE.txt', which is part of this source code package. + +// Modified by juanjp600 to remove LerpPrecise, as it is not +// available in Farseer's implementation of MathHelper. + +using System; +using System.Runtime.Serialization; +using System.Diagnostics; + +namespace Microsoft.Xna.Framework +{ + /// + /// Describes a 4D-vector. + /// +#if XNADESIGNPROVIDED + [System.ComponentModel.TypeConverter(typeof(Microsoft.Xna.Framework.Design.Vector4TypeConverter))] +#endif + [DebuggerDisplay("{DebugDisplayString,nq}")] + public struct Vector4 : IEquatable + { + #region Private Fields + + private static readonly Vector4 zero = new Vector4(); + private static readonly Vector4 one = new Vector4(1f, 1f, 1f, 1f); + private static readonly Vector4 unitX = new Vector4(1f, 0f, 0f, 0f); + private static readonly Vector4 unitY = new Vector4(0f, 1f, 0f, 0f); + private static readonly Vector4 unitZ = new Vector4(0f, 0f, 1f, 0f); + private static readonly Vector4 unitW = new Vector4(0f, 0f, 0f, 1f); + + #endregion + + #region Public Fields + + /// + /// The x coordinate of this . + /// + + public float X; + + /// + /// The y coordinate of this . + /// + + public float Y; + + /// + /// The z coordinate of this . + /// + + public float Z; + + /// + /// The w coordinate of this . + /// + + public float W; + + #endregion + + #region Public Properties + + /// + /// Returns a with components 0, 0, 0, 0. + /// + public static Vector4 Zero + { + get { return zero; } + } + + /// + /// Returns a with components 1, 1, 1, 1. + /// + public static Vector4 One + { + get { return one; } + } + + /// + /// Returns a with components 1, 0, 0, 0. + /// + public static Vector4 UnitX + { + get { return unitX; } + } + + /// + /// Returns a with components 0, 1, 0, 0. + /// + public static Vector4 UnitY + { + get { return unitY; } + } + + /// + /// Returns a with components 0, 0, 1, 0. + /// + public static Vector4 UnitZ + { + get { return unitZ; } + } + + /// + /// Returns a with components 0, 0, 0, 1. + /// + public static Vector4 UnitW + { + get { return unitW; } + } + + #endregion + + #region Internal Properties + + internal string DebugDisplayString + { + get + { + return string.Concat( + this.X.ToString(), " ", + this.Y.ToString(), " ", + this.Z.ToString(), " ", + this.W.ToString() + ); + } + } + + #endregion + + #region Constructors + + /// + /// Constructs a 3d vector with X, Y, Z and W from four values. + /// + /// The x coordinate in 4d-space. + /// The y coordinate in 4d-space. + /// The z coordinate in 4d-space. + /// The w coordinate in 4d-space. + public Vector4(float x, float y, float z, float w) + { + this.X = x; + this.Y = y; + this.Z = z; + this.W = w; + } + + /// + /// Constructs a 3d vector with X and Z from and Z and W from the scalars. + /// + /// The x and y coordinates in 4d-space. + /// The z coordinate in 4d-space. + /// The w coordinate in 4d-space. + public Vector4(Vector2 value, float z, float w) + { + this.X = value.X; + this.Y = value.Y; + this.Z = z; + this.W = w; + } + + /// + /// Constructs a 3d vector with X, Y, Z from and W from a scalar. + /// + /// The x, y and z coordinates in 4d-space. + /// The w coordinate in 4d-space. + public Vector4(Vector3 value, float w) + { + this.X = value.X; + this.Y = value.Y; + this.Z = value.Z; + this.W = w; + } + + /// + /// Constructs a 4d vector with X, Y, Z and W set to the same value. + /// + /// The x, y, z and w coordinates in 4d-space. + public Vector4(float value) + { + this.X = value; + this.Y = value; + this.Z = value; + this.W = value; + } + + #endregion + + #region Public Methods + + /// + /// Performs vector addition on and . + /// + /// The first vector to add. + /// The second vector to add. + /// The result of the vector addition. + public static Vector4 Add(Vector4 value1, Vector4 value2) + { + value1.X += value2.X; + value1.Y += value2.Y; + value1.Z += value2.Z; + value1.W += value2.W; + return value1; + } + + /// + /// Performs vector addition on and + /// , storing the result of the + /// addition in . + /// + /// The first vector to add. + /// The second vector to add. + /// The result of the vector addition. + public static void Add(ref Vector4 value1, ref Vector4 value2, out Vector4 result) + { + result.X = value1.X + value2.X; + result.Y = value1.Y + value2.Y; + result.Z = value1.Z + value2.Z; + result.W = value1.W + value2.W; + } + + /// + /// Creates a new that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 4d-triangle. + /// + /// The first vector of 4d-triangle. + /// The second vector of 4d-triangle. + /// The third vector of 4d-triangle. + /// Barycentric scalar b2 which represents a weighting factor towards second vector of 4d-triangle. + /// Barycentric scalar b3 which represents a weighting factor towards third vector of 4d-triangle. + /// The cartesian translation of barycentric coordinates. + public static Vector4 Barycentric(Vector4 value1, Vector4 value2, Vector4 value3, float amount1, float amount2) + { + return new Vector4( + MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), + MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), + MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2), + MathHelper.Barycentric(value1.W, value2.W, value3.W, amount1, amount2)); + } + + /// + /// Creates a new that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 4d-triangle. + /// + /// The first vector of 4d-triangle. + /// The second vector of 4d-triangle. + /// The third vector of 4d-triangle. + /// Barycentric scalar b2 which represents a weighting factor towards second vector of 4d-triangle. + /// Barycentric scalar b3 which represents a weighting factor towards third vector of 4d-triangle. + /// The cartesian translation of barycentric coordinates as an output parameter. + public static void Barycentric(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, float amount1, float amount2, out Vector4 result) + { + result.X = MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2); + result.Y = MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2); + result.Z = MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2); + result.W = MathHelper.Barycentric(value1.W, value2.W, value3.W, amount1, amount2); + } + + /// + /// Creates a new that contains CatmullRom interpolation of the specified vectors. + /// + /// The first vector in interpolation. + /// The second vector in interpolation. + /// The third vector in interpolation. + /// The fourth vector in interpolation. + /// Weighting factor. + /// The result of CatmullRom interpolation. + public static Vector4 CatmullRom(Vector4 value1, Vector4 value2, Vector4 value3, Vector4 value4, float amount) + { + return new Vector4( + MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), + MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), + MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount), + MathHelper.CatmullRom(value1.W, value2.W, value3.W, value4.W, amount)); + } + + /// + /// Creates a new that contains CatmullRom interpolation of the specified vectors. + /// + /// The first vector in interpolation. + /// The second vector in interpolation. + /// The third vector in interpolation. + /// The fourth vector in interpolation. + /// Weighting factor. + /// The result of CatmullRom interpolation as an output parameter. + public static void CatmullRom(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, ref Vector4 value4, float amount, out Vector4 result) + { + result.X = MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount); + result.Y = MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount); + result.Z = MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount); + result.W = MathHelper.CatmullRom(value1.W, value2.W, value3.W, value4.W, amount); + } + + /// + /// Clamps the specified value within a range. + /// + /// The value to clamp. + /// The min value. + /// The max value. + /// The clamped value. + public static Vector4 Clamp(Vector4 value1, Vector4 min, Vector4 max) + { + return new Vector4( + MathHelper.Clamp(value1.X, min.X, max.X), + MathHelper.Clamp(value1.Y, min.Y, max.Y), + MathHelper.Clamp(value1.Z, min.Z, max.Z), + MathHelper.Clamp(value1.W, min.W, max.W)); + } + + /// + /// Clamps the specified value within a range. + /// + /// The value to clamp. + /// The min value. + /// The max value. + /// The clamped value as an output parameter. + public static void Clamp(ref Vector4 value1, ref Vector4 min, ref Vector4 max, out Vector4 result) + { + result.X = MathHelper.Clamp(value1.X, min.X, max.X); + result.Y = MathHelper.Clamp(value1.Y, min.Y, max.Y); + result.Z = MathHelper.Clamp(value1.Z, min.Z, max.Z); + result.W = MathHelper.Clamp(value1.W, min.W, max.W); + } + + /// + /// Returns the distance between two vectors. + /// + /// The first vector. + /// The second vector. + /// The distance between two vectors. + public static float Distance(Vector4 value1, Vector4 value2) + { + return (float)Math.Sqrt(DistanceSquared(value1, value2)); + } + + /// + /// Returns the distance between two vectors. + /// + /// The first vector. + /// The second vector. + /// The distance between two vectors as an output parameter. + public static void Distance(ref Vector4 value1, ref Vector4 value2, out float result) + { + result = (float)Math.Sqrt(DistanceSquared(value1, value2)); + } + + /// + /// Returns the squared distance between two vectors. + /// + /// The first vector. + /// The second vector. + /// The squared distance between two vectors. + public static float DistanceSquared(Vector4 value1, Vector4 value2) + { + return (value1.W - value2.W) * (value1.W - value2.W) + + (value1.X - value2.X) * (value1.X - value2.X) + + (value1.Y - value2.Y) * (value1.Y - value2.Y) + + (value1.Z - value2.Z) * (value1.Z - value2.Z); + } + + /// + /// Returns the squared distance between two vectors. + /// + /// The first vector. + /// The second vector. + /// The squared distance between two vectors as an output parameter. + public static void DistanceSquared(ref Vector4 value1, ref Vector4 value2, out float result) + { + result = (value1.W - value2.W) * (value1.W - value2.W) + + (value1.X - value2.X) * (value1.X - value2.X) + + (value1.Y - value2.Y) * (value1.Y - value2.Y) + + (value1.Z - value2.Z) * (value1.Z - value2.Z); + } + + /// + /// Divides the components of a by the components of another . + /// + /// Source . + /// Divisor . + /// The result of dividing the vectors. + public static Vector4 Divide(Vector4 value1, Vector4 value2) + { + value1.W /= value2.W; + value1.X /= value2.X; + value1.Y /= value2.Y; + value1.Z /= value2.Z; + return value1; + } + + /// + /// Divides the components of a by a scalar. + /// + /// Source . + /// Divisor scalar. + /// The result of dividing a vector by a scalar. + public static Vector4 Divide(Vector4 value1, float divider) + { + float factor = 1f / divider; + value1.W *= factor; + value1.X *= factor; + value1.Y *= factor; + value1.Z *= factor; + return value1; + } + + /// + /// Divides the components of a by a scalar. + /// + /// Source . + /// Divisor scalar. + /// The result of dividing a vector by a scalar as an output parameter. + public static void Divide(ref Vector4 value1, float divider, out Vector4 result) + { + float factor = 1f / divider; + result.W = value1.W * factor; + result.X = value1.X * factor; + result.Y = value1.Y * factor; + result.Z = value1.Z * factor; + } + + /// + /// Divides the components of a by the components of another . + /// + /// Source . + /// Divisor . + /// The result of dividing the vectors as an output parameter. + public static void Divide(ref Vector4 value1, ref Vector4 value2, out Vector4 result) + { + result.W = value1.W / value2.W; + result.X = value1.X / value2.X; + result.Y = value1.Y / value2.Y; + result.Z = value1.Z / value2.Z; + } + + /// + /// Returns a dot product of two vectors. + /// + /// The first vector. + /// The second vector. + /// The dot product of two vectors. + public static float Dot(Vector4 value1, Vector4 value2) + { + return value1.X * value2.X + value1.Y * value2.Y + value1.Z * value2.Z + value1.W * value2.W; + } + + /// + /// Returns a dot product of two vectors. + /// + /// The first vector. + /// The second vector. + /// The dot product of two vectors as an output parameter. + public static void Dot(ref Vector4 value1, ref Vector4 value2, out float result) + { + result = value1.X * value2.X + value1.Y * value2.Y + value1.Z * value2.Z + value1.W * value2.W; + } + + /// + /// Compares whether current instance is equal to specified . + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public override bool Equals(object obj) + { + return (obj is Vector4) ? this == (Vector4)obj : false; + } + + /// + /// Compares whether current instance is equal to specified . + /// + /// The to compare. + /// true if the instances are equal; false otherwise. + public bool Equals(Vector4 other) + { + return this.W == other.W + && this.X == other.X + && this.Y == other.Y + && this.Z == other.Z; + } + + /// + /// Gets the hash code of this . + /// + /// Hash code of this . + public override int GetHashCode() + { + return (int)(this.W + this.X + this.Y + this.Y); + } + + /// + /// Creates a new that contains hermite spline interpolation. + /// + /// The first position vector. + /// The first tangent vector. + /// The second position vector. + /// The second tangent vector. + /// Weighting factor. + /// The hermite spline interpolation vector. + public static Vector4 Hermite(Vector4 value1, Vector4 tangent1, Vector4 value2, Vector4 tangent2, float amount) + { + return new Vector4(MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount), + MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount), + MathHelper.Hermite(value1.Z, tangent1.Z, value2.Z, tangent2.Z, amount), + MathHelper.Hermite(value1.W, tangent1.W, value2.W, tangent2.W, amount)); + } + + /// + /// Creates a new that contains hermite spline interpolation. + /// + /// The first position vector. + /// The first tangent vector. + /// The second position vector. + /// The second tangent vector. + /// Weighting factor. + /// The hermite spline interpolation vector as an output parameter. + public static void Hermite(ref Vector4 value1, ref Vector4 tangent1, ref Vector4 value2, ref Vector4 tangent2, float amount, out Vector4 result) + { + result.W = MathHelper.Hermite(value1.W, tangent1.W, value2.W, tangent2.W, amount); + result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount); + result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount); + result.Z = MathHelper.Hermite(value1.Z, tangent1.Z, value2.Z, tangent2.Z, amount); + } + + /// + /// Returns the length of this . + /// + /// The length of this . + public float Length() + { + float result = DistanceSquared(this, zero); + return (float)Math.Sqrt(result); + } + + /// + /// Returns the squared length of this . + /// + /// The squared length of this . + public float LengthSquared() + { + return DistanceSquared(this, zero); + } + + /// + /// Creates a new that contains linear interpolation of the specified vectors. + /// + /// The first vector. + /// The second vector. + /// Weighting value(between 0.0 and 1.0). + /// The result of linear interpolation of the specified vectors. + public static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount) + { + return new Vector4( + MathHelper.Lerp(value1.X, value2.X, amount), + MathHelper.Lerp(value1.Y, value2.Y, amount), + MathHelper.Lerp(value1.Z, value2.Z, amount), + MathHelper.Lerp(value1.W, value2.W, amount)); + } + + /// + /// Creates a new that contains linear interpolation of the specified vectors. + /// + /// The first vector. + /// The second vector. + /// Weighting value(between 0.0 and 1.0). + /// The result of linear interpolation of the specified vectors as an output parameter. + public static void Lerp(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result) + { + result.X = MathHelper.Lerp(value1.X, value2.X, amount); + result.Y = MathHelper.Lerp(value1.Y, value2.Y, amount); + result.Z = MathHelper.Lerp(value1.Z, value2.Z, amount); + result.W = MathHelper.Lerp(value1.W, value2.W, amount); + } + + /// + /// Creates a new that contains a maximal values from the two vectors. + /// + /// The first vector. + /// The second vector. + /// The with maximal values from the two vectors. + public static Vector4 Max(Vector4 value1, Vector4 value2) + { + return new Vector4( + MathHelper.Max(value1.X, value2.X), + MathHelper.Max(value1.Y, value2.Y), + MathHelper.Max(value1.Z, value2.Z), + MathHelper.Max(value1.W, value2.W)); + } + + /// + /// Creates a new that contains a maximal values from the two vectors. + /// + /// The first vector. + /// The second vector. + /// The with maximal values from the two vectors as an output parameter. + public static void Max(ref Vector4 value1, ref Vector4 value2, out Vector4 result) + { + result.X = MathHelper.Max(value1.X, value2.X); + result.Y = MathHelper.Max(value1.Y, value2.Y); + result.Z = MathHelper.Max(value1.Z, value2.Z); + result.W = MathHelper.Max(value1.W, value2.W); + } + + /// + /// Creates a new that contains a minimal values from the two vectors. + /// + /// The first vector. + /// The second vector. + /// The with minimal values from the two vectors. + public static Vector4 Min(Vector4 value1, Vector4 value2) + { + return new Vector4( + MathHelper.Min(value1.X, value2.X), + MathHelper.Min(value1.Y, value2.Y), + MathHelper.Min(value1.Z, value2.Z), + MathHelper.Min(value1.W, value2.W)); + } + + /// + /// Creates a new that contains a minimal values from the two vectors. + /// + /// The first vector. + /// The second vector. + /// The with minimal values from the two vectors as an output parameter. + public static void Min(ref Vector4 value1, ref Vector4 value2, out Vector4 result) + { + result.X = MathHelper.Min(value1.X, value2.X); + result.Y = MathHelper.Min(value1.Y, value2.Y); + result.Z = MathHelper.Min(value1.Z, value2.Z); + result.W = MathHelper.Min(value1.W, value2.W); + } + + /// + /// Creates a new that contains a multiplication of two vectors. + /// + /// Source . + /// Source . + /// The result of the vector multiplication. + public static Vector4 Multiply(Vector4 value1, Vector4 value2) + { + value1.W *= value2.W; + value1.X *= value2.X; + value1.Y *= value2.Y; + value1.Z *= value2.Z; + return value1; + } + + /// + /// Creates a new that contains a multiplication of and a scalar. + /// + /// Source . + /// Scalar value. + /// The result of the vector multiplication with a scalar. + public static Vector4 Multiply(Vector4 value1, float scaleFactor) + { + value1.W *= scaleFactor; + value1.X *= scaleFactor; + value1.Y *= scaleFactor; + value1.Z *= scaleFactor; + return value1; + } + + /// + /// Creates a new that contains a multiplication of and a scalar. + /// + /// Source . + /// Scalar value. + /// The result of the multiplication with a scalar as an output parameter. + public static void Multiply(ref Vector4 value1, float scaleFactor, out Vector4 result) + { + result.W = value1.W * scaleFactor; + result.X = value1.X * scaleFactor; + result.Y = value1.Y * scaleFactor; + result.Z = value1.Z * scaleFactor; + } + + /// + /// Creates a new that contains a multiplication of two vectors. + /// + /// Source . + /// Source . + /// The result of the vector multiplication as an output parameter. + public static void Multiply(ref Vector4 value1, ref Vector4 value2, out Vector4 result) + { + result.W = value1.W * value2.W; + result.X = value1.X * value2.X; + result.Y = value1.Y * value2.Y; + result.Z = value1.Z * value2.Z; + } + + /// + /// Creates a new that contains the specified vector inversion. + /// + /// Source . + /// The result of the vector inversion. + public static Vector4 Negate(Vector4 value) + { + value = new Vector4(-value.X, -value.Y, -value.Z, -value.W); + return value; + } + + /// + /// Creates a new that contains the specified vector inversion. + /// + /// Source . + /// The result of the vector inversion as an output parameter. + public static void Negate(ref Vector4 value, out Vector4 result) + { + result.X = -value.X; + result.Y = -value.Y; + result.Z = -value.Z; + result.W = -value.W; + } + + /// + /// Turns this to a unit vector with the same direction. + /// + public void Normalize() + { + Normalize(ref this, out this); + } + + /// + /// Creates a new that contains a normalized values from another vector. + /// + /// Source . + /// Unit vector. + public static Vector4 Normalize(Vector4 value) + { + float factor = DistanceSquared(value, zero); + factor = 1f / (float)Math.Sqrt(factor); + + return new Vector4(value.X*factor,value.Y*factor,value.Z*factor,value.W*factor); + } + + /// + /// Creates a new that contains a normalized values from another vector. + /// + /// Source . + /// Unit vector as an output parameter. + public static void Normalize(ref Vector4 value, out Vector4 result) + { + float factor = DistanceSquared(value, zero); + factor = 1f / (float)Math.Sqrt(factor); + + result.W = value.W * factor; + result.X = value.X * factor; + result.Y = value.Y * factor; + result.Z = value.Z * factor; + } + + /// + /// Creates a new that contains cubic interpolation of the specified vectors. + /// + /// Source . + /// Source . + /// Weighting value. + /// Cubic interpolation of the specified vectors. + public static Vector4 SmoothStep(Vector4 value1, Vector4 value2, float amount) + { + return new Vector4( + MathHelper.SmoothStep(value1.X, value2.X, amount), + MathHelper.SmoothStep(value1.Y, value2.Y, amount), + MathHelper.SmoothStep(value1.Z, value2.Z, amount), + MathHelper.SmoothStep(value1.W, value2.W, amount)); + } + + /// + /// Creates a new that contains cubic interpolation of the specified vectors. + /// + /// Source . + /// Source . + /// Weighting value. + /// Cubic interpolation of the specified vectors as an output parameter. + public static void SmoothStep(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result) + { + result.X = MathHelper.SmoothStep(value1.X, value2.X, amount); + result.Y = MathHelper.SmoothStep(value1.Y, value2.Y, amount); + result.Z = MathHelper.SmoothStep(value1.Z, value2.Z, amount); + result.W = MathHelper.SmoothStep(value1.W, value2.W, amount); + } + + /// + /// Creates a new that contains subtraction of on from a another. + /// + /// Source . + /// Source . + /// The result of the vector subtraction. + public static Vector4 Subtract(Vector4 value1, Vector4 value2) + { + value1.W -= value2.W; + value1.X -= value2.X; + value1.Y -= value2.Y; + value1.Z -= value2.Z; + return value1; + } + + /// + /// Creates a new that contains subtraction of on from a another. + /// + /// Source . + /// Source . + /// The result of the vector subtraction as an output parameter. + public static void Subtract(ref Vector4 value1, ref Vector4 value2, out Vector4 result) + { + result.W = value1.W - value2.W; + result.X = value1.X - value2.X; + result.Y = value1.Y - value2.Y; + result.Z = value1.Z - value2.Z; + } + + #region Transform + + /// + /// Creates a new that contains a transformation of 2d-vector by the specified . + /// + /// Source . + /// The transformation . + /// Transformed . + public static Vector4 Transform(Vector2 value, Matrix matrix) + { + Vector4 result; + Transform(ref value, ref matrix, out result); + return result; + } + + /// + /// Creates a new that contains a transformation of 2d-vector by the specified . + /// + /// Source . + /// The which contains rotation transformation. + /// Transformed . + public static Vector4 Transform(Vector2 value, Quaternion rotation) + { + Vector4 result; + Transform(ref value, ref rotation, out result); + return result; + } + + /// + /// Creates a new that contains a transformation of 3d-vector by the specified . + /// + /// Source . + /// The transformation . + /// Transformed . + public static Vector4 Transform(Vector3 value, Matrix matrix) + { + Vector4 result; + Transform(ref value, ref matrix, out result); + return result; + } + + /// + /// Creates a new that contains a transformation of 3d-vector by the specified . + /// + /// Source . + /// The which contains rotation transformation. + /// Transformed . + public static Vector4 Transform(Vector3 value, Quaternion rotation) + { + Vector4 result; + Transform(ref value, ref rotation, out result); + return result; + } + + /// + /// Creates a new that contains a transformation of 4d-vector by the specified . + /// + /// Source . + /// The transformation . + /// Transformed . + public static Vector4 Transform(Vector4 value, Matrix matrix) + { + Transform(ref value, ref matrix, out value); + return value; + } + + /// + /// Creates a new that contains a transformation of 4d-vector by the specified . + /// + /// Source . + /// The which contains rotation transformation. + /// Transformed . + public static Vector4 Transform(Vector4 value, Quaternion rotation) + { + Vector4 result; + Transform(ref value, ref rotation, out result); + return result; + } + + /// + /// Creates a new that contains a transformation of 2d-vector by the specified . + /// + /// Source . + /// The transformation . + /// Transformed as an output parameter. + public static void Transform(ref Vector2 value, ref Matrix matrix, out Vector4 result) + { + result.X = (value.X * matrix.M11) + (value.Y * matrix.M21) + matrix.M41; + result.Y = (value.X * matrix.M12) + (value.Y * matrix.M22) + matrix.M42; + result.Z = (value.X * matrix.M13) + (value.Y * matrix.M23) + matrix.M43; + result.W = (value.X * matrix.M14) + (value.Y * matrix.M24) + matrix.M44; + } + + /// + /// Creates a new that contains a transformation of 2d-vector by the specified . + /// + /// Source . + /// The which contains rotation transformation. + /// Transformed as an output parameter. + public static void Transform(ref Vector2 value, ref Quaternion rotation, out Vector4 result) + { + throw new NotImplementedException(); + } + + /// + /// Creates a new that contains a transformation of 3d-vector by the specified . + /// + /// Source . + /// The transformation . + /// Transformed as an output parameter. + public static void Transform(ref Vector3 value, ref Matrix matrix, out Vector4 result) + { + result.X = (value.X * matrix.M11) + (value.Y * matrix.M21) + (value.Z * matrix.M31) + matrix.M41; + result.Y = (value.X * matrix.M12) + (value.Y * matrix.M22) + (value.Z * matrix.M32) + matrix.M42; + result.Z = (value.X * matrix.M13) + (value.Y * matrix.M23) + (value.Z * matrix.M33) + matrix.M43; + result.W = (value.X * matrix.M14) + (value.Y * matrix.M24) + (value.Z * matrix.M34) + matrix.M44; + } + + /// + /// Creates a new that contains a transformation of 3d-vector by the specified . + /// + /// Source . + /// The which contains rotation transformation. + /// Transformed as an output parameter. + public static void Transform(ref Vector3 value, ref Quaternion rotation, out Vector4 result) + { + throw new NotImplementedException(); + } + + /// + /// Creates a new that contains a transformation of 4d-vector by the specified . + /// + /// Source . + /// The transformation . + /// Transformed as an output parameter. + public static void Transform(ref Vector4 value, ref Matrix matrix, out Vector4 result) + { + var x = (value.X * matrix.M11) + (value.Y * matrix.M21) + (value.Z * matrix.M31) + (value.W * matrix.M41); + var y = (value.X * matrix.M12) + (value.Y * matrix.M22) + (value.Z * matrix.M32) + (value.W * matrix.M42); + var z = (value.X * matrix.M13) + (value.Y * matrix.M23) + (value.Z * matrix.M33) + (value.W * matrix.M43); + var w = (value.X * matrix.M14) + (value.Y * matrix.M24) + (value.Z * matrix.M34) + (value.W * matrix.M44); + result.X = x; + result.Y = y; + result.Z = z; + result.W = w; + } + + /// + /// Creates a new that contains a transformation of 4d-vector by the specified . + /// + /// Source . + /// The which contains rotation transformation. + /// Transformed as an output parameter. + public static void Transform(ref Vector4 value, ref Quaternion rotation, out Vector4 result) + { + throw new NotImplementedException(); + } + + /// + /// Apply transformation on vectors within array of by the specified and places the results in an another array. + /// + /// Source array. + /// The starting index of transformation in the source array. + /// The transformation . + /// Destination array. + /// The starting index in the destination array, where the first should be written. + /// The number of vectors to be transformed. + public static void Transform + ( + Vector4[] sourceArray, + int sourceIndex, + ref Matrix matrix, + Vector4[] destinationArray, + int destinationIndex, + int length + ) + { + if (sourceArray == null) + throw new ArgumentNullException("sourceArray"); + if (destinationArray == null) + throw new ArgumentNullException("destinationArray"); + if (sourceArray.Length < sourceIndex + length) + throw new ArgumentException("Source array length is lesser than sourceIndex + length"); + if (destinationArray.Length < destinationIndex + length) + throw new ArgumentException("Destination array length is lesser than destinationIndex + length"); + + for (var i = 0; i < length; i++) + { + var value = sourceArray[sourceIndex + i]; + destinationArray[destinationIndex + i] = Transform(value, matrix); + } + } + + /// + /// Apply transformation on vectors within array of by the specified and places the results in an another array. + /// + /// Source array. + /// The starting index of transformation in the source array. + /// The which contains rotation transformation. + /// Destination array. + /// The starting index in the destination array, where the first should be written. + /// The number of vectors to be transformed. + public static void Transform( + Vector4[] sourceArray, + int sourceIndex, + ref Quaternion rotation, + Vector4[] destinationArray, + int destinationIndex, + int length + ) + { + if (sourceArray == null) + throw new ArgumentNullException("sourceArray"); + if (destinationArray == null) + throw new ArgumentNullException("destinationArray"); + if (sourceArray.Length < sourceIndex + length) + throw new ArgumentException("Source array length is lesser than sourceIndex + length"); + if (destinationArray.Length < destinationIndex + length) + throw new ArgumentException("Destination array length is lesser than destinationIndex + length"); + + for (var i = 0; i < length; i++) + { + var value = sourceArray[sourceIndex + i]; + destinationArray[destinationIndex + i] = Transform(value, rotation); + } + } + + /// + /// Apply transformation on all vectors within array of by the specified and places the results in an another array. + /// + /// Source array. + /// The transformation . + /// Destination array. + public static void Transform(Vector4[] sourceArray, ref Matrix matrix, Vector4[] destinationArray) + { + if (sourceArray == null) + throw new ArgumentNullException("sourceArray"); + if (destinationArray == null) + throw new ArgumentNullException("destinationArray"); + if (destinationArray.Length < sourceArray.Length) + throw new ArgumentException("Destination array length is lesser than source array length"); + + for (var i = 0; i < sourceArray.Length; i++) + { + var value = sourceArray[i]; + destinationArray[i] = Transform(value, matrix); + } + } + + /// + /// Apply transformation on all vectors within array of by the specified and places the results in an another array. + /// + /// Source array. + /// The which contains rotation transformation. + /// Destination array. + public static void Transform(Vector4[] sourceArray, ref Quaternion rotation, Vector4[] destinationArray) + { + if (sourceArray == null) + throw new ArgumentNullException("sourceArray"); + if (destinationArray == null) + throw new ArgumentNullException("destinationArray"); + if (destinationArray.Length < sourceArray.Length) + throw new ArgumentException("Destination array length is lesser than source array length"); + + for (var i = 0; i < sourceArray.Length; i++) + { + var value = sourceArray[i]; + destinationArray[i] = Transform(value, rotation); + } + } + + #endregion + + /// + /// Returns a representation of this in the format: + /// {X:[] Y:[] Z:[] W:[]} + /// + /// A representation of this . + public override string ToString() + { + return "{X:" + X + " Y:" + Y + " Z:" + Z + " W:" + W + "}"; + } + + #endregion + + #region Operators + + /// + /// Inverts values in the specified . + /// + /// Source on the right of the sub sign. + /// Result of the inversion. + public static Vector4 operator -(Vector4 value) + { + return new Vector4(-value.X, -value.Y, -value.Z, -value.W); + } + + /// + /// Compares whether two instances are equal. + /// + /// instance on the left of the equal sign. + /// instance on the right of the equal sign. + /// true if the instances are equal; false otherwise. + public static bool operator ==(Vector4 value1, Vector4 value2) + { + return value1.W == value2.W + && value1.X == value2.X + && value1.Y == value2.Y + && value1.Z == value2.Z; + } + + /// + /// Compares whether two instances are not equal. + /// + /// instance on the left of the not equal sign. + /// instance on the right of the not equal sign. + /// true if the instances are not equal; false otherwise. + public static bool operator !=(Vector4 value1, Vector4 value2) + { + return !(value1 == value2); + } + + /// + /// Adds two vectors. + /// + /// Source on the left of the add sign. + /// Source on the right of the add sign. + /// Sum of the vectors. + public static Vector4 operator +(Vector4 value1, Vector4 value2) + { + value1.W += value2.W; + value1.X += value2.X; + value1.Y += value2.Y; + value1.Z += value2.Z; + return value1; + } + + /// + /// Subtracts a from a . + /// + /// Source on the left of the sub sign. + /// Source on the right of the sub sign. + /// Result of the vector subtraction. + public static Vector4 operator -(Vector4 value1, Vector4 value2) + { + value1.W -= value2.W; + value1.X -= value2.X; + value1.Y -= value2.Y; + value1.Z -= value2.Z; + return value1; + } + + /// + /// Multiplies the components of two vectors by each other. + /// + /// Source on the left of the mul sign. + /// Source on the right of the mul sign. + /// Result of the vector multiplication. + public static Vector4 operator *(Vector4 value1, Vector4 value2) + { + value1.W *= value2.W; + value1.X *= value2.X; + value1.Y *= value2.Y; + value1.Z *= value2.Z; + return value1; + } + + /// + /// Multiplies the components of vector by a scalar. + /// + /// Source on the left of the mul sign. + /// Scalar value on the right of the mul sign. + /// Result of the vector multiplication with a scalar. + public static Vector4 operator *(Vector4 value, float scaleFactor) + { + value.W *= scaleFactor; + value.X *= scaleFactor; + value.Y *= scaleFactor; + value.Z *= scaleFactor; + return value; + } + + /// + /// Multiplies the components of vector by a scalar. + /// + /// Scalar value on the left of the mul sign. + /// Source on the right of the mul sign. + /// Result of the vector multiplication with a scalar. + public static Vector4 operator *(float scaleFactor, Vector4 value) + { + value.W *= scaleFactor; + value.X *= scaleFactor; + value.Y *= scaleFactor; + value.Z *= scaleFactor; + return value; + } + + /// + /// Divides the components of a by the components of another . + /// + /// Source on the left of the div sign. + /// Divisor on the right of the div sign. + /// The result of dividing the vectors. + public static Vector4 operator /(Vector4 value1, Vector4 value2) + { + value1.W /= value2.W; + value1.X /= value2.X; + value1.Y /= value2.Y; + value1.Z /= value2.Z; + return value1; + } + + /// + /// Divides the components of a by a scalar. + /// + /// Source on the left of the div sign. + /// Divisor scalar on the right of the div sign. + /// The result of dividing a vector by a scalar. + public static Vector4 operator /(Vector4 value1, float divider) + { + float factor = 1f / divider; + value1.W *= factor; + value1.X *= factor; + value1.Y *= factor; + value1.Z *= factor; + return value1; + } + + #endregion + } +} diff --git a/Barotrauma/BarotraumaServer/Source/Utils/XnaToConsoleColor.cs b/Barotrauma/BarotraumaServer/Source/Utils/XnaToConsoleColor.cs new file mode 100644 index 000000000..7377bc216 --- /dev/null +++ b/Barotrauma/BarotraumaServer/Source/Utils/XnaToConsoleColor.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; + +namespace Barotrauma +{ + public static class XnaToConsoleColor + { + static Dictionary dictionary; + + public static ConsoleColor Convert(Color xnaCol) + { + if (dictionary == null) + { + dictionary = new Dictionary(); + dictionary.Add(Color.White, ConsoleColor.White); + dictionary.Add(Color.Gray, ConsoleColor.Gray); + dictionary.Add(Color.LightGray, ConsoleColor.Gray); + dictionary.Add(Color.DarkGray, ConsoleColor.Gray); + dictionary.Add(Color.Red, ConsoleColor.Red); + dictionary.Add(Color.DarkRed, ConsoleColor.DarkRed); + dictionary.Add(Color.Yellow, ConsoleColor.Yellow); + dictionary.Add(Color.Orange, ConsoleColor.Yellow); + dictionary.Add(Color.Green, ConsoleColor.Green); + dictionary.Add(Color.Lime, ConsoleColor.Green); + dictionary.Add(Color.Blue, ConsoleColor.Blue); + dictionary.Add(Color.Cyan, ConsoleColor.Cyan); + dictionary.Add(Color.DarkBlue, ConsoleColor.DarkBlue); + dictionary.Add(Color.Pink, ConsoleColor.Magenta); + dictionary.Add(Color.Magenta, ConsoleColor.Magenta); + } + + ConsoleColor val = ConsoleColor.White; + if (dictionary.TryGetValue(xnaCol, out val)) + { + return val; + } + + return ConsoleColor.White; + } + } +} diff --git a/Launcher2/packages.config b/Barotrauma/BarotraumaServer/packages.config similarity index 94% rename from Launcher2/packages.config rename to Barotrauma/BarotraumaServer/packages.config index 1acdfb47e..a63cb4deb 100644 --- a/Launcher2/packages.config +++ b/Barotrauma/BarotraumaServer/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Barotrauma/BarotraumaShared/BarotraumaShared.projitems b/Barotrauma/BarotraumaShared/BarotraumaShared.projitems new file mode 100644 index 000000000..65af1d5f4 --- /dev/null +++ b/Barotrauma/BarotraumaShared/BarotraumaShared.projitems @@ -0,0 +1,1467 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + 561357c2-db28-4e01-b275-6bf545f70491 + + + BarotraumaShared + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + Always + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Barotrauma/BarotraumaShared/BarotraumaShared.shproj b/Barotrauma/BarotraumaShared/BarotraumaShared.shproj new file mode 100644 index 000000000..25d6e31ed --- /dev/null +++ b/Barotrauma/BarotraumaShared/BarotraumaShared.shproj @@ -0,0 +1,13 @@ + + + + 561357c2-db28-4e01-b275-6bf545f70491 + 14.0 + + + + + + + + diff --git a/Barotrauma/BarotraumaShared/BarotraumaShared.shproj.user b/Barotrauma/BarotraumaShared/BarotraumaShared.shproj.user new file mode 100644 index 000000000..a11cd7f91 --- /dev/null +++ b/Barotrauma/BarotraumaShared/BarotraumaShared.shproj.user @@ -0,0 +1,6 @@ + + + + true + + \ No newline at end of file diff --git a/Barotrauma/Content/BackgroundSprites/BackgroundCreaturePrefabs.xml b/Barotrauma/BarotraumaShared/Content/BackgroundSprites/BackgroundCreaturePrefabs.xml similarity index 100% rename from Barotrauma/Content/BackgroundSprites/BackgroundCreaturePrefabs.xml rename to Barotrauma/BarotraumaShared/Content/BackgroundSprites/BackgroundCreaturePrefabs.xml diff --git a/Barotrauma/Content/BackgroundSprites/BackgroundSpritePrefabs.xml b/Barotrauma/BarotraumaShared/Content/BackgroundSprites/BackgroundSpritePrefabs.xml similarity index 100% rename from Barotrauma/Content/BackgroundSprites/BackgroundSpritePrefabs.xml rename to Barotrauma/BarotraumaShared/Content/BackgroundSprites/BackgroundSpritePrefabs.xml diff --git a/Barotrauma/Content/BackgroundSprites/bgFish1.png b/Barotrauma/BarotraumaShared/Content/BackgroundSprites/bgFish1.png similarity index 100% rename from Barotrauma/Content/BackgroundSprites/bgFish1.png rename to Barotrauma/BarotraumaShared/Content/BackgroundSprites/bgFish1.png diff --git a/Barotrauma/Content/BackgroundSprites/ice.png b/Barotrauma/BarotraumaShared/Content/BackgroundSprites/ice.png similarity index 100% rename from Barotrauma/Content/BackgroundSprites/ice.png rename to Barotrauma/BarotraumaShared/Content/BackgroundSprites/ice.png diff --git a/Barotrauma/Content/BackgroundSprites/vegetation.png b/Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation.png similarity index 100% rename from Barotrauma/Content/BackgroundSprites/vegetation.png rename to Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation.png diff --git a/Barotrauma/Content/BackgroundSprites/vegetation2.png b/Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation2.png similarity index 100% rename from Barotrauma/Content/BackgroundSprites/vegetation2.png rename to Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation2.png diff --git a/Barotrauma/Content/BackgroundSprites/vegetation3.png b/Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation3.png similarity index 100% rename from Barotrauma/Content/BackgroundSprites/vegetation3.png rename to Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation3.png diff --git a/Barotrauma/Content/BackgroundSprites/vegetation4.png b/Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation4.png similarity index 100% rename from Barotrauma/Content/BackgroundSprites/vegetation4.png rename to Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation4.png diff --git a/Barotrauma/Content/BackgroundSprites/vegetation5.png b/Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation5.png similarity index 100% rename from Barotrauma/Content/BackgroundSprites/vegetation5.png rename to Barotrauma/BarotraumaShared/Content/BackgroundSprites/vegetation5.png diff --git a/Barotrauma/Content/Characters/Carrier/alarm1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Carrier/alarm1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Carrier/alarm1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Carrier/alarm1.ogg diff --git a/Barotrauma/Content/Characters/Carrier/carrier.png b/Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier.png similarity index 100% rename from Barotrauma/Content/Characters/Carrier/carrier.png rename to Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier.png diff --git a/Barotrauma/Content/Characters/Carrier/carrier.xml b/Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier.xml similarity index 100% rename from Barotrauma/Content/Characters/Carrier/carrier.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier.xml diff --git a/Barotrauma/Content/Characters/Carrier/carrier1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Carrier/carrier1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier1.ogg diff --git a/Barotrauma/Content/Characters/Carrier/carrier2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Carrier/carrier2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier2.ogg diff --git a/Barotrauma/Content/Characters/Carrier/carrier3.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier3.ogg similarity index 100% rename from Barotrauma/Content/Characters/Carrier/carrier3.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Carrier/carrier3.ogg diff --git a/Barotrauma/Content/Characters/Carrier/ping.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Carrier/ping.ogg similarity index 100% rename from Barotrauma/Content/Characters/Carrier/ping.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Carrier/ping.ogg diff --git a/Barotrauma/Content/Characters/Charybdis/charybdis.png b/Barotrauma/BarotraumaShared/Content/Characters/Charybdis/charybdis.png similarity index 100% rename from Barotrauma/Content/Characters/Charybdis/charybdis.png rename to Barotrauma/BarotraumaShared/Content/Characters/Charybdis/charybdis.png diff --git a/Barotrauma/Content/Characters/Charybdis/charybdis.xml b/Barotrauma/BarotraumaShared/Content/Characters/Charybdis/charybdis.xml similarity index 100% rename from Barotrauma/Content/Characters/Charybdis/charybdis.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Charybdis/charybdis.xml diff --git a/Barotrauma/Content/Characters/Charybdis/charybdisattack.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Charybdis/charybdisattack.ogg similarity index 100% rename from Barotrauma/Content/Characters/Charybdis/charybdisattack.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Charybdis/charybdisattack.ogg diff --git a/Barotrauma/Content/Characters/Coelanth/attack1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Coelanth/attack1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Coelanth/attack1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Coelanth/attack1.ogg diff --git a/Barotrauma/Content/Characters/Coelanth/coelanth.png b/Barotrauma/BarotraumaShared/Content/Characters/Coelanth/coelanth.png similarity index 100% rename from Barotrauma/Content/Characters/Coelanth/coelanth.png rename to Barotrauma/BarotraumaShared/Content/Characters/Coelanth/coelanth.png diff --git a/Barotrauma/Content/Characters/Coelanth/coelanth.xml b/Barotrauma/BarotraumaShared/Content/Characters/Coelanth/coelanth.xml similarity index 100% rename from Barotrauma/Content/Characters/Coelanth/coelanth.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Coelanth/coelanth.xml diff --git a/Barotrauma/Content/Characters/Coelanth/idle1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Coelanth/idle1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Coelanth/idle1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Coelanth/idle1.ogg diff --git a/Barotrauma/Content/Characters/Coelanth/idle2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Coelanth/idle2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Coelanth/idle2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Coelanth/idle2.ogg diff --git a/Barotrauma/Content/Characters/Crawler/attack1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Crawler/attack1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Crawler/attack1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Crawler/attack1.ogg diff --git a/Barotrauma/Content/Characters/Crawler/attack2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Crawler/attack2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Crawler/attack2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Crawler/attack2.ogg diff --git a/Barotrauma/Content/Characters/Crawler/crawler.png b/Barotrauma/BarotraumaShared/Content/Characters/Crawler/crawler.png similarity index 100% rename from Barotrauma/Content/Characters/Crawler/crawler.png rename to Barotrauma/BarotraumaShared/Content/Characters/Crawler/crawler.png diff --git a/Barotrauma/Content/Characters/Crawler/crawler.xml b/Barotrauma/BarotraumaShared/Content/Characters/Crawler/crawler.xml similarity index 100% rename from Barotrauma/Content/Characters/Crawler/crawler.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Crawler/crawler.xml diff --git a/Barotrauma/Content/Characters/Crawler/idle1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Crawler/idle1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Crawler/idle1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Crawler/idle1.ogg diff --git a/Barotrauma/Content/Characters/Crawler/idle2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Crawler/idle2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Crawler/idle2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Crawler/idle2.ogg diff --git a/Barotrauma/Content/Characters/Endworm/endworm.png b/Barotrauma/BarotraumaShared/Content/Characters/Endworm/endworm.png similarity index 100% rename from Barotrauma/Content/Characters/Endworm/endworm.png rename to Barotrauma/BarotraumaShared/Content/Characters/Endworm/endworm.png diff --git a/Barotrauma/Content/Characters/Endworm/endworm.xml b/Barotrauma/BarotraumaShared/Content/Characters/Endworm/endworm.xml similarity index 100% rename from Barotrauma/Content/Characters/Endworm/endworm.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Endworm/endworm.xml diff --git a/Barotrauma/Content/Characters/Endworm/endwormattack1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Endworm/endwormattack1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Endworm/endwormattack1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Endworm/endwormattack1.ogg diff --git a/Barotrauma/Content/Characters/Endworm/endwormattack2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Endworm/endwormattack2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Endworm/endwormattack2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Endworm/endwormattack2.ogg diff --git a/Barotrauma/Content/Characters/Endworm/endwormidle.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Endworm/endwormidle.ogg similarity index 100% rename from Barotrauma/Content/Characters/Endworm/endwormidle.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Endworm/endwormidle.ogg diff --git a/Barotrauma/Content/Characters/Fractalguardian/Die1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/Die1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Fractalguardian/Die1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/Die1.ogg diff --git a/Barotrauma/Content/Characters/Fractalguardian/Die2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/Die2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Fractalguardian/Die2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/Die2.ogg diff --git a/Barotrauma/Content/Characters/Fractalguardian/fractalguardian.png b/Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/fractalguardian.png similarity index 100% rename from Barotrauma/Content/Characters/Fractalguardian/fractalguardian.png rename to Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/fractalguardian.png diff --git a/Barotrauma/Content/Characters/Fractalguardian/fractalguardian.xml b/Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/fractalguardian.xml similarity index 100% rename from Barotrauma/Content/Characters/Fractalguardian/fractalguardian.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/fractalguardian.xml diff --git a/Barotrauma/Content/Characters/Fractalguardian/guardian1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/guardian1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Fractalguardian/guardian1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/guardian1.ogg diff --git a/Barotrauma/Content/Characters/Fractalguardian/guardian2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/guardian2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Fractalguardian/guardian2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian/guardian2.ogg diff --git a/Barotrauma/Content/Characters/Fractalguardian2/fractalguardian2.xml b/Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian2/fractalguardian2.xml similarity index 100% rename from Barotrauma/Content/Characters/Fractalguardian2/fractalguardian2.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Fractalguardian2/fractalguardian2.xml diff --git a/Barotrauma/Content/Characters/Human/damagedhead.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/damagedhead.png similarity index 100% rename from Barotrauma/Content/Characters/Human/damagedhead.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/damagedhead.png diff --git a/Barotrauma/Content/Characters/Human/damagedlegs.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/damagedlegs.png similarity index 100% rename from Barotrauma/Content/Characters/Human/damagedlegs.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/damagedlegs.png diff --git a/Barotrauma/Content/Characters/Human/damagedtorso.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/damagedtorso.png similarity index 100% rename from Barotrauma/Content/Characters/Human/damagedtorso.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/damagedtorso.png diff --git a/Barotrauma/Content/Characters/Human/ffirstnames.txt b/Barotrauma/BarotraumaShared/Content/Characters/Human/ffirstnames.txt similarity index 100% rename from Barotrauma/Content/Characters/Human/ffirstnames.txt rename to Barotrauma/BarotraumaShared/Content/Characters/Human/ffirstnames.txt diff --git a/Barotrauma/Content/Characters/Human/fhead1.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/fhead1.png similarity index 100% rename from Barotrauma/Content/Characters/Human/fhead1.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/fhead1.png diff --git a/Barotrauma/Content/Characters/Human/fhead2.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/fhead2.png similarity index 100% rename from Barotrauma/Content/Characters/Human/fhead2.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/fhead2.png diff --git a/Barotrauma/Content/Characters/Human/fhead3.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/fhead3.png similarity index 100% rename from Barotrauma/Content/Characters/Human/fhead3.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/fhead3.png diff --git a/Barotrauma/Content/Characters/Human/fhead4.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/fhead4.png similarity index 100% rename from Barotrauma/Content/Characters/Human/fhead4.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/fhead4.png diff --git a/Barotrauma/Content/Characters/Human/fhead5.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/fhead5.png similarity index 100% rename from Barotrauma/Content/Characters/Human/fhead5.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/fhead5.png diff --git a/Barotrauma/Content/Characters/Human/fhead6.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/fhead6.png similarity index 100% rename from Barotrauma/Content/Characters/Human/fhead6.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/fhead6.png diff --git a/Barotrauma/Content/Characters/Human/fhead7[black].png b/Barotrauma/BarotraumaShared/Content/Characters/Human/fhead7[black].png similarity index 100% rename from Barotrauma/Content/Characters/Human/fhead7[black].png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/fhead7[black].png diff --git a/Barotrauma/Content/Characters/Human/fhead8.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/fhead8.png similarity index 100% rename from Barotrauma/Content/Characters/Human/fhead8.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/fhead8.png diff --git a/Barotrauma/Content/Characters/Human/firstnames.txt b/Barotrauma/BarotraumaShared/Content/Characters/Human/firstnames.txt similarity index 100% rename from Barotrauma/Content/Characters/Human/firstnames.txt rename to Barotrauma/BarotraumaShared/Content/Characters/Human/firstnames.txt diff --git a/Barotrauma/Content/Characters/Human/flegs.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/flegs.png similarity index 100% rename from Barotrauma/Content/Characters/Human/flegs.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/flegs.png diff --git a/Barotrauma/Content/Characters/Human/ftorso.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/ftorso.png similarity index 100% rename from Barotrauma/Content/Characters/Human/ftorso.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/ftorso.png diff --git a/Barotrauma/Content/Characters/Human/ftorso[black].png b/Barotrauma/BarotraumaShared/Content/Characters/Human/ftorso[black].png similarity index 100% rename from Barotrauma/Content/Characters/Human/ftorso[black].png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/ftorso[black].png diff --git a/Barotrauma/Content/Characters/Human/head1.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/head1.png similarity index 100% rename from Barotrauma/Content/Characters/Human/head1.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/head1.png diff --git a/Barotrauma/Content/Characters/Human/head2.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/head2.png similarity index 100% rename from Barotrauma/Content/Characters/Human/head2.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/head2.png diff --git a/Barotrauma/Content/Characters/Human/head3.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/head3.png similarity index 100% rename from Barotrauma/Content/Characters/Human/head3.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/head3.png diff --git a/Barotrauma/Content/Characters/Human/head4.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/head4.png similarity index 100% rename from Barotrauma/Content/Characters/Human/head4.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/head4.png diff --git a/Barotrauma/Content/Characters/Human/head5.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/head5.png similarity index 100% rename from Barotrauma/Content/Characters/Human/head5.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/head5.png diff --git a/Barotrauma/Content/Characters/Human/head6.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/head6.png similarity index 100% rename from Barotrauma/Content/Characters/Human/head6.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/head6.png diff --git a/Barotrauma/Content/Characters/Human/head7[black].png b/Barotrauma/BarotraumaShared/Content/Characters/Human/head7[black].png similarity index 100% rename from Barotrauma/Content/Characters/Human/head7[black].png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/head7[black].png diff --git a/Barotrauma/Content/Characters/Human/head8[black].png b/Barotrauma/BarotraumaShared/Content/Characters/Human/head8[black].png similarity index 100% rename from Barotrauma/Content/Characters/Human/head8[black].png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/head8[black].png diff --git a/Barotrauma/Content/Characters/Human/human.xml b/Barotrauma/BarotraumaShared/Content/Characters/Human/human.xml similarity index 100% rename from Barotrauma/Content/Characters/Human/human.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Human/human.xml diff --git a/Barotrauma/Content/Characters/Human/humanhusk.xml b/Barotrauma/BarotraumaShared/Content/Characters/Human/humanhusk.xml similarity index 100% rename from Barotrauma/Content/Characters/Human/humanhusk.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Human/humanhusk.xml diff --git a/Barotrauma/Content/Characters/Human/huskappendage.xml b/Barotrauma/BarotraumaShared/Content/Characters/Human/huskappendage.xml similarity index 100% rename from Barotrauma/Content/Characters/Human/huskappendage.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Human/huskappendage.xml diff --git a/Barotrauma/Content/Characters/Human/lastnames.txt b/Barotrauma/BarotraumaShared/Content/Characters/Human/lastnames.txt similarity index 100% rename from Barotrauma/Content/Characters/Human/lastnames.txt rename to Barotrauma/BarotraumaShared/Content/Characters/Human/lastnames.txt diff --git a/Barotrauma/Content/Characters/Human/legs.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/legs.png similarity index 100% rename from Barotrauma/Content/Characters/Human/legs.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/legs.png diff --git a/Barotrauma/Content/Characters/Human/torso.png b/Barotrauma/BarotraumaShared/Content/Characters/Human/torso.png similarity index 100% rename from Barotrauma/Content/Characters/Human/torso.png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/torso.png diff --git a/Barotrauma/Content/Characters/Human/torso[black].png b/Barotrauma/BarotraumaShared/Content/Characters/Human/torso[black].png similarity index 100% rename from Barotrauma/Content/Characters/Human/torso[black].png rename to Barotrauma/BarotraumaShared/Content/Characters/Human/torso[black].png diff --git a/Barotrauma/Content/Characters/Husk/DivingSuit.png b/Barotrauma/BarotraumaShared/Content/Characters/Husk/DivingSuit.png similarity index 100% rename from Barotrauma/Content/Characters/Husk/DivingSuit.png rename to Barotrauma/BarotraumaShared/Content/Characters/Husk/DivingSuit.png diff --git a/Barotrauma/Content/Characters/Husk/Husk1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Husk/Husk1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Husk/Husk1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Husk/Husk1.ogg diff --git a/Barotrauma/Content/Characters/Husk/Husk2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Husk/Husk2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Husk/Husk2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Husk/Husk2.ogg diff --git a/Barotrauma/Content/Characters/Husk/Husk3.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Husk/Husk3.ogg similarity index 100% rename from Barotrauma/Content/Characters/Husk/Husk3.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Husk/Husk3.ogg diff --git a/Barotrauma/Content/Characters/Husk/husk.xml b/Barotrauma/BarotraumaShared/Content/Characters/Husk/husk.xml similarity index 100% rename from Barotrauma/Content/Characters/Husk/husk.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Husk/husk.xml diff --git a/Barotrauma/Content/Characters/Husk/legs.png b/Barotrauma/BarotraumaShared/Content/Characters/Husk/legs.png similarity index 100% rename from Barotrauma/Content/Characters/Husk/legs.png rename to Barotrauma/BarotraumaShared/Content/Characters/Husk/legs.png diff --git a/Barotrauma/Content/Characters/Mantis/attack1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Mantis/attack1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Mantis/attack1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Mantis/attack1.ogg diff --git a/Barotrauma/Content/Characters/Mantis/attack2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Mantis/attack2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Mantis/attack2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Mantis/attack2.ogg diff --git a/Barotrauma/Content/Characters/Mantis/idle1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Mantis/idle1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Mantis/idle1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Mantis/idle1.ogg diff --git a/Barotrauma/Content/Characters/Mantis/idle2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Mantis/idle2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Mantis/idle2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Mantis/idle2.ogg diff --git a/Barotrauma/Content/Characters/Mantis/idle3.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Mantis/idle3.ogg similarity index 100% rename from Barotrauma/Content/Characters/Mantis/idle3.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Mantis/idle3.ogg diff --git a/Barotrauma/Content/Characters/Mantis/mantis.png b/Barotrauma/BarotraumaShared/Content/Characters/Mantis/mantis.png similarity index 100% rename from Barotrauma/Content/Characters/Mantis/mantis.png rename to Barotrauma/BarotraumaShared/Content/Characters/Mantis/mantis.png diff --git a/Barotrauma/Content/Characters/Mantis/mantis.xml b/Barotrauma/BarotraumaShared/Content/Characters/Mantis/mantis.xml similarity index 100% rename from Barotrauma/Content/Characters/Mantis/mantis.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Mantis/mantis.xml diff --git a/Barotrauma/Content/Characters/Moloch/attack1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Moloch/attack1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Moloch/attack1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Moloch/attack1.ogg diff --git a/Barotrauma/Content/Characters/Moloch/attack2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Moloch/attack2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Moloch/attack2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Moloch/attack2.ogg diff --git a/Barotrauma/Content/Characters/Moloch/idle1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Moloch/idle1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Moloch/idle1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Moloch/idle1.ogg diff --git a/Barotrauma/Content/Characters/Moloch/idle2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Moloch/idle2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Moloch/idle2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Moloch/idle2.ogg diff --git a/Barotrauma/Content/Characters/Moloch/moloch.png b/Barotrauma/BarotraumaShared/Content/Characters/Moloch/moloch.png similarity index 100% rename from Barotrauma/Content/Characters/Moloch/moloch.png rename to Barotrauma/BarotraumaShared/Content/Characters/Moloch/moloch.png diff --git a/Barotrauma/Content/Characters/Moloch/moloch.xml b/Barotrauma/BarotraumaShared/Content/Characters/Moloch/moloch.xml similarity index 100% rename from Barotrauma/Content/Characters/Moloch/moloch.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Moloch/moloch.xml diff --git a/Barotrauma/Content/Characters/Scorpion/scorpion.png b/Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpion.png similarity index 100% rename from Barotrauma/Content/Characters/Scorpion/scorpion.png rename to Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpion.png diff --git a/Barotrauma/Content/Characters/Scorpion/scorpion.xml b/Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpion.xml similarity index 100% rename from Barotrauma/Content/Characters/Scorpion/scorpion.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpion.xml diff --git a/Barotrauma/Content/Characters/Scorpion/scorpionattack1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpionattack1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Scorpion/scorpionattack1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpionattack1.ogg diff --git a/Barotrauma/Content/Characters/Scorpion/scorpionidle1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpionidle1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Scorpion/scorpionidle1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpionidle1.ogg diff --git a/Barotrauma/Content/Characters/Scorpion/scorpionidle2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpionidle2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Scorpion/scorpionidle2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Scorpion/scorpionidle2.ogg diff --git a/Barotrauma/Content/Characters/Tigerthresher/damagedtigerthresher.png b/Barotrauma/BarotraumaShared/Content/Characters/Tigerthresher/damagedtigerthresher.png similarity index 100% rename from Barotrauma/Content/Characters/Tigerthresher/damagedtigerthresher.png rename to Barotrauma/BarotraumaShared/Content/Characters/Tigerthresher/damagedtigerthresher.png diff --git a/Barotrauma/Content/Characters/Tigerthresher/tigerthresher.png b/Barotrauma/BarotraumaShared/Content/Characters/Tigerthresher/tigerthresher.png similarity index 100% rename from Barotrauma/Content/Characters/Tigerthresher/tigerthresher.png rename to Barotrauma/BarotraumaShared/Content/Characters/Tigerthresher/tigerthresher.png diff --git a/Barotrauma/Content/Characters/Tigerthresher/tigerthresher.xml b/Barotrauma/BarotraumaShared/Content/Characters/Tigerthresher/tigerthresher.xml similarity index 100% rename from Barotrauma/Content/Characters/Tigerthresher/tigerthresher.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Tigerthresher/tigerthresher.xml diff --git a/Barotrauma/Content/Characters/Watcher/attack1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/attack1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Watcher/attack1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/attack1.ogg diff --git a/Barotrauma/Content/Characters/Watcher/attack2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/attack2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Watcher/attack2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/attack2.ogg diff --git a/Barotrauma/Content/Characters/Watcher/attack3.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/attack3.ogg similarity index 100% rename from Barotrauma/Content/Characters/Watcher/attack3.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/attack3.ogg diff --git a/Barotrauma/Content/Characters/Watcher/watch1.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch1.ogg similarity index 100% rename from Barotrauma/Content/Characters/Watcher/watch1.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch1.ogg diff --git a/Barotrauma/Content/Characters/Watcher/watch2.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch2.ogg similarity index 100% rename from Barotrauma/Content/Characters/Watcher/watch2.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch2.ogg diff --git a/Barotrauma/Content/Characters/Watcher/watch3.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch3.ogg similarity index 100% rename from Barotrauma/Content/Characters/Watcher/watch3.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch3.ogg diff --git a/Barotrauma/Content/Characters/Watcher/watch4.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch4.ogg similarity index 100% rename from Barotrauma/Content/Characters/Watcher/watch4.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch4.ogg diff --git a/Barotrauma/Content/Characters/Watcher/watch5.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch5.ogg similarity index 100% rename from Barotrauma/Content/Characters/Watcher/watch5.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch5.ogg diff --git a/Barotrauma/Content/Characters/Watcher/watch6.ogg b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch6.ogg similarity index 100% rename from Barotrauma/Content/Characters/Watcher/watch6.ogg rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/watch6.ogg diff --git a/Barotrauma/Content/Characters/Watcher/watcher.png b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/watcher.png similarity index 100% rename from Barotrauma/Content/Characters/Watcher/watcher.png rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/watcher.png diff --git a/Barotrauma/Content/Characters/Watcher/watcher.xml b/Barotrauma/BarotraumaShared/Content/Characters/Watcher/watcher.xml similarity index 100% rename from Barotrauma/Content/Characters/Watcher/watcher.xml rename to Barotrauma/BarotraumaShared/Content/Characters/Watcher/watcher.xml diff --git a/Barotrauma/Content/Code Pro Bold.otf b/Barotrauma/BarotraumaShared/Content/Code Pro Bold.otf similarity index 100% rename from Barotrauma/Content/Code Pro Bold.otf rename to Barotrauma/BarotraumaShared/Content/Code Pro Bold.otf diff --git a/Barotrauma/Content/Content.mgcb b/Barotrauma/BarotraumaShared/Content/Content.mgcb similarity index 100% rename from Barotrauma/Content/Content.mgcb rename to Barotrauma/BarotraumaShared/Content/Content.mgcb diff --git a/Barotrauma/Content/Exo2-Light.otf b/Barotrauma/BarotraumaShared/Content/Exo2-Light.otf similarity index 100% rename from Barotrauma/Content/Exo2-Light.otf rename to Barotrauma/BarotraumaShared/Content/Exo2-Light.otf diff --git a/Barotrauma/Content/Exo2-Medium.otf b/Barotrauma/BarotraumaShared/Content/Exo2-Medium.otf similarity index 100% rename from Barotrauma/Content/Exo2-Medium.otf rename to Barotrauma/BarotraumaShared/Content/Exo2-Medium.otf diff --git a/Barotrauma/Content/InfoTexts.xml b/Barotrauma/BarotraumaShared/Content/InfoTexts.xml similarity index 100% rename from Barotrauma/Content/InfoTexts.xml rename to Barotrauma/BarotraumaShared/Content/InfoTexts.xml diff --git a/Barotrauma/Content/Items/Artifacts/aliendoor.ogg b/Barotrauma/BarotraumaShared/Content/Items/Artifacts/aliendoor.ogg similarity index 100% rename from Barotrauma/Content/Items/Artifacts/aliendoor.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Artifacts/aliendoor.ogg diff --git a/Barotrauma/Content/Items/Artifacts/alientools.png b/Barotrauma/BarotraumaShared/Content/Items/Artifacts/alientools.png similarity index 100% rename from Barotrauma/Content/Items/Artifacts/alientools.png rename to Barotrauma/BarotraumaShared/Content/Items/Artifacts/alientools.png diff --git a/Barotrauma/Content/Items/Artifacts/alienweapon.ogg b/Barotrauma/BarotraumaShared/Content/Items/Artifacts/alienweapon.ogg similarity index 100% rename from Barotrauma/Content/Items/Artifacts/alienweapon.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Artifacts/alienweapon.ogg diff --git a/Barotrauma/Content/Items/Artifacts/artifact.png b/Barotrauma/BarotraumaShared/Content/Items/Artifacts/artifact.png similarity index 100% rename from Barotrauma/Content/Items/Artifacts/artifact.png rename to Barotrauma/BarotraumaShared/Content/Items/Artifacts/artifact.png diff --git a/Barotrauma/Content/Items/Artifacts/artifactholder.png b/Barotrauma/BarotraumaShared/Content/Items/Artifacts/artifactholder.png similarity index 100% rename from Barotrauma/Content/Items/Artifacts/artifactholder.png rename to Barotrauma/BarotraumaShared/Content/Items/Artifacts/artifactholder.png diff --git a/Barotrauma/Content/Items/Artifacts/artifacts.xml b/Barotrauma/BarotraumaShared/Content/Items/Artifacts/artifacts.xml similarity index 100% rename from Barotrauma/Content/Items/Artifacts/artifacts.xml rename to Barotrauma/BarotraumaShared/Content/Items/Artifacts/artifacts.xml diff --git a/Barotrauma/Content/Items/Button/beep.ogg b/Barotrauma/BarotraumaShared/Content/Items/Button/beep.ogg similarity index 100% rename from Barotrauma/Content/Items/Button/beep.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Button/beep.ogg diff --git a/Barotrauma/Content/Items/Button/button.png b/Barotrauma/BarotraumaShared/Content/Items/Button/button.png similarity index 100% rename from Barotrauma/Content/Items/Button/button.png rename to Barotrauma/BarotraumaShared/Content/Items/Button/button.png diff --git a/Barotrauma/Content/Items/Button/button.xml b/Barotrauma/BarotraumaShared/Content/Items/Button/button.xml similarity index 100% rename from Barotrauma/Content/Items/Button/button.xml rename to Barotrauma/BarotraumaShared/Content/Items/Button/button.xml diff --git a/Barotrauma/Content/Items/Containers/cabinets.png b/Barotrauma/BarotraumaShared/Content/Items/Containers/cabinets.png similarity index 100% rename from Barotrauma/Content/Items/Containers/cabinets.png rename to Barotrauma/BarotraumaShared/Content/Items/Containers/cabinets.png diff --git a/Barotrauma/Content/Items/Containers/containers.xml b/Barotrauma/BarotraumaShared/Content/Items/Containers/containers.xml similarity index 100% rename from Barotrauma/Content/Items/Containers/containers.xml rename to Barotrauma/BarotraumaShared/Content/Items/Containers/containers.xml diff --git a/Barotrauma/Content/Items/Containers/crates.png b/Barotrauma/BarotraumaShared/Content/Items/Containers/crates.png similarity index 100% rename from Barotrauma/Content/Items/Containers/crates.png rename to Barotrauma/BarotraumaShared/Content/Items/Containers/crates.png diff --git a/Barotrauma/Content/Items/Containers/locker.png b/Barotrauma/BarotraumaShared/Content/Items/Containers/locker.png similarity index 100% rename from Barotrauma/Content/Items/Containers/locker.png rename to Barotrauma/BarotraumaShared/Content/Items/Containers/locker.png diff --git a/Barotrauma/Content/Items/Diving/DivingMask.png b/Barotrauma/BarotraumaShared/Content/Items/Diving/DivingMask.png similarity index 100% rename from Barotrauma/Content/Items/Diving/DivingMask.png rename to Barotrauma/BarotraumaShared/Content/Items/Diving/DivingMask.png diff --git a/Barotrauma/Content/Items/Diving/DivingSuit.png b/Barotrauma/BarotraumaShared/Content/Items/Diving/DivingSuit.png similarity index 100% rename from Barotrauma/Content/Items/Diving/DivingSuit.png rename to Barotrauma/BarotraumaShared/Content/Items/Diving/DivingSuit.png diff --git a/Barotrauma/Content/Items/Diving/divingSuit.ogg b/Barotrauma/BarotraumaShared/Content/Items/Diving/divingSuit.ogg similarity index 100% rename from Barotrauma/Content/Items/Diving/divingSuit.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Diving/divingSuit.ogg diff --git a/Barotrauma/Content/Items/Diving/divinggear.xml b/Barotrauma/BarotraumaShared/Content/Items/Diving/divinggear.xml similarity index 100% rename from Barotrauma/Content/Items/Diving/divinggear.xml rename to Barotrauma/BarotraumaShared/Content/Items/Diving/divinggear.xml diff --git a/Barotrauma/Content/Items/Diving/scooter.ogg b/Barotrauma/BarotraumaShared/Content/Items/Diving/scooter.ogg similarity index 100% rename from Barotrauma/Content/Items/Diving/scooter.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Diving/scooter.ogg diff --git a/Barotrauma/Content/Items/Door/dockingport.png b/Barotrauma/BarotraumaShared/Content/Items/Door/dockingport.png similarity index 100% rename from Barotrauma/Content/Items/Door/dockingport.png rename to Barotrauma/BarotraumaShared/Content/Items/Door/dockingport.png diff --git a/Barotrauma/Content/Items/Door/dockingport1.ogg b/Barotrauma/BarotraumaShared/Content/Items/Door/dockingport1.ogg similarity index 100% rename from Barotrauma/Content/Items/Door/dockingport1.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Door/dockingport1.ogg diff --git a/Barotrauma/Content/Items/Door/dockingport2.ogg b/Barotrauma/BarotraumaShared/Content/Items/Door/dockingport2.ogg similarity index 100% rename from Barotrauma/Content/Items/Door/dockingport2.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Door/dockingport2.ogg diff --git a/Barotrauma/Content/Items/Door/dockingport2.png b/Barotrauma/BarotraumaShared/Content/Items/Door/dockingport2.png similarity index 100% rename from Barotrauma/Content/Items/Door/dockingport2.png rename to Barotrauma/BarotraumaShared/Content/Items/Door/dockingport2.png diff --git a/Barotrauma/Content/Items/Door/door.ogg b/Barotrauma/BarotraumaShared/Content/Items/Door/door.ogg similarity index 100% rename from Barotrauma/Content/Items/Door/door.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Door/door.ogg diff --git a/Barotrauma/Content/Items/Door/door.png b/Barotrauma/BarotraumaShared/Content/Items/Door/door.png similarity index 100% rename from Barotrauma/Content/Items/Door/door.png rename to Barotrauma/BarotraumaShared/Content/Items/Door/door.png diff --git a/Barotrauma/Content/Items/Door/doors.xml b/Barotrauma/BarotraumaShared/Content/Items/Door/doors.xml similarity index 100% rename from Barotrauma/Content/Items/Door/doors.xml rename to Barotrauma/BarotraumaShared/Content/Items/Door/doors.xml diff --git a/Barotrauma/Content/Items/Electricity/battery.png b/Barotrauma/BarotraumaShared/Content/Items/Electricity/battery.png similarity index 100% rename from Barotrauma/Content/Items/Electricity/battery.png rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/battery.png diff --git a/Barotrauma/Content/Items/Electricity/junctionbox.png b/Barotrauma/BarotraumaShared/Content/Items/Electricity/junctionbox.png similarity index 100% rename from Barotrauma/Content/Items/Electricity/junctionbox.png rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/junctionbox.png diff --git a/Barotrauma/Content/Items/Electricity/lamp.png b/Barotrauma/BarotraumaShared/Content/Items/Electricity/lamp.png similarity index 100% rename from Barotrauma/Content/Items/Electricity/lamp.png rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/lamp.png diff --git a/Barotrauma/Content/Items/Electricity/lights.xml b/Barotrauma/BarotraumaShared/Content/Items/Electricity/lights.xml similarity index 100% rename from Barotrauma/Content/Items/Electricity/lights.xml rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/lights.xml diff --git a/Barotrauma/Content/Items/Electricity/lightsprite.png b/Barotrauma/BarotraumaShared/Content/Items/Electricity/lightsprite.png similarity index 100% rename from Barotrauma/Content/Items/Electricity/lightsprite.png rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/lightsprite.png diff --git a/Barotrauma/Content/Items/Electricity/monitor.png b/Barotrauma/BarotraumaShared/Content/Items/Electricity/monitor.png similarity index 100% rename from Barotrauma/Content/Items/Electricity/monitor.png rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/monitor.png diff --git a/Barotrauma/Content/Items/Electricity/monitors.xml b/Barotrauma/BarotraumaShared/Content/Items/Electricity/monitors.xml similarity index 100% rename from Barotrauma/Content/Items/Electricity/monitors.xml rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/monitors.xml diff --git a/Barotrauma/Content/Items/Electricity/powerOn.ogg b/Barotrauma/BarotraumaShared/Content/Items/Electricity/powerOn.ogg similarity index 100% rename from Barotrauma/Content/Items/Electricity/powerOn.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/powerOn.ogg diff --git a/Barotrauma/Content/Items/Electricity/poweritems.xml b/Barotrauma/BarotraumaShared/Content/Items/Electricity/poweritems.xml similarity index 100% rename from Barotrauma/Content/Items/Electricity/poweritems.xml rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/poweritems.xml diff --git a/Barotrauma/Content/Items/Electricity/signalcomp.png b/Barotrauma/BarotraumaShared/Content/Items/Electricity/signalcomp.png similarity index 100% rename from Barotrauma/Content/Items/Electricity/signalcomp.png rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/signalcomp.png diff --git a/Barotrauma/Content/Items/Electricity/signalitems.xml b/Barotrauma/BarotraumaShared/Content/Items/Electricity/signalitems.xml similarity index 100% rename from Barotrauma/Content/Items/Electricity/signalitems.xml rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/signalitems.xml diff --git a/Barotrauma/Content/Items/Electricity/supercapacitor.png b/Barotrauma/BarotraumaShared/Content/Items/Electricity/supercapacitor.png similarity index 100% rename from Barotrauma/Content/Items/Electricity/supercapacitor.png rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/supercapacitor.png diff --git a/Barotrauma/Content/Items/Electricity/zap1.ogg b/Barotrauma/BarotraumaShared/Content/Items/Electricity/zap1.ogg similarity index 100% rename from Barotrauma/Content/Items/Electricity/zap1.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/zap1.ogg diff --git a/Barotrauma/Content/Items/Electricity/zap2.ogg b/Barotrauma/BarotraumaShared/Content/Items/Electricity/zap2.ogg similarity index 100% rename from Barotrauma/Content/Items/Electricity/zap2.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/zap2.ogg diff --git a/Barotrauma/Content/Items/Electricity/zap3.ogg b/Barotrauma/BarotraumaShared/Content/Items/Electricity/zap3.ogg similarity index 100% rename from Barotrauma/Content/Items/Electricity/zap3.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/zap3.ogg diff --git a/Barotrauma/Content/Items/Electricity/zap4.ogg b/Barotrauma/BarotraumaShared/Content/Items/Electricity/zap4.ogg similarity index 100% rename from Barotrauma/Content/Items/Electricity/zap4.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Electricity/zap4.ogg diff --git a/Barotrauma/Content/Items/Engine/engine.ogg b/Barotrauma/BarotraumaShared/Content/Items/Engine/engine.ogg similarity index 100% rename from Barotrauma/Content/Items/Engine/engine.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Engine/engine.ogg diff --git a/Barotrauma/Content/Items/Engine/engine.png b/Barotrauma/BarotraumaShared/Content/Items/Engine/engine.png similarity index 100% rename from Barotrauma/Content/Items/Engine/engine.png rename to Barotrauma/BarotraumaShared/Content/Items/Engine/engine.png diff --git a/Barotrauma/Content/Items/Engine/engine.xml b/Barotrauma/BarotraumaShared/Content/Items/Engine/engine.xml similarity index 100% rename from Barotrauma/Content/Items/Engine/engine.xml rename to Barotrauma/BarotraumaShared/Content/Items/Engine/engine.xml diff --git a/Barotrauma/Content/Items/Engine/pingCircle.png b/Barotrauma/BarotraumaShared/Content/Items/Engine/pingCircle.png similarity index 100% rename from Barotrauma/Content/Items/Engine/pingCircle.png rename to Barotrauma/BarotraumaShared/Content/Items/Engine/pingCircle.png diff --git a/Barotrauma/Content/Items/Engine/radarBlip.png b/Barotrauma/BarotraumaShared/Content/Items/Engine/radarBlip.png similarity index 100% rename from Barotrauma/Content/Items/Engine/radarBlip.png rename to Barotrauma/BarotraumaShared/Content/Items/Engine/radarBlip.png diff --git a/Barotrauma/Content/Items/Engine/radarOverlay.png b/Barotrauma/BarotraumaShared/Content/Items/Engine/radarOverlay.png similarity index 100% rename from Barotrauma/Content/Items/Engine/radarOverlay.png rename to Barotrauma/BarotraumaShared/Content/Items/Engine/radarOverlay.png diff --git a/Barotrauma/Content/Items/Engine/radarPing.ogg b/Barotrauma/BarotraumaShared/Content/Items/Engine/radarPing.ogg similarity index 100% rename from Barotrauma/Content/Items/Engine/radarPing.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Engine/radarPing.ogg diff --git a/Barotrauma/Content/Items/Fabricators/deconstructor.ogg b/Barotrauma/BarotraumaShared/Content/Items/Fabricators/deconstructor.ogg similarity index 100% rename from Barotrauma/Content/Items/Fabricators/deconstructor.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Fabricators/deconstructor.ogg diff --git a/Barotrauma/Content/Items/Fabricators/fabricator.ogg b/Barotrauma/BarotraumaShared/Content/Items/Fabricators/fabricator.ogg similarity index 100% rename from Barotrauma/Content/Items/Fabricators/fabricator.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Fabricators/fabricator.ogg diff --git a/Barotrauma/Content/Items/Fabricators/fabricators.xml b/Barotrauma/BarotraumaShared/Content/Items/Fabricators/fabricators.xml similarity index 100% rename from Barotrauma/Content/Items/Fabricators/fabricators.xml rename to Barotrauma/BarotraumaShared/Content/Items/Fabricators/fabricators.xml diff --git a/Barotrauma/Content/Items/Fabricators/materials.png b/Barotrauma/BarotraumaShared/Content/Items/Fabricators/materials.png similarity index 100% rename from Barotrauma/Content/Items/Fabricators/materials.png rename to Barotrauma/BarotraumaShared/Content/Items/Fabricators/materials.png diff --git a/Barotrauma/Content/Items/Fabricators/materials.xml b/Barotrauma/BarotraumaShared/Content/Items/Fabricators/materials.xml similarity index 100% rename from Barotrauma/Content/Items/Fabricators/materials.xml rename to Barotrauma/BarotraumaShared/Content/Items/Fabricators/materials.xml diff --git a/Barotrauma/Content/Items/Jobgear/captainLegs.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/captainLegs.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/captainLegs.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/captainLegs.png diff --git a/Barotrauma/Content/Items/Jobgear/captainTorso.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/captainTorso.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/captainTorso.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/captainTorso.png diff --git a/Barotrauma/Content/Items/Jobgear/captaingear.xml b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/captaingear.xml similarity index 100% rename from Barotrauma/Content/Items/Jobgear/captaingear.xml rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/captaingear.xml diff --git a/Barotrauma/Content/Items/Jobgear/captainhat.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/captainhat.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/captainhat.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/captainhat.png diff --git a/Barotrauma/Content/Items/Jobgear/clownmask.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/clownmask.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/clownmask.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/clownmask.png diff --git a/Barotrauma/Content/Items/Jobgear/clownpants.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/clownpants.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/clownpants.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/clownpants.png diff --git a/Barotrauma/Content/Items/Jobgear/clownshirt.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/clownshirt.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/clownshirt.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/clownshirt.png diff --git a/Barotrauma/Content/Items/Jobgear/doctorgear.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/doctorgear.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/doctorgear.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/doctorgear.png diff --git a/Barotrauma/Content/Items/Jobgear/doctorgear.xml b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/doctorgear.xml similarity index 100% rename from Barotrauma/Content/Items/Jobgear/doctorgear.xml rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/doctorgear.xml diff --git a/Barotrauma/Content/Items/Jobgear/engigear.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/engigear.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/engigear.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/engigear.png diff --git a/Barotrauma/Content/Items/Jobgear/engigear.xml b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/engigear.xml similarity index 100% rename from Barotrauma/Content/Items/Jobgear/engigear.xml rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/engigear.xml diff --git a/Barotrauma/Content/Items/Jobgear/headset.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/headset.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/headset.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/headset.png diff --git a/Barotrauma/Content/Items/Jobgear/misc.xml b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/misc.xml similarity index 100% rename from Barotrauma/Content/Items/Jobgear/misc.xml rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/misc.xml diff --git a/Barotrauma/Content/Items/Jobgear/securitygear.png b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/securitygear.png similarity index 100% rename from Barotrauma/Content/Items/Jobgear/securitygear.png rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/securitygear.png diff --git a/Barotrauma/Content/Items/Jobgear/securitygear.xml b/Barotrauma/BarotraumaShared/Content/Items/Jobgear/securitygear.xml similarity index 100% rename from Barotrauma/Content/Items/Jobgear/securitygear.xml rename to Barotrauma/BarotraumaShared/Content/Items/Jobgear/securitygear.xml diff --git a/Barotrauma/Content/Items/Ladder/ladder.png b/Barotrauma/BarotraumaShared/Content/Items/Ladder/ladder.png similarity index 100% rename from Barotrauma/Content/Items/Ladder/ladder.png rename to Barotrauma/BarotraumaShared/Content/Items/Ladder/ladder.png diff --git a/Barotrauma/Content/Items/Ladder/ladder.xml b/Barotrauma/BarotraumaShared/Content/Items/Ladder/ladder.xml similarity index 100% rename from Barotrauma/Content/Items/Ladder/ladder.xml rename to Barotrauma/BarotraumaShared/Content/Items/Ladder/ladder.xml diff --git a/Barotrauma/Content/Items/Medical/bandage.ogg b/Barotrauma/BarotraumaShared/Content/Items/Medical/bandage.ogg similarity index 100% rename from Barotrauma/Content/Items/Medical/bandage.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Medical/bandage.ogg diff --git a/Barotrauma/Content/Items/Medical/med.png b/Barotrauma/BarotraumaShared/Content/Items/Medical/med.png similarity index 100% rename from Barotrauma/Content/Items/Medical/med.png rename to Barotrauma/BarotraumaShared/Content/Items/Medical/med.png diff --git a/Barotrauma/Content/Items/Medical/medical.xml b/Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml similarity index 100% rename from Barotrauma/Content/Items/Medical/medical.xml rename to Barotrauma/BarotraumaShared/Content/Items/Medical/medical.xml diff --git a/Barotrauma/Content/Items/Medical/syringe.ogg b/Barotrauma/BarotraumaShared/Content/Items/Medical/syringe.ogg similarity index 100% rename from Barotrauma/Content/Items/Medical/syringe.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Medical/syringe.ogg diff --git a/Barotrauma/Content/Items/MiniMap/item.xml b/Barotrauma/BarotraumaShared/Content/Items/MiniMap/item.xml similarity index 100% rename from Barotrauma/Content/Items/MiniMap/item.xml rename to Barotrauma/BarotraumaShared/Content/Items/MiniMap/item.xml diff --git a/Barotrauma/Content/Items/OxygenGenerator/oxygengenerator.ogg b/Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/oxygengenerator.ogg similarity index 100% rename from Barotrauma/Content/Items/OxygenGenerator/oxygengenerator.ogg rename to Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/oxygengenerator.ogg diff --git a/Barotrauma/Content/Items/OxygenGenerator/oxygengenerator.png b/Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/oxygengenerator.png similarity index 100% rename from Barotrauma/Content/Items/OxygenGenerator/oxygengenerator.png rename to Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/oxygengenerator.png diff --git a/Barotrauma/Content/Items/OxygenGenerator/oxygengenerator.xml b/Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/oxygengenerator.xml similarity index 100% rename from Barotrauma/Content/Items/OxygenGenerator/oxygengenerator.xml rename to Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/oxygengenerator.xml diff --git a/Barotrauma/Content/Items/OxygenGenerator/vent.png b/Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/vent.png similarity index 100% rename from Barotrauma/Content/Items/OxygenGenerator/vent.png rename to Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/vent.png diff --git a/Barotrauma/Content/Items/OxygenGenerator/ventilation.ogg b/Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/ventilation.ogg similarity index 100% rename from Barotrauma/Content/Items/OxygenGenerator/ventilation.ogg rename to Barotrauma/BarotraumaShared/Content/Items/OxygenGenerator/ventilation.ogg diff --git a/Barotrauma/Content/Items/Pump/pump.ogg b/Barotrauma/BarotraumaShared/Content/Items/Pump/pump.ogg similarity index 100% rename from Barotrauma/Content/Items/Pump/pump.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Pump/pump.ogg diff --git a/Barotrauma/Content/Items/Pump/pump.png b/Barotrauma/BarotraumaShared/Content/Items/Pump/pump.png similarity index 100% rename from Barotrauma/Content/Items/Pump/pump.png rename to Barotrauma/BarotraumaShared/Content/Items/Pump/pump.png diff --git a/Barotrauma/Content/Items/Pump/pump.xml b/Barotrauma/BarotraumaShared/Content/Items/Pump/pump.xml similarity index 100% rename from Barotrauma/Content/Items/Pump/pump.xml rename to Barotrauma/BarotraumaShared/Content/Items/Pump/pump.xml diff --git a/Barotrauma/Content/Items/Pump/smallpump.png b/Barotrauma/BarotraumaShared/Content/Items/Pump/smallpump.png similarity index 100% rename from Barotrauma/Content/Items/Pump/smallpump.png rename to Barotrauma/BarotraumaShared/Content/Items/Pump/smallpump.png diff --git a/Barotrauma/Content/Items/Reactor/explosion.ogg b/Barotrauma/BarotraumaShared/Content/Items/Reactor/explosion.ogg similarity index 100% rename from Barotrauma/Content/Items/Reactor/explosion.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Reactor/explosion.ogg diff --git a/Barotrauma/Content/Items/Reactor/fuelrod.png b/Barotrauma/BarotraumaShared/Content/Items/Reactor/fuelrod.png similarity index 100% rename from Barotrauma/Content/Items/Reactor/fuelrod.png rename to Barotrauma/BarotraumaShared/Content/Items/Reactor/fuelrod.png diff --git a/Barotrauma/Content/Items/Reactor/heatabsorber.png b/Barotrauma/BarotraumaShared/Content/Items/Reactor/heatabsorber.png similarity index 100% rename from Barotrauma/Content/Items/Reactor/heatabsorber.png rename to Barotrauma/BarotraumaShared/Content/Items/Reactor/heatabsorber.png diff --git a/Barotrauma/Content/Items/Reactor/reactor.ogg b/Barotrauma/BarotraumaShared/Content/Items/Reactor/reactor.ogg similarity index 100% rename from Barotrauma/Content/Items/Reactor/reactor.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Reactor/reactor.ogg diff --git a/Barotrauma/Content/Items/Reactor/reactor.png b/Barotrauma/BarotraumaShared/Content/Items/Reactor/reactor.png similarity index 100% rename from Barotrauma/Content/Items/Reactor/reactor.png rename to Barotrauma/BarotraumaShared/Content/Items/Reactor/reactor.png diff --git a/Barotrauma/Content/Items/Reactor/reactor.xml b/Barotrauma/BarotraumaShared/Content/Items/Reactor/reactor.xml similarity index 100% rename from Barotrauma/Content/Items/Reactor/reactor.xml rename to Barotrauma/BarotraumaShared/Content/Items/Reactor/reactor.xml diff --git a/Barotrauma/Content/Items/Tools/extinguisher.ogg b/Barotrauma/BarotraumaShared/Content/Items/Tools/extinguisher.ogg similarity index 100% rename from Barotrauma/Content/Items/Tools/extinguisher.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Tools/extinguisher.ogg diff --git a/Barotrauma/Content/Items/Tools/extinguisher.png b/Barotrauma/BarotraumaShared/Content/Items/Tools/extinguisher.png similarity index 100% rename from Barotrauma/Content/Items/Tools/extinguisher.png rename to Barotrauma/BarotraumaShared/Content/Items/Tools/extinguisher.png diff --git a/Barotrauma/Content/Items/Tools/flare.ogg b/Barotrauma/BarotraumaShared/Content/Items/Tools/flare.ogg similarity index 100% rename from Barotrauma/Content/Items/Tools/flare.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Tools/flare.ogg diff --git a/Barotrauma/Content/Items/Tools/plasmaCutter.ogg b/Barotrauma/BarotraumaShared/Content/Items/Tools/plasmaCutter.ogg similarity index 100% rename from Barotrauma/Content/Items/Tools/plasmaCutter.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Tools/plasmaCutter.ogg diff --git a/Barotrauma/Content/Items/Tools/tools.png b/Barotrauma/BarotraumaShared/Content/Items/Tools/tools.png similarity index 100% rename from Barotrauma/Content/Items/Tools/tools.png rename to Barotrauma/BarotraumaShared/Content/Items/Tools/tools.png diff --git a/Barotrauma/Content/Items/Tools/tools.xml b/Barotrauma/BarotraumaShared/Content/Items/Tools/tools.xml similarity index 100% rename from Barotrauma/Content/Items/Tools/tools.xml rename to Barotrauma/BarotraumaShared/Content/Items/Tools/tools.xml diff --git a/Barotrauma/Content/Items/Tools/weldingTool.ogg b/Barotrauma/BarotraumaShared/Content/Items/Tools/weldingTool.ogg similarity index 100% rename from Barotrauma/Content/Items/Tools/weldingTool.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Tools/weldingTool.ogg diff --git a/Barotrauma/Content/Items/Weapons/bigexplosion.ogg b/Barotrauma/BarotraumaShared/Content/Items/Weapons/bigexplosion.ogg similarity index 100% rename from Barotrauma/Content/Items/Weapons/bigexplosion.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/bigexplosion.ogg diff --git a/Barotrauma/Content/Items/Weapons/depthcharge.xml b/Barotrauma/BarotraumaShared/Content/Items/Weapons/depthcharge.xml similarity index 100% rename from Barotrauma/Content/Items/Weapons/depthcharge.xml rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/depthcharge.xml diff --git a/Barotrauma/Content/Items/Weapons/explosives.xml b/Barotrauma/BarotraumaShared/Content/Items/Weapons/explosives.xml similarity index 100% rename from Barotrauma/Content/Items/Weapons/explosives.xml rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/explosives.xml diff --git a/Barotrauma/Content/Items/Weapons/harpoon1.ogg b/Barotrauma/BarotraumaShared/Content/Items/Weapons/harpoon1.ogg similarity index 100% rename from Barotrauma/Content/Items/Weapons/harpoon1.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/harpoon1.ogg diff --git a/Barotrauma/Content/Items/Weapons/harpoon2.ogg b/Barotrauma/BarotraumaShared/Content/Items/Weapons/harpoon2.ogg similarity index 100% rename from Barotrauma/Content/Items/Weapons/harpoon2.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/harpoon2.ogg diff --git a/Barotrauma/Content/Items/Weapons/honk.ogg b/Barotrauma/BarotraumaShared/Content/Items/Weapons/honk.ogg similarity index 100% rename from Barotrauma/Content/Items/Weapons/honk.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/honk.ogg diff --git a/Barotrauma/Content/Items/Weapons/railgun.ogg b/Barotrauma/BarotraumaShared/Content/Items/Weapons/railgun.ogg similarity index 100% rename from Barotrauma/Content/Items/Weapons/railgun.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/railgun.ogg diff --git a/Barotrauma/Content/Items/Weapons/railgun.xml b/Barotrauma/BarotraumaShared/Content/Items/Weapons/railgun.xml similarity index 100% rename from Barotrauma/Content/Items/Weapons/railgun.xml rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/railgun.xml diff --git a/Barotrauma/Content/Items/Weapons/railgunbarrel.png b/Barotrauma/BarotraumaShared/Content/Items/Weapons/railgunbarrel.png similarity index 100% rename from Barotrauma/Content/Items/Weapons/railgunbarrel.png rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/railgunbarrel.png diff --git a/Barotrauma/Content/Items/Weapons/railgunbase.png b/Barotrauma/BarotraumaShared/Content/Items/Weapons/railgunbase.png similarity index 100% rename from Barotrauma/Content/Items/Weapons/railgunbase.png rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/railgunbase.png diff --git a/Barotrauma/Content/Items/Weapons/railgunetc.png b/Barotrauma/BarotraumaShared/Content/Items/Weapons/railgunetc.png similarity index 100% rename from Barotrauma/Content/Items/Weapons/railgunetc.png rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/railgunetc.png diff --git a/Barotrauma/Content/Items/Weapons/rope.png b/Barotrauma/BarotraumaShared/Content/Items/Weapons/rope.png similarity index 100% rename from Barotrauma/Content/Items/Weapons/rope.png rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/rope.png diff --git a/Barotrauma/Content/Items/Weapons/smack.ogg b/Barotrauma/BarotraumaShared/Content/Items/Weapons/smack.ogg similarity index 100% rename from Barotrauma/Content/Items/Weapons/smack.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/smack.ogg diff --git a/Barotrauma/Content/Items/Weapons/stunbaton.ogg b/Barotrauma/BarotraumaShared/Content/Items/Weapons/stunbaton.ogg similarity index 100% rename from Barotrauma/Content/Items/Weapons/stunbaton.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/stunbaton.ogg diff --git a/Barotrauma/Content/Items/Weapons/stungrenade.ogg b/Barotrauma/BarotraumaShared/Content/Items/Weapons/stungrenade.ogg similarity index 100% rename from Barotrauma/Content/Items/Weapons/stungrenade.ogg rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/stungrenade.ogg diff --git a/Barotrauma/Content/Items/Weapons/stungrenade.png b/Barotrauma/BarotraumaShared/Content/Items/Weapons/stungrenade.png similarity index 100% rename from Barotrauma/Content/Items/Weapons/stungrenade.png rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/stungrenade.png diff --git a/Barotrauma/Content/Items/Weapons/weapons.png b/Barotrauma/BarotraumaShared/Content/Items/Weapons/weapons.png similarity index 100% rename from Barotrauma/Content/Items/Weapons/weapons.png rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/weapons.png diff --git a/Barotrauma/Content/Items/Weapons/weapons.xml b/Barotrauma/BarotraumaShared/Content/Items/Weapons/weapons.xml similarity index 100% rename from Barotrauma/Content/Items/Weapons/weapons.xml rename to Barotrauma/BarotraumaShared/Content/Items/Weapons/weapons.xml diff --git a/Barotrauma/Content/Items/blank.png b/Barotrauma/BarotraumaShared/Content/Items/blank.png similarity index 100% rename from Barotrauma/Content/Items/blank.png rename to Barotrauma/BarotraumaShared/Content/Items/blank.png diff --git a/Barotrauma/Content/Items/circuitboard.png b/Barotrauma/BarotraumaShared/Content/Items/circuitboard.png similarity index 100% rename from Barotrauma/Content/Items/circuitboard.png rename to Barotrauma/BarotraumaShared/Content/Items/circuitboard.png diff --git a/Barotrauma/Content/Items/connectionpanel.png b/Barotrauma/BarotraumaShared/Content/Items/connectionpanel.png similarity index 100% rename from Barotrauma/Content/Items/connectionpanel.png rename to Barotrauma/BarotraumaShared/Content/Items/connectionpanel.png diff --git a/Barotrauma/Content/Items/connector.png b/Barotrauma/BarotraumaShared/Content/Items/connector.png similarity index 100% rename from Barotrauma/Content/Items/connector.png rename to Barotrauma/BarotraumaShared/Content/Items/connector.png diff --git a/Barotrauma/Content/Items/idcard.png b/Barotrauma/BarotraumaShared/Content/Items/idcard.png similarity index 100% rename from Barotrauma/Content/Items/idcard.png rename to Barotrauma/BarotraumaShared/Content/Items/idcard.png diff --git a/Barotrauma/Content/Items/idcard.xml b/Barotrauma/BarotraumaShared/Content/Items/idcard.xml similarity index 100% rename from Barotrauma/Content/Items/idcard.xml rename to Barotrauma/BarotraumaShared/Content/Items/idcard.xml diff --git a/Barotrauma/Content/Items/itemlabel.xml b/Barotrauma/BarotraumaShared/Content/Items/itemlabel.xml similarity index 100% rename from Barotrauma/Content/Items/itemlabel.xml rename to Barotrauma/BarotraumaShared/Content/Items/itemlabel.xml diff --git a/Barotrauma/Content/Items/machines.png b/Barotrauma/BarotraumaShared/Content/Items/machines.png similarity index 100% rename from Barotrauma/Content/Items/machines.png rename to Barotrauma/BarotraumaShared/Content/Items/machines.png diff --git a/Barotrauma/Content/Items/warningBeep.ogg b/Barotrauma/BarotraumaShared/Content/Items/warningBeep.ogg similarity index 100% rename from Barotrauma/Content/Items/warningBeep.ogg rename to Barotrauma/BarotraumaShared/Content/Items/warningBeep.ogg diff --git a/Barotrauma/Content/Items/warningSiren.ogg b/Barotrauma/BarotraumaShared/Content/Items/warningSiren.ogg similarity index 100% rename from Barotrauma/Content/Items/warningSiren.ogg rename to Barotrauma/BarotraumaShared/Content/Items/warningSiren.ogg diff --git a/Barotrauma/Content/Items/wireCorner.png b/Barotrauma/BarotraumaShared/Content/Items/wireCorner.png similarity index 100% rename from Barotrauma/Content/Items/wireCorner.png rename to Barotrauma/BarotraumaShared/Content/Items/wireCorner.png diff --git a/Barotrauma/Content/Items/wireHorizontal.png b/Barotrauma/BarotraumaShared/Content/Items/wireHorizontal.png similarity index 100% rename from Barotrauma/Content/Items/wireHorizontal.png rename to Barotrauma/BarotraumaShared/Content/Items/wireHorizontal.png diff --git a/Barotrauma/Content/Items/wireVertical.png b/Barotrauma/BarotraumaShared/Content/Items/wireVertical.png similarity index 100% rename from Barotrauma/Content/Items/wireVertical.png rename to Barotrauma/BarotraumaShared/Content/Items/wireVertical.png diff --git a/Barotrauma/Content/Jobs.xml b/Barotrauma/BarotraumaShared/Content/Jobs.xml similarity index 100% rename from Barotrauma/Content/Jobs.xml rename to Barotrauma/BarotraumaShared/Content/Jobs.xml diff --git a/Barotrauma/Content/Lights/alphaOne.png b/Barotrauma/BarotraumaShared/Content/Lights/alphaOne.png similarity index 100% rename from Barotrauma/Content/Lights/alphaOne.png rename to Barotrauma/BarotraumaShared/Content/Lights/alphaOne.png diff --git a/Barotrauma/Content/Lights/light.png b/Barotrauma/BarotraumaShared/Content/Lights/light.png similarity index 100% rename from Barotrauma/Content/Lights/light.png rename to Barotrauma/BarotraumaShared/Content/Lights/light.png diff --git a/Barotrauma/Content/Lights/lightcone.png b/Barotrauma/BarotraumaShared/Content/Lights/lightcone.png similarity index 100% rename from Barotrauma/Content/Lights/lightcone.png rename to Barotrauma/BarotraumaShared/Content/Lights/lightcone.png diff --git a/Barotrauma/Content/Lights/penumbra.png b/Barotrauma/BarotraumaShared/Content/Lights/penumbra.png similarity index 100% rename from Barotrauma/Content/Lights/penumbra.png rename to Barotrauma/BarotraumaShared/Content/Lights/penumbra.png diff --git a/Barotrauma/Content/Lights/visioncircle.png b/Barotrauma/BarotraumaShared/Content/Lights/visioncircle.png similarity index 100% rename from Barotrauma/Content/Lights/visioncircle.png rename to Barotrauma/BarotraumaShared/Content/Lights/visioncircle.png diff --git a/Barotrauma/Content/Map/LevelGenerationParameters.xml b/Barotrauma/BarotraumaShared/Content/Map/LevelGenerationParameters.xml similarity index 100% rename from Barotrauma/Content/Map/LevelGenerationParameters.xml rename to Barotrauma/BarotraumaShared/Content/Map/LevelGenerationParameters.xml diff --git a/Barotrauma/Content/Map/RuinConfig.xml b/Barotrauma/BarotraumaShared/Content/Map/RuinConfig.xml similarity index 100% rename from Barotrauma/Content/Map/RuinConfig.xml rename to Barotrauma/BarotraumaShared/Content/Map/RuinConfig.xml diff --git a/Barotrauma/Content/Map/StructurePrefabs.xml b/Barotrauma/BarotraumaShared/Content/Map/StructurePrefabs.xml similarity index 100% rename from Barotrauma/Content/Map/StructurePrefabs.xml rename to Barotrauma/BarotraumaShared/Content/Map/StructurePrefabs.xml diff --git a/Barotrauma/Content/Map/TutorialSub.sub b/Barotrauma/BarotraumaShared/Content/Map/TutorialSub.sub similarity index 100% rename from Barotrauma/Content/Map/TutorialSub.sub rename to Barotrauma/BarotraumaShared/Content/Map/TutorialSub.sub diff --git a/Barotrauma/Content/Map/background.png b/Barotrauma/BarotraumaShared/Content/Map/background.png similarity index 100% rename from Barotrauma/Content/Map/background.png rename to Barotrauma/BarotraumaShared/Content/Map/background.png diff --git a/Barotrauma/Content/Map/background2.png b/Barotrauma/BarotraumaShared/Content/Map/background2.png similarity index 100% rename from Barotrauma/Content/Map/background2.png rename to Barotrauma/BarotraumaShared/Content/Map/background2.png diff --git a/Barotrauma/Content/Map/beaconSymbol.png b/Barotrauma/BarotraumaShared/Content/Map/beaconSymbol.png similarity index 100% rename from Barotrauma/Content/Map/beaconSymbol.png rename to Barotrauma/BarotraumaShared/Content/Map/beaconSymbol.png diff --git a/Barotrauma/Content/Map/beaconbackground.jpg b/Barotrauma/BarotraumaShared/Content/Map/beaconbackground.jpg similarity index 100% rename from Barotrauma/Content/Map/beaconbackground.jpg rename to Barotrauma/BarotraumaShared/Content/Map/beaconbackground.jpg diff --git a/Barotrauma/Content/Map/citySymbol.png b/Barotrauma/BarotraumaShared/Content/Map/citySymbol.png similarity index 100% rename from Barotrauma/Content/Map/citySymbol.png rename to Barotrauma/BarotraumaShared/Content/Map/citySymbol.png diff --git a/Barotrauma/Content/Map/citybackground.jpg b/Barotrauma/BarotraumaShared/Content/Map/citybackground.jpg similarity index 100% rename from Barotrauma/Content/Map/citybackground.jpg rename to Barotrauma/BarotraumaShared/Content/Map/citybackground.jpg diff --git a/Barotrauma/Content/Map/dustparticles.png b/Barotrauma/BarotraumaShared/Content/Map/dustparticles.png similarity index 100% rename from Barotrauma/Content/Map/dustparticles.png rename to Barotrauma/BarotraumaShared/Content/Map/dustparticles.png diff --git a/Barotrauma/Content/Map/iceCrack.png b/Barotrauma/BarotraumaShared/Content/Map/iceCrack.png similarity index 100% rename from Barotrauma/Content/Map/iceCrack.png rename to Barotrauma/BarotraumaShared/Content/Map/iceCrack.png diff --git a/Barotrauma/Content/Map/iceCraters.png b/Barotrauma/BarotraumaShared/Content/Map/iceCraters.png similarity index 100% rename from Barotrauma/Content/Map/iceCraters.png rename to Barotrauma/BarotraumaShared/Content/Map/iceCraters.png diff --git a/Barotrauma/Content/Map/iceSurface.png b/Barotrauma/BarotraumaShared/Content/Map/iceSurface.png similarity index 100% rename from Barotrauma/Content/Map/iceSurface.png rename to Barotrauma/BarotraumaShared/Content/Map/iceSurface.png diff --git a/Barotrauma/Content/Map/iceWall.png b/Barotrauma/BarotraumaShared/Content/Map/iceWall.png similarity index 100% rename from Barotrauma/Content/Map/iceWall.png rename to Barotrauma/BarotraumaShared/Content/Map/iceWall.png diff --git a/Barotrauma/Content/Map/locationNames.txt b/Barotrauma/BarotraumaShared/Content/Map/locationNames.txt similarity index 100% rename from Barotrauma/Content/Map/locationNames.txt rename to Barotrauma/BarotraumaShared/Content/Map/locationNames.txt diff --git a/Barotrauma/Content/Map/locationTypes.xml b/Barotrauma/BarotraumaShared/Content/Map/locationTypes.xml similarity index 100% rename from Barotrauma/Content/Map/locationTypes.xml rename to Barotrauma/BarotraumaShared/Content/Map/locationTypes.xml diff --git a/Barotrauma/Content/Map/militarySymbol.png b/Barotrauma/BarotraumaShared/Content/Map/militarySymbol.png similarity index 100% rename from Barotrauma/Content/Map/militarySymbol.png rename to Barotrauma/BarotraumaShared/Content/Map/militarySymbol.png diff --git a/Barotrauma/Content/Map/militarybackground.jpg b/Barotrauma/BarotraumaShared/Content/Map/militarybackground.jpg similarity index 100% rename from Barotrauma/Content/Map/militarybackground.jpg rename to Barotrauma/BarotraumaShared/Content/Map/militarybackground.jpg diff --git a/Barotrauma/Content/Map/researchSymbol.png b/Barotrauma/BarotraumaShared/Content/Map/researchSymbol.png similarity index 100% rename from Barotrauma/Content/Map/researchSymbol.png rename to Barotrauma/BarotraumaShared/Content/Map/researchSymbol.png diff --git a/Barotrauma/Content/Map/researchbackground.jpg b/Barotrauma/BarotraumaShared/Content/Map/researchbackground.jpg similarity index 100% rename from Barotrauma/Content/Map/researchbackground.jpg rename to Barotrauma/BarotraumaShared/Content/Map/researchbackground.jpg diff --git a/Barotrauma/Content/Map/ruins.png b/Barotrauma/BarotraumaShared/Content/Map/ruins.png similarity index 100% rename from Barotrauma/Content/Map/ruins.png rename to Barotrauma/BarotraumaShared/Content/Map/ruins.png diff --git a/Barotrauma/Content/Map/ruins2.png b/Barotrauma/BarotraumaShared/Content/Map/ruins2.png similarity index 100% rename from Barotrauma/Content/Map/ruins2.png rename to Barotrauma/BarotraumaShared/Content/Map/ruins2.png diff --git a/Barotrauma/Content/Map/ruins3.png b/Barotrauma/BarotraumaShared/Content/Map/ruins3.png similarity index 100% rename from Barotrauma/Content/Map/ruins3.png rename to Barotrauma/BarotraumaShared/Content/Map/ruins3.png diff --git a/Barotrauma/Content/Map/shaft.png b/Barotrauma/BarotraumaShared/Content/Map/shaft.png similarity index 100% rename from Barotrauma/Content/Map/shaft.png rename to Barotrauma/BarotraumaShared/Content/Map/shaft.png diff --git a/Barotrauma/Content/Map/structures2.png b/Barotrauma/BarotraumaShared/Content/Map/structures2.png similarity index 100% rename from Barotrauma/Content/Map/structures2.png rename to Barotrauma/BarotraumaShared/Content/Map/structures2.png diff --git a/Barotrauma/Content/Map/testroom.png b/Barotrauma/BarotraumaShared/Content/Map/testroom.png similarity index 100% rename from Barotrauma/Content/Map/testroom.png rename to Barotrauma/BarotraumaShared/Content/Map/testroom.png diff --git a/Barotrauma/Content/Map/walldamage.png b/Barotrauma/BarotraumaShared/Content/Map/walldamage.png similarity index 100% rename from Barotrauma/Content/Map/walldamage.png rename to Barotrauma/BarotraumaShared/Content/Map/walldamage.png diff --git a/Barotrauma/Content/Map/waypointIcons.png b/Barotrauma/BarotraumaShared/Content/Map/waypointIcons.png similarity index 100% rename from Barotrauma/Content/Map/waypointIcons.png rename to Barotrauma/BarotraumaShared/Content/Map/waypointIcons.png diff --git a/Barotrauma/Content/Missions.xml b/Barotrauma/BarotraumaShared/Content/Missions.xml similarity index 100% rename from Barotrauma/Content/Missions.xml rename to Barotrauma/BarotraumaShared/Content/Missions.xml diff --git a/Barotrauma/Content/Orders.xml b/Barotrauma/BarotraumaShared/Content/Orders.xml similarity index 100% rename from Barotrauma/Content/Orders.xml rename to Barotrauma/BarotraumaShared/Content/Orders.xml diff --git a/Barotrauma/Content/Particles/FlameRoundParticleSheet.png b/Barotrauma/BarotraumaShared/Content/Particles/FlameRoundParticleSheet.png similarity index 100% rename from Barotrauma/Content/Particles/FlameRoundParticleSheet.png rename to Barotrauma/BarotraumaShared/Content/Particles/FlameRoundParticleSheet.png diff --git a/Barotrauma/Content/Particles/ParticlePrefabs.xml b/Barotrauma/BarotraumaShared/Content/Particles/ParticlePrefabs.xml similarity index 100% rename from Barotrauma/Content/Particles/ParticlePrefabs.xml rename to Barotrauma/BarotraumaShared/Content/Particles/ParticlePrefabs.xml diff --git a/Barotrauma/Content/Particles/Smoke.png b/Barotrauma/BarotraumaShared/Content/Particles/Smoke.png similarity index 100% rename from Barotrauma/Content/Particles/Smoke.png rename to Barotrauma/BarotraumaShared/Content/Particles/Smoke.png diff --git a/Barotrauma/Content/Particles/SmokeParticleSheet.png b/Barotrauma/BarotraumaShared/Content/Particles/SmokeParticleSheet.png similarity index 100% rename from Barotrauma/Content/Particles/SmokeParticleSheet.png rename to Barotrauma/BarotraumaShared/Content/Particles/SmokeParticleSheet.png diff --git a/Barotrauma/Content/Particles/Spatter1.png b/Barotrauma/BarotraumaShared/Content/Particles/Spatter1.png similarity index 100% rename from Barotrauma/Content/Particles/Spatter1.png rename to Barotrauma/BarotraumaShared/Content/Particles/Spatter1.png diff --git a/Barotrauma/Content/Particles/Spatter2.png b/Barotrauma/BarotraumaShared/Content/Particles/Spatter2.png similarity index 100% rename from Barotrauma/Content/Particles/Spatter2.png rename to Barotrauma/BarotraumaShared/Content/Particles/Spatter2.png diff --git a/Barotrauma/Content/Particles/Spatter3.png b/Barotrauma/BarotraumaShared/Content/Particles/Spatter3.png similarity index 100% rename from Barotrauma/Content/Particles/Spatter3.png rename to Barotrauma/BarotraumaShared/Content/Particles/Spatter3.png diff --git a/Barotrauma/Content/Particles/bubbles.png b/Barotrauma/BarotraumaShared/Content/Particles/bubbles.png similarity index 100% rename from Barotrauma/Content/Particles/bubbles.png rename to Barotrauma/BarotraumaShared/Content/Particles/bubbles.png diff --git a/Barotrauma/Content/Particles/explosion.png b/Barotrauma/BarotraumaShared/Content/Particles/explosion.png similarity index 100% rename from Barotrauma/Content/Particles/explosion.png rename to Barotrauma/BarotraumaShared/Content/Particles/explosion.png diff --git a/Barotrauma/Content/Particles/fire.png b/Barotrauma/BarotraumaShared/Content/Particles/fire.png similarity index 100% rename from Barotrauma/Content/Particles/fire.png rename to Barotrauma/BarotraumaShared/Content/Particles/fire.png diff --git a/Barotrauma/Content/Particles/flames.png b/Barotrauma/BarotraumaShared/Content/Particles/flames.png similarity index 100% rename from Barotrauma/Content/Particles/flames.png rename to Barotrauma/BarotraumaShared/Content/Particles/flames.png diff --git a/Barotrauma/Content/Particles/shrapnel.png b/Barotrauma/BarotraumaShared/Content/Particles/shrapnel.png similarity index 100% rename from Barotrauma/Content/Particles/shrapnel.png rename to Barotrauma/BarotraumaShared/Content/Particles/shrapnel.png diff --git a/Barotrauma/Content/Particles/spatter.png b/Barotrauma/BarotraumaShared/Content/Particles/spatter.png similarity index 100% rename from Barotrauma/Content/Particles/spatter.png rename to Barotrauma/BarotraumaShared/Content/Particles/spatter.png diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient1.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient10.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient10.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient10.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient10.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient11.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient11.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient11.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient11.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient12.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient12.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient12.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient12.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient13.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient13.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient13.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient13.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient2.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient3.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient4.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient4.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient4.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient4.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient5.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient5.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient5.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient5.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient6.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient6.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient6.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient6.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient7.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient7.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient7.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient7.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient8.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient8.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient8.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient8.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/Ambient9.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient9.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/Ambient9.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/Ambient9.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/DistantPod1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/DistantPod1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/DistantPod1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/DistantPod1.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/DistantPod2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/DistantPod2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/DistantPod2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/DistantPod2.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/DistantPod3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/DistantPod3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/DistantPod3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/DistantPod3.ogg diff --git a/Barotrauma/Content/Sounds/Ambient/GlacialMovement.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Ambient/GlacialMovement.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Ambient/GlacialMovement.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Ambient/GlacialMovement.ogg diff --git a/Barotrauma/Content/Sounds/Damage/GlassBreak1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassBreak1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/GlassBreak1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassBreak1.ogg diff --git a/Barotrauma/Content/Sounds/Damage/GlassBreak2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassBreak2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/GlassBreak2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassBreak2.ogg diff --git a/Barotrauma/Content/Sounds/Damage/GlassBreak3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassBreak3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/GlassBreak3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassBreak3.ogg diff --git a/Barotrauma/Content/Sounds/Damage/GlassImpact1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassImpact1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/GlassImpact1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassImpact1.ogg diff --git a/Barotrauma/Content/Sounds/Damage/GlassImpact2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassImpact2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/GlassImpact2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassImpact2.ogg diff --git a/Barotrauma/Content/Sounds/Damage/GlassImpact3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassImpact3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/GlassImpact3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/GlassImpact3.ogg diff --git a/Barotrauma/Content/Sounds/Damage/HitArmor1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/HitArmor1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/HitArmor1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/HitArmor1.ogg diff --git a/Barotrauma/Content/Sounds/Damage/HitArmor2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/HitArmor2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/HitArmor2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/HitArmor2.ogg diff --git a/Barotrauma/Content/Sounds/Damage/HitArmor3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/HitArmor3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/HitArmor3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/HitArmor3.ogg diff --git a/Barotrauma/Content/Sounds/Damage/LimbBlunt1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/LimbBlunt1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt1.ogg diff --git a/Barotrauma/Content/Sounds/Damage/LimbBlunt2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/LimbBlunt2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt2.ogg diff --git a/Barotrauma/Content/Sounds/Damage/LimbBlunt3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/LimbBlunt3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt3.ogg diff --git a/Barotrauma/Content/Sounds/Damage/LimbBlunt4.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt4.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/LimbBlunt4.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt4.ogg diff --git a/Barotrauma/Content/Sounds/Damage/LimbBlunt5.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt5.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/LimbBlunt5.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbBlunt5.ogg diff --git a/Barotrauma/Content/Sounds/Damage/LimbSlash1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbSlash1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/LimbSlash1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbSlash1.ogg diff --git a/Barotrauma/Content/Sounds/Damage/LimbSlash2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbSlash2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/LimbSlash2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbSlash2.ogg diff --git a/Barotrauma/Content/Sounds/Damage/LimbSlash3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbSlash3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/LimbSlash3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/LimbSlash3.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt1.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt10.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt10.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt10.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt10.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt2.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt3.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt4.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt4.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt4.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt4.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt5.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt5.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt5.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt5.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt6.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt6.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt6.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt6.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt7.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt7.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt7.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt7.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt8.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt8.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt8.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt8.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureBlunt9.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt9.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureBlunt9.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureBlunt9.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureCrunch1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureCrunch1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch1.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureCrunch2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureCrunch2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch2.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureCrunch3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureCrunch3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch3.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureCrunch4.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch4.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureCrunch4.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch4.ogg diff --git a/Barotrauma/Content/Sounds/Damage/StructureCrunch5.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch5.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/StructureCrunch5.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/StructureCrunch5.ogg diff --git a/Barotrauma/Content/Sounds/Damage/creak1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/creak1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak1.ogg diff --git a/Barotrauma/Content/Sounds/Damage/creak2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/creak2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak2.ogg diff --git a/Barotrauma/Content/Sounds/Damage/creak3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/creak3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak3.ogg diff --git a/Barotrauma/Content/Sounds/Damage/creak4.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak4.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/creak4.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak4.ogg diff --git a/Barotrauma/Content/Sounds/Damage/creak5.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak5.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/creak5.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/creak5.ogg diff --git a/Barotrauma/Content/Sounds/Damage/implode.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Damage/implode.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Damage/implode.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Damage/implode.ogg diff --git a/Barotrauma/Content/Sounds/Music/Controlled Chaos 2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/Controlled Chaos 2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/Controlled Chaos 2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/Controlled Chaos 2.ogg diff --git a/Barotrauma/Content/Sounds/Music/Controlled Chaos.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/Controlled Chaos.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/Controlled Chaos.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/Controlled Chaos.ogg diff --git a/Barotrauma/Content/Sounds/Music/Enter the Maze.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/Enter the Maze.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/Enter the Maze.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/Enter the Maze.ogg diff --git a/Barotrauma/Content/Sounds/Music/Phantom From Space.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/Phantom From Space.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/Phantom From Space.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/Phantom From Space.ogg diff --git a/Barotrauma/Content/Sounds/Music/Road to Hell.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/Road to Hell.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/Road to Hell.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/Road to Hell.ogg diff --git a/Barotrauma/Content/Sounds/Music/Simplex.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/Simplex.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/Simplex.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/Simplex.ogg diff --git a/Barotrauma/Content/Sounds/Music/Static Motion.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/Static Motion.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/Static Motion.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/Static Motion.ogg diff --git a/Barotrauma/Content/Sounds/Music/Tenebrous Brothers Carnival - Prelude.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/Tenebrous Brothers Carnival - Prelude.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/Tenebrous Brothers Carnival - Prelude.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/Tenebrous Brothers Carnival - Prelude.ogg diff --git a/Barotrauma/Content/Sounds/Music/The Descent.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/The Descent.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/The Descent.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/The Descent.ogg diff --git a/Barotrauma/Content/Sounds/Music/Unseen Horrors.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/Unseen Horrors.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/Unseen Horrors.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/Unseen Horrors.ogg diff --git a/Barotrauma/Content/Sounds/Music/amb_JD_drone_clattering_machine.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Music/amb_JD_drone_clattering_machine.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Music/amb_JD_drone_clattering_machine.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Music/amb_JD_drone_clattering_machine.ogg diff --git a/Barotrauma/Content/Sounds/UI/UImsg.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/UI/UImsg.ogg similarity index 100% rename from Barotrauma/Content/Sounds/UI/UImsg.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/UI/UImsg.ogg diff --git a/Barotrauma/Content/Sounds/UI/beep-shinymetal.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/UI/beep-shinymetal.ogg similarity index 100% rename from Barotrauma/Content/Sounds/UI/beep-shinymetal.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/UI/beep-shinymetal.ogg diff --git a/Barotrauma/Content/Sounds/UI/deadmsg.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/UI/deadmsg.ogg similarity index 100% rename from Barotrauma/Content/Sounds/UI/deadmsg.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/UI/deadmsg.ogg diff --git a/Barotrauma/Content/Sounds/UI/radiomsg.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/UI/radiomsg.ogg similarity index 100% rename from Barotrauma/Content/Sounds/UI/radiomsg.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/UI/radiomsg.ogg diff --git a/Barotrauma/Content/Sounds/UI/tap-zipper.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/UI/tap-zipper.ogg similarity index 100% rename from Barotrauma/Content/Sounds/UI/tap-zipper.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/UI/tap-zipper.ogg diff --git a/Barotrauma/Content/Sounds/Water/Drown1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Drown1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Drown1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Drown1.ogg diff --git a/Barotrauma/Content/Sounds/Water/Drown2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Drown2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Drown2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Drown2.ogg diff --git a/Barotrauma/Content/Sounds/Water/Drown3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Drown3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Drown3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Drown3.ogg diff --git a/Barotrauma/Content/Sounds/Water/Drown4.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Drown4.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Drown4.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Drown4.ogg diff --git a/Barotrauma/Content/Sounds/Water/DrownLoop.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/DrownLoop.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/DrownLoop.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/DrownLoop.ogg diff --git a/Barotrauma/Content/Sounds/Water/FlowLarge.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/FlowLarge.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/FlowLarge.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/FlowLarge.ogg diff --git a/Barotrauma/Content/Sounds/Water/FlowMedium.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/FlowMedium.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/FlowMedium.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/FlowMedium.ogg diff --git a/Barotrauma/Content/Sounds/Water/FlowSmall.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/FlowSmall.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/FlowSmall.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/FlowSmall.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash0.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash0.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash0.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash0.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash1.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash2.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash3.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash3.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash3.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash3.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash4.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash4.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash4.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash4.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash5.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash5.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash5.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash5.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash6.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash6.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash6.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash6.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash7.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash7.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash7.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash7.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash8.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash8.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash8.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash8.ogg diff --git a/Barotrauma/Content/Sounds/Water/Splash9.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash9.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/Splash9.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/Splash9.ogg diff --git a/Barotrauma/Content/Sounds/Water/WaterAmbience1.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/WaterAmbience1.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/WaterAmbience1.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/WaterAmbience1.ogg diff --git a/Barotrauma/Content/Sounds/Water/WaterAmbience2.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/WaterAmbience2.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/WaterAmbience2.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/WaterAmbience2.ogg diff --git a/Barotrauma/Content/Sounds/Water/splashLoop.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/Water/splashLoop.ogg similarity index 100% rename from Barotrauma/Content/Sounds/Water/splashLoop.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/Water/splashLoop.ogg diff --git a/Barotrauma/Content/Sounds/fire.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/fire.ogg similarity index 100% rename from Barotrauma/Content/Sounds/fire.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/fire.ogg diff --git a/Barotrauma/Content/Sounds/firelarge.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/firelarge.ogg similarity index 100% rename from Barotrauma/Content/Sounds/firelarge.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/firelarge.ogg diff --git a/Barotrauma/Content/Sounds/pickItem.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/pickItem.ogg similarity index 100% rename from Barotrauma/Content/Sounds/pickItem.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/pickItem.ogg diff --git a/Barotrauma/Content/Sounds/sounds.xml b/Barotrauma/BarotraumaShared/Content/Sounds/sounds.xml similarity index 100% rename from Barotrauma/Content/Sounds/sounds.xml rename to Barotrauma/BarotraumaShared/Content/Sounds/sounds.xml diff --git a/Barotrauma/Content/Sounds/startDrone.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/startDrone.ogg similarity index 100% rename from Barotrauma/Content/Sounds/startDrone.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/startDrone.ogg diff --git a/Barotrauma/Content/Sounds/stepMetal.ogg b/Barotrauma/BarotraumaShared/Content/Sounds/stepMetal.ogg similarity index 100% rename from Barotrauma/Content/Sounds/stepMetal.ogg rename to Barotrauma/BarotraumaShared/Content/Sounds/stepMetal.ogg diff --git a/Barotrauma/Content/UI/UI_Atlas.png b/Barotrauma/BarotraumaShared/Content/UI/UI_Atlas.png similarity index 100% rename from Barotrauma/Content/UI/UI_Atlas.png rename to Barotrauma/BarotraumaShared/Content/UI/UI_Atlas.png diff --git a/Barotrauma/Content/UI/caret.png b/Barotrauma/BarotraumaShared/Content/UI/caret.png similarity index 100% rename from Barotrauma/Content/UI/caret.png rename to Barotrauma/BarotraumaShared/Content/UI/caret.png diff --git a/Barotrauma/Content/UI/cursor.png b/Barotrauma/BarotraumaShared/Content/UI/cursor.png similarity index 100% rename from Barotrauma/Content/UI/cursor.png rename to Barotrauma/BarotraumaShared/Content/UI/cursor.png diff --git a/Barotrauma/Content/UI/damageOverlay.png b/Barotrauma/BarotraumaShared/Content/UI/damageOverlay.png similarity index 100% rename from Barotrauma/Content/UI/damageOverlay.png rename to Barotrauma/BarotraumaShared/Content/UI/damageOverlay.png diff --git a/Barotrauma/Content/UI/inventoryIcons.png b/Barotrauma/BarotraumaShared/Content/UI/inventoryIcons.png similarity index 100% rename from Barotrauma/Content/UI/inventoryIcons.png rename to Barotrauma/BarotraumaShared/Content/UI/inventoryIcons.png diff --git a/Barotrauma/Content/UI/noise.png b/Barotrauma/BarotraumaShared/Content/UI/noise.png similarity index 100% rename from Barotrauma/Content/UI/noise.png rename to Barotrauma/BarotraumaShared/Content/UI/noise.png diff --git a/Barotrauma/Content/UI/statusIcons.png b/Barotrauma/BarotraumaShared/Content/UI/statusIcons.png similarity index 100% rename from Barotrauma/Content/UI/statusIcons.png rename to Barotrauma/BarotraumaShared/Content/UI/statusIcons.png diff --git a/Barotrauma/Content/UI/style.xml b/Barotrauma/BarotraumaShared/Content/UI/style.xml similarity index 100% rename from Barotrauma/Content/UI/style.xml rename to Barotrauma/BarotraumaShared/Content/UI/style.xml diff --git a/Barotrauma/Content/UI/textboxTexture.png b/Barotrauma/BarotraumaShared/Content/UI/textboxTexture.png similarity index 100% rename from Barotrauma/Content/UI/textboxTexture.png rename to Barotrauma/BarotraumaShared/Content/UI/textboxTexture.png diff --git a/Barotrauma/Content/UI/titleBackground.png b/Barotrauma/BarotraumaShared/Content/UI/titleBackground.png similarity index 100% rename from Barotrauma/Content/UI/titleBackground.png rename to Barotrauma/BarotraumaShared/Content/UI/titleBackground.png diff --git a/Barotrauma/Content/UI/titleMonster.png b/Barotrauma/BarotraumaShared/Content/UI/titleMonster.png similarity index 100% rename from Barotrauma/Content/UI/titleMonster.png rename to Barotrauma/BarotraumaShared/Content/UI/titleMonster.png diff --git a/Barotrauma/Content/UI/titleText.png b/Barotrauma/BarotraumaShared/Content/UI/titleText.png similarity index 100% rename from Barotrauma/Content/UI/titleText.png rename to Barotrauma/BarotraumaShared/Content/UI/titleText.png diff --git a/Barotrauma/Content/UI/uiBackground.png b/Barotrauma/BarotraumaShared/Content/UI/uiBackground.png similarity index 100% rename from Barotrauma/Content/UI/uiBackground.png rename to Barotrauma/BarotraumaShared/Content/UI/uiBackground.png diff --git a/Barotrauma/Content/UI/uiButton.png b/Barotrauma/BarotraumaShared/Content/UI/uiButton.png similarity index 100% rename from Barotrauma/Content/UI/uiButton.png rename to Barotrauma/BarotraumaShared/Content/UI/uiButton.png diff --git a/Barotrauma/Content/UI/uiIcons.png b/Barotrauma/BarotraumaShared/Content/UI/uiIcons.png similarity index 100% rename from Barotrauma/Content/UI/uiIcons.png rename to Barotrauma/BarotraumaShared/Content/UI/uiIcons.png diff --git a/Barotrauma/Content/blurshader.fx b/Barotrauma/BarotraumaShared/Content/blurshader.fx similarity index 100% rename from Barotrauma/Content/blurshader.fx rename to Barotrauma/BarotraumaShared/Content/blurshader.fx diff --git a/Barotrauma/Content/blurshader.xnb b/Barotrauma/BarotraumaShared/Content/blurshader.xnb similarity index 54% rename from Barotrauma/Content/blurshader.xnb rename to Barotrauma/BarotraumaShared/Content/blurshader.xnb index 111241629..800b942e2 100644 Binary files a/Barotrauma/Content/blurshader.xnb and b/Barotrauma/BarotraumaShared/Content/blurshader.xnb differ diff --git a/Barotrauma/Content/blurshader_opengl.xnb b/Barotrauma/BarotraumaShared/Content/blurshader_opengl.xnb similarity index 100% rename from Barotrauma/Content/blurshader_opengl.xnb rename to Barotrauma/BarotraumaShared/Content/blurshader_opengl.xnb diff --git a/Barotrauma/Content/damageshader.fx b/Barotrauma/BarotraumaShared/Content/damageshader.fx similarity index 100% rename from Barotrauma/Content/damageshader.fx rename to Barotrauma/BarotraumaShared/Content/damageshader.fx diff --git a/Barotrauma/BarotraumaShared/Content/damageshader.xnb b/Barotrauma/BarotraumaShared/Content/damageshader.xnb new file mode 100644 index 000000000..73688a666 Binary files /dev/null and b/Barotrauma/BarotraumaShared/Content/damageshader.xnb differ diff --git a/Barotrauma/Content/damageshader_opengl.xnb b/Barotrauma/BarotraumaShared/Content/damageshader_opengl.xnb similarity index 100% rename from Barotrauma/Content/damageshader_opengl.xnb rename to Barotrauma/BarotraumaShared/Content/damageshader_opengl.xnb diff --git a/Barotrauma/Content/randomevents.xml b/Barotrauma/BarotraumaShared/Content/randomevents.xml similarity index 100% rename from Barotrauma/Content/randomevents.xml rename to Barotrauma/BarotraumaShared/Content/randomevents.xml diff --git a/Barotrauma/Content/step.ogg b/Barotrauma/BarotraumaShared/Content/step.ogg similarity index 100% rename from Barotrauma/Content/step.ogg rename to Barotrauma/BarotraumaShared/Content/step.ogg diff --git a/Barotrauma/Content/utg_4.mp4 b/Barotrauma/BarotraumaShared/Content/utg_4.mp4 similarity index 100% rename from Barotrauma/Content/utg_4.mp4 rename to Barotrauma/BarotraumaShared/Content/utg_4.mp4 diff --git a/Barotrauma/Content/utg_4.xnb b/Barotrauma/BarotraumaShared/Content/utg_4.xnb similarity index 100% rename from Barotrauma/Content/utg_4.xnb rename to Barotrauma/BarotraumaShared/Content/utg_4.xnb diff --git a/Barotrauma/Content/waterbump.png b/Barotrauma/BarotraumaShared/Content/waterbump.png similarity index 100% rename from Barotrauma/Content/waterbump.png rename to Barotrauma/BarotraumaShared/Content/waterbump.png diff --git a/Barotrauma/Content/watershader.fx b/Barotrauma/BarotraumaShared/Content/watershader.fx similarity index 100% rename from Barotrauma/Content/watershader.fx rename to Barotrauma/BarotraumaShared/Content/watershader.fx diff --git a/Barotrauma/BarotraumaShared/Content/watershader.xnb b/Barotrauma/BarotraumaShared/Content/watershader.xnb new file mode 100644 index 000000000..cd5992cd6 Binary files /dev/null and b/Barotrauma/BarotraumaShared/Content/watershader.xnb differ diff --git a/Barotrauma/Content/watershader_opengl.xnb b/Barotrauma/BarotraumaShared/Content/watershader_opengl.xnb similarity index 100% rename from Barotrauma/Content/watershader_opengl.xnb rename to Barotrauma/BarotraumaShared/Content/watershader_opengl.xnb diff --git a/Barotrauma/Data/ContentPackages/Vanilla 0.3.xml b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.3.xml similarity index 100% rename from Barotrauma/Data/ContentPackages/Vanilla 0.3.xml rename to Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.3.xml diff --git a/Barotrauma/Icon.ico b/Barotrauma/BarotraumaShared/Icon.ico similarity index 100% rename from Barotrauma/Icon.ico rename to Barotrauma/BarotraumaShared/Icon.ico diff --git a/Barotrauma/Mods/info.txt b/Barotrauma/BarotraumaShared/Mods/info.txt similarity index 100% rename from Barotrauma/Mods/info.txt rename to Barotrauma/BarotraumaShared/Mods/info.txt diff --git a/Barotrauma/readme.txt b/Barotrauma/BarotraumaShared/README.txt similarity index 100% rename from Barotrauma/readme.txt rename to Barotrauma/BarotraumaShared/README.txt diff --git a/Barotrauma/Source/Characters/AI/AIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/AIController.cs similarity index 93% rename from Barotrauma/Source/Characters/AI/AIController.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/AIController.cs index dee7aab5d..d3095f5a2 100644 --- a/Barotrauma/Source/Characters/AI/AIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/AIController.cs @@ -4,7 +4,7 @@ using Microsoft.Xna.Framework.Graphics; namespace Barotrauma { - class AIController : ISteerable + partial class AIController : ISteerable { public enum AIState { None, Attack, GoTo, Escape, Eat } @@ -55,8 +55,6 @@ namespace Barotrauma Enabled = true; } - public virtual void DebugDraw(SpriteBatch spriteBatch) { } - public virtual void OnAttacked(IDamageable attacker, float amount) { } public virtual void SelectTarget(AITarget target) { } diff --git a/Barotrauma/Source/Characters/AI/AITarget.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/AITarget.cs similarity index 59% rename from Barotrauma/Source/Characters/AI/AITarget.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/AITarget.cs index f3038082f..4939a9358 100644 --- a/Barotrauma/Source/Characters/AI/AITarget.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/AITarget.cs @@ -5,10 +5,8 @@ using Microsoft.Xna.Framework.Graphics; namespace Barotrauma { - class AITarget + partial class AITarget { - public static bool ShowAITargets; - public static List List = new List(); public Entity Entity @@ -53,25 +51,5 @@ namespace Barotrauma List.Remove(this); Entity = null; } - - public void Draw(SpriteBatch spriteBatch) - { - if (!ShowAITargets) return; - - var rangeSprite = GUI.SubmarineIcon; - - if (soundRange > 0.0f) - rangeSprite.Draw(spriteBatch, - new Vector2(WorldPosition.X, -WorldPosition.Y), - Color.Cyan * 0.1f, rangeSprite.Origin, - 0.0f, soundRange / rangeSprite.size.X); - - if (sightRange > 0.0f) - rangeSprite.Draw(spriteBatch, - new Vector2(WorldPosition.X, -WorldPosition.Y), - Color.Orange * 0.1f, rangeSprite.Origin, - 0.0f, sightRange / rangeSprite.size.X); - } - } } diff --git a/Barotrauma/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs similarity index 91% rename from Barotrauma/Source/Characters/AI/EnemyAIController.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs index baea625ad..6133f4429 100644 --- a/Barotrauma/Source/Characters/AI/EnemyAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs @@ -8,8 +8,7 @@ using Microsoft.Xna.Framework.Graphics; namespace Barotrauma { - - class EnemyAIController : AIController + partial class EnemyAIController : AIController { private const float UpdateTargetsInterval = 0.5f; @@ -725,59 +724,7 @@ namespace Barotrauma } } - #endregion - - public override void DebugDraw(SpriteBatch spriteBatch) - { - if (Character.IsDead) return; - - Vector2 pos = Character.WorldPosition; - pos.Y = -pos.Y; - - if (selectedAiTarget!=null && selectedAiTarget.Entity != null) - { - GUI.DrawLine(spriteBatch, pos, new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red); - - if (wallAttackPos!=Vector2.Zero) - { - GUI.DrawRectangle(spriteBatch, ConvertUnits.ToDisplayUnits(new Vector2(wallAttackPos.X, -wallAttackPos.Y)) - new Vector2(10.0f, 10.0f), new Vector2(20.0f, 20.0f), Color.Red, false); - } - - GUI.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY*20.0f, Color.Red); - - GUI.DrawLine(spriteBatch, - new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y), - new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red); - } - - GUI.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY * 80.0f, Color.Red); - - GUI.Font.DrawString(spriteBatch, "updatetargets: "+updateTargetsTimer, pos - Vector2.UnitY * 100.0f, Color.Red); - GUI.Font.DrawString(spriteBatch, "cooldown: " + coolDownTimer, pos - Vector2.UnitY * 120.0f, Color.Red); - - - IndoorsSteeringManager pathSteering = steeringManager as IndoorsSteeringManager; - if (pathSteering == null || pathSteering.CurrentPath == null || pathSteering.CurrentPath.CurrentNode == null) return; - - GUI.DrawLine(spriteBatch, - new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y), - new Vector2(pathSteering.CurrentPath.CurrentNode.DrawPosition.X, -pathSteering.CurrentPath.CurrentNode.DrawPosition.Y), - Color.LightGreen); - - - for (int i = 1; i < pathSteering.CurrentPath.Nodes.Count; i++) - { - GUI.DrawLine(spriteBatch, - new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y), - new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y), - Color.LightGreen); - - GUI.SmallFont.DrawString(spriteBatch, - pathSteering.CurrentPath.Nodes[i].ID.ToString(), - new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y - 10), - Color.LightGreen); - } - } + #endregion } //the "memory" of the Character diff --git a/Barotrauma/Source/Characters/AI/HumanAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs similarity index 72% rename from Barotrauma/Source/Characters/AI/HumanAIController.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs index ed63eb9eb..416e96c99 100644 --- a/Barotrauma/Source/Characters/AI/HumanAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs @@ -3,7 +3,7 @@ using System; namespace Barotrauma { - class HumanAIController : AIController + partial class HumanAIController : AIController { public static bool DisableCrewAI; @@ -37,14 +37,9 @@ namespace Barotrauma updateObjectiveTimer = Rand.Range(0.0f, UpdateObjectiveInterval); - if (GameMain.GameSession!=null && GameMain.GameSession.CrewManager!=null) - { - CurrentOrder = Order.PrefabList.Find(o => o.Name.ToLowerInvariant() == "dismissed"); - objectiveManager.SetOrder(CurrentOrder, ""); - GameMain.GameSession.CrewManager.SetCharacterOrder(Character, CurrentOrder); - } - + InitProjSpecific(); } + partial void InitProjSpecific(); public override void Update(float deltaTime) { @@ -153,44 +148,13 @@ namespace Barotrauma CurrentOrder = order; objectiveManager.SetOrder(order, option); - GameMain.GameSession.CrewManager.SetCharacterOrder(Character, order); + SetOrderProjSpecific(order); } + partial void SetOrderProjSpecific(Order order); public override void SelectTarget(AITarget target) { selectedAiTarget = target; } - - public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) - { - if (selectedAiTarget != null) - { - GUI.DrawLine(spriteBatch, - new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y), - new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red); - } - - IndoorsSteeringManager pathSteering = steeringManager as IndoorsSteeringManager; - if (pathSteering == null || pathSteering.CurrentPath == null || pathSteering.CurrentPath.CurrentNode==null) return; - - GUI.DrawLine(spriteBatch, - new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y), - new Vector2(pathSteering.CurrentPath.CurrentNode.DrawPosition.X, -pathSteering.CurrentPath.CurrentNode.DrawPosition.Y), - Color.LightGreen); - - - for (int i = 1; i < pathSteering.CurrentPath.Nodes.Count; i++) - { - GUI.DrawLine(spriteBatch, - new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y), - new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y), - Color.LightGreen); - - GUI.SmallFont.DrawString(spriteBatch, - pathSteering.CurrentPath.Nodes[i].ID.ToString(), - new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y - 10), - Color.LightGreen); - } - } } } diff --git a/Barotrauma/Source/Characters/AI/ISteerable.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/ISteerable.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/ISteerable.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/ISteerable.cs diff --git a/Barotrauma/Source/Characters/AI/IndoorsSteeringManager.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/IndoorsSteeringManager.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjective.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjective.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjective.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjective.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveCombat.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveCombat.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveFindDivingGear.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindDivingGear.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveFindDivingGear.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindDivingGear.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs similarity index 98% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs index 7fb78c83f..dbed48d27 100644 --- a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs @@ -181,7 +181,7 @@ namespace Barotrauma return priority; } - private static float GetHullSafety(Hull hull, Character character) + public static float GetHullSafety(Hull hull, Character character) { if (hull == null) return 0.0f; diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveFixLeak.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFixLeak.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveFixLeak.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFixLeak.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveFixLeaks.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFixLeaks.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveFixLeaks.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFixLeaks.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveIdle.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveIdle.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveManager.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveManager.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveManager.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveManager.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveRescue.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveRescue.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs diff --git a/Barotrauma/Source/Characters/AI/Objectives/AIObjectiveRescureAll.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescueAll.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Objectives/AIObjectiveRescureAll.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescueAll.cs diff --git a/Barotrauma/Source/Characters/AI/Order.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Order.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/Order.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/Order.cs diff --git a/Barotrauma/Source/Characters/AI/PathFinder.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/PathFinder.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/PathFinder.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/PathFinder.cs diff --git a/Barotrauma/Source/Characters/AI/SteeringManager.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/SteeringManager.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/SteeringManager.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/SteeringManager.cs diff --git a/Barotrauma/Source/Characters/AI/SteeringPath.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/SteeringPath.cs similarity index 100% rename from Barotrauma/Source/Characters/AI/SteeringPath.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AI/SteeringPath.cs diff --git a/Barotrauma/Source/Characters/AICharacter.cs b/Barotrauma/BarotraumaShared/Source/Characters/AICharacter.cs similarity index 65% rename from Barotrauma/Source/Characters/AICharacter.cs rename to Barotrauma/BarotraumaShared/Source/Characters/AICharacter.cs index 7411305f7..5bcc5aeb3 100644 --- a/Barotrauma/Source/Characters/AICharacter.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AICharacter.cs @@ -3,7 +3,7 @@ using System; namespace Barotrauma { - class AICharacter : Character + partial class AICharacter : Character { private AIController aiController; @@ -15,17 +15,18 @@ namespace Barotrauma public AICharacter(string file, Vector2 position, CharacterInfo characterInfo = null, bool isNetworkPlayer = false) : base(file, position, characterInfo, isNetworkPlayer) { - soundTimer = Rand.Range(0.0f, soundInterval); + } + partial void InitProjSpecific(); public void SetAI(AIController aiController) { this.aiController = aiController; } - public override void Update(Camera cam, float deltaTime) + public override void Update(float deltaTime, Camera cam) { - base.Update(cam, deltaTime); + base.Update(deltaTime, cam); if (!Enabled || IsRemotePlayer) return; @@ -42,34 +43,12 @@ namespace Barotrauma if (IsDead || Health <= 0.0f || IsUnconscious || Stun > 0.0f) return; if (Controlled == this || !aiController.Enabled) return; - - if (soundTimer > 0) - { - soundTimer -= deltaTime; - } - else - { - switch (aiController.State) - { - case AIController.AIState.Attack: - PlaySound(CharacterSound.SoundType.Attack); - break; - default: - PlaySound(CharacterSound.SoundType.Idle); - break; - } - soundTimer = soundInterval; - } + + SoundUpdate(deltaTime); aiController.Update(deltaTime); } - - public override void DrawFront(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch,Camera cam) - { - base.DrawFront(spriteBatch,cam); - - if (GameMain.DebugDraw && !IsDead) aiController.DebugDraw(spriteBatch); - } + partial void SoundUpdate(float deltaTime); public override void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker) { diff --git a/Barotrauma/Source/Characters/Animation/AnimController.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/AnimController.cs similarity index 100% rename from Barotrauma/Source/Characters/Animation/AnimController.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Animation/AnimController.cs diff --git a/Barotrauma/Source/Characters/Animation/FishAnimController.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/FishAnimController.cs similarity index 99% rename from Barotrauma/Source/Characters/Animation/FishAnimController.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Animation/FishAnimController.cs index 7fa3c6752..df3711b26 100644 --- a/Barotrauma/Source/Characters/Animation/FishAnimController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/FishAnimController.cs @@ -4,7 +4,6 @@ using System.Xml.Linq; using FarseerPhysics; using FarseerPhysics.Dynamics.Joints; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Input; namespace Barotrauma { diff --git a/Barotrauma/Source/Characters/Animation/HumanoidAnimController.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs similarity index 100% rename from Barotrauma/Source/Characters/Animation/HumanoidAnimController.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs diff --git a/Barotrauma/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs similarity index 90% rename from Barotrauma/Source/Characters/Animation/Ragdoll.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs index bde487a1e..f513a4a5d 100644 --- a/Barotrauma/Source/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs @@ -11,7 +11,7 @@ using Microsoft.Xna.Framework.Graphics; namespace Barotrauma { - class Ragdoll + partial class Ragdoll { public static List list = new List(); @@ -160,6 +160,11 @@ namespace Barotrauma foreach (Limb limb in Limbs) { if (limb.IsSevered) continue; + if (limb.body == null) + { + DebugConsole.ThrowError("Limb has no body! (" + (character != null ? character.Name : "Unknown character") + ", " + limb.type.ToString()); + continue; + } limb.body.Enabled = !simplePhysicsEnabled; } @@ -496,17 +501,11 @@ namespace Barotrauma if (character.Submarine == null && f2.Body.UserData is Submarine) velocity -= ((Submarine)f2.Body.UserData).Velocity; float impact = Vector2.Dot(velocity, -normal); - - float volume = Math.Min(impact-3.0f, 1.0f); + + ImpactProjSpecific(impact,f1.Body); + if (f1.Body.UserData is Limb) { - Limb limb = (Limb)f1.Body.UserData; - - if (impact > 3.0f && limb.HitSound != null && limb.SoundTimer <= 0.0f) - { - limb.SoundTimer = Limb.SoundInterval; - limb.HitSound.Play(volume, impact * 100.0f, limb.WorldPosition); - } } else if (f1.Body == Collider.FarseerBody) { @@ -515,12 +514,10 @@ namespace Barotrauma if (impact > ImpactTolerance) { character.AddDamage(CauseOfDeath.Damage, impact - ImpactTolerance, null); - SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, strongestImpact, Collider); + strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance); } - } - - if (Character.Controlled == character) GameMain.GameScreen.Cam.Shake = strongestImpact; + } } } @@ -540,7 +537,6 @@ namespace Barotrauma limb.IsSevered = true; } } - } private void GetConnectedLimbs(List connectedLimbs, List checkedJoints, Limb limb) @@ -568,92 +564,8 @@ namespace Barotrauma } } } - - public virtual void Draw(SpriteBatch spriteBatch) - { - if (simplePhysicsEnabled) return; - - Collider.UpdateDrawPosition(); - - foreach (Limb limb in Limbs) - { - limb.Draw(spriteBatch); - } - } - - public void DebugDraw(SpriteBatch spriteBatch) - { - if (!GameMain.DebugDraw || !character.Enabled) return; - if (simplePhysicsEnabled) return; - - foreach (Limb limb in Limbs) - { - - if (limb.pullJoint != null) - { - Vector2 pos = ConvertUnits.ToDisplayUnits(limb.pullJoint.WorldAnchorA); - if (currentHull != null) pos += currentHull.Submarine.DrawPosition; - pos.Y = -pos.Y; - GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f); - } - - Color limbColor = inWater ? Color.Cyan : Color.White; - if (limb.IsSevered) limbColor = Color.Red; - limb.body.DebugDraw(spriteBatch, limbColor); - } - - Collider.DebugDraw(spriteBatch, frozen ? Color.Red : (inWater ? Color.SkyBlue : Color.Gray)); - GUI.Font.DrawString(spriteBatch, Collider.LinearVelocity.X.ToString(), new Vector2(Collider.DrawPosition.X, -Collider.DrawPosition.Y), Color.Orange); - - foreach (RevoluteJoint joint in LimbJoints) - { - Vector2 pos = ConvertUnits.ToDisplayUnits(joint.WorldAnchorA); - GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.White, true); - - pos = ConvertUnits.ToDisplayUnits(joint.WorldAnchorB); - GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.White, true); - } - - foreach (Limb limb in Limbs) - { - if (limb.body.TargetPosition != null) - { - Vector2 pos = ConvertUnits.ToDisplayUnits((Vector2)limb.body.TargetPosition); - if (currentHull != null) pos += currentHull.Submarine.DrawPosition; - pos.Y = -pos.Y; - - GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X - 10, (int)pos.Y - 10, 20, 20), Color.Cyan, false, 0.01f); - GUI.DrawLine(spriteBatch, pos, new Vector2(limb.WorldPosition.X, -limb.WorldPosition.Y), Color.Cyan); - } - } - - if (character.MemState.Count > 1) - { - Vector2 prevPos = ConvertUnits.ToDisplayUnits(character.MemState[0].Position); - if (currentHull != null) prevPos += currentHull.Submarine.DrawPosition; - prevPos.Y = -prevPos.Y; - - for (int i = 1; i < character.MemState.Count; i++ ) - { - Vector2 currPos = ConvertUnits.ToDisplayUnits(character.MemState[i].Position); - if (currentHull != null) currPos += currentHull.Submarine.DrawPosition; - currPos.Y = -currPos.Y; - - GUI.DrawRectangle(spriteBatch, new Rectangle((int)currPos.X - 3, (int)currPos.Y - 3, 6, 6), Color.Cyan*0.6f, true, 0.01f); - GUI.DrawLine(spriteBatch, prevPos, currPos, Color.Cyan*0.6f, 0, 3); - - prevPos = currPos; - } - } - - if (ignorePlatforms) - { - GUI.DrawLine(spriteBatch, - new Vector2(Collider.DrawPosition.X, -Collider.DrawPosition.Y), - new Vector2(Collider.DrawPosition.X, -Collider.DrawPosition.Y + 50), - Color.Orange, 0, 5); - } - } + + partial void ImpactProjSpecific(float impact, Body body); public virtual void Flip() { @@ -735,11 +647,11 @@ namespace Barotrauma } } - public static void UpdateAll(Camera cam, float deltaTime) + public static void UpdateAll(float deltaTime, Camera cam) { foreach (Ragdoll r in list) { - r.Update(cam, deltaTime); + r.Update(deltaTime, cam); } } @@ -868,7 +780,7 @@ namespace Barotrauma protected bool levitatingCollider = true; - public void Update(Camera cam, float deltaTime) + public void Update(float deltaTime, Camera cam) { if (!character.Enabled || Frozen) return; @@ -957,27 +869,11 @@ namespace Barotrauma //the limb has gone through the surface of the water if (Math.Abs(limb.LinearVelocity.Y) > 5.0f && limb.inWater != prevInWater) { - - //create a splash particle - GameMain.ParticleManager.CreateParticle("watersplash", - new Vector2(limb.Position.X, limbHull.Surface) + limbHull.Submarine.Position, - new Vector2(0.0f, Math.Abs(-limb.LinearVelocity.Y * 20.0f)), - 0.0f, limbHull); - - GameMain.ParticleManager.CreateParticle("bubbles", - new Vector2(limb.Position.X, limbHull.Surface) + limbHull.Submarine.Position, - limb.LinearVelocity * 0.001f, - 0.0f, limbHull); + Splash(limb, limbHull); //if the Character dropped into water, create a wave if (limb.LinearVelocity.Y < 0.0f) { - if (splashSoundTimer <= 0.0f) - { - SoundPlayer.PlaySplashSound(limb.WorldPosition, Math.Abs(limb.LinearVelocity.Y) + Rand.Range(-5.0f, 0.0f)); - splashSoundTimer = 0.5f; - } - //1.0 when the limb is parallel to the surface of the water // = big splash and a large impact float parallel = (float)Math.Abs(Math.Sin(limb.Rotation)); @@ -989,10 +885,6 @@ namespace Barotrauma } } - if (limb.LightSource != null) - { - limb.LightSource.Rotation = dir == Direction.Right ? limb.body.DrawRotation : limb.body.DrawRotation - MathHelper.Pi; - } limb.Update(deltaTime); } @@ -1133,6 +1025,8 @@ namespace Barotrauma } } + partial void Splash(Limb limb, Hull limbHull); + protected float GetFloorY(Limb refLimb = null) { PhysicsBody refBody = refLimb == null ? Collider : refLimb.body; diff --git a/Barotrauma/Source/Characters/Attack.cs b/Barotrauma/BarotraumaShared/Source/Characters/Attack.cs similarity index 79% rename from Barotrauma/Source/Characters/Attack.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Attack.cs index dcdf7dd0e..a6731a3af 100644 --- a/Barotrauma/Source/Characters/Attack.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Attack.cs @@ -1,5 +1,4 @@ using Microsoft.Xna.Framework; -using Barotrauma.Particles; using System; using System.Xml.Linq; using System.Collections.Generic; @@ -30,7 +29,7 @@ namespace Barotrauma } } - class Attack + partial class Attack { public readonly float Range; public readonly float Duration; @@ -54,11 +53,7 @@ namespace Barotrauma //the indices of the limbs Force is applied on //(if none, force is applied only to the limb the attack is attached to) public readonly List ApplyForceOnLimbs; - - private Sound sound; - - private ParticleEmitterPrefab particleEmitterPrefab; - + public readonly float Stun; private float priority; @@ -104,21 +99,17 @@ namespace Barotrauma SeverLimbsProbability = ToolBox.GetAttributeFloat(element, "severlimbsprobability", 0.0f); - Force = ToolBox.GetAttributeFloat(element, "force", 0.0f); - TargetForce = ToolBox.GetAttributeFloat(element, "targetforce", 0.0f); - Torque = ToolBox.GetAttributeFloat(element, "torque", 0.0f); + Force = ToolBox.GetAttributeFloat(element,"force", 0.0f); + TargetForce = ToolBox.GetAttributeFloat(element, "targetforce", 0.0f); + Torque = ToolBox.GetAttributeFloat(element, "torque", 0.0f); - string soundPath = ToolBox.GetAttributeString(element, "sound", ""); - if (!string.IsNullOrWhiteSpace(soundPath)) - { - sound = Sound.Load(soundPath); - } - - Range = ToolBox.GetAttributeFloat(element, "range", 0.0f); - Duration = ToolBox.GetAttributeFloat(element, "duration", 0.0f); + Range = ToolBox.GetAttributeFloat(element, "range", 0.0f); + Duration = ToolBox.GetAttributeFloat(element, "duration", 0.0f); + + priority = ToolBox.GetAttributeFloat(element, "priority", 1.0f); + + InitProjSpecific(element); - priority = ToolBox.GetAttributeFloat(element, "priority", 1.0f); - string limbIndicesStr = ToolBox.GetAttributeString(element, "applyforceonlimbs", ""); if (!string.IsNullOrWhiteSpace(limbIndicesStr)) { @@ -129,17 +120,14 @@ namespace Barotrauma if (int.TryParse(limbIndexStr, out limbIndex)) { ApplyForceOnLimbs.Add(limbIndex); - } + } } } - + foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) { - case "particleemitter": - particleEmitterPrefab = new ParticleEmitterPrefab(subElement); - break; case "statuseffect": if (statusEffects == null) { @@ -151,20 +139,12 @@ namespace Barotrauma } } - - + partial void InitProjSpecific(XElement element); + public AttackResult DoDamage(IDamageable attacker, IDamageable target, Vector2 worldPosition, float deltaTime, bool playSound = true) { - if (particleEmitterPrefab != null) - { - particleEmitterPrefab.Emit(worldPosition); - } + DamageParticles(worldPosition); - if (sound != null) - { - sound.Play(1.0f, 500.0f, worldPosition); - } - var attackResult = target.AddDamage(attacker, worldPosition, this, deltaTime, playSound); var effectType = attackResult.Damage > 0.0f ? ActionType.OnUse : ActionType.OnFailure; @@ -188,5 +168,6 @@ namespace Barotrauma return attackResult; } + partial void DamageParticles(Vector2 worldPosition); } } diff --git a/Barotrauma/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs similarity index 77% rename from Barotrauma/Source/Characters/Character.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Character.cs index 471a0aab2..3f6b0cf93 100644 --- a/Barotrauma/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -1,14 +1,12 @@ using FarseerPhysics; using FarseerPhysics.Dynamics; using FarseerPhysics.Dynamics.Joints; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Barotrauma.Networking; -using Barotrauma.Particles; using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; +using Microsoft.Xna.Framework; namespace Barotrauma { @@ -17,26 +15,6 @@ namespace Barotrauma public static List CharacterList = new List(); public static bool DisableControls; - - - //the Character that the player is currently controlling - private static Character controlled; - - public static Character Controlled - { - get { return controlled; } - set - { - if (controlled == value) return; - controlled = value; - CharacterHUD.Reset(); - - if (controlled != null) - { - controlled.Enabled = true; - } - } - } private bool enabled = true; public bool Enabled @@ -97,8 +75,6 @@ namespace Barotrauma protected Item closestItem; private Character closestCharacter, selectedCharacter; - private Dictionary hudProgressBars; - private bool isDead; private CauseOfDeath lastAttackCauseOfDeath; private CauseOfDeath causeOfDeath; @@ -108,13 +84,8 @@ namespace Barotrauma //the name of the species (e.q. human) public readonly string SpeciesName; - protected float soundTimer; - protected float soundInterval; - private float bleeding; - private List sounds; - private float attackCoolDown; public Entity ViewTarget @@ -337,12 +308,7 @@ namespace Barotrauma GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status }); } } - - public Dictionary HUDProgressBars - { - get { return hudProgressBars; } - } - + public HuskInfection huskInfection; public float HuskInfectionState { @@ -474,7 +440,7 @@ namespace Barotrauma public static Character Create(string file, Vector2 position, CharacterInfo characterInfo = null, bool isRemotePlayer = false, bool hasAi=true) { -#if LINUX +#if LINUX if (!System.IO.File.Exists(file)) { @@ -539,19 +505,10 @@ namespace Barotrauma protected Character(string file, Vector2 position, CharacterInfo characterInfo = null, bool isRemotePlayer = false) : base(null) { - keys = new Key[Enum.GetNames(typeof(InputType)).Length]; - - for (int i = 0; i < Enum.GetNames(typeof(InputType)).Length; i++) - { - keys[i] = new Key(GameMain.Config.KeyBind((InputType)i)); - } - ConfigPath = file; selectedItems = new Item[2]; - hudProgressBars = new Dictionary(); - IsRemotePlayer = isRemotePlayer; oxygen = 100.0f; @@ -570,7 +527,9 @@ namespace Barotrauma XDocument doc = ToolBox.TryLoadXml(file); if (doc == null || doc.Root == null) return; - + + InitProjSpecific(doc); + SpeciesName = ToolBox.GetAttributeString(doc.Root, "name", "Unknown"); IsHumanoid = ToolBox.GetAttributeBool(doc.Root, "humanoid", false); @@ -597,18 +556,7 @@ namespace Barotrauma needsAir = ToolBox.GetAttributeBool(doc.Root, "needsair", false); drowningTime = ToolBox.GetAttributeFloat(doc.Root, "drowningtime", 10.0f); - - soundInterval = ToolBox.GetAttributeFloat(doc.Root, "soundinterval", 10.0f); - - var soundElements = doc.Root.Elements("sound").ToList(); - - sounds = new List(); - foreach (XElement soundElement in soundElements) - { - sounds.Add(new CharacterSound(soundElement)); - } - if (file == humanConfigFile) { if (Info.PickedItemIDs.Any()) @@ -641,6 +589,7 @@ namespace Barotrauma // - if an AICharacter, the server enables it when close enough to any of the players Enabled = GameMain.NetworkMember == null; } + partial void InitProjSpecific(XDocument doc); private static string humanConfigFile; public static string HumanConfigFile @@ -740,6 +689,7 @@ namespace Barotrauma public void ClearInputs() { + if (keys == null) return; foreach (Key key in keys) { key.Hit = false; @@ -943,8 +893,8 @@ namespace Barotrauma } } - - if (IsRemotePlayer) + + if (IsRemotePlayer && keys!=null) { foreach (Key key in keys) { @@ -1137,142 +1087,7 @@ namespace Barotrauma selectedCharacter = null; } - - /// - /// Control the Character according to player input - /// - public void ControlLocalPlayer(float deltaTime, Camera cam, bool moveCam = true) - { - if (!DisableControls) - { - for (int i = 0; i < keys.Length; i++ ) - { - keys[i].SetState(); - } - } - else - { - foreach (Key key in keys) - { - if (key == null) continue; - key.Reset(); - } - } - - if (moveCam) - { - if (needsAir && - pressureProtection < 80.0f && - (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure > 50.0f)) - { - float pressure = AnimController.CurrentHull == null ? 100.0f : AnimController.CurrentHull.LethalPressure; - - cam.Zoom = MathHelper.Lerp(cam.Zoom, - (pressure / 50.0f) * Rand.Range(1.0f, 1.05f), - (pressure - 50.0f) / 50.0f); - } - - if (IsHumanoid) - { - cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, 250.0f, deltaTime); - } - else - { - //increased visibility range when controlling large a non-humanoid - cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, MathHelper.Clamp(Mass, 250.0f, 800.0f), deltaTime); - } - } - - cursorPosition = cam.ScreenToWorld(PlayerInput.MousePosition); - if (AnimController.CurrentHull != null && AnimController.CurrentHull.Submarine != null) - { - cursorPosition -= AnimController.CurrentHull.Submarine.Position; - } - - Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition); - - if (Lights.LightManager.ViewTarget == this && Vector2.DistanceSquared(AnimController.Limbs[0].SimPosition, mouseSimPos) > 1.0f) - { - Body body = Submarine.PickBody(AnimController.Limbs[0].SimPosition, mouseSimPos); - Structure structure = null; - if (body != null) structure = body.UserData as Structure; - if (structure != null) - { - if (!structure.CastShadow && moveCam) - { - cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, 500.0f, 0.05f); - } - } - } - - if (!LockHands) - { - //find the closest item if selectkey has been hit, or if the Character is being - //controlled by the player (in order to highlight it) - - if (findClosestTimer <= 0.0f || Screen.Selected == GameMain.EditMapScreen) - { - closestCharacter = FindClosestCharacter(mouseSimPos); - if (closestCharacter != null && closestCharacter.info==null) - { - closestCharacter = null; - } - - float closestItemDist = 0.0f; - closestItem = FindClosestItem(mouseSimPos, out closestItemDist); - - if (closestCharacter != null && closestItem != null) - { - if (Vector2.DistanceSquared(closestCharacter.SimPosition, mouseSimPos) < ConvertUnits.ToSimUnits(closestItemDist)*ConvertUnits.ToSimUnits(closestItemDist)) - { - if (selectedConstruction != closestItem) closestItem = null; - } - else - { - closestCharacter = null; - } - } - - findClosestTimer = 0.1f; - } - else - { - findClosestTimer -= deltaTime; - } - - if (selectedCharacter == null && closestItem != null) - { - closestItem.IsHighlighted = true; - if (!LockHands && closestItem.Pick(this)) - { - - } - } - - if (IsKeyHit(InputType.Select)) - { - if (selectedCharacter != null) - { - DeselectCharacter(); - } - else if (closestCharacter != null && closestCharacter.IsHumanoid && closestCharacter.CanBeSelected) - { - SelectCharacter(closestCharacter); - } - } - } - else - { - if (selectedCharacter != null) DeselectCharacter(); - selectedConstruction = null; - closestItem = null; - closestCharacter = null; - } - - DisableControls = false; - } - - + public static void UpdateAnimAll(float deltaTime) { foreach (Character c in CharacterList) @@ -1283,15 +1098,7 @@ namespace Barotrauma } } - public static void AddAllToGUIUpdateList() - { - for (int i = 0; i < CharacterList.Count; i++) - { - CharacterList[i].AddToGUIUpdateList(); - } - } - - public static void UpdateAll(Camera cam, float deltaTime) + public static void UpdateAll(float deltaTime, Camera cam) { if (GameMain.Client == null) { @@ -1319,19 +1126,11 @@ namespace Barotrauma for (int i = 0; i < CharacterList.Count; i++) { - CharacterList[i].Update(cam, deltaTime); + CharacterList[i].Update(deltaTime, cam); } } - public virtual void AddToGUIUpdateList() - { - if (controlled == this) - { - CharacterHUD.AddToGUIUpdateList(this); - } - } - - public virtual void Update(Camera cam, float deltaTime) + public virtual void Update(float deltaTime, Camera cam) { if (GameMain.Client != null && this == Controlled && !isSynced) return; @@ -1396,21 +1195,7 @@ namespace Barotrauma } } - if (controlled == this) - { - Lights.LightManager.ViewTarget = this; - CharacterHUD.Update(deltaTime, this); - - foreach (HUDProgressBar progressBar in hudProgressBars.Values) - { - progressBar.Update(deltaTime); - } - - foreach (var pb in hudProgressBars.Where(pb => pb.Value.FadeTimer<=0.0f).ToList()) - { - hudProgressBars.Remove(pb.Key); - } - } + UpdateControlled(deltaTime,cam); if (Stun > 0.0f) { @@ -1428,11 +1213,6 @@ namespace Barotrauma return; } - if (controlled == this) - { - ControlLocalPlayer(deltaTime, cam); - } - Control(deltaTime, cam); if (selectedConstruction != null && !selectedConstruction.IsInPickRange(WorldPosition)) @@ -1525,15 +1305,14 @@ namespace Barotrauma if (!IsDead) LockHands = false; } + partial void UpdateControlled(float deltaTime,Camera cam); + private void UpdateOxygen(float deltaTime) { float prevOxygen = oxygen; Oxygen += deltaTime * (oxygenAvailable < 30.0f ? -5.0f : 10.0f); - if (prevOxygen > 0.0f && Oxygen <= 0.0f && controlled == this) - { - SoundPlayer.PlaySound("drown"); - } + UpdateOxygenProjSpecific(prevOxygen); PressureProtection -= deltaTime * 100.0f; @@ -1548,6 +1327,7 @@ namespace Barotrauma OxygenAvailable += Math.Sign(hullAvailableOxygen - oxygenAvailable) * deltaTime * 50.0f; } + partial void UpdateOxygenProjSpecific(float prevOxygen); private void UpdateUnconscious(float deltaTime) { @@ -1577,155 +1357,18 @@ namespace Barotrauma speechBubbleColor = color; } - public void Draw(SpriteBatch spriteBatch) - { - if (!Enabled) return; - - AnimController.Draw(spriteBatch); - } - - public void DrawHUD(SpriteBatch spriteBatch, Camera cam) - { - CharacterHUD.Draw(spriteBatch, this, cam); - } - - public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam) - { - if (!Enabled) return; - - if (GameMain.DebugDraw) - { - AnimController.DebugDraw(spriteBatch); - - if (aiTarget != null) aiTarget.Draw(spriteBatch); - } - - /*if (memPos != null && memPos.Count > 0 && controlled == this) - { - PosInfo serverPos = memPos.Last(); - Vector2 remoteVec = ConvertUnits.ToDisplayUnits(serverPos.Position); - if (Submarine != null) - { - remoteVec += Submarine.DrawPosition; - } - remoteVec.Y = -remoteVec.Y; - - PosInfo localPos = memLocalPos.Find(m => m.ID == serverPos.ID); - int mpind = memLocalPos.FindIndex(lp => lp.ID == localPos.ID); - PosInfo localPos1 = mpind > 0 ? memLocalPos[mpind - 1] : null; - PosInfo localPos2 = mpind < memLocalPos.Count-1 ? memLocalPos[mpind + 1] : null; - - Vector2 localVec = ConvertUnits.ToDisplayUnits(localPos.Position); - Vector2 localVec1 = localPos1 != null ? ConvertUnits.ToDisplayUnits(((PosInfo)localPos1).Position) : Vector2.Zero; - Vector2 localVec2 = localPos2 != null ? ConvertUnits.ToDisplayUnits(((PosInfo)localPos2).Position) : Vector2.Zero; - if (Submarine != null) - { - localVec += Submarine.DrawPosition; - localVec1 += Submarine.DrawPosition; - localVec2 += Submarine.DrawPosition; - } - localVec.Y = -localVec.Y; - localVec1.Y = -localVec1.Y; - localVec2.Y = -localVec2.Y; - - //GUI.DrawLine(spriteBatch, remoteVec, localVec, Color.Yellow, 0, 10); - if (localPos1 != null) GUI.DrawLine(spriteBatch, remoteVec, localVec1, Color.Lime, 0, 2); - if (localPos2 != null) GUI.DrawLine(spriteBatch, remoteVec + Vector2.One, localVec2 + Vector2.One, Color.Red, 0, 2); - } - - Vector2 mouseDrawPos = CursorWorldPosition; - mouseDrawPos.Y = -mouseDrawPos.Y; - GUI.DrawLine(spriteBatch, mouseDrawPos - new Vector2(0, 5), mouseDrawPos + new Vector2(0, 5), Color.Red, 0, 10); - - Vector2 closestItemPos = closestItem != null ? closestItem.DrawPosition : Vector2.Zero; - closestItemPos.Y = -closestItemPos.Y; - GUI.DrawLine(spriteBatch, closestItemPos - new Vector2(0, 5), closestItemPos + new Vector2(0, 5), Color.Lime, 0, 10);*/ - - if (this == controlled || GUI.DisableHUD) return; - - Vector2 pos = DrawPosition; - pos.Y = -pos.Y; - - if (speechBubbleTimer > 0.0f) - { - GUI.SpeechBubbleIcon.Draw(spriteBatch, pos - Vector2.UnitY * 100.0f, - speechBubbleColor * Math.Min(speechBubbleTimer, 1.0f), 0.0f, - Math.Min((float)speechBubbleTimer, 1.0f)); - } - - if (this == controlled) return; - - if (info != null) - { - Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom; - Color nameColor = Color.White; - - if (Character.Controlled != null && TeamID != Character.Controlled.TeamID) - { - nameColor = Color.Red; - } - GUI.Font.DrawString(spriteBatch, Info.Name, namePos + new Vector2(1.0f / cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.001f); - GUI.Font.DrawString(spriteBatch, Info.Name, namePos, nameColor, 0.0f, Vector2.Zero, 1.0f / cam.Zoom, SpriteEffects.None, 0.0f); - - if (GameMain.DebugDraw) - { - GUI.Font.DrawString(spriteBatch, ID.ToString(), namePos - new Vector2(0.0f, 20.0f), Color.White); - } - } - - if (isDead) return; - - if (health < maxHealth * 0.98f) - { - Vector2 healthBarPos = new Vector2(pos.X - 50, DrawPosition.Y + 100.0f); - - GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health / maxHealth, Color.Lerp(Color.Red, Color.Green, health / maxHealth) * 0.8f); - } - } - - /// - /// Creates a progress bar that's "linked" to the specified object (or updates an existing one if there's one already linked to the object) - /// The progress bar will automatically fade out after 1 sec if the method hasn't been called during that time - /// - public HUDProgressBar UpdateHUDProgressBar(object linkedObject, Vector2 worldPosition, float progress, Color emptyColor, Color fullColor) - { - if (controlled != this) return null; - - HUDProgressBar progressBar = null; - if (!hudProgressBars.TryGetValue(linkedObject, out progressBar)) - { - progressBar = new HUDProgressBar(worldPosition, Submarine, emptyColor, fullColor); - hudProgressBars.Add(linkedObject, progressBar); - } - - progressBar.WorldPosition = worldPosition; - progressBar.FadeTimer = Math.Max(progressBar.FadeTimer, 1.0f); - progressBar.Progress = progress; - - return progressBar; - } - - public void PlaySound(CharacterSound.SoundType soundType) - { - if (sounds == null || sounds.Count == 0) return; - - var matchingSounds = sounds.FindAll(s => s.Type == soundType); - if (matchingSounds.Count == 0) return; - - var selectedSound = matchingSounds[Rand.Int(matchingSounds.Count)]; - selectedSound.Sound.Play(1.0f, selectedSound.Range, AnimController.WorldPosition); - } - public virtual void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker) { Health = health-amount; if (amount > 0.0f) { lastAttackCauseOfDeath = causeOfDeath; - if (controlled == this) CharacterHUD.TakeDamage(amount); + + DamageHUD(amount); } if (health <= minHealth) Kill(causeOfDeath); } + partial void DamageHUD(float amount); public virtual AttackResult AddDamage(IDamageable attacker, Vector2 worldPosition, Attack attack, float deltaTime, bool playSound = false) { @@ -1859,25 +1502,15 @@ namespace Barotrauma // limb.Damage = 100.0f; } - SoundPlayer.PlaySound("implode", 1.0f, 150.0f, WorldPosition); - - for (int i = 0; i < 10; i++) - { - Particle p = GameMain.ParticleManager.CreateParticle("waterblood", - ConvertUnits.ToDisplayUnits(centerOfMass) + Rand.Vector(5.0f), - Rand.Vector(10.0f)); - if (p != null) p.Size *= 2.0f; - - GameMain.ParticleManager.CreateParticle("bubbles", - ConvertUnits.ToDisplayUnits(centerOfMass) + Rand.Vector(5.0f), - new Vector2(Rand.Range(-50f, 50f), Rand.Range(-100f, 50f))); - } + ImplodeFX(); foreach (var joint in AnimController.LimbJoints) { joint.LimitEnabled = false; } } + + partial void ImplodeFX(); public void Kill(CauseOfDeath causeOfDeath, bool isNetworkMessage = false) { @@ -1891,16 +1524,6 @@ namespace Barotrauma if (GameMain.NetworkMember != null) { - if (Character.controlled == this) - { - string chatMessage = InfoTextManager.GetInfoText("Self_CauseOfDeath." + causeOfDeath.ToString()); - if (GameMain.Client!=null) chatMessage += " Your chat messages will only be visible to other dead players."; - - GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead); - GameMain.LightManager.LosEnabled = false; - controlled = null; - } - if (GameMain.Server != null) GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status }); } @@ -1910,9 +1533,9 @@ namespace Barotrauma GameServer.Log(Name+" has died (Cause of death: "+causeOfDeath+")", ServerLog.MessageType.Attack); if (OnDeath != null) OnDeath(this, causeOfDeath); - - PlaySound(CharacterSound.SoundType.Die); - + + KillProjSpecific(); + isDead = true; this.causeOfDeath = causeOfDeath; @@ -1940,6 +1563,7 @@ namespace Barotrauma GameMain.GameSession.KillCharacter(this); } } + partial void KillProjSpecific(); public void Revive(bool isNetworkMessage) { @@ -1982,30 +1606,21 @@ namespace Barotrauma CharacterList.Remove(this); - if (controlled == this) controlled = null; - - if (GameMain.Client != null && GameMain.Client.Character == this) GameMain.Client.Character = null; + DisposeProjSpecific(); if (aiTarget != null) aiTarget.Remove(); if (AnimController != null) AnimController.Remove(); - if (Lights.LightManager.ViewTarget == this) Lights.LightManager.ViewTarget = null; - if (selectedItems[0] != null) selectedItems[0].Drop(this); if (selectedItems[1] != null) selectedItems[1].Drop(this); - if (GameMain.GameSession?.CrewManager != null && - GameMain.GameSession.CrewManager.characters.Contains(this)) - { - GameMain.GameSession.CrewManager.characters.Remove(this); - } - foreach (Character c in CharacterList) { if (c.closestCharacter == this) c.closestCharacter = null; if (c.selectedCharacter == this) c.selectedCharacter = null; } } + partial void DisposeProjSpecific(); } } diff --git a/Barotrauma/Source/Characters/CharacterInfo.cs b/Barotrauma/BarotraumaShared/Source/Characters/CharacterInfo.cs similarity index 80% rename from Barotrauma/Source/Characters/CharacterInfo.cs rename to Barotrauma/BarotraumaShared/Source/Characters/CharacterInfo.cs index f67043f6e..c63d9ae10 100644 --- a/Barotrauma/Source/Characters/CharacterInfo.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/CharacterInfo.cs @@ -1,5 +1,4 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.IO; @@ -10,7 +9,7 @@ namespace Barotrauma { public enum Gender { None, Male, Female }; - class CharacterInfo + partial class CharacterInfo { public string Name; @@ -114,7 +113,7 @@ namespace Barotrauma if (gender == Gender.None) { float femaleRatio = ToolBox.GetAttributeFloat(doc.Root, "femaleratio", 0.5f); - this.gender = (Rand.Range(0.0f, 1.0f, false) < femaleRatio) ? Gender.Female : Gender.Male; + this.gender = (Rand.Range(0.0f, 1.0f, Rand.RandSync.Server) < femaleRatio) ? Gender.Female : Gender.Male; } else { @@ -211,66 +210,6 @@ namespace Barotrauma } } - public GUIFrame CreateInfoFrame(Rectangle rect) - { - GUIFrame frame = new GUIFrame(rect, Color.Transparent); - frame.Padding = new Vector4(10.0f,10.0f,10.0f,10.0f); - - return CreateInfoFrame(frame); - } - - public GUIFrame CreateInfoFrame(GUIFrame frame) - { - new GUIImage(new Rectangle(0,0,30,30), HeadSprite, Alignment.TopLeft, frame); - - ScalableFont font = frame.Rect.Width<280 ? GUI.SmallFont : GUI.Font; - - int x = 0, y = 0; - new GUITextBlock(new Rectangle(x+60, y, 200, 20), Name, "", frame, font); - y += 20; - - if (Job!=null) - { - new GUITextBlock(new Rectangle(x + 60, y, 200, 20), Job.Name, "", frame, font); - y += 30; - - var skills = Job.Skills; - skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level)); - - new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", "", frame, font); - y += 20; - foreach (Skill skill in skills) - { - Color textColor = Color.White * (0.5f + skill.Level/200.0f); - new GUITextBlock(new Rectangle(x, y, 200, 20), skill.Name, Color.Transparent, textColor, Alignment.Left, "", frame).Font = font; - new GUITextBlock(new Rectangle(x, y, 200, 20), skill.Level.ToString(), Color.Transparent, textColor, Alignment.Right, "", frame).Font = font; - y += 20; - } - } - - - return frame; - } - - public GUIFrame CreateCharacterFrame(GUIComponent parent, string text, object userData) - { - GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, "ListBoxElement", parent); - frame.UserData = userData; - - GUITextBlock textBlock = new GUITextBlock( - new Rectangle(40, 0, 0, 25), - text, - null, null, - Alignment.Left, Alignment.Left, - "", frame, false); - textBlock.Font = GUI.SmallFont; - textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); - - new GUIImage(new Rectangle(-5, -5, 0, 0), HeadSprite, Alignment.Left, frame); - - return frame; - } - public void UpdateCharacterItems() { pickedItems.Clear(); diff --git a/Barotrauma/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaShared/Source/Characters/CharacterNetworking.cs similarity index 67% rename from Barotrauma/Source/Characters/CharacterNetworking.cs rename to Barotrauma/BarotraumaShared/Source/Characters/CharacterNetworking.cs index 065563c40..c1ba8a061 100644 --- a/Barotrauma/Source/Characters/CharacterNetworking.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/CharacterNetworking.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; namespace Barotrauma -{ +{ class CharacterStateInfo : PosInfo { public readonly Direction Direction; @@ -237,55 +237,7 @@ namespace Barotrauma networkUpdateSent = false; } } - - public virtual void ClientWrite(NetBuffer msg, object[] extraData = null) - { - if (GameMain.Server != null) return; - - if (extraData != null) - { - switch ((NetEntityEvent.Type)extraData[0]) - { - case NetEntityEvent.Type.InventoryState: - msg.WriteRangedInteger(0, 2, 0); - inventory.ClientWrite(msg, extraData); - break; - case NetEntityEvent.Type.Repair: - msg.WriteRangedInteger(0, 2, 1); - msg.Write(AnimController.Anim == AnimController.Animation.CPR); - break; - case NetEntityEvent.Type.Status: - msg.WriteRangedInteger(0, 2, 2); - break; - } - } - else - { - msg.Write((byte)ClientNetObject.CHARACTER_INPUT); - - if (memInput.Count > 60) - { - memInput.RemoveRange(60, memInput.Count - 60); - } - - msg.Write(LastNetworkUpdateID); - byte inputCount = Math.Min((byte)memInput.Count, (byte)60); - msg.Write(inputCount); - for (int i = 0; i < inputCount; i++) - { - msg.WriteRangedInteger(0, (int)InputNetFlags.MaxVal, (int)memInput[i].states); - if (memInput[i].states.HasFlag(InputNetFlags.Aim)) - { - msg.Write(memInput[i].intAim); - } - if (memInput[i].states.HasFlag(InputNetFlags.Select) || memInput[i].states.HasFlag(InputNetFlags.Use)) - { - msg.Write(memInput[i].interact); - } - } - } - msg.WritePadBits(); - } + public virtual void ServerRead(ClientNetObject type, NetBuffer msg, Client c) { if (GameMain.Server == null) return; @@ -447,7 +399,7 @@ namespace Barotrauma attack = dequeuedInput.HasFlag(InputNetFlags.Attack); } - else + else if (keys != null) { aiming = keys[(int)InputType.Aim].GetHeldQueue; use = keys[(int)InputType.Use].GetHeldQueue; @@ -497,133 +449,6 @@ namespace Barotrauma } } - public virtual void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) - { - if (GameMain.Server != null) return; - - switch (type) - { - case ServerNetObject.ENTITY_POSITION: - bool facingRight = AnimController.Dir > 0.0f; - - lastRecvPositionUpdateTime = (float)NetTime.Now; - - AnimController.Frozen = false; - Enabled = true; - - UInt16 networkUpdateID = 0; - if (msg.ReadBoolean()) - { - networkUpdateID = msg.ReadUInt16(); - } - else - { - bool aimInput = msg.ReadBoolean(); - keys[(int)InputType.Aim].Held = aimInput; - keys[(int)InputType.Aim].SetState(false, aimInput); - - bool useInput = msg.ReadBoolean(); - keys[(int)InputType.Use].Held = useInput; - keys[(int)InputType.Use].SetState(false, useInput); - - bool hasAttackLimb = msg.ReadBoolean(); - if (hasAttackLimb) - { - bool attackInput = msg.ReadBoolean(); - keys[(int)InputType.Attack].Held = attackInput; - keys[(int)InputType.Attack].SetState(false, attackInput); - } - - if (aimInput) - { - double aimAngle = ((double)msg.ReadUInt16() / 65535.0) * 2.0 * Math.PI; - cursorPosition = (ViewTarget == null ? AnimController.Collider.Position : ViewTarget.Position) - + new Vector2((float)Math.Cos(aimAngle), (float)Math.Sin(aimAngle)) * 60.0f; - - TransformCursorPos(); - } - facingRight = msg.ReadBoolean(); - } - - bool entitySelected = msg.ReadBoolean(); - Entity selectedEntity = null; - - AnimController.Animation animation = AnimController.Animation.None; - if (entitySelected) - { - ushort entityID = msg.ReadUInt16(); - selectedEntity = FindEntityByID(entityID); - if (selectedEntity is Character) - { - bool doingCpr = msg.ReadBoolean(); - if (doingCpr && selectedCharacter != null) - { - animation = AnimController.Animation.CPR; - } - } - } - - Vector2 pos = new Vector2( - msg.ReadFloat(), - msg.ReadFloat()); - - - int index = 0; - if (GameMain.NetworkMember.Character == this && AllowInput) - { - var posInfo = new CharacterStateInfo(pos, networkUpdateID, facingRight ? Direction.Right : Direction.Left, selectedEntity, animation); - while (index < memState.Count && NetIdUtils.IdMoreRecent(posInfo.ID, memState[index].ID)) - index++; - - memState.Insert(index, posInfo); - } - else - { - var posInfo = new CharacterStateInfo(pos, sendingTime, facingRight ? Direction.Right : Direction.Left, selectedEntity, animation); - while (index < memState.Count && posInfo.Timestamp > memState[index].Timestamp) - index++; - - memState.Insert(index, posInfo); - } - - break; - case ServerNetObject.ENTITY_EVENT: - - int eventType = msg.ReadRangedInteger(0, 2); - switch (eventType) - { - case 0: - inventory.ClientRead(type, msg, sendingTime); - break; - case 1: - byte ownerID = msg.ReadByte(); - ResetNetState(); - if (ownerID == GameMain.Client.ID) - { - if (controlled != null) - { - LastNetworkUpdateID = controlled.LastNetworkUpdateID; - } - - controlled = this; - IsRemotePlayer = false; - GameMain.Client.Character = this; - } - else if (controlled == this) - { - controlled = null; - IsRemotePlayer = ownerID > 0; - } - break; - case 2: - ReadStatus(msg); - break; - } - - break; - } - } - private void WriteStatus(NetBuffer msg) { if (GameMain.Client != null) @@ -804,112 +629,6 @@ namespace Barotrauma msg.Write(""); } } - - public static Character ReadSpawnData(NetBuffer inc, bool spawn = true) - { - if (GameMain.Server != null) return null; - - bool noInfo = inc.ReadBoolean(); - ushort id = inc.ReadUInt16(); - string configPath = inc.ReadString(); - - Vector2 position = new Vector2(inc.ReadFloat(), inc.ReadFloat()); - - bool enabled = inc.ReadBoolean(); - - DebugConsole.Log("Received spawn data for " + configPath); - - Character character = null; - if (noInfo) - { - if (!spawn) return null; - - character = Character.Create(configPath, position, null, true); - character.ID = id; - } - else - { - bool hasOwner = inc.ReadBoolean(); - int ownerId = hasOwner ? inc.ReadByte() : -1; - - - string newName = inc.ReadString(); - byte teamID = inc.ReadByte(); - - bool hasAi = inc.ReadBoolean(); - bool isFemale = inc.ReadBoolean(); - int headSpriteID = inc.ReadByte(); - string jobName = inc.ReadString(); - - JobPrefab jobPrefab = null; - Dictionary skillLevels = new Dictionary(); - if (!string.IsNullOrEmpty(jobName)) - { - jobPrefab = JobPrefab.List.Find(jp => jp.Name == jobName); - int skillCount = inc.ReadByte(); - for (int i = 0; i < skillCount; i++) - { - string skillName = inc.ReadString(); - int skillLevel = inc.ReadRangedInteger(0, 100); - - skillLevels.Add(skillName, skillLevel); - } - } - - if (!spawn) return null; - - - CharacterInfo ch = new CharacterInfo(configPath, newName, isFemale ? Gender.Female : Gender.Male, jobPrefab); - ch.HeadSpriteId = headSpriteID; - - System.Diagnostics.Debug.Assert(skillLevels.Count == ch.Job.Skills.Count); - if (ch.Job != null) - { - foreach (KeyValuePair skill in skillLevels) - { - Skill matchingSkill = ch.Job.Skills.Find(s => s.Name == skill.Key); - if (matchingSkill == null) - { - DebugConsole.ThrowError("Skill \""+skill.Key+"\" not found in character \""+newName+"\""); - continue; - } - matchingSkill.Level = skill.Value; - } - } - - character = Create(configPath, position, ch, GameMain.Client.ID != ownerId, hasAi); - character.ID = id; - character.TeamID = teamID; - - if (GameMain.Client.ID == ownerId) - { - GameMain.Client.Character = character; - Controlled = character; - - GameMain.LightManager.LosEnabled = true; - - character.memInput.Clear(); - character.memState.Clear(); - character.memLocalState.Clear(); - } - else - { - var ownerClient = GameMain.Client.ConnectedClients.Find(c => c.ID == ownerId); - if (ownerClient != null) - { - ownerClient.Character = character; - } - } - - if (configPath == Character.HumanConfigFile) - { - GameMain.GameSession.CrewManager.characters.Add(character); - } - } - - character.Enabled = Controlled == character || enabled; - - return character; - } + } } diff --git a/Barotrauma/Source/Characters/DelayedEffect.cs b/Barotrauma/BarotraumaShared/Source/Characters/DelayedEffect.cs similarity index 100% rename from Barotrauma/Source/Characters/DelayedEffect.cs rename to Barotrauma/BarotraumaShared/Source/Characters/DelayedEffect.cs diff --git a/Barotrauma/Source/Characters/HuskInfection.cs b/Barotrauma/BarotraumaShared/Source/Characters/HuskInfection.cs similarity index 89% rename from Barotrauma/Source/Characters/HuskInfection.cs rename to Barotrauma/BarotraumaShared/Source/Characters/HuskInfection.cs index df4f09eb4..859f9f97c 100644 --- a/Barotrauma/Source/Characters/HuskInfection.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/HuskInfection.cs @@ -9,7 +9,7 @@ using System.Xml.Linq; namespace Barotrauma { - class HuskInfection + partial class HuskInfection { public enum InfectionState { @@ -47,9 +47,11 @@ namespace Barotrauma public void Update(float deltaTime, Character character) { + float prevTimer = IncubationTimer; + if (IncubationTimer < 0.5f) { - UpdateDormantState(deltaTime, character); + UpdateDormantState(deltaTime, character); } else if (IncubationTimer < 1.0f) { @@ -59,7 +61,9 @@ namespace Barotrauma { UpdateActiveState(deltaTime, character); } + UpdateProjSpecific(prevTimer,character); } + partial void UpdateProjSpecific(float prevTimer, Character character); private void UpdateDormantState(float deltaTime, Character character) { @@ -70,22 +74,12 @@ namespace Barotrauma IncubationTimer += deltaTime / IncubationDuration; if (Character.Controlled != character) return; - - if (prevTimer % 0.1f > 0.05f && IncubationTimer % 0.1f < 0.05f) - { - GUI.AddMessage(InfoTextManager.GetInfoText("HuskDormant"), Color.Red, 4.0f); - } } private void UpdateTransitionState(float deltaTime, Character character) { IncubationTimer += deltaTime / IncubationDuration; - - if (state == InfectionState.Dormant && Character.Controlled == character) - { - new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak")); - } - + state = InfectionState.Transition; } @@ -93,7 +87,6 @@ namespace Barotrauma { if (state != InfectionState.Active) { - if (Character.Controlled==character) new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate")); ActivateHusk(character); state = InfectionState.Active; } diff --git a/Barotrauma/Source/Characters/Jobs/Job.cs b/Barotrauma/BarotraumaShared/Source/Characters/Jobs/Job.cs similarity index 99% rename from Barotrauma/Source/Characters/Jobs/Job.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Jobs/Job.cs index 1f975bf72..99ea1cb83 100644 --- a/Barotrauma/Source/Characters/Jobs/Job.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Jobs/Job.cs @@ -71,7 +71,7 @@ namespace Barotrauma public static Job Random() { - JobPrefab prefab = JobPrefab.List[Rand.Int(JobPrefab.List.Count - 1, false)]; + JobPrefab prefab = JobPrefab.List[Rand.Int(JobPrefab.List.Count - 1, Rand.RandSync.Server)]; return new Job(prefab); } diff --git a/Barotrauma/Source/Characters/Jobs/JobPrefab.cs b/Barotrauma/BarotraumaShared/Source/Characters/Jobs/JobPrefab.cs similarity index 61% rename from Barotrauma/Source/Characters/Jobs/JobPrefab.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Jobs/JobPrefab.cs index f75993dc0..ef2bb924a 100644 --- a/Barotrauma/Source/Characters/Jobs/JobPrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Jobs/JobPrefab.cs @@ -6,7 +6,7 @@ using System.Linq; namespace Barotrauma { - class JobPrefab + partial class JobPrefab { public static List List; @@ -102,52 +102,6 @@ namespace Barotrauma return List[Rand.Int(List.Count)]; } - public GUIFrame CreateInfoFrame() - { - int width = 500, height = 400; - - GUIFrame backFrame = new GUIFrame(Rectangle.Empty, Color.Black*0.5f); - backFrame.Padding = Vector4.Zero; - - GUIFrame frame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", backFrame); - frame.Padding = new Vector4(30.0f, 30.0f, 30.0f, 30.0f); - - new GUITextBlock(new Rectangle(0,0,100,20), Name, "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont); - - var descriptionBlock = new GUITextBlock(new Rectangle(0, 40, 0, 0), Description, "", Alignment.TopLeft, Alignment.TopLeft, frame, true, GUI.SmallFont); - - new GUITextBlock(new Rectangle(0, 40 + descriptionBlock.Rect.Height + 20, 100, 20), "Skills: ", "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont); - - int y = 40 + descriptionBlock.Rect.Height + 50; - foreach (SkillPrefab skill in Skills) - { - string skillDescription = Skill.GetLevelName((int)skill.LevelRange.X); - string skillDescription2 = Skill.GetLevelName((int)skill.LevelRange.Y); - - if (skillDescription2!= skillDescription) - { - skillDescription += "/"+skillDescription2; - } - new GUITextBlock(new Rectangle(0, y, 100, 20), - " - " + skill.Name + ": " + skillDescription, "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.SmallFont); - - y += 20; - } - - new GUITextBlock(new Rectangle(250, 40 + descriptionBlock.Rect.Height + 20, 0, 20), "Items: ", "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont); - - y = 40 + descriptionBlock.Rect.Height + 50; - foreach (string itemName in ItemNames) - { - new GUITextBlock(new Rectangle(250, y, 100, 20), - " - " + itemName, "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.SmallFont); - - y += 20; - } - - return backFrame; - } - public static void LoadAll(List filePaths) { List = new List(); diff --git a/Barotrauma/Source/Characters/Jobs/Skill.cs b/Barotrauma/BarotraumaShared/Source/Characters/Jobs/Skill.cs similarity index 100% rename from Barotrauma/Source/Characters/Jobs/Skill.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Jobs/Skill.cs diff --git a/Barotrauma/Source/Characters/Jobs/SkillPrefab.cs b/Barotrauma/BarotraumaShared/Source/Characters/Jobs/SkillPrefab.cs similarity index 100% rename from Barotrauma/Source/Characters/Jobs/SkillPrefab.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Jobs/SkillPrefab.cs diff --git a/Barotrauma/Source/Characters/Limb.cs b/Barotrauma/BarotraumaShared/Source/Characters/Limb.cs similarity index 80% rename from Barotrauma/Source/Characters/Limb.cs rename to Barotrauma/BarotraumaShared/Source/Characters/Limb.cs index fb61f3c50..49cc2cdd5 100644 --- a/Barotrauma/Source/Characters/Limb.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Limb.cs @@ -4,10 +4,9 @@ using FarseerPhysics; using FarseerPhysics.Dynamics; using FarseerPhysics.Dynamics.Joints; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +//using Microsoft.Xna.Framework.Graphics; using Barotrauma.Items.Components; using System.Collections.Generic; -using Barotrauma.Lights; using System.Linq; using System.IO; @@ -18,7 +17,7 @@ namespace Barotrauma None, LeftHand, RightHand, LeftArm, RightArm, LeftLeg, RightLeg, LeftFoot, RightFoot, Head, Torso, Tail, Legs, RightThigh, LeftThigh, Waist }; - + class LimbJoint : RevoluteJoint { public bool IsSevered; @@ -37,8 +36,8 @@ namespace Barotrauma LimbB = limbB; } } - - class Limb + + partial class Limb { private const float LimbDensity = 15; private const float LimbAngularDamping = 7; @@ -65,8 +64,6 @@ namespace Barotrauma public FixedMouseJoint pullJoint; - public readonly Lights.LightSource LightSource; - public readonly LimbType type; public readonly bool ignoreCollisions; @@ -78,10 +75,9 @@ namespace Barotrauma private readonly Vector2 armorSector; private readonly float armorValue; - + public Vector2? MouthPos; - - private Sound hitSound; + //a timer for delaying when a hitsound/attacksound can be played again public float SoundTimer; public const float SoundInterval = 0.4f; @@ -158,12 +154,7 @@ namespace Barotrauma } public bool Disabled { get; set; } - - public Sound HitSound - { - get { return hitSound; } - } - + public Vector2 LinearVelocity { get { return body.LinearVelocity; } @@ -327,20 +318,16 @@ namespace Barotrauma } damagedSprite = new Sprite(subElement, "", damagedSpritePath); - break; - case "lightsource": - LightSource = new LightSource(subElement); - break; case "attack": attack = new Attack(subElement); break; - case "sound": - hitSound = Sound.Load(ToolBox.GetAttributeString(subElement, "file", "")); - break; } } + + InitProjSpecific(element); } + partial void InitProjSpecific(XElement element); public void MoveToPos(Vector2 pos, float force, bool pullFromCenter=false) { @@ -357,8 +344,6 @@ namespace Barotrauma public AttackResult AddDamage(Vector2 position, DamageType damageType, float amount, float bleedingAmount, bool playSound) { - DamageSoundType damageSoundType = (damageType == DamageType.Blunt) ? DamageSoundType.LimbBlunt : DamageSoundType.LimbSlash; - bool hitArmor = false; float totalArmorValue = 0.0f; @@ -375,9 +360,14 @@ namespace Barotrauma { hitArmor = true; totalArmorValue += wearable.WearableComponent.ArmorValue; - } - } + } + } +#if CLIENT + float bloodAmount = hitArmor || bleedingAmount <= 0.0f ? 0 : (int)Math.Min((int)(amount * 2.0f), 20); + + DamageSoundType damageSoundType = (damageType == DamageType.Blunt) ? DamageSoundType.LimbBlunt : DamageSoundType.LimbSlash; + if (hitArmor) { totalArmorValue = Math.Max(totalArmorValue, 0.0f); @@ -403,8 +393,10 @@ namespace Barotrauma blood.Size *= bloodParticleSize; } } - - damage += Math.Max(amount, bleedingAmount) / character.MaxHealth * 100.0f; + +#endif + + damage += Math.Max(amount,bleedingAmount) / character.MaxHealth * 100.0f; return new AttackResult(amount, bleedingAmount, hitArmor); } @@ -426,11 +418,9 @@ namespace Barotrauma public void Update(float deltaTime) { - if (LightSource != null) - { - LightSource.ParentSub = body.Submarine; - } - + UpdateProjSpecific(); + + if (!character.IsDead) damage = Math.Max(0.0f, damage - deltaTime * 0.1f); if (burnt > 0.0f) Burnt -= deltaTime; if (LinearVelocity.X > 500.0f) @@ -458,13 +448,13 @@ namespace Barotrauma damage = Math.Max(0.0f, damage - deltaTime * 0.1f); SoundTimer -= deltaTime; + } - //if (MathUtils.RandomFloat(0.0f, 1000.0f) < Bleeding) - //{ - // Game1.particleManager.CreateParticle( - // !inWater ? "blood" : "waterblood", - // SimPosition, Vector2.Zero); - //} + partial void UpdateProjSpecific(); + + public void ActivateDamagedSprite() + { + damage = 100.0f; } public void UpdateAttack(float deltaTime, Vector2 attackPosition, IDamageable damageTarget) @@ -508,89 +498,7 @@ namespace Barotrauma } } - - public void Draw(SpriteBatch spriteBatch) - { - float brightness = 1.0f - (burnt / 100.0f) * 0.5f; - Color color = new Color(brightness, brightness, brightness); - - if (isSevered) - { - if (severedFadeOutTimer > SeveredFadeOutTime) - { - return; - } - else if (severedFadeOutTimer > SeveredFadeOutTime - 1.0f) - { - color *= SeveredFadeOutTime - severedFadeOutTimer; - } - } - - body.Dir = Dir; - - bool hideLimb = wearingItems.Any(w => w != null && w.HideLimb); - if (!hideLimb) - { - body.Draw(spriteBatch, sprite, color, null, scale); - } - else - { - body.UpdateDrawPosition(); - } - - if (LightSource != null) - { - LightSource.Position = body.DrawPosition; - } - - foreach (WearableSprite wearable in wearingItems) - { - SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - - Vector2 origin = wearable.Sprite.Origin; - if (body.Dir == -1.0f) origin.X = wearable.Sprite.SourceRect.Width - origin.X; - - float depth = sprite.Depth - 0.000001f; - - if (wearable.DepthLimb != LimbType.None) - { - Limb depthLimb = character.AnimController.GetLimb(wearable.DepthLimb); - if (depthLimb != null) - { - depth = depthLimb.sprite.Depth - 0.000001f; - } - } - - wearable.Sprite.Draw(spriteBatch, - new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), - color, origin, - -body.DrawRotation, - scale, spriteEffect, depth); - } - - if (damage > 0.0f && damagedSprite != null && !hideLimb) - { - SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - - float depth = sprite.Depth - 0.0000015f; - - damagedSprite.Draw(spriteBatch, - new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), - color * Math.Min(damage / 50.0f, 1.0f), sprite.Origin, - -body.DrawRotation, - 1.0f, spriteEffect, depth); - } - - if (!GameMain.DebugDraw) return; - - if (pullJoint != null) - { - Vector2 pos = ConvertUnits.ToDisplayUnits(pullJoint.WorldAnchorB); - GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.Red, true); - } - } - public void Remove() { if (sprite != null) @@ -598,11 +506,7 @@ namespace Barotrauma sprite.Remove(); sprite = null; } - - if (LightSource != null) - { - LightSource.Remove(); - } + if (damagedSprite != null) { damagedSprite.Remove(); @@ -615,11 +519,18 @@ namespace Barotrauma body = null; } +#if CLIENT if (hitSound != null) { hitSound.Remove(); hitSound = null; } + + if (LightSource != null) + { + LightSource.Remove(); + } +#endif } } } diff --git a/Barotrauma/Source/Characters/StatusEffect.cs b/Barotrauma/BarotraumaShared/Source/Characters/StatusEffect.cs similarity index 97% rename from Barotrauma/Source/Characters/StatusEffect.cs rename to Barotrauma/BarotraumaShared/Source/Characters/StatusEffect.cs index 1ff504b28..cebeb9e1e 100644 --- a/Barotrauma/Source/Characters/StatusEffect.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/StatusEffect.cs @@ -1,13 +1,15 @@ -using Barotrauma.Particles; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; +#if CLIENT +using Barotrauma.Particles; +#endif namespace Barotrauma { - class StatusEffect + partial class StatusEffect { [Flags] public enum TargetType @@ -20,6 +22,12 @@ namespace Barotrauma private List requiredItems; +#if CLIENT + private List particleEmitters; + + private Sound sound; +#endif + public string[] propertyNames; private object[] propertyEffects; @@ -37,12 +45,8 @@ namespace Barotrauma private Explosion explosion; - private List particleEmitters; - public readonly float FireSize; - private Sound sound; - public TargetType Targets { get { return targetTypes; } @@ -71,7 +75,10 @@ namespace Barotrauma protected StatusEffect(XElement element) { requiredItems = new List(); + +#if CLIENT particleEmitters = new List(); +#endif IEnumerable attributes = element.Attributes(); List propertyAttributes = new List(); @@ -122,12 +129,14 @@ namespace Barotrauma targetNames.Add(names[i].Trim()); } break; - case "sound": - sound = Sound.Load(attribute.Value.ToString()); - break; case "duration": duration = ToolBox.GetAttributeFloat(attribute, 0.0f); break; +#if CLIENT + case "sound": + sound = Sound.Load(attribute.Value.ToString()); + break; +#endif default: propertyAttributes.Add(attribute); break; @@ -160,9 +169,6 @@ namespace Barotrauma case "useitem": useItem = true; break; - case "particleemitter": - particleEmitters.Add(new ParticleEmitterPrefab(subElement)); - break; case "requireditem": case "requireditems": RelatedItem newRequiredItem = RelatedItem.Load(subElement); @@ -171,6 +177,11 @@ namespace Barotrauma requiredItems.Add(newRequiredItem); break; +#if CLIENT + case "particleemitter": + particleEmitters.Add(new ParticleEmitterPrefab(subElement)); + break; +#endif } } } @@ -214,8 +225,10 @@ namespace Barotrauma } protected void Apply(float deltaTime, Entity entity, List targets) - { + { +#if CLIENT if (sound != null) sound.Play(1.0f, 1000.0f, entity.WorldPosition); +#endif if (useItem) { @@ -264,12 +277,14 @@ namespace Barotrauma var fire = new FireSource(entity.WorldPosition, hull); fire.Size = new Vector2(FireSize, fire.Size.Y); - } + } +#if CLIENT foreach (ParticleEmitterPrefab emitter in particleEmitters) { emitter.Emit(entity.WorldPosition, hull); } +#endif } private IEnumerable ApplyToPropertyOverDuration(float duration, ObjectProperty property, object value) diff --git a/Barotrauma/Source/ContentPackage.cs b/Barotrauma/BarotraumaShared/Source/ContentPackage.cs similarity index 100% rename from Barotrauma/Source/ContentPackage.cs rename to Barotrauma/BarotraumaShared/Source/ContentPackage.cs diff --git a/Barotrauma/Source/CoroutineManager.cs b/Barotrauma/BarotraumaShared/Source/CoroutineManager.cs similarity index 100% rename from Barotrauma/Source/CoroutineManager.cs rename to Barotrauma/BarotraumaShared/Source/CoroutineManager.cs diff --git a/Barotrauma/Source/DebugConsole.cs b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs similarity index 56% rename from Barotrauma/Source/DebugConsole.cs rename to Barotrauma/BarotraumaShared/Source/DebugConsole.cs index f4b870944..bd3d5ae5e 100644 --- a/Barotrauma/Source/DebugConsole.cs +++ b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using Barotrauma.Networking; using Barotrauma.Items.Components; using System.Text; @@ -27,172 +26,79 @@ namespace Barotrauma } } - static class DebugConsole + static partial class DebugConsole { const int MaxMessages = 200; public static List Messages = new List(); - static bool isOpen; + private static string[] SplitCommand(string command) + { + command = command.Trim(); + List commands = new List(); + int escape = 0; + bool inQuotes = false; + string piece = ""; + + for (int i=0;i 0) escape--; + } + + if (!string.IsNullOrWhiteSpace(piece)) commands.Add(piece); //add final piece + + return commands.ToArray(); + } - //used for keeping track of the message entered when pressing up/down - static int selectedIndex; - - public static bool IsOpen - { - get - { - return isOpen; - } - } - - public static void Init(GameWindow window) - { - int x = 20, y = 20; - int width = 800, height = 500; - - frame = new GUIFrame(new Rectangle(x, y, width, height), new Color(0.4f, 0.4f, 0.4f, 0.8f)); - frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); - - listBox = new GUIListBox(new Rectangle(0, 0, 0, frame.Rect.Height - 40), Color.Black, "", frame); - //listBox.Color = Color.Black * 0.7f; - - textBox = new GUITextBox(new Rectangle(0,0,0,20), Color.Black, Color.White, Alignment.BottomLeft, Alignment.Left, "", frame); - //textBox.Color = Color.Black * 0.7f; - - //messages already added before initialization -> add them to the listbox - List unInitializedMessages = new List(Messages); - Messages.Clear(); - - foreach (ColoredText msg in unInitializedMessages) - { - NewMessage(msg.Text, msg.Color); - } - - NewMessage("Press F3 to open/close the debug console", Color.Cyan); - NewMessage("Enter \"help\" for a list of available console commands", Color.Cyan); - - } - - public static void AddToGUIUpdateList() - { - if (isOpen) - { - frame.AddToGUIUpdateList(); - } - } - - public static void Update(GameMain game, float deltaTime) - { - if (PlayerInput.KeyHit(Keys.F3)) - { - isOpen = !isOpen; - if (isOpen) - { - textBox.Select(); - AddToGUIUpdateList(); - } - else - { - GUIComponent.ForceMouseOn(null); - textBox.Deselect(); - } - - //keyboardDispatcher.Subscriber = (isOpen) ? textBox : null; - } - - if (isOpen) - { - frame.Update(deltaTime); - - Character.DisableControls = true; - - if (PlayerInput.KeyHit(Keys.Up)) - { - SelectMessage(-1); - } - else if (PlayerInput.KeyHit(Keys.Down)) - { - SelectMessage(1); - } - - //textBox.Update(deltaTime); - - if (PlayerInput.KeyDown(Keys.Enter) && textBox.Text != "") - { - ExecuteCommand(textBox.Text, game); - textBox.Text = ""; - - //selectedIndex = messages.Count; - } - } - } - - private static void SelectMessage(int direction) - { - int messageCount = listBox.children.Count; - if (messageCount == 0) return; - - direction = Math.Min(Math.Max(-1, direction), 1); - - selectedIndex += direction; - if (selectedIndex < 0) selectedIndex = messageCount - 1; - selectedIndex = selectedIndex % messageCount; - - textBox.Text = (listBox.children[selectedIndex] as GUITextBlock).Text; - } - - public static void Draw(SpriteBatch spriteBatch) - { - if (!isOpen) return; - - frame.Draw(spriteBatch); - } - - private static bool IsCommandPermitted(string command, GameClient client) - { - switch (command) - { - case "kick": - return client.HasPermission(ClientPermissions.Kick); - case "ban": - case "banip": - return client.HasPermission(ClientPermissions.Ban); - case "netstats": - case "help": - case "dumpids": - case "admin": - return true; - default: - return false; - } - } - public static void ExecuteCommand(string command, GameMain game) { if (string.IsNullOrWhiteSpace(command)) return; - string[] commands = command.Split(' '); + string[] commands = SplitCommand(command); if (!commands[0].ToLowerInvariant().Equals("admin")) { - NewMessage(textBox.Text, Color.White); + NewMessage(command, Color.White); } #if !DEBUG +#if CLIENT if (GameMain.Client != null && !IsCommandPermitted(commands[0].ToLowerInvariant(), GameMain.Client)) { ThrowError("You're not permitted to use the command \"" + commands[0].ToLowerInvariant()+"\"!"); return; } +#endif #endif switch (commands[0].ToLowerInvariant()) { + case "clientlist": + if (GameMain.Server == null) break; + DebugConsole.NewMessage("***************", Color.Cyan); + foreach (Client c in GameMain.Server.ConnectedClients) + { + DebugConsole.NewMessage("- " + c.ID.ToString() + ": " + c.name + ", " + c.Connection.RemoteEndPoint.Address.ToString(),Color.Cyan); + } + DebugConsole.NewMessage("***************", Color.Cyan); + break; case "help": NewMessage("menu: go to main menu", Color.Cyan); NewMessage("game: enter the \"game screen\"", Color.Cyan); @@ -304,8 +210,9 @@ namespace Barotrauma if (commands[1].ToLowerInvariant()=="human") { - spawnedCharacter = Character.Create(Character.HumanConfigFile, spawnPosition); + spawnedCharacter = Character.Create(Character.HumanConfigFile, spawnPosition); +#if CLIENT if (GameMain.GameSession != null) { SinglePlayerMode mode = GameMain.GameSession.gameMode as SinglePlayerMode; @@ -316,6 +223,7 @@ namespace Barotrauma GameMain.GameSession.CrewManager.SelectCharacter(null, Character.Controlled); } } +#endif } else { @@ -397,6 +305,25 @@ namespace Barotrauma if (GameMain.NetworkMember == null || commands.Length < 2) break; GameMain.NetworkMember.KickPlayer(string.Join(" ", commands.Skip(1)), false); + break; + case "kickid": + if (GameMain.Server == null || commands.Length < 2) break; + + { + int id = 0; + int.TryParse(commands[1], out id); + GameMain.Server.KickPlayer(id, false); + } + break; + case "banid": + if (GameMain.Server == null || commands.Length < 2) break; + + { + int id = 0; + int.TryParse(commands[1], out id); + GameMain.Server.KickPlayer(id, true); + } + break; case "ban": if (GameMain.NetworkMember == null || commands.Length < 2) break; @@ -418,90 +345,6 @@ namespace Barotrauma } } break; - case "startclient": - if (commands.Length == 1) return; - if (GameMain.Client == null) - { - GameMain.NetworkMember = new GameClient("Name"); - GameMain.Client.ConnectToServer(commands[1]); - } - break; - case "mainmenuscreen": - case "mainmenu": - case "menu": - GameMain.GameSession = null; - - List characters = new List(Character.CharacterList); - foreach (Character c in characters) - { - c.Remove(); - } - - GameMain.MainMenuScreen.Select(); - break; - case "gamescreen": - case "game": - GameMain.GameScreen.Select(); - break; - case "editmapscreen": - case "editmap": - case "edit": - if (commands.Length>1) - { - Submarine.Load(string.Join(" ", commands.Skip(1)), true); - } - GameMain.EditMapScreen.Select(); - break; - case "test": - Submarine.Load("aegir mark ii", true); - GameMain.DebugDraw = true; - GameMain.LightManager.LosEnabled = false; - GameMain.EditMapScreen.Select(); - break; - case "editcharacter": - case "editchar": - GameMain.EditCharacterScreen.Select(); - break; - case "controlcharacter": - case "control": - { - if (commands.Length < 2) break; - - var character = FindMatchingCharacter(commands, true); - - if (character != null) - { - Character.Controlled = character; - } - } - break; - case "setclientcharacter": - { - if (GameMain.Server == null) break; - - int separatorIndex = Array.IndexOf(commands, ";"); - - if (separatorIndex == -1 || commands.Length < 4) - { - ThrowError("Invalid parameters. The command should be formatted as \"setclientcharacter [client] ; [character]\""); - break; - } - - string[] commandsLeft = commands.Take(separatorIndex).ToArray(); - string[] commandsRight = commands.Skip(separatorIndex).ToArray(); - - string clientName = String.Join(" ", commandsLeft.Skip(1)); - - var client = GameMain.Server.ConnectedClients.Find(c => c.name == clientName); - if (client == null) - { - ThrowError("Client \"" + clientName + "\" not found."); - } - - var character = FindMatchingCharacter(commandsRight, false); - GameMain.Server.SetClientCharacter(client, character); - } - break; case "teleportcharacter": case "teleport": var tpCharacter = FindMatchingCharacter(commands, false); @@ -646,20 +489,6 @@ namespace Barotrauma reactorItem.CreateServerEvent(reactor); } break; - case "shake": - GameMain.GameScreen.Cam.Shake = 10.0f; - break; - case "losenabled": - case "los": - case "drawlos": - GameMain.LightManager.LosEnabled = !GameMain.LightManager.LosEnabled; - break; - case "lighting": - case "lightingenabled": - case "light": - case "lights": - GameMain.LightManager.LightingEnabled = !GameMain.LightManager.LightingEnabled; - break; case "oxygen": case "air": foreach (Hull hull in Hull.hullList) @@ -667,99 +496,7 @@ namespace Barotrauma hull.OxygenPercentage = 100.0f; } break; - case "tutorial": - TutorialMode.StartTutorial(Tutorials.TutorialType.TutorialTypes[0]); - - - break; - case "editortutorial": - GameMain.EditMapScreen.Select(); - GameMain.EditMapScreen.StartTutorial(); - break; - case "lobbyscreen": - case "lobby": - GameMain.LobbyScreen.Select(); - break; - case "savemap": - case "savesub": - case "save": - if (commands.Length < 2) break; - - if (GameMain.EditMapScreen.CharacterMode) - { - GameMain.EditMapScreen.ToggleCharacterMode(); - } - - string fileName = string.Join(" ", commands.Skip(1)); - if (fileName.Contains("../")) - { - DebugConsole.ThrowError("Illegal symbols in filename (../)"); - return; - } - - if (Submarine.SaveCurrent(System.IO.Path.Combine(Submarine.SavePath, fileName + ".sub"))) - { - NewMessage("Sub saved", Color.Green); - //Submarine.Loaded.First().CheckForErrors(); - } - - break; - case "loadmap": - case "loadsub": - case "load": - if (commands.Length < 2) break; - - Submarine.Load(string.Join(" ", commands.Skip(1)), true); - break; - case "cleansub": - for (int i = MapEntity.mapEntityList.Count - 1; i >= 0; i--) - { - MapEntity me = MapEntity.mapEntityList[i]; - - if (me.SimPosition.Length()>2000.0f) - { - DebugConsole.NewMessage("Removed "+me.Name+" (simposition "+me.SimPosition+")", Color.Orange); - MapEntity.mapEntityList.RemoveAt(i); - } - else if (me.MoveWithLevel) - { - DebugConsole.NewMessage("Removed " + me.Name + " (MoveWithLevel==true)", Color.Orange); - MapEntity.mapEntityList.RemoveAt(i); - } - else if (me is Item) - { - Item item = me as Item; - var wire = item.GetComponent(); - if (wire == null) continue; - - if (wire.GetNodes().Count > 0 && !wire.Connections.Any(c => c != null)) - { - wire.Item.Drop(null); - DebugConsole.NewMessage("Dropped wire (ID: "+wire.Item.ID+") - attached on wall but no connections found", Color.Orange); - } - } - - } - break; - case "messagebox": - if (commands.Length < 3) break; - new GUIMessageBox(commands[1], commands[2]); - break; - case "debugdraw": - GameMain.DebugDraw = !GameMain.DebugDraw; - break; - case "disablehud": - case "hud": - GUI.DisableHUD = !GUI.DisableHUD; - GameMain.Instance.IsMouseVisible = !GameMain.Instance.IsMouseVisible; - break; - case "followsub": - Camera.FollowSub = !Camera.FollowSub; - break; - case "drawaitargets": - case "showaitargets": - AITarget.ShowAITargets = !AITarget.ShowAITargets; - break; + case "killmonsters": foreach (Character c in Character.CharacterList) { @@ -772,143 +509,9 @@ namespace Barotrauma GameMain.Server.ShowNetStats = !GameMain.Server.ShowNetStats; break; -#if DEBUG - case "spamevents": - foreach (Item item in Item.ItemList) - { - for (int i = 0; i(); - if (itemContainer != null) - { - GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.InventoryState }); - } - GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.Status }); - - item.NeedsPositionUpdate = true; - } - } - - foreach (Character c in Character.CharacterList) - { - GameMain.Server.CreateEntityEvent(c, new object[] { NetEntityEvent.Type.Status }); - } - - foreach (Structure wall in Structure.WallList) - { - GameMain.Server.CreateEntityEvent(wall); - } - break; - case "spamchatmessages": - int msgCount = 1000; - if (commands.Length > 1) int.TryParse(commands[1], out msgCount); - int msgLength = 50; - if (commands.Length > 2) int.TryParse(commands[2], out msgLength); - - for (int i = 0; i < msgCount; i++) - { - if (GameMain.Server != null) - { - GameMain.Server.SendChatMessage(ToolBox.RandomSeed(msgLength), ChatMessageType.Default); - } - else - { - GameMain.Client.SendChatMessage(ToolBox.RandomSeed(msgLength)); - } - } - break; -#endif - case "cleanbuild": - GameMain.Config.MusicVolume = 0.5f; - GameMain.Config.SoundVolume = 0.5f; - DebugConsole.NewMessage("Music and sound volume set to 0.5", Color.Green); - - GameMain.Config.GraphicsWidth = 0; - GameMain.Config.GraphicsHeight = 0; - GameMain.Config.WindowMode = WindowMode.Fullscreen; - DebugConsole.NewMessage("Resolution set to 0 x 0 (screen resolution will be used)", Color.Green); - DebugConsole.NewMessage("Fullscreen enabled", Color.Green); - - GameSettings.VerboseLogging = false; - - if (GameMain.Config.MasterServerUrl != "http://www.undertowgames.com/baromaster") - { - DebugConsole.ThrowError("MasterServerUrl \""+GameMain.Config.MasterServerUrl+"\"!"); - } - - GameMain.Config.Save("config.xml"); - - var saveFiles = System.IO.Directory.GetFiles(SaveUtil.SaveFolder); - - foreach (string saveFile in saveFiles) - { - System.IO.File.Delete(saveFile); - DebugConsole.NewMessage("Deleted "+saveFile, Color.Green); - } - - if (System.IO.Directory.Exists(System.IO.Path.Combine(SaveUtil.SaveFolder, "temp"))) - { - System.IO.Directory.Delete(System.IO.Path.Combine(SaveUtil.SaveFolder, "temp"), true); - DebugConsole.NewMessage("Deleted temp save folder", Color.Green); - } - - if (System.IO.Directory.Exists(ServerLog.SavePath)) - { - var logFiles = System.IO.Directory.GetFiles(ServerLog.SavePath); - - foreach (string logFile in logFiles) - { - System.IO.File.Delete(logFile); - DebugConsole.NewMessage("Deleted "+logFile, Color.Green); - } - } - - if (System.IO.File.Exists("filelist.xml")) - { - System.IO.File.Delete("filelist.xml"); - DebugConsole.NewMessage("Deleted filelist", Color.Green); - } - - - if (System.IO.File.Exists("Submarines/TutorialSub.sub")) - { - System.IO.File.Delete("Submarines/TutorialSub.sub"); - - DebugConsole.NewMessage("Deleted TutorialSub from the submarine folder", Color.Green); - } - - if (System.IO.File.Exists(GameServer.SettingsFile)) - { - System.IO.File.Delete(GameServer.SettingsFile); - DebugConsole.NewMessage("Deleted server settings", Color.Green); - } - - if (System.IO.File.Exists(GameServer.ClientPermissionsFile)) - { - System.IO.File.Delete(GameServer.ClientPermissionsFile); - DebugConsole.NewMessage("Deleted client permission file", Color.Green); - - } - - if (System.IO.File.Exists("crashreport.txt")) - { - System.IO.File.Delete("crashreport.txt"); - DebugConsole.NewMessage("Deleted crashreport.txt", Color.Green); - } - - if (!System.IO.File.Exists("Content/Map/TutorialSub.sub")) - { - DebugConsole.ThrowError("TutorialSub.sub not found!"); - } - - break; default: - NewMessage("Command not found", Color.Red); + if (!ExecProjSpecific(commands)) NewMessage("Command not found", Color.Red); break; } } @@ -965,12 +568,19 @@ namespace Barotrauma if (String.IsNullOrEmpty((msg))) return; Messages.Add(new ColoredText(msg, color)); +#if SERVER + //TODO: REMOVE + Console.ForegroundColor = XnaToConsoleColor.Convert(color); + Console.WriteLine(msg); + Console.ForegroundColor = ConsoleColor.White; +#endif if (Messages.Count > MaxMessages) { Messages.RemoveRange(0, Messages.Count - MaxMessages); } +#if CLIENT //listbox not created yet, don't attempt to add if (listBox == null) return; @@ -994,6 +604,7 @@ namespace Barotrauma } selectedIndex = listBox.children.Count; +#endif } public static void Log(string message) @@ -1009,7 +620,9 @@ namespace Barotrauma } System.Diagnostics.Debug.WriteLine(error); NewMessage(error, Color.Red); +#if CLIENT isOpen = true; +#endif } } } diff --git a/Barotrauma/Source/Events/ArtifactEvent.cs b/Barotrauma/BarotraumaShared/Source/Events/ArtifactEvent.cs similarity index 100% rename from Barotrauma/Source/Events/ArtifactEvent.cs rename to Barotrauma/BarotraumaShared/Source/Events/ArtifactEvent.cs diff --git a/Barotrauma/Source/Events/Missions/CargoMission.cs b/Barotrauma/BarotraumaShared/Source/Events/Missions/CargoMission.cs similarity index 99% rename from Barotrauma/Source/Events/Missions/CargoMission.cs rename to Barotrauma/BarotraumaShared/Source/Events/Missions/CargoMission.cs index acb048d58..839f09298 100644 --- a/Barotrauma/Source/Events/Missions/CargoMission.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/Missions/CargoMission.cs @@ -69,7 +69,7 @@ namespace Barotrauma } Vector2 position = new Vector2( - cargoSpawnPos.Position.X + Rand.Range(-20.0f, 20.0f, false), + cargoSpawnPos.Position.X + Rand.Range(-20.0f, 20.0f, Rand.RandSync.Server), cargoRoom.Rect.Y - cargoRoom.Rect.Height + itemPrefab.Size.Y / 2); var item = new Item(itemPrefab, position, cargoRoom.Submarine); diff --git a/Barotrauma/Source/Events/Missions/CombatMission.cs b/Barotrauma/BarotraumaShared/Source/Events/Missions/CombatMission.cs similarity index 99% rename from Barotrauma/Source/Events/Missions/CombatMission.cs rename to Barotrauma/BarotraumaShared/Source/Events/Missions/CombatMission.cs index 64c696a4f..d93312c21 100644 --- a/Barotrauma/Source/Events/Missions/CombatMission.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/Missions/CombatMission.cs @@ -196,7 +196,9 @@ namespace Barotrauma winner = i; +#if CLIENT ShowMessage(i); +#endif state = 1; break; } @@ -208,14 +210,18 @@ namespace Barotrauma (winner == 0 && subs[winner].AtStartPosition) || (winner == 1 && subs[winner].AtEndPosition) && crews[winner].Any(c => !c.IsDead && c.Submarine == subs[winner])) { +#if CLIENT GameMain.GameSession.CrewManager.WinningTeam = winner+1; +#endif if (GameMain.Server != null) GameMain.Server.EndGame(); } } if (teamDead[0] && teamDead[1]) { +#if CLIENT GameMain.GameSession.CrewManager.WinningTeam = 0; +#endif winner = -1; if (GameMain.Server != null) GameMain.Server.EndGame(); } diff --git a/Barotrauma/Source/Events/Missions/Mission.cs b/Barotrauma/BarotraumaShared/Source/Events/Missions/Mission.cs similarity index 94% rename from Barotrauma/Source/Events/Missions/Mission.cs rename to Barotrauma/BarotraumaShared/Source/Events/Missions/Mission.cs index fe90876ea..e1a409358 100644 --- a/Barotrauma/Source/Events/Missions/Mission.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/Missions/Mission.cs @@ -8,7 +8,7 @@ using System.Xml.Linq; namespace Barotrauma { - class Mission + partial class Mission { public static List MissionTypes = new List() { "Random" }; @@ -237,18 +237,6 @@ namespace Barotrauma return false; } - public void ShowMessage(int index) - { - if (index >= headers.Count && index >= messages.Count) return; - - string header = index < headers.Count ? headers[index] : ""; - string message = index < messages.Count ? messages[index] : ""; - - GameServer.Log("Mission info: " + header + " - " + message, ServerLog.MessageType.ServerMessage); - - new GUIMessageBox(header, message); - } - /// /// End the mission and give a reward if it was completed successfully /// @@ -261,10 +249,12 @@ namespace Barotrauma public void GiveReward() { +#if CLIENT var mode = GameMain.GameSession.gameMode as SinglePlayerMode; if (mode == null) return; mode.Money += reward; +#endif } } } diff --git a/Barotrauma/Source/Events/Missions/MonsterMission.cs b/Barotrauma/BarotraumaShared/Source/Events/Missions/MonsterMission.cs similarity index 98% rename from Barotrauma/Source/Events/Missions/MonsterMission.cs rename to Barotrauma/BarotraumaShared/Source/Events/Missions/MonsterMission.cs index 02103903d..5555aa68f 100644 --- a/Barotrauma/Source/Events/Missions/MonsterMission.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/Missions/MonsterMission.cs @@ -46,7 +46,9 @@ namespace Barotrauma } if (!monster.IsDead) return; +#if CLIENT ShowMessage(state); +#endif state = 1; break; } diff --git a/Barotrauma/Source/Events/Missions/SalvageMission.cs b/Barotrauma/BarotraumaShared/Source/Events/Missions/SalvageMission.cs similarity index 98% rename from Barotrauma/Source/Events/Missions/SalvageMission.cs rename to Barotrauma/BarotraumaShared/Source/Events/Missions/SalvageMission.cs index f12232250..8adc61b00 100644 --- a/Barotrauma/Source/Events/Missions/SalvageMission.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/Missions/SalvageMission.cs @@ -82,13 +82,17 @@ namespace Barotrauma //item.body.LinearVelocity = Vector2.Zero; if (item.ParentInventory!=null) item.body.FarseerBody.IsKinematic = false; if (item.CurrentHull == null) return; - + +#if CLIENT ShowMessage(state); +#endif state = 1; break; case 1: if (!Submarine.MainSub.AtEndPosition && !Submarine.MainSub.AtStartPosition) return; +#if CLIENT ShowMessage(state); +#endif state = 2; break; } diff --git a/Barotrauma/Source/Events/MonsterEvent.cs b/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs similarity index 94% rename from Barotrauma/Source/Events/MonsterEvent.cs rename to Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs index 9bc7a5cdd..5670ba620 100644 --- a/Barotrauma/Source/Events/MonsterEvent.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs @@ -73,7 +73,7 @@ namespace Barotrauma { base.Init(); - SpawnMonsters(Rand.Range(minAmount, maxAmount, false)); + SpawnMonsters(Rand.Range(minAmount, maxAmount, Rand.RandSync.Server)); } private Character[] SpawnMonsters(int amount) @@ -82,15 +82,14 @@ namespace Barotrauma Vector2 spawnPos = Level.Loaded.GetRandomInterestingPosition(true, spawnPosType, true); - var monsters = new Character[amount]; if (spawnDeep) spawnPos.Y -= Level.Loaded.Size.Y; for (int i = 0; i < amount; i++) { - spawnPos.X += Rand.Range(-0.5f, 0.5f, false); - spawnPos.Y += Rand.Range(-0.5f, 0.5f, false); + spawnPos.X += Rand.Range(-0.5f, 0.5f, Rand.RandSync.Server); + spawnPos.Y += Rand.Range(-0.5f, 0.5f, Rand.RandSync.Server); monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null); } @@ -107,7 +106,7 @@ namespace Barotrauma if (monsters == null) { - monsters = SpawnMonsters(Rand.Range(minAmount, maxAmount, false)); + monsters = SpawnMonsters(Rand.Range(minAmount, maxAmount, Rand.RandSync.Server)); return; } diff --git a/Barotrauma/Source/Events/PropertyTask.cs b/Barotrauma/BarotraumaShared/Source/Events/PropertyTask.cs similarity index 100% rename from Barotrauma/Source/Events/PropertyTask.cs rename to Barotrauma/BarotraumaShared/Source/Events/PropertyTask.cs diff --git a/Barotrauma/Source/Events/RepairTask.cs b/Barotrauma/BarotraumaShared/Source/Events/RepairTask.cs similarity index 100% rename from Barotrauma/Source/Events/RepairTask.cs rename to Barotrauma/BarotraumaShared/Source/Events/RepairTask.cs diff --git a/Barotrauma/Source/Events/ScriptedEvent.cs b/Barotrauma/BarotraumaShared/Source/Events/ScriptedEvent.cs similarity index 100% rename from Barotrauma/Source/Events/ScriptedEvent.cs rename to Barotrauma/BarotraumaShared/Source/Events/ScriptedEvent.cs diff --git a/Barotrauma/Source/Events/ScriptedTask.cs b/Barotrauma/BarotraumaShared/Source/Events/ScriptedTask.cs similarity index 100% rename from Barotrauma/Source/Events/ScriptedTask.cs rename to Barotrauma/BarotraumaShared/Source/Events/ScriptedTask.cs diff --git a/Barotrauma/Source/Events/Task.cs b/Barotrauma/BarotraumaShared/Source/Events/Task.cs similarity index 100% rename from Barotrauma/Source/Events/Task.cs rename to Barotrauma/BarotraumaShared/Source/Events/Task.cs diff --git a/Barotrauma/Source/Events/TaskManager.cs b/Barotrauma/BarotraumaShared/Source/Events/TaskManager.cs similarity index 100% rename from Barotrauma/Source/Events/TaskManager.cs rename to Barotrauma/BarotraumaShared/Source/Events/TaskManager.cs diff --git a/Barotrauma/Source/FrameCounter.cs b/Barotrauma/BarotraumaShared/Source/FrameCounter.cs similarity index 100% rename from Barotrauma/Source/FrameCounter.cs rename to Barotrauma/BarotraumaShared/Source/FrameCounter.cs diff --git a/Barotrauma/Source/GameSession/CargoManager.cs b/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs similarity index 100% rename from Barotrauma/Source/GameSession/CargoManager.cs rename to Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs diff --git a/Barotrauma/Source/GameSession/GameModes/GameMode.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/GameMode.cs similarity index 96% rename from Barotrauma/Source/GameSession/GameModes/GameMode.cs rename to Barotrauma/BarotraumaShared/Source/GameSession/GameModes/GameMode.cs index ae25c4ef2..5803458d2 100644 --- a/Barotrauma/Source/GameSession/GameModes/GameMode.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/GameMode.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Barotrauma { - class GameMode + partial class GameMode { public static List PresetList = new List(); @@ -55,10 +55,6 @@ namespace Barotrauma this.preset = preset; } - public virtual void Draw(SpriteBatch spriteBatch) - { - } - public virtual void Start() { startTime = DateTime.Now; diff --git a/Barotrauma/Source/GameSession/GameModes/GameModePreset.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/GameModePreset.cs similarity index 99% rename from Barotrauma/Source/GameSession/GameModes/GameModePreset.cs rename to Barotrauma/BarotraumaShared/Source/GameSession/GameModes/GameModePreset.cs index d08cb2d66..6cd2b8897 100644 --- a/Barotrauma/Source/GameSession/GameModes/GameModePreset.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/GameModePreset.cs @@ -35,8 +35,10 @@ namespace Barotrauma public static void Init() { +#if CLIENT new GameModePreset("Single Player", typeof(SinglePlayerMode), true); new GameModePreset("Tutorial", typeof(TutorialMode), true); +#endif var mode = new GameModePreset("SandBox", typeof(GameMode), false); mode.Description = "A game mode with no specific objectives."; diff --git a/Barotrauma/Source/GameSession/GameModes/MissionMode.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/MissionMode.cs similarity index 55% rename from Barotrauma/Source/GameSession/GameModes/MissionMode.cs rename to Barotrauma/BarotraumaShared/Source/GameSession/GameModes/MissionMode.cs index 353d1d66b..dcdb014b7 100644 --- a/Barotrauma/Source/GameSession/GameModes/MissionMode.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/MissionMode.cs @@ -2,7 +2,7 @@ namespace Barotrauma { - class MissionMode : GameMode + partial class MissionMode : GameMode { private Mission mission; @@ -22,16 +22,5 @@ namespace Barotrauma MTRandom rand = new MTRandom(ToolBox.StringToInt(GameMain.NetLobbyScreen.LevelSeed)); mission = Mission.LoadRandom(locations, rand, param as string); } - - public override void MsgBox() - { - if (mission == null) return; - - var missionMsg = new GUIMessageBox(mission.Name, mission.Description, 400, 400); - missionMsg.UserData = "missionstartmessage"; - - Networking.GameServer.Log("Mission: " + mission.Name, Networking.ServerLog.MessageType.ServerMessage); - Networking.GameServer.Log(mission.Description, Networking.ServerLog.MessageType.ServerMessage); - } } } diff --git a/Barotrauma/Source/GameSession/GameModes/TraitorManager.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/TraitorManager.cs similarity index 90% rename from Barotrauma/Source/GameSession/GameModes/TraitorManager.cs rename to Barotrauma/BarotraumaShared/Source/GameSession/GameModes/TraitorManager.cs index 0da0d223f..5e905c268 100644 --- a/Barotrauma/Source/GameSession/GameModes/TraitorManager.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/TraitorManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace Barotrauma { - class TraitorManager + partial class TraitorManager { public Character TraitorCharacter { @@ -53,8 +53,9 @@ namespace Barotrauma traitorCharacter = characters[traitorIndex]; targetCharacter = characters[targetIndex]; +#if CLIENT if (server.Character == null) - { + { new GUIMessageBox("New traitor", traitorCharacter.Name + " is the traitor and the target is " + targetCharacter.Name+"."); } else if (server.Character == traitorCharacter) @@ -62,15 +63,9 @@ namespace Barotrauma CreateStartPopUp(traitorCharacter.Name); return; } +#endif } - public static void CreateStartPopUp(string targetName) - { - new GUIMessageBox("You are the Traitor!", - "Your secret task is to assassinate " + targetName + "! Discretion is an utmost concern; sinking the submarine and killing the entire crew " - + "will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.", 400, 350); - } - public string GetEndMessage() { if (GameMain.Server == null || traitorCharacter == null || targetCharacter == null) return ""; diff --git a/Barotrauma/Source/GameSession/GameSession.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs similarity index 54% rename from Barotrauma/Source/GameSession/GameSession.cs rename to Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs index 79b825f85..d5bbc2bd8 100644 --- a/Barotrauma/Source/GameSession/GameSession.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs @@ -5,7 +5,7 @@ using System.Xml.Linq; namespace Barotrauma { - class GameSession + partial class GameSession { public enum InfoFrameTab { Crew, Mission, ManagePlayers }; @@ -16,17 +16,13 @@ namespace Barotrauma //two locations used as the start and end in the MP mode private Location[] dummyLocations; - private InfoFrameTab selectedTab; - private GUIButton infoButton; - private GUIFrame infoFrame; - private string saveFile; private Submarine submarine; +#if CLIENT public CrewManager CrewManager; - - private ShiftSummary shiftSummary; +#endif private Mission currentMission; @@ -44,16 +40,7 @@ namespace Barotrauma { get { return level; } } - - public Map Map - { - get - { - SinglePlayerMode mode = (gameMode as SinglePlayerMode); - return (mode == null) ? null : mode.Map; - } - } - + public Location StartLocation { get @@ -94,26 +81,23 @@ namespace Barotrauma { get { return saveFile; } } - - public ShiftSummary ShiftSummary - { - get { return shiftSummary; } - } - + public GameSession(Submarine submarine, string saveFile, GameModePreset gameModePreset = null, string missionType="") { Submarine.MainSub = submarine; GameMain.GameSession = this; - - CrewManager = new CrewManager(); - + TaskManager = new TaskManager(this); this.saveFile = saveFile; +#if CLIENT + CrewManager = new CrewManager(); + infoButton = new GUIButton(new Rectangle(10, 10, 100, 20), "Info", "", null); infoButton.OnClicked = ToggleInfoFrame; +#endif if (gameModePreset != null) gameMode = gameModePreset.Instantiate(missionType); this.submarine = submarine; @@ -125,17 +109,19 @@ namespace Barotrauma Submarine.MainSub = submarine; GameMain.GameSession = this; - - CrewManager = new CrewManager(); - + selectedSub.Name = ToolBox.GetAttributeString(doc.Root, "submarine", selectedSub.Name); +#if CLIENT + CrewManager = new CrewManager(); + foreach (XElement subElement in doc.Root.Elements()) { if (subElement.Name.ToString().ToLowerInvariant() != "gamemode") continue; gameMode = new SinglePlayerMode(subElement); } +#endif } private void CreateDummyLocations() @@ -168,7 +154,9 @@ namespace Barotrauma public void StartShift(Level level, bool reloadSub = true, bool loadSecondSub = false) { +#if CLIENT GameMain.LightManager.LosEnabled = GameMain.NetworkMember == null || GameMain.NetworkMember.CharacterInfo != null; +#endif this.level = level; @@ -198,8 +186,10 @@ namespace Barotrauma level.Generate(); submarine.SetPosition(submarine.FindSpawnPos(level.StartPosition - new Vector2(0.0f, 2000.0f))); - + +#if CLIENT GameMain.GameScreen.BackgroundCreatureManager.SpawnSprites(80); +#endif } if (gameMode.Mission != null) @@ -207,8 +197,6 @@ namespace Barotrauma currentMission = gameMode.Mission; } - shiftSummary = new ShiftSummary(this); - if (gameMode!=null) gameMode.Start(); if (gameMode.Mission != null) Mission.Start(Level.Loaded); @@ -219,8 +207,12 @@ namespace Barotrauma Entity.Spawner = new EntitySpawner(); +#if CLIENT + shiftSummary = new ShiftSummary(this); + GameMain.GameScreen.ColorFade(Color.Black, Color.TransparentBlack, 5.0f); SoundPlayer.SwitchMusic(); +#endif } public void EndShift(string endMessage) @@ -238,6 +230,7 @@ namespace Barotrauma GameMain.LobbyScreen.Select(); } +#if CLIENT if (shiftSummary != null) { GUIFrame summaryFrame = shiftSummary.CreateSummaryFrame(endMessage); @@ -245,6 +238,7 @@ namespace Barotrauma var okButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Ok", Alignment.BottomRight, "", summaryFrame.children[0]); okButton.OnClicked = (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Remove(summaryFrame); return true; }; } +#endif TaskManager.EndShift(); @@ -253,182 +247,19 @@ namespace Barotrauma StatusEffect.StopAll(); } - public void KillCharacter(Character character) { +#if CLIENT CrewManager.KillCharacter(character); +#endif } public void ReviveCharacter(Character character) { +#if CLIENT CrewManager.ReviveCharacter(character); +#endif } - public bool LoadPrevious(GUIButton button, object obj) - { - Submarine.Unload(); - - SaveUtil.LoadGame(saveFile); - - GameMain.LobbyScreen.Select(); - - return true; - } - - private bool ToggleInfoFrame(GUIButton button, object obj) - { - if (infoFrame == null) - { - if (CrewManager != null && CrewManager.CrewCommander!= null && CrewManager.CrewCommander.IsOpen) - { - CrewManager.CrewCommander.ToggleGUIFrame(); - } - - CreateInfoFrame(); - SelectInfoFrameTab(null, selectedTab); - } - else - { - infoFrame = null; - } - - return true; - } - - public void CreateInfoFrame() - { - int width = 600, height = 400; - - - infoFrame = new GUIFrame( - Rectangle.Empty, Color.Black * 0.8f, null); - - var innerFrame = new GUIFrame( - new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", infoFrame); - - innerFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); - - var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Crew", "", innerFrame); - crewButton.UserData = InfoFrameTab.Crew; - crewButton.OnClicked = SelectInfoFrameTab; - - var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), "Mission", "", innerFrame); - missionButton.UserData = InfoFrameTab.Mission; - missionButton.OnClicked = SelectInfoFrameTab; - - if (GameMain.Server != null) - { - var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), "Manage players", "", innerFrame); - manageButton.UserData = InfoFrameTab.ManagePlayers; - manageButton.OnClicked = SelectInfoFrameTab; - } - - var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Close", Alignment.BottomCenter, "", innerFrame); - closeButton.OnClicked = ToggleInfoFrame; - - } - - private bool SelectInfoFrameTab(GUIButton button, object userData) - { - selectedTab = (InfoFrameTab)userData; - - CreateInfoFrame(); - - switch (selectedTab) - { - case InfoFrameTab.Crew: - CrewManager.CreateCrewFrame(CrewManager.characters, infoFrame.children[0] as GUIFrame); - break; - case InfoFrameTab.Mission: - CreateMissionInfo(infoFrame.children[0] as GUIFrame); - break; - case InfoFrameTab.ManagePlayers: - GameMain.Server.ManagePlayersFrame(infoFrame.children[0] as GUIFrame); - break; - } - - return true; - } - - private void CreateMissionInfo(GUIFrame infoFrame) - { - if (Mission == null) - { - new GUITextBlock(new Rectangle(0,0,0,50), "No mission", "", infoFrame, true); - return; - } - - new GUITextBlock(new Rectangle(0, 0, 0, 40), Mission.Name, "", infoFrame, GUI.LargeFont); - - new GUITextBlock(new Rectangle(0, 50, 0, 20), "Reward: "+Mission.Reward, "", infoFrame, true); - new GUITextBlock(new Rectangle(0, 70, 0, 50), Mission.Description, "", infoFrame, true); - - - } - - public void AddToGUIUpdateList() - { - infoButton.AddToGUIUpdateList(); - - if (gameMode != null) gameMode.AddToGUIUpdateList(); - - if (infoFrame != null) infoFrame.AddToGUIUpdateList(); - } - - public void Update(float deltaTime) - { - TaskManager.Update(deltaTime); - - if (GUI.DisableHUD) return; - - //guiRoot.Update(deltaTime); - infoButton.Update(deltaTime); - - if (gameMode != null) gameMode.Update(deltaTime); - if (Mission != null) Mission.Update(deltaTime); - if (infoFrame != null) - { - infoFrame.Update(deltaTime); - - if (CrewManager != null && CrewManager.CrewCommander != null && CrewManager.CrewCommander.IsOpen) - { - infoFrame = null; - } - } - } - - public void Draw(SpriteBatch spriteBatch) - { - if (GUI.DisableHUD) return; - - infoButton.Draw(spriteBatch); - - if (gameMode != null) gameMode.Draw(spriteBatch); - if (infoFrame != null) infoFrame.Draw(spriteBatch); - } - - public void Save(string filePath) - { - XDocument doc = new XDocument( - new XElement("Gamesession")); - - var now = DateTime.Now; - doc.Root.Add(new XAttribute("savetime", now.ToShortTimeString() + ", " + now.ToShortDateString())); - - doc.Root.Add(new XAttribute("submarine", submarine==null ? "" : submarine.Name)); - - doc.Root.Add(new XAttribute("mapseed", Map.Seed)); - - ((SinglePlayerMode)gameMode).Save(doc.Root); - - try - { - doc.Save(filePath); - } - catch - { - DebugConsole.ThrowError("Saving gamesession to \"" + filePath + "\" failed!"); - } - } } } diff --git a/Barotrauma/Source/GameSession/InfoTextManager.cs b/Barotrauma/BarotraumaShared/Source/GameSession/InfoTextManager.cs similarity index 99% rename from Barotrauma/Source/GameSession/InfoTextManager.cs rename to Barotrauma/BarotraumaShared/Source/GameSession/InfoTextManager.cs index e72f1eef3..445756bf1 100644 --- a/Barotrauma/Source/GameSession/InfoTextManager.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/InfoTextManager.cs @@ -52,10 +52,12 @@ namespace Barotrauma string text = infoList[Rand.Int(infoList.Count)]; +#if CLIENT foreach (InputType inputType in Enum.GetValues(typeof(InputType))) { text = text.Replace("[" + inputType.ToString() + "]", GameMain.Config.KeyBind(inputType).ToString()); } +#endif if (Submarine.MainSub != null) text = text.Replace("[sub]", Submarine.MainSub.Name); if (GameMain.GameSession != null && GameMain.GameSession.StartLocation != null) diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs new file mode 100644 index 000000000..d87980261 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs @@ -0,0 +1,71 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace Barotrauma +{ + + public partial class GameSettings + { + + public ContentPackage SelectedContentPackage { get; set; } + + public string MasterServerUrl { get; set; } + public bool AutoCheckUpdates { get; set; } + public bool WasGameUpdated { get; set; } + + public static bool VerboseLogging { get; set; } + + public GameSettings(string filePath) + { + ContentPackage.LoadAll(ContentPackage.Folder); + + Load(filePath); + } + + public void Load(string filePath) + { + XDocument doc = ToolBox.TryLoadXml(filePath); + + if (doc == null) + { + DebugConsole.ThrowError("No config file found"); + + MasterServerUrl = ""; + + SelectedContentPackage = ContentPackage.list.Any() ? ContentPackage.list[0] : new ContentPackage(""); + + return; + } + + MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", ""); + + AutoCheckUpdates = ToolBox.GetAttributeBool(doc.Root, "autocheckupdates", true); + WasGameUpdated = ToolBox.GetAttributeBool(doc.Root, "wasgameupdated", false); + + VerboseLogging = ToolBox.GetAttributeBool(doc.Root, "verboselogging", false); + + InitProjSpecific(doc); + + foreach (XElement subElement in doc.Root.Elements()) + { + switch (subElement.Name.ToString().ToLowerInvariant()) + { + case "contentpackage": + string path = ToolBox.GetAttributeString(subElement, "path", ""); + + + SelectedContentPackage = ContentPackage.list.Find(cp => cp.Path == path); + + if (SelectedContentPackage == null) SelectedContentPackage = new ContentPackage(path); + break; + } + } + } + + partial void InitProjSpecific(XDocument doc); + } +} diff --git a/Barotrauma/Source/IPropertyObject.cs b/Barotrauma/BarotraumaShared/Source/IPropertyObject.cs similarity index 100% rename from Barotrauma/Source/IPropertyObject.cs rename to Barotrauma/BarotraumaShared/Source/IPropertyObject.cs diff --git a/Barotrauma/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs similarity index 68% rename from Barotrauma/Source/Items/CharacterInventory.cs rename to Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs index f04985292..5d3372b7b 100644 --- a/Barotrauma/Source/Items/CharacterInventory.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs @@ -2,7 +2,6 @@ using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using Barotrauma.Networking; using Lidgren.Network; using System.Collections.Generic; @@ -16,91 +15,36 @@ namespace Barotrauma None = 0, Any = 1, RightHand = 2, LeftHand = 4, Head = 8, Torso = 16, Legs = 32, Face=64 }; - class CharacterInventory : Inventory + partial class CharacterInventory : Inventory { - private static Texture2D icons; - private Character character; public static InvSlotType[] limbSlots = new InvSlotType[] { InvSlotType.Head, InvSlotType.Torso, InvSlotType.Legs, InvSlotType.LeftHand, InvSlotType.RightHand, InvSlotType.Face, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any}; - - public Vector2[] SlotPositions; - - private GUIButton[] useOnSelfButton; - + public CharacterInventory(int capacity, Character character) : base(character, capacity) { this.character = character; - useOnSelfButton = new GUIButton[2]; - - if (icons == null) icons = TextureLoader.FromFile("Content/UI/inventoryIcons.png"); - - SlotPositions = new Vector2[limbSlots.Length]; - - int rectWidth = 40, rectHeight = 40; - int spacing = 10; - for (int i = 0; i < SlotPositions.Length; i++) - { - switch (i) - { - //head, torso, legs - case 0: - case 1: - case 2: - SlotPositions[i] = new Vector2( - spacing, - GameMain.GraphicsHeight - (spacing + rectHeight) * (3 - i)); - break; - //lefthand, righthand - case 3: - case 4: - SlotPositions[i] = new Vector2( - spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 2), - GameMain.GraphicsHeight - (spacing + rectHeight)*3); - - useOnSelfButton[i - 3] = new GUIButton( - new Rectangle((int) SlotPositions[i].X, (int) (SlotPositions[i].Y - spacing - rectHeight), - rectWidth, rectHeight), "Use", "") - { - UserData = i, - OnClicked = UseItemOnSelf - }; - - - break; - case 5: - SlotPositions[i] = new Vector2( - spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 5), - GameMain.GraphicsHeight - (spacing + rectHeight) * 3); - - break; - default: - SlotPositions[i] = new Vector2( - spacing * 2 + rectWidth + (spacing + rectWidth) * ((i - 6)%5), - GameMain.GraphicsHeight - (spacing + rectHeight) * ((i>10) ? 2 : 1)); - break; - } - } + InitProjSpecific(); } - private bool UseItemOnSelf(GUIButton button, object obj) + partial void InitProjSpecific(); + + private bool UseItemOnSelf(int slotIndex) { - if (!(obj is int)) return false; - - int slotIndex = (int)obj; - if (Items[slotIndex] == null) return false; - + +#if CLIENT if (GameMain.Client != null) { GameMain.Client.CreateEntityEvent(Items[slotIndex], new object[] { NetEntityEvent.Type.ApplyStatusEffect }); return true; } +#endif if (GameMain.Server != null) { @@ -174,7 +118,9 @@ namespace Barotrauma if (allowedSlot.HasFlag(limbSlots[i]) && Items[i]!=null && Items[i]!=item) { free = false; +#if CLIENT if (slots != null) slots[i].ShowBorderHighlight(Color.Red, 0.1f, 0.9f); +#endif } } @@ -295,30 +241,6 @@ namespace Barotrauma CreateSlots(); } - protected override void CreateSlots() - { - if (slots == null) slots = new InventorySlot[capacity]; - - int rectWidth = 40, rectHeight = 40; - - Rectangle slotRect = new Rectangle(0, 0, rectWidth, rectHeight); - for (int i = 0; i < capacity; i++) - { - if (slots[i] == null) slots[i] = new InventorySlot(slotRect); - - slots[i].Disabled = false; - - slotRect.X = (int)(SlotPositions[i].X + DrawOffset.X); - slotRect.Y = (int)(SlotPositions[i].Y + DrawOffset.Y); - - slots[i].Rect = slotRect; - - slots[i].Color = limbSlots[i] == InvSlotType.Any ? Color.White * 0.2f : Color.White * 0.4f; - } - - MergeSlots(); - } - public override void Update(float deltaTime, bool subInventory = false) { base.Update(deltaTime); @@ -364,6 +286,7 @@ namespace Barotrauma UpdateSubInventory(deltaTime, selectedSlot); } +#if CLIENT if (character == Character.Controlled) { for (int i = 0; i < capacity; i++) @@ -376,6 +299,7 @@ namespace Barotrauma } } } +#endif //cancel dragging if too far away from the container of the dragged item if (draggingItem != null) @@ -420,67 +344,5 @@ namespace Barotrauma selectedSlot = -1; } - - public void DrawOwn(SpriteBatch spriteBatch) - { - if (slots == null) CreateSlots(); - - Rectangle slotRect = new Rectangle(0, 0, 40, 40); - - for (int i = 0; i < capacity; i++) - { - slotRect.X = (int)(SlotPositions[i].X + DrawOffset.X); - slotRect.Y = (int)(SlotPositions[i].Y + DrawOffset.Y); - - if (i==1) //head - { - spriteBatch.Draw(icons, new Vector2(slotRect.Center.X, slotRect.Center.Y), - new Rectangle(0,0,56,128), Color.White*0.7f, 0.0f, - new Vector2(28.0f, 64.0f), Vector2.One, - SpriteEffects.None, 0.1f); - } - else if (i==3 || i==4) - { - spriteBatch.Draw(icons, new Vector2(slotRect.Center.X, slotRect.Center.Y), - new Rectangle(92, 41*(4-i), 36, 40), Color.White * 0.7f, 0.0f, - new Vector2(18.0f, 20.0f), Vector2.One, - SpriteEffects.None, 0.1f); - } - else if (i==5) - { - spriteBatch.Draw(icons, new Vector2(slotRect.Center.X, slotRect.Center.Y), - new Rectangle(57,0,31,32), Color.White * 0.7f, 0.0f, - new Vector2(15.0f, 16.0f), Vector2.One, - SpriteEffects.None, 0.1f); - } - } - - base.Draw(spriteBatch); - - if (character == Character.Controlled) - { - for (int i = 0; i < capacity; i++) - { - if (selectedSlot != i && - Items[i] != null && Items[i].CanUseOnSelf && character.HasSelectedItem(Items[i])) - { - useOnSelfButton[i - 3].Draw(spriteBatch); - } - } - } - - if (selectedSlot > -1) - { - DrawSubInventory(spriteBatch, selectedSlot); - - if (selectedSlot > -1 && - !slots[selectedSlot].IsHighlighted && - (draggingItem == null || draggingItem.Container != Items[selectedSlot])) - { - selectedSlot = -1; - } - } - } - } } diff --git a/Barotrauma/Source/Items/Components/DockingPort.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/DockingPort.cs similarity index 91% rename from Barotrauma/Source/Items/Components/DockingPort.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/DockingPort.cs index 4af54f726..88c426fce 100644 --- a/Barotrauma/Source/Items/Components/DockingPort.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/DockingPort.cs @@ -15,8 +15,7 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { - - class DockingPort : ItemComponent, IDrawableComponent, IServerSerializable + partial class DockingPort : ItemComponent, IDrawableComponent, IServerSerializable { public static List list = new List(); @@ -185,7 +184,9 @@ namespace Barotrauma.Items.Components return; } +#if CLIENT PlaySound(ActionType.OnUse, item.WorldPosition); +#endif if (!item.linkedTo.Contains(target.item)) item.linkedTo.Add(target.item); if (!target.item.linkedTo.Contains(item)) target.item.linkedTo.Add(item); @@ -254,9 +255,11 @@ namespace Barotrauma.Items.Components dockingDir = IsHorizontal ? Math.Sign(dockingTarget.item.WorldPosition.X - item.WorldPosition.X) : Math.Sign(dockingTarget.item.WorldPosition.Y - item.WorldPosition.Y); - dockingTarget.dockingDir = -dockingDir; - + dockingTarget.dockingDir = -dockingDir; + +#if CLIENT PlaySound(ActionType.OnSecondaryUse, item.WorldPosition); +#endif ConnectWireBetweenPorts(); @@ -389,7 +392,7 @@ namespace Barotrauma.Items.Components for (int i = 0; i < 2; i++) { - hullRects[i].Location -= (subs[i].WorldPosition - subs[i].HiddenSubPosition).ToPoint(); + hullRects[i].Location -= MathUtils.ToPoint((subs[i].WorldPosition - subs[i].HiddenSubPosition)); hulls[i] = new Hull(MapEntityPrefab.list.Find(m => m.Name == "Hull"), hullRects[i], subs[i]); hulls[i].AddToGrid(subs[i]); @@ -419,7 +422,7 @@ namespace Barotrauma.Items.Components for (int i = 0; i < 2; i++) { - hullRects[i].Location -= (subs[i].WorldPosition - subs[i].HiddenSubPosition).ToPoint(); + hullRects[i].Location -= MathUtils.ToPoint((subs[i].WorldPosition - subs[i].HiddenSubPosition)); hulls[i] = new Hull(MapEntityPrefab.list.Find(m => m.Name == "Hull"), hullRects[i], subs[i]); hulls[i].AddToGrid(subs[i]); @@ -496,8 +499,10 @@ namespace Barotrauma.Items.Components public void Undock() { if (dockingTarget == null || !docked) return; - + +#if CLIENT PlaySound(ActionType.OnUse, item.WorldPosition); +#endif dockingTarget.item.Submarine.DockedTo.Remove(item.Submarine); item.Submarine.DockedTo.Remove(dockingTarget.item.Submarine); @@ -622,60 +627,6 @@ namespace Barotrauma.Items.Components } } - public void Draw(SpriteBatch spriteBatch, bool editing) - { - if (dockingState == 0.0f) return; - - Vector2 drawPos = item.DrawPosition; - drawPos.Y = -drawPos.Y; - - var rect = overlaySprite.SourceRect; - - if (IsHorizontal) - { - drawPos.Y -= rect.Height / 2; - - if (dockingDir == 1) - { - spriteBatch.Draw(overlaySprite.Texture, - drawPos, - new Rectangle( - rect.Center.X + (int)(rect.Width / 2 * (1.0f - dockingState)), rect.Y, - (int)(rect.Width / 2 * dockingState), rect.Height), Color.White); - - } - else - { - spriteBatch.Draw(overlaySprite.Texture, - drawPos - Vector2.UnitX * (rect.Width / 2 * dockingState), - new Rectangle( - rect.X, rect.Y, - (int)(rect.Width / 2 * dockingState), rect.Height), Color.White); - } - } - else - { - drawPos.X -= rect.Width / 2; - - if (dockingDir == 1) - { - spriteBatch.Draw(overlaySprite.Texture, - drawPos - Vector2.UnitY * (rect.Height / 2 * dockingState), - new Rectangle( - rect.X, rect.Y, - rect.Width, (int)(rect.Height / 2 * dockingState)), Color.White); - } - else - { - spriteBatch.Draw(overlaySprite.Texture, - drawPos, - new Rectangle( - rect.X, rect.Y + rect.Height / 2 + (int)(rect.Height / 2 * (1.0f - dockingState)), - rect.Width, (int)(rect.Height / 2 * dockingState)), Color.White); - } - } - } - protected override void RemoveComponentSpecific() { list.Remove(this); diff --git a/Barotrauma/Source/Items/Components/Door.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs similarity index 73% rename from Barotrauma/Source/Items/Components/Door.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs index 173b37f4c..c1b64fdc3 100644 --- a/Barotrauma/Source/Items/Components/Door.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs @@ -1,5 +1,4 @@ -using Barotrauma.Lights; -using Barotrauma.Networking; +using Barotrauma.Networking; using FarseerPhysics; using FarseerPhysics.Dynamics; using Microsoft.Xna.Framework; @@ -9,19 +8,18 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Linq; - +#if CLIENT +using Barotrauma.Lights; +#endif namespace Barotrauma.Items.Components { - class Door : ItemComponent, IDrawableComponent, IServerSerializable + partial class Door : ItemComponent, IDrawableComponent, IServerSerializable { private Gap linkedGap; private Rectangle window; - private ConvexHull convexHull; - private ConvexHull convexHull2; - private bool isOpen; private float openState; @@ -133,7 +131,9 @@ namespace Barotrauma.Items.Components openState = MathHelper.Clamp(value, 0.0f, 1.0f); if (openState == prevValue) return; +#if CLIENT UpdateConvexHulls(); +#endif } } @@ -185,78 +185,6 @@ namespace Barotrauma.Items.Components IsActive = true; } - private void UpdateConvexHulls() - { - doorRect = new Rectangle( - item.Rect.Center.X - (int)(doorSprite.size.X / 2), - item.Rect.Y - item.Rect.Height / 2 + (int)(doorSprite.size.Y / 2.0f), - (int)doorSprite.size.X, - (int)doorSprite.size.Y); - - Rectangle rect = doorRect; - if (isHorizontal) - { - rect.Width = (int)(rect.Width * (1.0f - openState)); - } - else - { - rect.Height = (int)(rect.Height * (1.0f - openState)); - } - - if (window.Height > 0 && window.Width > 0) - { - rect.Height = -window.Y; - - rect.Y += (int)(doorRect.Height * openState); - rect.Height = Math.Max(rect.Height - (rect.Y - doorRect.Y), 0); - rect.Y = Math.Min(doorRect.Y, rect.Y); - - if (convexHull2 != null) - { - Rectangle rect2 = doorRect; - rect2.Y = rect2.Y + window.Y - window.Height; - - rect2.Y += (int)(doorRect.Height * openState); - rect2.Y = Math.Min(doorRect.Y, rect2.Y); - rect2.Height = rect2.Y - (doorRect.Y - (int)(doorRect.Height * (1.0f - openState))); - //convexHull2.SetVertices(GetConvexHullCorners(rect2)); - - if (rect2.Height == 0) - { - convexHull2.Enabled = false; - } - else - { - convexHull2.Enabled = true; - convexHull2.SetVertices(GetConvexHullCorners(rect2)); - } - } - } - - if (convexHull == null) return; - - if (rect.Height == 0 || rect.Width == 0) - { - convexHull.Enabled = false; - } - else - { - convexHull.Enabled = true; - convexHull.SetVertices(GetConvexHullCorners(rect)); - } - } - - private Vector2[] GetConvexHullCorners(Rectangle rect) - { - Vector2[] corners = new Vector2[4]; - corners[0] = new Vector2(rect.X, rect.Y - rect.Height); - corners[1] = new Vector2(rect.X, rect.Y); - corners[2] = new Vector2(rect.Right, rect.Y); - corners[3] = new Vector2(rect.Right, rect.Y - rect.Height); - - return corners; - } - public override void Move(Vector2 amount) { base.Move(amount); @@ -265,7 +193,9 @@ namespace Barotrauma.Items.Components body.SetTransform(body.SimPosition + ConvertUnits.ToSimUnits(amount), 0.0f); +#if CLIENT UpdateConvexHulls(); +#endif //convexHull.Move(amount); //if (convexHull2 != null) convexHull2.Move(amount); @@ -331,66 +261,19 @@ namespace Barotrauma.Items.Components linkedGap.Open = 1.0f; } - public void Draw(SpriteBatch spriteBatch, bool editing) - { - Color color = (item.IsSelected) ? Color.Green : Color.White; - color = color * (item.Condition / 100.0f); - color.A = 255; - - //prefab.sprite.Draw(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color); - - if (stuck>0.0f && weldedSprite!=null) - { - Vector2 weldSpritePos = new Vector2(item.Rect.Center.X, item.Rect.Y-item.Rect.Height/2.0f); - if (item.Submarine != null) weldSpritePos += item.Submarine.Position; - weldSpritePos.Y = -weldSpritePos.Y; - - weldedSprite.Draw(spriteBatch, - weldSpritePos, Color.White*(stuck/100.0f), 0.0f, 1.0f); - } - - if (openState == 1.0f) - { - body.Enabled = false; - return; - } - - if (isHorizontal) - { - Vector2 pos = new Vector2(item.Rect.X, item.Rect.Y - item.Rect.Height/2); - if (item.Submarine != null) pos += item.Submarine.DrawPosition; - pos.Y = -pos.Y; - - spriteBatch.Draw(doorSprite.Texture, pos, - new Rectangle((int)(doorSprite.SourceRect.X + doorSprite.size.X * openState), (int)doorSprite.SourceRect.Y, - (int)(doorSprite.size.X * (1.0f - openState)),(int)doorSprite.size.Y), - color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth); - } - else - { - Vector2 pos = new Vector2(item.Rect.Center.X, item.Rect.Y); - if (item.Submarine != null) pos += item.Submarine.DrawPosition; - pos.Y = -pos.Y; - - spriteBatch.Draw(doorSprite.Texture, pos, - new Rectangle(doorSprite.SourceRect.X, (int)(doorSprite.SourceRect.Y + doorSprite.size.Y * openState), - (int)doorSprite.size.X, (int)(doorSprite.size.Y * (1.0f - openState))), - color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth); - } - - } - public override void OnMapLoaded() { LinkedGap.ConnectedDoor = this; LinkedGap.Open = openState; +#if CLIENT Vector2[] corners = GetConvexHullCorners(Rectangle.Empty); convexHull = new ConvexHull(corners, Color.Black, item); if (window != Rectangle.Empty) convexHull2 = new ConvexHull(corners, Color.Black, item); UpdateConvexHulls(); +#endif } protected override void RemoveComponentSpecific() @@ -409,8 +292,10 @@ namespace Barotrauma.Items.Components doorSprite.Remove(); if (weldedSprite != null) weldedSprite.Remove(); +#if CLIENT if (convexHull!=null) convexHull.Remove(); if (convexHull2 != null) convexHull2.Remove(); +#endif } private void PushCharactersAway() @@ -450,7 +335,9 @@ namespace Barotrauma.Items.Components if (Math.Sign(diff) != dir) { +#if CLIENT SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, 1.0f, body); +#endif if (isHorizontal) { @@ -512,10 +399,12 @@ namespace Barotrauma.Items.Components { //clients can "predict" that the door opens/closes when a signal is received - //the prediction will be reset after 1 second, setting the door to a state - //sent by the server, or reverting it back to its old state if no msg from server was received +//the prediction will be reset after 1 second, setting the door to a state +//sent by the server, or reverting it back to its old state if no msg from server was received +#if CLIENT if (open != predictedState) PlaySound(ActionType.OnUse, item.WorldPosition); +#endif predictedState = open; resetPredictionTimer = CorrectionDelay; @@ -523,7 +412,9 @@ namespace Barotrauma.Items.Components } else { +#if CLIENT if (!isNetworkMessage || open != predictedState) PlaySound(ActionType.OnUse, item.WorldPosition); +#endif isOpen = open; } diff --git a/Barotrauma/Source/Items/Components/Holdable/Holdable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Holdable/Holdable.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs diff --git a/Barotrauma/Source/Items/Components/Holdable/MeleeWeapon.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/MeleeWeapon.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Holdable/MeleeWeapon.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/MeleeWeapon.cs diff --git a/Barotrauma/Source/Items/Components/Holdable/Pickable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs similarity index 99% rename from Barotrauma/Source/Items/Components/Holdable/Pickable.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs index 7bfab6563..a98b76cbe 100644 --- a/Barotrauma/Source/Items/Components/Holdable/Pickable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs @@ -111,11 +111,13 @@ namespace Barotrauma.Items.Components yield return CoroutineStatus.Success; } +#if CLIENT picker.UpdateHUDProgressBar( this, item.WorldPosition, pickTimer / requiredTime, Color.Red, Color.Green); +#endif picker.AnimController.Anim = AnimController.Animation.UsingConstruction; diff --git a/Barotrauma/Source/Items/Components/Holdable/Propulsion.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Propulsion.cs similarity index 86% rename from Barotrauma/Source/Items/Components/Holdable/Propulsion.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Propulsion.cs index 25f730f0d..ade46f88b 100644 --- a/Barotrauma/Source/Items/Components/Holdable/Propulsion.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Propulsion.cs @@ -1,19 +1,26 @@ using System.Xml.Linq; using Microsoft.Xna.Framework; +#if CLIENT using Microsoft.Xna.Framework.Graphics; using Barotrauma.Particles; +#endif namespace Barotrauma.Items.Components { class Propulsion : ItemComponent { + enum UsableIn + { + Air,Water,Both + }; + private float force; private string particles; private float useState; - - private ParticlePrefab.DrawTargetType usableIn; + + private UsableIn usableIn; [HasDefaultValue(0.0f, false)] public float Force @@ -21,13 +28,15 @@ namespace Barotrauma.Items.Components get { return force; } set { force = value; } } - + +#if CLIENT [HasDefaultValue("", false)] public string Particles { get { return particles; } set { particles = value; } } +#endif public Propulsion(Item item, XElement element) : base(item,element) @@ -35,14 +44,14 @@ namespace Barotrauma.Items.Components switch (ToolBox.GetAttributeString(element, "usablein", "both").ToLowerInvariant()) { case "air": - usableIn = ParticlePrefab.DrawTargetType.Air; + usableIn = UsableIn.Air; break; case "water": - usableIn = ParticlePrefab.DrawTargetType.Water; + usableIn = UsableIn.Water; break; case "both": default: - usableIn = ParticlePrefab.DrawTargetType.Both; + usableIn = UsableIn.Both; break; } } @@ -58,11 +67,11 @@ namespace Barotrauma.Items.Components if (character.AnimController.InWater) { - if (usableIn == ParticlePrefab.DrawTargetType.Air) return true; + if (usableIn == UsableIn.Air) return true; } else { - if (usableIn == ParticlePrefab.DrawTargetType.Water) return true; + if (usableIn == UsableIn.Water) return true; } Vector2 dir = Vector2.Normalize(character.CursorPosition - character.Position); @@ -82,13 +91,14 @@ namespace Barotrauma.Items.Components if (character.SelectedItems[0] == item) character.AnimController.GetLimb(LimbType.RightHand).body.ApplyForce(propulsion); if (character.SelectedItems[1] == item) character.AnimController.GetLimb(LimbType.LeftHand).body.ApplyForce(propulsion); - +#if CLIENT if (!string.IsNullOrWhiteSpace(particles)) { GameMain.ParticleManager.CreateParticle(particles, item.WorldPosition, item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi), 0.0f, item.CurrentHull); } +#endif return true; } diff --git a/Barotrauma/Source/Items/Components/Holdable/RangedWeapon.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Holdable/RangedWeapon.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs diff --git a/Barotrauma/Source/Items/Components/Holdable/RepairTool.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs similarity index 98% rename from Barotrauma/Source/Items/Components/Holdable/RepairTool.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs index 491378aea..18b82fc19 100644 --- a/Barotrauma/Source/Items/Components/Holdable/RepairTool.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs @@ -148,8 +148,10 @@ namespace Barotrauma.Items.Components Repair(rayStart - character.Submarine.SimPosition, rayEnd - character.Submarine.SimPosition, deltaTime, character, degreeOfSuccess, ignoredBodies); } +#if CLIENT GameMain.ParticleManager.CreateParticle(particles, item.WorldPosition + TransformedBarrelPos, -item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi), ParticleSpeed); +#endif return true; } @@ -165,10 +167,10 @@ namespace Barotrauma.Items.Components Hull hull = Hull.FindHull(displayPos, item.CurrentHull); if (hull != null) { - hull.Extinquish(deltaTime, ExtinquishAmount, displayPos); + hull.Extinguish(deltaTime, ExtinquishAmount, displayPos); if (hull != item.CurrentHull) { - item.CurrentHull.Extinquish(deltaTime, ExtinquishAmount, displayPos); + item.CurrentHull.Extinguish(deltaTime, ExtinquishAmount, displayPos); } } @@ -191,6 +193,7 @@ namespace Barotrauma.Items.Components int sectionIndex = targetStructure.FindSectionIndex(ConvertUnits.ToDisplayUnits(pickedPosition)); if (sectionIndex < 0) return; +#if CLIENT Vector2 progressBarPos = targetStructure.SectionPosition(sectionIndex); if (targetStructure.Submarine != null) { @@ -204,6 +207,7 @@ namespace Barotrauma.Items.Components Color.Red, Color.Green); if (progressBar != null) progressBar.Size = new Vector2(60.0f, 20.0f); +#endif targetStructure.AddDamage(sectionIndex, -StructureFixAmount * degreeOfSuccess); diff --git a/Barotrauma/Source/Items/Components/Holdable/Throwable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Throwable.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Holdable/Throwable.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Throwable.cs diff --git a/Barotrauma/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs similarity index 65% rename from Barotrauma/Source/Items/Components/ItemComponent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs index c47ab83df..da0e36187 100644 --- a/Barotrauma/Source/Items/Components/ItemComponent.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs @@ -13,36 +13,15 @@ namespace Barotrauma.Items.Components { interface IDrawableComponent { +#if CLIENT void Draw(SpriteBatch spriteBatch, bool editing); +#endif } - - class ItemSound - { - public readonly Sound Sound; - public readonly ActionType Type; - - public string VolumeProperty; - - public float VolumeMultiplier; - - public readonly float Range; - - public readonly bool Loop; - - public ItemSound(Sound sound, ActionType type, float range, bool loop = false) - { - this.Sound = sound; - this.Type = type; - this.Range = range; - - this.Loop = loop; - } - } - + /// /// The base class for components holding the different functionalities of the item /// - class ItemComponent : IPropertyObject + partial class ItemComponent : IPropertyObject { protected Item item; @@ -63,10 +42,6 @@ namespace Barotrauma.Items.Components public List requiredSkills; - private Dictionary> sounds; - - private GUIFrame guiFrame; - public ItemComponent Parent; protected const float CorrectionDelay = 1.0f; @@ -93,10 +68,12 @@ namespace Barotrauma.Items.Components get { return isActive; } set { +#if CLIENT if (!value && isActive) { StopSounds(ActionType.OnActive); } +#endif isActive = value; } @@ -179,19 +156,6 @@ namespace Barotrauma.Items.Components get { return name; } } - protected GUIFrame GuiFrame - { - get - { - if (guiFrame==null) - { - DebugConsole.ThrowError("Error: the component "+name+" in "+item.Name+" doesn't have a GuiFrame component"); - guiFrame = new GUIFrame(new Rectangle(0, 0, 100, 100), Color.Black); - } - return guiFrame; - } - } - [HasDefaultValue("", false)] public string Msg { @@ -214,7 +178,9 @@ namespace Barotrauma.Items.Components requiredSkills = new List(); +#if CLIENT sounds = new Dictionary>(); +#endif SelectKey = InputType.Select; @@ -273,86 +239,9 @@ namespace Barotrauma.Items.Components effectList.Add(statusEffect); - break; - case "guiframe": - string rectStr = ToolBox.GetAttributeString(subElement, "rect", "0.0,0.0,0.5,0.5"); - - string[] components = rectStr.Split(','); - if (components.Length < 4) continue; - - Vector4 rect = ToolBox.GetAttributeVector4(subElement, "rect", Vector4.One); - if (components[0].Contains(".")) rect.X *= GameMain.GraphicsWidth; - if (components[1].Contains(".")) rect.Y *= GameMain.GraphicsHeight; - if (components[2].Contains(".")) rect.Z *= GameMain.GraphicsWidth; - if (components[3].Contains(".")) rect.W *= GameMain.GraphicsHeight; - - string style = ToolBox.GetAttributeString(subElement, "style", ""); - - Vector4 color = ToolBox.GetAttributeVector4(subElement, "color", Vector4.One); - - Alignment alignment = Alignment.Center; - try - { - alignment = (Alignment)Enum.Parse(typeof(Alignment), - ToolBox.GetAttributeString(subElement, "alignment", "Center"), true); - } - catch - { - DebugConsole.ThrowError("Error in " + element + "! \"" + element.Attribute("type").Value + "\" is not a valid alignment"); - } - - guiFrame = new GUIFrame( - new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Z, (int)rect.W), - new Color(color.X, color.Y, color.Z) * color.W, - alignment, style); - - break; - case "sound": - string filePath = ToolBox.GetAttributeString(subElement, "file", ""); - - if (filePath == "") filePath = ToolBox.GetAttributeString(subElement, "sound", ""); - - if (filePath == "") - { - DebugConsole.ThrowError("Error when instantiating item \""+item.Name+"\" - sound with no file path set"); - continue; - } - - if (!filePath.Contains("/") && !filePath.Contains("\\") && !filePath.Contains(Path.DirectorySeparatorChar)) - { - filePath = Path.Combine(Path.GetDirectoryName(item.Prefab.ConfigFile), filePath); - } - - ActionType type; - - try - { - type = (ActionType)Enum.Parse(typeof(ActionType), ToolBox.GetAttributeString(subElement, "type", ""), true); - } - catch (Exception e) - { - DebugConsole.ThrowError("Invalid sound type in "+subElement+"!", e); - break; - } - - Sound sound = Sound.Load(filePath); - - float range = ToolBox.GetAttributeFloat(subElement, "range", 800.0f); - bool loop = ToolBox.GetAttributeBool(subElement, "loop", false); - ItemSound itemSound = new ItemSound(sound, type, range, loop); - itemSound.VolumeProperty = ToolBox.GetAttributeString(subElement, "volume", ""); - itemSound.VolumeMultiplier = ToolBox.GetAttributeFloat(subElement, "volumemultiplier", 1.0f); - - List soundList = null; - if (!sounds.TryGetValue(itemSound.Type, out soundList)) - { - soundList = new List(); - sounds.Add(itemSound.Type, soundList); - } - - soundList.Add(itemSound); break; default: + if (LoadElemProjSpecific(subElement)) break; ItemComponent ic = Load(subElement, item, item.ConfigFile, false); if (ic == null) break; @@ -364,83 +253,6 @@ namespace Barotrauma.Items.Components } } - private ItemSound loopingSound; - private int loopingSoundIndex; - public void PlaySound(ActionType type, Vector2 position) - { - if (loopingSound != null) - { - loopingSoundIndex = loopingSound.Sound.Loop(loopingSoundIndex, GetSoundVolume(loopingSound), position, loopingSound.Range); - return; - } - - List matchingSounds; - if (!sounds.TryGetValue(type, out matchingSounds)) return; - - ItemSound itemSound = null; - if (!Sounds.SoundManager.IsPlaying(loopingSoundIndex)) - { - int index = Rand.Int(matchingSounds.Count); - itemSound = matchingSounds[index]; - } - - if (itemSound == null) return; - - if (itemSound.Loop) - { - loopingSound = itemSound; - - loopingSoundIndex = loopingSound.Sound.Loop(loopingSoundIndex, GetSoundVolume(loopingSound), position, loopingSound.Range); - } - else - { - float volume = GetSoundVolume(itemSound); - if (volume == 0.0f) return; - itemSound.Sound.Play(volume, itemSound.Range, position); - } - } - - public void StopSounds(ActionType type) - { - if (loopingSoundIndex <= 0) return; - - if (loopingSound == null) return; - - if (loopingSound.Type != type) return; - - if (Sounds.SoundManager.IsPlaying(loopingSoundIndex)) - { - Sounds.SoundManager.Stop(loopingSoundIndex); - loopingSound = null; - loopingSoundIndex = -1; - } - } - - private float GetSoundVolume(ItemSound sound) - { - if (sound == null) return 0.0f; - if (sound.VolumeProperty == "") return 1.0f; - - ObjectProperty op = null; - if (properties.TryGetValue(sound.VolumeProperty.ToLowerInvariant(), out op)) - { - float newVolume = 0.0f; - try - { - newVolume = (float)op.GetValue(); - } - catch - { - return 0.0f; - } - newVolume *= sound.VolumeMultiplier; - - return MathHelper.Clamp(newVolume, 0.0f, 1.0f); - } - - return 0.0f; - } - public virtual void Move(Vector2 amount) { } /// a Character has picked the item @@ -457,17 +269,6 @@ namespace Barotrauma.Items.Components /// a Character has dropped the item public virtual void Drop(Character dropper) { } - //public virtual void Draw(SpriteBatch spriteBatch, bool editing = false) - //{ - // item.drawableComponents = Array.FindAll(item.drawableComponents, i => i != this); - //} - - public virtual void DrawHUD(SpriteBatch spriteBatch, Character character) { } - - public virtual void AddToGUIUpdateList() { } - - public virtual void UpdateHUD(Character character) { } - /// true if the operation was completed public virtual bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective) { @@ -480,7 +281,9 @@ namespace Barotrauma.Items.Components //called when isActive is true and condition == 0.0f public virtual void UpdateBroken(float deltaTime, Camera cam) { - StopSounds(ActionType.OnActive); +#if CLIENT + StopSounds(ActionType.OnActive); +#endif } //called when the item is equipped and left mouse button is pressed @@ -525,10 +328,12 @@ namespace Barotrauma.Items.Components public void Remove() { +#if CLIENT if (loopingSound != null) { Sounds.SoundManager.Stop(loopingSoundIndex); } +#endif if (delayedCorrectionCoroutine != null) { @@ -545,10 +350,12 @@ namespace Barotrauma.Items.Components /// public void ShallowRemove() { +#if CLIENT if (loopingSound != null) { Sounds.SoundManager.Stop(loopingSoundIndex); } +#endif ShallowRemoveComponentSpecific(); } @@ -620,7 +427,9 @@ namespace Barotrauma.Items.Components Item containedItem = Array.Find(containedItems, x => x != null && x.Condition > 0.0f && ri.MatchesItem(x)); if (containedItem == null) { +#if CLIENT if (addMessage && !string.IsNullOrEmpty(ri.Msg)) GUI.AddMessage(ri.Msg, Color.Red); +#endif return false; } } @@ -647,7 +456,9 @@ namespace Barotrauma.Items.Components } if (!hasItem) { +#if CLIENT if (addMessage && !string.IsNullOrEmpty(ri.Msg)) GUI.AddMessage(ri.Msg, Color.Red); +#endif return false; } } @@ -681,47 +492,6 @@ namespace Barotrauma.Items.Components } } - //Starts a coroutine that will read the correct state of the component from the NetBuffer when correctionTimer reaches zero. - protected void StartDelayedCorrection(ServerNetObject type, NetBuffer buffer, float sendingTime) - { - if (delayedCorrectionCoroutine != null) CoroutineManager.StopCoroutines(delayedCorrectionCoroutine); - - delayedCorrectionCoroutine = CoroutineManager.StartCoroutine(DoDelayedCorrection(type, buffer, sendingTime)); - } - - private IEnumerable DoDelayedCorrection(ServerNetObject type, NetBuffer buffer, float sendingTime) - { - while (correctionTimer > 0.0f) - { - correctionTimer -= CoroutineManager.DeltaTime; - yield return CoroutineStatus.Running; - } - - ((IServerSerializable)this).ClientRead(type, buffer, sendingTime); - - correctionTimer = 0.0f; - delayedCorrectionCoroutine = null; - - yield return CoroutineStatus.Success; - } - - public virtual XElement Save(XElement parentElement) - { - XElement componentElement = new XElement(name); - - foreach (RelatedItem ri in requiredItems) - { - XElement newElement = new XElement("requireditem"); - ri.Save(newElement); - componentElement.Add(newElement); - } - - ObjectProperty.SaveProperties(this, componentElement); - - parentElement.Add(componentElement); - return componentElement; - } - public virtual void Load(XElement componentElement) { if (componentElement == null) return; diff --git a/Barotrauma/Source/Items/Components/ItemContainer.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemContainer.cs similarity index 72% rename from Barotrauma/Source/Items/Components/ItemContainer.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/ItemContainer.cs index db295927a..d883a1d1f 100644 --- a/Barotrauma/Source/Items/Components/ItemContainer.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemContainer.cs @@ -8,7 +8,7 @@ using Microsoft.Xna.Framework.Graphics; namespace Barotrauma.Items.Components { - class ItemContainer : ItemComponent, IDrawableComponent + partial class ItemContainer : ItemComponent, IDrawableComponent { public const int MaxInventoryCount = 4; @@ -175,64 +175,6 @@ namespace Barotrauma.Items.Components } } - public void Draw(SpriteBatch spriteBatch, bool editing = false) - { - if (hideItems || (item.body != null && !item.body.Enabled)) return; - - Vector2 transformedItemPos = itemPos; - Vector2 transformedItemInterval = itemInterval; - float currentRotation = itemRotation; - - if (item.body == null) - { - transformedItemPos = new Vector2(item.Rect.X, item.Rect.Y); - if (item.Submarine != null) transformedItemPos += item.Submarine.DrawPosition; - transformedItemPos = transformedItemPos + itemPos; - } - else - { - //item.body.Enabled = true; - - Matrix transform = Matrix.CreateRotationZ(item.body.Rotation); - - if (item.body.Dir==-1.0f) - { - transformedItemPos.X = -transformedItemPos.X; - transformedItemInterval.X = -transformedItemInterval.X; - } - transformedItemPos = Vector2.Transform(transformedItemPos, transform); - transformedItemInterval = Vector2.Transform(transformedItemInterval, transform); - - transformedItemPos += item.DrawPosition; - - currentRotation += item.body.Rotation; - } - - foreach (Item containedItem in Inventory.Items) - { - if (containedItem == null) continue; - - containedItem.Sprite.Draw( - spriteBatch, - new Vector2(transformedItemPos.X, -transformedItemPos.Y), - -currentRotation, - 1.0f, - (item.body != null && item.body.Dir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - - transformedItemPos += transformedItemInterval; - } - } - - public override void UpdateHUD(Character character) - { - Inventory.Update((float)Timing.Step); - } - - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - Inventory.Draw(spriteBatch); - } - public override bool Pick(Character picker) { return (picker != null); @@ -301,20 +243,5 @@ namespace Barotrauma.Items.Components } ushort[] itemIds; - - public override XElement Save(XElement parentElement) - { - XElement componentElement = base.Save(parentElement); - - string[] itemIdStrings = new string[Inventory.Items.Length]; - for (int i = 0; i < Inventory.Items.Length; i++) - { - itemIdStrings[i] = (Inventory.Items[i]==null) ? "0" : Inventory.Items[i].ID.ToString(); - } - - componentElement.Add(new XAttribute("contained", string.Join(",",itemIdStrings))); - - return componentElement; - } } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemLabel.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemLabel.cs new file mode 100644 index 000000000..f6a08169a --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemLabel.cs @@ -0,0 +1,8 @@ +using Microsoft.Xna.Framework; + +namespace Barotrauma.Items.Components +{ + partial class ItemLabel : ItemComponent, IDrawableComponent + { + } +} \ No newline at end of file diff --git a/Barotrauma/Source/Items/Components/Ladder.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Ladder.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Ladder.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Ladder.cs diff --git a/Barotrauma/Source/Items/Components/Machines/Controller.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs similarity index 99% rename from Barotrauma/Source/Items/Components/Machines/Controller.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs index 82c4cb9d4..232712cb5 100644 --- a/Barotrauma/Source/Items/Components/Machines/Controller.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs @@ -195,8 +195,9 @@ namespace Barotrauma.Items.Components item.SendSignal(0, ToolBox.Vector2ToString(character.CursorWorldPosition), "position_out", character); return; } - + character.ViewTarget = focusTarget; +#if CLIENT if (character == Character.Controlled && cam != null) { Lights.LightManager.ViewTarget = focusTarget; @@ -204,6 +205,7 @@ namespace Barotrauma.Items.Components cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, (focusTarget as Item).Prefab.OffsetOnSelected, deltaTime*10.0f); } +#endif if (!character.IsRemotePlayer || character.ViewTarget == focusTarget) { @@ -215,7 +217,9 @@ namespace Barotrauma.Items.Components { item.SendSignal(0, "1", "signal_out", picker); +#if CLIENT PlaySound(ActionType.OnUse, item.WorldPosition); +#endif return true; } diff --git a/Barotrauma/Source/Items/Components/Machines/Deconstructor.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Deconstructor.cs similarity index 78% rename from Barotrauma/Source/Items/Components/Machines/Deconstructor.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Deconstructor.cs index dee384eec..ee547ad24 100644 --- a/Barotrauma/Source/Items/Components/Machines/Deconstructor.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Deconstructor.cs @@ -10,11 +10,8 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { - class Deconstructor : Powered, IServerSerializable, IClientSerializable + partial class Deconstructor : Powered, IServerSerializable, IClientSerializable { - GUIProgressBar progressBar; - GUIButton activateButton; - float progressTimer; ItemContainer container; @@ -22,10 +19,12 @@ namespace Barotrauma.Items.Components public Deconstructor(Item item, XElement element) : base(item, element) { +#if CLIENT progressBar = new GUIProgressBar(new Rectangle(0,0,200,20), Color.Green, "", 0.0f, Alignment.BottomCenter, GuiFrame); activateButton = new GUIButton(new Rectangle(0, 0, 200, 20), "Deconstruct", Alignment.TopCenter, "", GuiFrame); activateButton.OnClicked = ToggleActive; +#endif } public override void Update(float deltaTime, Camera cam) @@ -44,7 +43,9 @@ namespace Barotrauma.Items.Components Voltage -= deltaTime * 10.0f; var targetItem = container.Inventory.Items.FirstOrDefault(i => i != null); +#if CLIENT progressBar.BarSize = Math.Min(progressTimer / targetItem.Prefab.DeconstructTime, 1.0f); +#endif if (progressTimer>targetItem.Prefab.DeconstructTime) { var containers = item.GetComponents(); @@ -83,44 +84,13 @@ namespace Barotrauma.Items.Components if (container.Inventory.Items.Any(i => i != null)) { progressTimer = 0.0f; +#if CLIENT progressBar.BarSize = 0.0f; +#endif } } } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - GuiFrame.Draw(spriteBatch); - } - - public override void AddToGUIUpdateList() - { - GuiFrame.AddToGUIUpdateList(); - } - - public override void UpdateHUD(Character character) - { - GuiFrame.Update((float)Timing.Step); - } - - private bool ToggleActive(GUIButton button, object obj) - { - SetActive(!IsActive, Character.Controlled); - - currPowerConsumption = IsActive ? powerConsumption : 0.0f; - - if (GameMain.Server != null) - { - item.CreateServerEvent(this); - } - else if (GameMain.Client != null) - { - item.CreateClientEvent(this); - } - - return true; - } - private void SetActive(bool active, Character user = null) { container = item.GetComponent(); @@ -139,6 +109,7 @@ namespace Barotrauma.Items.Components GameServer.Log(user.Name + (IsActive ? " activated " : " deactivated ") + item.Name, ServerLog.MessageType.ItemInteraction); } +#if CLIENT if (!IsActive) { progressBar.BarSize = 0.0f; @@ -151,16 +122,11 @@ namespace Barotrauma.Items.Components activateButton.Text = "Cancel"; } +#endif container.Inventory.Locked = IsActive; } - - - public void ClientWrite(NetBuffer msg, object[] extraData = null) - { - msg.Write(IsActive); - } - + public void ServerRead(ClientNetObject type, NetBuffer msg, Client c) { bool active = msg.ReadBoolean(); @@ -177,11 +143,5 @@ namespace Barotrauma.Items.Components { msg.Write(IsActive); } - - public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) - { - SetActive(msg.ReadBoolean()); - } - } } diff --git a/Barotrauma/Source/Items/Components/Machines/Engine.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Engine.cs similarity index 80% rename from Barotrauma/Source/Items/Components/Machines/Engine.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Engine.cs index bb91914fb..d56d74af5 100644 --- a/Barotrauma/Source/Items/Components/Machines/Engine.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Engine.cs @@ -9,9 +9,8 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { - class Engine : Powered + partial class Engine : Powered { - private float force; private float targetForce; @@ -49,6 +48,7 @@ namespace Barotrauma.Items.Components { IsActive = true; +#if CLIENT var button = new GUIButton(new Rectangle(160, 50, 30, 30), "-", "", GuiFrame); button.OnClicked = (GUIButton btn, object obj) => { @@ -63,7 +63,8 @@ namespace Barotrauma.Items.Components targetForce += 1.0f; return true; - }; + }; +#endif } public float CurrentVolume @@ -91,41 +92,19 @@ namespace Barotrauma.Items.Components item.CurrentHull.AiTarget.SoundRange = Math.Max(currForce.Length(), item.CurrentHull.AiTarget.SoundRange); } +#if CLIENT for (int i = 0; i < 5; i++) { GameMain.ParticleManager.CreateParticle("bubbles", item.WorldPosition - (Vector2.UnitX * item.Rect.Width/2), -currForce / 5.0f + new Vector2(Rand.Range(-100.0f, 100.0f), Rand.Range(-50f, 50f)), 0.0f, item.CurrentHull); } +#endif } voltage = 0.0f; } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - //isActive = true; - GuiFrame.Draw(spriteBatch); - - //int width = 300, height = 300; - //int x = Game1.GraphicsWidth / 2 - width / 2; - //int y = Game1.GraphicsHeight / 2 - height / 2 - 50; - - //GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true); - - GUI.Font.DrawString(spriteBatch, "Force: " + (int)(targetForce) + " %", new Vector2(GuiFrame.Rect.X + 30, GuiFrame.Rect.Y + 30), Color.White); - } - - public override void AddToGUIUpdateList() - { - GuiFrame.AddToGUIUpdateList(); - } - - public override void UpdateHUD(Character character) - { - GuiFrame.Update(1.0f / 60.0f); - } - public override void UpdateBroken(float deltaTime, Camera cam) { force = MathHelper.Lerp(force, 0.0f, 0.1f); diff --git a/Barotrauma/Source/Items/Components/Machines/Fabricator.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Fabricator.cs similarity index 54% rename from Barotrauma/Source/Items/Components/Machines/Fabricator.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Fabricator.cs index 649edcc45..a98209b57 100644 --- a/Barotrauma/Source/Items/Components/Machines/Fabricator.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Fabricator.cs @@ -79,17 +79,10 @@ namespace Barotrauma.Items.Components } } - class Fabricator : Powered, IServerSerializable, IClientSerializable + partial class Fabricator : Powered, IServerSerializable, IClientSerializable { private List fabricableItems; - private GUIListBox itemList; - - private GUIFrame selectedItemFrame; - - private GUIProgressBar progressBar; - private GUIButton activateButton; - private FabricableItem fabricatedItem; private float timeUntilReady; @@ -110,140 +103,20 @@ namespace Barotrauma.Items.Components if (fabricableItem.TargetItem != null) fabricableItems.Add(fabricableItem); } - GuiFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f); - - itemList = new GUIListBox(new Rectangle(0,0,GuiFrame.Rect.Width/2-20,0), "", GuiFrame); - itemList.OnSelected = SelectItem; - - foreach (FabricableItem fi in fabricableItems) - { - GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, null, itemList) - { - UserData = fi, - Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f), - HoverColor = Color.Gold * 0.2f, - SelectedColor = Color.Gold * 0.5f, - ToolTip = fi.TargetItem.Description - }; - - GUITextBlock textBlock = new GUITextBlock( - new Rectangle(40, 0, 0, 25), - fi.TargetItem.Name, - Color.Transparent, Color.White, - Alignment.Left, Alignment.Left, - null, frame); - textBlock.ToolTip = fi.TargetItem.Description; - textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); - - if (fi.TargetItem.sprite != null) - { - GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), fi.TargetItem.sprite, Alignment.Left, frame); - img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f); - img.Color = fi.TargetItem.SpriteColor; - img.ToolTip = fi.TargetItem.Description; - } - - } + InitProjSpecific(); } - private bool SelectItem(GUIComponent component, object obj) - { - FabricableItem targetItem = obj as FabricableItem; - if (targetItem == null) return false; - - if (selectedItemFrame != null) GuiFrame.RemoveChild(selectedItemFrame); - - //int width = 200, height = 150; - selectedItemFrame = new GUIFrame(new Rectangle(0, 0, (int)(GuiFrame.Rect.Width * 0.4f), 300), Color.Black * 0.8f, Alignment.CenterY | Alignment.Right, null, GuiFrame); - - selectedItemFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); - - progressBar = new GUIProgressBar(new Rectangle(0, 0, 0, 20), Color.Green, "", 0.0f, Alignment.BottomCenter, selectedItemFrame); - progressBar.IsHorizontal = true; - - if (targetItem.TargetItem.sprite != null) - { - int y = 0; - - GUIImage img = new GUIImage(new Rectangle(10, 0, 40, 40), targetItem.TargetItem.sprite, Alignment.TopLeft, selectedItemFrame); - img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f); - img.Color = targetItem.TargetItem.SpriteColor; - - new GUITextBlock( - new Rectangle(60, 0, 0, 25), - targetItem.TargetItem.Name, - Color.Transparent, Color.White, - Alignment.TopLeft, - Alignment.TopLeft, null, - selectedItemFrame, true); - - y += 40; - - if (!string.IsNullOrWhiteSpace(targetItem.TargetItem.Description)) - { - var description = new GUITextBlock( - new Rectangle(0, y, 0, 0), - targetItem.TargetItem.Description, - "", Alignment.TopLeft, Alignment.TopLeft, - selectedItemFrame, true, GUI.SmallFont); - - y += description.Rect.Height + 10; - } - - - List inadequateSkills = new List(); - - if (Character.Controlled != null) - { - inadequateSkills = targetItem.RequiredSkills.FindAll(skill => Character.Controlled.GetSkillLevel(skill.Name) < skill.Level); - } - - Color textColor = Color.White; - string text; - if (!inadequateSkills.Any()) - { - text = "Required items:\n"; - foreach (Tuple ip in targetItem.RequiredItems) - { - text += " - " + ip.Item1.Name + " x"+ip.Item2+"\n"; - } - text += "Required time: " + targetItem.RequiredTime + " s"; - } - else - { - text = "Skills required to calibrate:\n"; - foreach (Skill skill in inadequateSkills) - { - text += " - " + skill.Name + " lvl " + skill.Level + "\n"; - } - - textColor = Color.Red; - } - - new GUITextBlock( - new Rectangle(0, y, 0, 25), - text, - Color.Transparent, textColor, - Alignment.TopLeft, - Alignment.TopLeft, null, - selectedItemFrame); - - activateButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Create", Color.White, Alignment.CenterX | Alignment.Bottom, "", selectedItemFrame); - activateButton.OnClicked = StartButtonClicked; - activateButton.UserData = targetItem; - activateButton.Enabled = false; - } - - return true; - } + partial void InitProjSpecific(); public override bool Select(Character character) { CheckFabricableItems(character); +#if CLIENT if (itemList.Selected != null) { SelectItem(itemList.Selected, itemList.Selected.UserData); } +#endif return base.Select(character); @@ -260,6 +133,7 @@ namespace Barotrauma.Items.Components /// private void CheckFabricableItems(Character character) { +#if CLIENT foreach (GUIComponent child in itemList.children) { var itemPrefab = child.UserData as FabricableItem; @@ -272,35 +146,13 @@ namespace Barotrauma.Items.Components child.GetChild().Color = itemPrefab.TargetItem.SpriteColor * (canBeFabricated ? 1.0f : 0.5f); } +#endif var itemContainer = item.GetComponent(); prevContainedItems = new Item[itemContainer.Inventory.Items.Length]; itemContainer.Inventory.Items.CopyTo(prevContainedItems, 0); } - private bool StartButtonClicked(GUIButton button, object obj) - { - if (fabricatedItem == null) - { - StartFabricating(obj as FabricableItem, Character.Controlled); - } - else - { - CancelFabricating(Character.Controlled); - } - - if (GameMain.Server != null) - { - item.CreateServerEvent(this); - } - else if (GameMain.Client != null) - { - item.CreateClientEvent(this); - } - - return true; - } - private void StartFabricating(FabricableItem selectedItem, Character user = null) { if (selectedItem == null) return; @@ -310,9 +162,11 @@ namespace Barotrauma.Items.Components GameServer.Log(user.Name + " started fabricating " + selectedItem.TargetItem.Name + " in " + item.Name, ServerLog.MessageType.ItemInteraction); } +#if CLIENT itemList.Enabled = false; activateButton.Text = "Cancel"; +#endif fabricatedItem = selectedItem; IsActive = true; @@ -333,17 +187,19 @@ namespace Barotrauma.Items.Components GameServer.Log(user.Name + " cancelled the fabrication of " + fabricatedItem.TargetItem.Name + " in " + item.Name, ServerLog.MessageType.ItemInteraction); } - itemList.Enabled = true; IsActive = false; fabricatedItem = null; currPowerConsumption = 0.0f; +#if CLIENT + itemList.Enabled = true; if (activateButton != null) { activateButton.Text = "Create"; } if (progressBar != null) progressBar.BarSize = 0.0f; +#endif timeUntilReady = 0.0f; @@ -354,10 +210,12 @@ namespace Barotrauma.Items.Components public override void Update(float deltaTime, Camera cam) { +#if CLIENT if (progressBar!=null) { progressBar.BarSize = fabricatedItem == null ? 0.0f : (fabricatedItem.RequiredTime - timeUntilReady) / fabricatedItem.RequiredTime; } +#endif if (voltage < minVoltage) return; @@ -400,51 +258,6 @@ namespace Barotrauma.Items.Components CancelFabricating(null); } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - GuiFrame.Draw(spriteBatch); - } - - public override void AddToGUIUpdateList() - { - GuiFrame.AddToGUIUpdateList(); - } - - public override void UpdateHUD(Character character) - { - FabricableItem targetItem = itemList.SelectedData as FabricableItem; - if (targetItem != null) - { - activateButton.Enabled = CanBeFabricated(targetItem, character); - } - - if (character != null) - { - bool itemsChanged = false; - if (prevContainedItems == null) - { - itemsChanged = true; - } - else - { - var itemContainer = item.GetComponent(); - for (int i = 0; i < itemContainer.Inventory.Items.Length; i++) - { - if (prevContainedItems[i] != itemContainer.Inventory.Items[i]) - { - itemsChanged = true; - break; - } - } - } - - if (itemsChanged) CheckFabricableItems(character); - } - - - GuiFrame.Update((float)Timing.Step); - } - private bool CanBeFabricated(FabricableItem fabricableItem, Character user) { if (fabricableItem == null) return false; @@ -464,12 +277,6 @@ namespace Barotrauma.Items.Components return true; } - public void ClientWrite(NetBuffer msg, object[] extraData = null) - { - int itemIndex = fabricatedItem == null ? -1 : fabricableItems.IndexOf(fabricatedItem); - msg.WriteRangedInteger(-1, fabricableItems.Count - 1, itemIndex); - } - public void ServerRead(ClientNetObject type, NetBuffer msg, Client c) { int itemIndex = msg.ReadRangedInteger(-1, fabricableItems.Count - 1); @@ -488,7 +295,9 @@ namespace Barotrauma.Items.Components if (fabricatedItem != null && fabricableItems.IndexOf(fabricatedItem) == itemIndex) return; if (itemIndex < 0 || itemIndex >= fabricableItems.Count) return; +#if CLIENT SelectItem(null, fabricableItems[itemIndex]); +#endif StartFabricating(fabricableItems[itemIndex], c.Character); } } @@ -499,24 +308,5 @@ namespace Barotrauma.Items.Components msg.WriteRangedInteger(-1, fabricableItems.Count - 1, itemIndex); } - public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) - { - int itemIndex = msg.ReadRangedInteger(-1, fabricableItems.Count - 1); - - if (itemIndex == -1) - { - CancelFabricating(); - } - else - { - //if already fabricating the selected item, return - if (fabricatedItem != null && fabricableItems.IndexOf(fabricatedItem) == itemIndex) return; - if (itemIndex < 0 || itemIndex >= fabricableItems.Count) return; - - SelectItem(null, fabricableItems[itemIndex]); - StartFabricating(fabricableItems[itemIndex]); - } - } - } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/MiniMap.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/MiniMap.cs new file mode 100644 index 000000000..820fa590c --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/MiniMap.cs @@ -0,0 +1,122 @@ +using System; +using System.Xml.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Linq; + +namespace Barotrauma.Items.Components +{ + partial class MiniMap : Powered + { + class HullData + { + public float? Oxygen; + public float? Water; + } + + private DateTime resetDataTime; + + bool hasPower; + + [Editable, HasDefaultValue(false, true)] + public bool RequireWaterDetectors + { + get; + set; + } + + [Editable, HasDefaultValue(true, true)] + public bool RequireOxygenDetectors + { + get; + set; + } + + [Editable, HasDefaultValue(false, true)] + public bool ShowHullIntegrity + { + get; + set; + } + + + private Dictionary hullDatas; + + public MiniMap(Item item, XElement element) + : base(item, element) + { + IsActive = true; + + hullDatas = new Dictionary(); + } + + public override void Update(float deltaTime, Camera cam) + { + //periodically reset all hull data + //(so that outdated hull info won't be shown if detectors stop sending signals) + if (DateTime.Now > resetDataTime) + { + hullDatas.Clear(); + resetDataTime = DateTime.Now + new TimeSpan(0, 0, 1); + } + + currPowerConsumption = powerConsumption; + + hasPower = voltage > minVoltage; + + voltage = 0.0f; + } + + public override bool Pick(Character picker) + { + if (picker == null) return false; + + //picker.SelectedConstruction = item; + + return true; + } + + public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power = 0) + { + base.ReceiveSignal(stepsTaken, signal, connection, source, sender, power); + + if (sender == null || sender.CurrentHull == null) return; + + Hull senderHull = sender.CurrentHull; + + HullData hullData; + if (!hullDatas.TryGetValue(senderHull, out hullData)) + { + hullData = new HullData(); + hullDatas.Add(senderHull, hullData); + } + + switch (connection.Name) + { + case "water_data_in": + //cheating a bit because water detectors don't actually send the water level + if (source.GetComponent() == null) + { + hullData.Water = Rand.Range(0.0f, 1.0f); + } + else + { + hullData.Water = Math.Min(senderHull.Volume / senderHull.FullVolume, 1.0f); + } + break; + case "oxygen_data_in": + float oxy; + + if (!float.TryParse(signal, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out oxy)) + { + oxy = Rand.Range(0.0f, 100.0f); + } + + hullData.Oxygen = oxy; + break; + } + } + + } +} diff --git a/Barotrauma/Source/Items/Components/Machines/OxygenGenerator.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/OxygenGenerator.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Machines/OxygenGenerator.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Machines/OxygenGenerator.cs diff --git a/Barotrauma/Source/Items/Components/Machines/Pump.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Pump.cs similarity index 60% rename from Barotrauma/Source/Items/Components/Machines/Pump.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Pump.cs index 12c824990..53813ce67 100644 --- a/Barotrauma/Source/Items/Components/Machines/Pump.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Pump.cs @@ -8,7 +8,7 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { - class Pump : Powered, IServerSerializable, IClientSerializable + partial class Pump : Powered, IServerSerializable, IClientSerializable { private float flowPercentage; private float maxFlow; @@ -17,8 +17,6 @@ namespace Barotrauma.Items.Components public Hull hull1; - private GUITickBox isActiveTickBox; - [HasDefaultValue(0.0f, true)] public float FlowPercentage { @@ -58,7 +56,9 @@ namespace Barotrauma.Items.Components { base.IsActive = value; +#if CLIENT if (isActiveTickBox != null) isActiveTickBox.Selected = value; +#endif } } @@ -67,66 +67,11 @@ namespace Barotrauma.Items.Components { GetHull(); - isActiveTickBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Running", Alignment.TopLeft, GuiFrame); - isActiveTickBox.OnSelected = (GUITickBox box) => - { - targetLevel = null; - IsActive = !IsActive; - if (!IsActive) currPowerConsumption = 0.0f; - - if (GameMain.Server != null) - { - item.CreateServerEvent(this); - GameServer.Log(Character.Controlled + (IsActive ? " turned on " : " turned off ") + item.Name, ServerLog.MessageType.ItemInteraction); - } - else if (GameMain.Client != null) - { - correctionTimer = CorrectionDelay; - item.CreateClientEvent(this); - } - - return true; - }; - - var button = new GUIButton(new Rectangle(160, 40, 35, 30), "OUT", "", GuiFrame); - button.OnClicked = (GUIButton btn, object obj) => - { - FlowPercentage -= 10.0f; - - if (GameMain.Server != null) - { - item.CreateServerEvent(this); - GameServer.Log(Character.Controlled + " set the pumping speed of " + item.Name + " to " + (int)(flowPercentage) + " %", ServerLog.MessageType.ItemInteraction); - } - else if (GameMain.Client != null) - { - correctionTimer = CorrectionDelay; - item.CreateClientEvent(this); - } - - return true; - }; - - button = new GUIButton(new Rectangle(210, 40, 35, 30), "IN", "", GuiFrame); - button.OnClicked = (GUIButton btn, object obj) => - { - FlowPercentage += 10.0f; - - if (GameMain.Server != null) - { - item.CreateServerEvent(this); - GameServer.Log(Character.Controlled + " set the pumping speed of " + item.Name + " to " + (int)(flowPercentage) + " %", ServerLog.MessageType.ItemInteraction); - } - else if (GameMain.Client != null) - { - correctionTimer = CorrectionDelay; - item.CreateClientEvent(this); - } - - return true; - }; + InitProjSpecific(); } + partial void InitProjSpecific(); + public override void Move(Vector2 amount) { base.Move(amount); @@ -180,27 +125,6 @@ namespace Barotrauma.Items.Components hull1 = Hull.FindHull(item.WorldPosition, item.CurrentHull); } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - int x = GuiFrame.Rect.X; - int y = GuiFrame.Rect.Y; - - GuiFrame.Draw(spriteBatch); - - GUI.Font.DrawString(spriteBatch, "Pumping speed: " + (int)flowPercentage + " %", new Vector2(x + 40, y + 85), Color.White); - - } - - public override void AddToGUIUpdateList() - { - GuiFrame.AddToGUIUpdateList(); - } - - public override void UpdateHUD(Character character) - { - GuiFrame.Update(1.0f / 60.0f); - } - public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power=0.0f) { base.ReceiveSignal(stepsTaken, signal, connection, source, sender, power); @@ -233,13 +157,6 @@ namespace Barotrauma.Items.Components if (!IsActive) currPowerConsumption = 0.0f; } - public void ClientWrite(Lidgren.Network.NetBuffer msg, object[] extraData = null) - { - //flowpercentage can only be adjusted at 10% intervals -> no need for more accuracy than this - msg.WriteRangedInteger(-10, 10, (int)(flowPercentage / 10.0f)); - msg.Write(IsActive); - } - public void ServerRead(ClientNetObject type, Lidgren.Network.NetBuffer msg, Client c) { float newFlowPercentage = msg.ReadRangedInteger(-10, 10) * 10.0f; @@ -271,17 +188,5 @@ namespace Barotrauma.Items.Components msg.Write(IsActive); } - public void ClientRead(ServerNetObject type, Lidgren.Network.NetBuffer msg, float sendingTime) - { - if (correctionTimer > 0.0f) - { - StartDelayedCorrection(type, msg.ExtractBits(5 + 1), sendingTime); - return; - } - - FlowPercentage = msg.ReadRangedInteger(-10, 10) * 10.0f; - IsActive = msg.ReadBoolean(); - } - } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Radar.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Radar.cs new file mode 100644 index 000000000..4e5f7a81e --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Radar.cs @@ -0,0 +1,165 @@ +using Barotrauma.Networking; +using FarseerPhysics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Xml.Linq; +using Voronoi2; + +namespace Barotrauma.Items.Components +{ + partial class Radar : Powered, IServerSerializable, IClientSerializable + { + private float range; + + private float pingState; + + private readonly Sprite pingCircle, screenOverlay; + + private readonly Sprite radarBlip; + + private float prevPingRadius; + + float prevPassivePingRadius; + + private Vector2 center; + private float displayRadius; + private float displayScale; + + private float displayBorderSize; + + [HasDefaultValue(10000.0f, false)] + public float Range + { + get { return range; } + set { range = MathHelper.Clamp(value, 0.0f, 100000.0f); } + } + + [HasDefaultValue(false, false)] + public bool DetectSubmarineWalls + { + get; + set; + } + + public override bool IsActive + { + get + { + return base.IsActive; + } + + set + { + base.IsActive = value; +#if CLIENT + if (isActiveTickBox != null) isActiveTickBox.Selected = value; +#endif + } + } + + public Radar(Item item, XElement element) + : base(item, element) + { +#if CLIENT + radarBlips = new List(); +#endif + + displayBorderSize = ToolBox.GetAttributeFloat(element, "displaybordersize", 0.0f); + + foreach (XElement subElement in element.Elements()) + { + switch (subElement.Name.ToString().ToLowerInvariant()) + { + case "pingcircle": + pingCircle = new Sprite(subElement); + break; + case "screenoverlay": + screenOverlay = new Sprite(subElement); + break; + case "blip": + radarBlip = new Sprite(subElement); + break; + } + } + +#if CLIENT + isActiveTickBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Active Sonar", Alignment.TopLeft, GuiFrame); + isActiveTickBox.OnSelected = (GUITickBox box) => + { + if (GameMain.Server != null) + { + item.CreateServerEvent(this); + } + else if (GameMain.Client != null) + { + item.CreateClientEvent(this); + correctionTimer = CorrectionDelay; + } + IsActive = box.Selected; + + return true; + }; + + GuiFrame.CanBeFocused = false; +#endif + + IsActive = false; + } + + public override void Update(float deltaTime, Camera cam) + { + currPowerConsumption = powerConsumption; + + base.Update(deltaTime, cam); + + if (voltage >= minVoltage || powerConsumption <= 0.0f) + { + pingState = pingState + deltaTime * 0.5f; + if (pingState > 1.0f) + { + if (item.CurrentHull != null) item.CurrentHull.AiTarget.SoundRange = Math.Max(Range * pingState, item.CurrentHull.AiTarget.SoundRange); + item.Use(deltaTime); + pingState = 0.0f; + } + } + else + { + pingState = 0.0f; + } + + Voltage -= deltaTime; + } + + public override bool Use(float deltaTime, Character character = null) + { + return pingState > 1.0f; + } + + protected override void RemoveComponentSpecific() + { + if (pingCircle!=null) pingCircle.Remove(); + if (screenOverlay != null) screenOverlay.Remove(); + } + + public void ServerRead(ClientNetObject type, Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c) + { + bool isActive = msg.ReadBoolean(); + + if (!item.CanClientAccess(c)) return; + + IsActive = isActive; +#if CLIENT + isActiveTickBox.Selected = IsActive; +#endif + + item.CreateServerEvent(this); + } + + public void ServerWrite(Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c, object[] extraData = null) + { + msg.Write(IsActive); + } + } +} diff --git a/Barotrauma/Source/Items/Components/Machines/Reactor.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Reactor.cs similarity index 59% rename from Barotrauma/Source/Items/Components/Machines/Reactor.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Reactor.cs index ed7ecb063..c9de27add 100644 --- a/Barotrauma/Source/Items/Components/Machines/Reactor.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Reactor.cs @@ -8,7 +8,7 @@ using Barotrauma.Networking; namespace Barotrauma.Items.Components { - class Reactor : Powered, IDrawableComponent, IServerSerializable, IClientSerializable + partial class Reactor : Powered, IDrawableComponent, IServerSerializable, IClientSerializable { const float NetworkUpdateInterval = 0.5f; @@ -50,8 +50,6 @@ namespace Barotrauma.Items.Components private PropertyTask powerUpTask; - private GUITickBox autoTempTickBox; - private bool unsentChanges; private float sendUpdateTimer; @@ -134,7 +132,9 @@ namespace Barotrauma.Items.Components set { autoTemp = value; +#if CLIENT if (autoTempTickBox!=null) autoTempTickBox.Selected = value; +#endif } } @@ -163,94 +163,11 @@ namespace Barotrauma.Items.Components IsActive = true; - var button = new GUIButton(new Rectangle(410, 70, 40, 40), "-", "", GuiFrame); - button.OnPressed = () => - { - lastUser = Character.Controlled; - if (nextServerLogWriteTime == null) - { - nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); - } - unsentChanges = true; - ShutDownTemp -= 100.0f; - - return false; - }; - - button = new GUIButton(new Rectangle(460, 70, 40,40), "+", "", GuiFrame); - button.OnPressed = () => - { - lastUser = Character.Controlled; - if (nextServerLogWriteTime == null) - { - nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); - } - unsentChanges = true; - ShutDownTemp += 100.0f; - - return false; - }; - - autoTempTickBox = new GUITickBox(new Rectangle(410, 170, 20, 20), "Automatic temperature control", Alignment.TopLeft, GuiFrame); - autoTempTickBox.OnSelected = ToggleAutoTemp; - - button = new GUIButton(new Rectangle(210, 290, 40, 40), "+", "", GuiFrame); - button.OnPressed = () => - { - lastUser = Character.Controlled; - if (nextServerLogWriteTime == null) - { - nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); - } - unsentChanges = true; - FissionRate += 1.0f; - - return false; - }; - - button = new GUIButton(new Rectangle(210, 340, 40, 40), "-", "", GuiFrame); - button.OnPressed = () => - { - lastUser = Character.Controlled; - if (nextServerLogWriteTime == null) - { - nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); - } - unsentChanges = true; - FissionRate -= 1.0f; - - return false; - }; - - button = new GUIButton(new Rectangle(500, 290, 40, 40), "+", "", GuiFrame); - button.OnPressed = () => - { - lastUser = Character.Controlled; - if (nextServerLogWriteTime == null) - { - nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); - } - unsentChanges = true; - CoolingRate += 1.0f; - - return false; - }; - - button = new GUIButton(new Rectangle(500, 340, 40, 40), "-", "", GuiFrame); - button.OnPressed = () => - { - lastUser = Character.Controlled; - if (nextServerLogWriteTime == null) - { - nextServerLogWriteTime = Math.Max(lastServerLogWriteTime + 1.0f, (float)Timing.TotalTime); - } - unsentChanges = true; - CoolingRate -= 1.0f; - - return false; - }; + InitProjSpecific(); } + partial void InitProjSpecific(); + public override void Update(float deltaTime, Camera cam) { if (GameMain.Server != null && nextServerLogWriteTime != null) @@ -283,6 +200,7 @@ namespace Barotrauma.Items.Components if (temperature>fireTemp && temperature-deltaTemp updateGraphInterval) - { - UpdateGraph(fissionRateGraph, fissionRate); - UpdateGraph(coolingRateGraph, coolingRate); - UpdateGraph(tempGraph, temperature); - - UpdateGraph(loadGraph, load); - - graphTimer = 0.0f; - } - } - private void MeltDown() { if (item.Condition <= 0.0f) return; @@ -435,18 +344,6 @@ namespace Barotrauma.Items.Components return picker != null; } - public void Draw(SpriteBatch spriteBatch, bool editing = false) - { - GUI.DrawRectangle(spriteBatch, - new Vector2(item.Rect.X + item.Rect.Width / 2 - 6, -item.Rect.Y + 29), - new Vector2(12, 42), Color.Black); - - if (temperature > 0) - GUI.DrawRectangle(spriteBatch, - new Vector2(item.Rect.X + item.Rect.Width / 2 - 5, -item.Rect.Y + 30 + (40.0f * (1.0f - temperature / 10000.0f))), - new Vector2(10, 40 * (temperature / 10000.0f)), new Color(temperature / 10000.0f, 1.0f - (temperature / 10000.0f), 0.0f, 1.0f), true); - } - public override bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective) { switch (objective.Option.ToLowerInvariant()) @@ -480,110 +377,6 @@ namespace Barotrauma.Items.Components return false; } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - IsActive = true; - - int x = GuiFrame.Rect.X; - int y = GuiFrame.Rect.Y; - - GuiFrame.Draw(spriteBatch); - - float xOffset = graphTimer / updateGraphInterval; - - //GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true); - - GUI.Font.DrawString(spriteBatch, "Output: " + (int)temperature + " kW", - new Vector2(x + 450, y + 30), Color.Red); - GUI.Font.DrawString(spriteBatch, "Grid load: " + (int)load + " kW", - new Vector2(x + 600, y + 30), Color.Yellow); - - float maxLoad = 0.0f; - foreach (float loadVal in loadGraph) - { - maxLoad = Math.Max(maxLoad, loadVal); - } - - DrawGraph(tempGraph, spriteBatch, - new Rectangle(x + 30, y + 30, 400, 250), Math.Max(10000.0f, maxLoad), xOffset, Color.Red); - - DrawGraph(loadGraph, spriteBatch, - new Rectangle(x + 30, y + 30, 400, 250), Math.Max(10000.0f, maxLoad), xOffset, Color.Yellow); - - GUI.Font.DrawString(spriteBatch, "Shutdown Temperature: " + (int)shutDownTemp, new Vector2(x + 450, y + 80), Color.White); - - //GUI.Font.DrawString(spriteBatch, "Automatic Temperature Control: " + ((autoTemp) ? "ON" : "OFF"), new Vector2(x + 450, y + 180), Color.White); - - y += 300; - - GUI.Font.DrawString(spriteBatch, "Fission rate: " + (int)fissionRate + " %", new Vector2(x + 30, y), Color.White); - DrawGraph(fissionRateGraph, spriteBatch, - new Rectangle(x + 30, y + 30, 200, 100), 100.0f, xOffset, Color.Orange); - - - GUI.Font.DrawString(spriteBatch, "Cooling rate: " + (int)coolingRate + " %", new Vector2(x + 320, y), Color.White); - DrawGraph(coolingRateGraph, spriteBatch, - new Rectangle(x + 320, y + 30, 200, 100), 100.0f, xOffset, Color.LightBlue); - - - //y = y - 260; - } - - public override void AddToGUIUpdateList() - { - GuiFrame.AddToGUIUpdateList(); - } - - public override void UpdateHUD(Character character) - { - GuiFrame.Update(1.0f / 60.0f); - } - - private bool ToggleAutoTemp(GUITickBox tickBox) - { - unsentChanges = true; - autoTemp = tickBox.Selected; - - return true; - } - - static void UpdateGraph(IList graph, T newValue) - { - for (int i = graph.Count - 1; i > 0; i--) - { - graph[i] = graph[i - 1]; - } - graph[0] = newValue; - } - - static void DrawGraph(IList graph, SpriteBatch spriteBatch, Rectangle rect, float maxVal, float xOffset, Color color) - { - float lineWidth = (float)rect.Width / (float)(graph.Count - 2); - float yScale = (float)rect.Height / maxVal; - - GUI.DrawRectangle(spriteBatch, rect, Color.White); - - Vector2 prevPoint = new Vector2(rect.Right, rect.Bottom - (graph[1] + (graph[0] - graph[1]) * xOffset) * yScale); - - float currX = rect.Right - ((xOffset - 1.0f) * lineWidth); - - for (int i = 1; i < graph.Count - 1; i++) - { - currX -= lineWidth; - - Vector2 newPoint = new Vector2(currX, rect.Bottom - graph[i] * yScale); - - GUI.DrawLine(spriteBatch, prevPoint, newPoint - new Vector2(1.0f, 0), color); - - prevPoint = newPoint; - } - - Vector2 lastPoint = new Vector2(rect.X, - rect.Bottom - (graph[graph.Count - 1] + (graph[graph.Count - 2] - graph[graph.Count - 1]) * xOffset) * yScale); - - GUI.DrawLine(spriteBatch, prevPoint, lastPoint, color); - } - public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power) { switch (connection.Name) @@ -598,17 +391,6 @@ namespace Barotrauma.Items.Components } } - public void ClientWrite(NetBuffer msg, object[] extraData = null) - { - msg.Write(autoTemp); - msg.WriteRangedSingle(shutDownTemp, 0.0f, 10000.0f, 15); - - msg.WriteRangedSingle(coolingRate, 0.0f, 100.0f, 8); - msg.WriteRangedSingle(fissionRate, 0.0f, 100.0f, 8); - - correctionTimer = CorrectionDelay; - } - public void ServerRead(ClientNetObject type, NetBuffer msg, Client c) { bool autoTemp = msg.ReadBoolean(); @@ -644,23 +426,5 @@ namespace Barotrauma.Items.Components msg.WriteRangedSingle(coolingRate, 0.0f, 100.0f, 8); msg.WriteRangedSingle(fissionRate, 0.0f, 100.0f, 8); } - - public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) - { - if (correctionTimer > 0.0f) - { - StartDelayedCorrection(type, msg.ExtractBits(16 + 1 + 15 + 8 + 8), sendingTime); - return; - } - - Temperature = msg.ReadRangedSingle(0.0f, 10000.0f, 16); - - AutoTemp = msg.ReadBoolean(); - ShutDownTemp = msg.ReadRangedSingle(0.0f, 10000.0f, 15); - - CoolingRate = msg.ReadRangedSingle(0.0f, 100.0f, 8); - FissionRate = msg.ReadRangedSingle(0.0f, 100.0f, 8); - } - } } diff --git a/Barotrauma/Source/Items/Components/Machines/Steering.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Steering.cs similarity index 57% rename from Barotrauma/Source/Items/Components/Machines/Steering.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Steering.cs index 7e584935a..77d28cc5c 100644 --- a/Barotrauma/Source/Items/Components/Machines/Steering.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Steering.cs @@ -12,16 +12,13 @@ using Voronoi2; namespace Barotrauma.Items.Components { - class Steering : Powered, IServerSerializable, IClientSerializable + partial class Steering : Powered, IServerSerializable, IClientSerializable { private const float AutopilotRayCastInterval = 0.5f; private Vector2 currVelocity; private Vector2 targetVelocity; - private GUITickBox autopilotTickBox, maintainPosTickBox; - private GUITickBox levelEndTickBox, levelStartTickBox; - private bool autoPilot; private Vector2? posToMaintain; @@ -47,17 +44,21 @@ namespace Barotrauma.Items.Components if (value == autoPilot) return; autoPilot = value; +#if CLIENT autopilotTickBox.Selected = value; maintainPosTickBox.Enabled = autoPilot; levelEndTickBox.Enabled = autoPilot; levelStartTickBox.Enabled = autoPilot; - +#endif if (autoPilot) { if (pathFinder == null) pathFinder = new PathFinder(WayPoint.WayPointList, false); +#if CLIENT ToggleMaintainPosition(maintainPosTickBox); +#endif } +#if CLIENT else { maintainPosTickBox.Selected = false; @@ -66,16 +67,10 @@ namespace Barotrauma.Items.Components posToMaintain = null; } +#endif } } - - public bool MaintainPos - { - get { return maintainPosTickBox.Selected; } - set { maintainPosTickBox.Selected = value; } - } - - + [Editable, HasDefaultValue(0.5f, true)] public float NeutralBallastLevel { @@ -107,35 +102,11 @@ namespace Barotrauma.Items.Components { IsActive = true; - autopilotTickBox = new GUITickBox(new Rectangle(0,25,20,20), "Autopilot", Alignment.TopLeft, GuiFrame); - autopilotTickBox.OnSelected = (GUITickBox box) => - { - AutoPilot = box.Selected; - unsentChanges = true; - - return true; - }; - - maintainPosTickBox = new GUITickBox(new Rectangle(5, 50, 15, 15), "Maintain position", Alignment.TopLeft, GUI.SmallFont, GuiFrame); - maintainPosTickBox.Enabled = false; - maintainPosTickBox.OnSelected = ToggleMaintainPosition; - - levelStartTickBox = new GUITickBox( - new Rectangle(5, 70, 15, 15), - GameMain.GameSession == null ? "" : ToolBox.LimitString(GameMain.GameSession.StartLocation.Name, 20), - Alignment.TopLeft, GUI.SmallFont, GuiFrame); - levelStartTickBox.Enabled = false; - levelStartTickBox.OnSelected = SelectDestination; - - levelEndTickBox = new GUITickBox( - new Rectangle(5, 90, 15, 15), - GameMain.GameSession == null ? "" : ToolBox.LimitString(GameMain.GameSession.EndLocation.Name, 20), - Alignment.TopLeft, GUI.SmallFont, GuiFrame); - levelEndTickBox.Enabled = false; - levelEndTickBox.OnSelected = SelectDestination; - + InitProjSpecific(); } - + + partial void InitProjSpecific(); + public override void Update(float deltaTime, Camera cam) { if (unsentChanges) @@ -143,12 +114,15 @@ namespace Barotrauma.Items.Components networkUpdateTimer -= deltaTime; if (networkUpdateTimer <= 0.0f) { +#if CLIENT if (GameMain.Client != null) { item.CreateClientEvent(this); correctionTimer = CorrectionDelay; } - else if (GameMain.Server != null) + else +#endif + if (GameMain.Server != null) { item.CreateServerEvent(this); } @@ -177,75 +151,6 @@ namespace Barotrauma.Items.Components voltage -= deltaTime; } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - //if (voltage < minVoltage) return; - - int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height; - int x = GuiFrame.Rect.X; - int y = GuiFrame.Rect.Y; - - GuiFrame.Draw(spriteBatch); - - if (voltage < minVoltage && powerConsumption > 0.0f) return; - - Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40); - //GUI.DrawRectangle(spriteBatch, velRect, Color.White, false); - - if (item.Submarine != null && Level.Loaded != null) - { - Vector2 realWorldVelocity = ConvertUnits.ToDisplayUnits(item.Submarine.Velocity * Physics.DisplayToRealWorldRatio) * 3.6f; - float realWorldDepth = Math.Abs(item.Submarine.Position.Y - Level.Loaded.Size.Y) * Physics.DisplayToRealWorldRatio; - GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 65), - "Velocity: " + (int)realWorldVelocity.X + " km/h", Color.LightGreen, null, 0, GUI.SmallFont); - GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 50), - "Descent velocity: " + -(int)realWorldVelocity.Y + " km/h", Color.LightGreen, null, 0, GUI.SmallFont); - - GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 30), - "Depth: " + (int)realWorldDepth + " m", Color.LightGreen, null, 0, GUI.SmallFont); - } - - GUI.DrawLine(spriteBatch, - new Vector2(velRect.Center.X,velRect.Center.Y), - new Vector2(velRect.Center.X + currVelocity.X, velRect.Center.Y - currVelocity.Y), - Color.Gray); - - Vector2 targetVelPos = new Vector2(velRect.Center.X + targetVelocity.X, velRect.Center.Y - targetVelocity.Y); - - GUI.DrawLine(spriteBatch, - new Vector2(velRect.Center.X, velRect.Center.Y), - targetVelPos, - Color.LightGray); - - GUI.DrawRectangle(spriteBatch, new Rectangle((int)targetVelPos.X - 5, (int)targetVelPos.Y - 5, 10, 10), Color.White); - - if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(velRect.Center.X, velRect.Center.Y)) < 200.0f) - { - GUI.DrawRectangle(spriteBatch, new Rectangle((int)targetVelPos.X -10, (int)targetVelPos.Y - 10, 20, 20), Color.Red); - } - } - - public override void AddToGUIUpdateList() - { - GuiFrame.AddToGUIUpdateList(); - } - - public override void UpdateHUD(Character character) - { - GuiFrame.Update(1.0f / 60.0f); - - if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y)) < 200.0f) - { - if (PlayerInput.LeftButtonHeld()) - { - TargetVelocity = PlayerInput.MousePosition - new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y); - targetVelocity.Y = -targetVelocity.Y; - - unsentChanges = true; - } - } - } - private void UpdateAutoPilot(float deltaTime) { if (posToMaintain != null) @@ -369,7 +274,7 @@ namespace Barotrauma.Items.Components if (pathFinder == null) pathFinder = new PathFinder(WayPoint.WayPointList, false); Vector2 target; - if (levelEndTickBox.Selected) + if (LevelEndSelected) { target = ConvertUnits.ToSimUnits(Level.Loaded.EndPosition); } @@ -382,6 +287,37 @@ namespace Barotrauma.Items.Components steeringPath = pathFinder.FindPath(ConvertUnits.ToSimUnits(item.WorldPosition), target); } + public void SetDestinationLevelStart() + { + AutoPilot = true; + + MaintainPos = false; + posToMaintain = null; + + LevelEndSelected = false; + + if (!LevelStartSelected) + { + LevelStartSelected = true; + UpdatePath(); + } + } + + public void SetDestinationLevelEnd() + { + AutoPilot = false; + + MaintainPos = false; + posToMaintain = null; + + LevelStartSelected = false; + + if (!LevelEndSelected) + { + LevelEndSelected = true; + UpdatePath(); + } + } private void SteerTowardsPosition(Vector2 worldPosition) { float prediction = 10.0f; @@ -400,82 +336,6 @@ namespace Barotrauma.Items.Components } } - private bool ToggleMaintainPosition(GUITickBox tickBox) - { - unsentChanges = true; - - levelStartTickBox.Selected = false; - levelEndTickBox.Selected = false; - - if (item.Submarine == null) - { - posToMaintain = null; - } - else - { - posToMaintain = item.Submarine.WorldPosition; - } - - tickBox.Selected = true; - - return true; - } - - public void SetDestinationLevelStart() - { - AutoPilot = true; - - MaintainPos = false; - posToMaintain = null; - - levelEndTickBox.Selected = false; - - if (!levelStartTickBox.Selected) - { - levelStartTickBox.Selected = true; - UpdatePath(); - } - } - - public void SetDestinationLevelEnd() - { - AutoPilot = false; - - MaintainPos = false; - posToMaintain = null; - - levelStartTickBox.Selected = false; - - if (!levelEndTickBox.Selected) - { - levelEndTickBox.Selected = true; - UpdatePath(); - } - } - - - private bool SelectDestination(GUITickBox tickBox) - { - unsentChanges = true; - - if (tickBox == levelStartTickBox) - { - levelEndTickBox.Selected = false; - } - else - { - levelStartTickBox.Selected = false; - } - - maintainPosTickBox.Selected = false; - posToMaintain = null; - tickBox.Selected = true; - - UpdatePath(); - - return true; - } - public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power=0.0f) { if (connection.Name == "velocity_in") @@ -488,31 +348,6 @@ namespace Barotrauma.Items.Components } } - public void ClientWrite(Lidgren.Network.NetBuffer msg, object[] extraData = null) - { - msg.Write(autoPilot); - - if (!autoPilot) - { - //no need to write steering info if autopilot is controlling - msg.Write(targetVelocity.X); - msg.Write(targetVelocity.Y); - } - else - { - msg.Write(posToMaintain != null); - if (posToMaintain != null) - { - msg.Write(((Vector2)posToMaintain).X); - msg.Write(((Vector2)posToMaintain).Y); - } - else - { - msg.Write(levelStartTickBox.Selected); - } - } - } - public void ServerRead(ClientNetObject type, Lidgren.Network.NetBuffer msg, Barotrauma.Networking.Client c) { bool autoPilot = msg.ReadBoolean(); @@ -551,19 +386,19 @@ namespace Barotrauma.Items.Components else { - maintainPosTickBox.Selected = newPosToMaintain != null; + MaintainPos = newPosToMaintain != null; posToMaintain = newPosToMaintain; if (posToMaintain == null) { - levelStartTickBox.Selected = headingToStart; - levelEndTickBox.Selected = !headingToStart; + LevelStartSelected = headingToStart; + LevelEndSelected = !headingToStart; UpdatePath(); } else { - levelStartTickBox.Selected = false; - levelEndTickBox.Selected = false; + LevelStartSelected = false; + LevelEndSelected = false; } } @@ -591,70 +426,7 @@ namespace Barotrauma.Items.Components } else { - msg.Write(levelStartTickBox.Selected); - } - } - } - - public void ClientRead(ServerNetObject type, Lidgren.Network.NetBuffer msg, float sendingTime) - { - long msgStartPos = msg.Position; - - bool autoPilot = msg.ReadBoolean(); - Vector2 newTargetVelocity = targetVelocity; - bool maintainPos = false; - Vector2? newPosToMaintain = null; - bool headingToStart = false; - - if (autoPilot) - { - maintainPos = msg.ReadBoolean(); - if (maintainPos) - { - newPosToMaintain = new Vector2( - msg.ReadFloat(), - msg.ReadFloat()); - } - else - { - headingToStart = msg.ReadBoolean(); - } - } - else - { - newTargetVelocity = new Vector2(msg.ReadFloat(), msg.ReadFloat()); - } - - if (correctionTimer > 0.0f) - { - int msgLength = (int)(msg.Position - msgStartPos); - msg.Position = msgStartPos; - StartDelayedCorrection(type, msg.ExtractBits(msgLength), sendingTime); - return; - } - - AutoPilot = autoPilot; - - if (!AutoPilot) - { - targetVelocity = newTargetVelocity; - } - else - { - - maintainPosTickBox.Selected = newPosToMaintain != null; - posToMaintain = newPosToMaintain; - - if (posToMaintain == null) - { - levelStartTickBox.Selected = headingToStart; - levelEndTickBox.Selected = !headingToStart; - UpdatePath(); - } - else - { - levelStartTickBox.Selected = false; - levelEndTickBox.Selected = false; + msg.Write(LevelStartSelected); } } } diff --git a/Barotrauma/Source/Items/Components/Machines/Vent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Vent.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Machines/Vent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Vent.cs diff --git a/Barotrauma/Source/Items/Components/Power/PowerContainer.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerContainer.cs similarity index 62% rename from Barotrauma/Source/Items/Components/Power/PowerContainer.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerContainer.cs index fb617d08c..0e921f05b 100644 --- a/Barotrauma/Source/Items/Components/Power/PowerContainer.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerContainer.cs @@ -7,7 +7,7 @@ using Lidgren.Network; namespace Barotrauma.Items.Components { - class PowerContainer : Powered, IDrawableComponent, IServerSerializable, IClientSerializable + partial class PowerContainer : Powered, IDrawableComponent, IServerSerializable, IClientSerializable { //[power/min] private float capacity; @@ -92,48 +92,11 @@ namespace Barotrauma.Items.Components IsActive = true; - if (canBeSelected) - { - var button = new GUIButton(new Rectangle(160, 50, 30,30), "-", "", GuiFrame); - button.OnClicked = (GUIButton btn, object obj) => - { - RechargeSpeed = rechargeSpeed - maxRechargeSpeed * 0.1f; - - if (GameMain.Server != null) - { - item.CreateServerEvent(this); - GameServer.Log(Character.Controlled + " set the recharge speed of " + item.Name + " to " + (int)((rechargeSpeed / maxRechargeSpeed) * 100.0f) + " %", ServerLog.MessageType.ItemInteraction); - } - else if (GameMain.Client != null) - { - item.CreateClientEvent(this); - correctionTimer = CorrectionDelay; - } - - return true; - }; - - button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", "", GuiFrame); - button.OnClicked = (GUIButton btn, object obj) => - { - RechargeSpeed = rechargeSpeed + maxRechargeSpeed * 0.1f; - - if (GameMain.Server != null) - { - item.CreateServerEvent(this); - GameServer.Log(Character.Controlled + " set the recharge speed of " + item.Name + " to " + (int)((rechargeSpeed / maxRechargeSpeed) * 100.0f) + " %", ServerLog.MessageType.ItemInteraction); - } - else if (GameMain.Client != null) - { - item.CreateClientEvent(this); - correctionTimer = CorrectionDelay; - } - - return true; - }; - } + InitProjSpecific(); } + partial void InitProjSpecific(); + public override bool Pick(Character picker) { if (picker == null) return false; @@ -240,48 +203,6 @@ namespace Barotrauma.Items.Components } } - public void Draw(SpriteBatch spriteBatch, bool editing = false) - { - GUI.DrawRectangle(spriteBatch, - new Vector2(item.DrawPosition.X- 4, -item.DrawPosition.Y), - new Vector2(8, 22), Color.Black); - - if (charge > 0) - GUI.DrawRectangle(spriteBatch, - new Vector2(item.DrawPosition.X - 3, -item.DrawPosition.Y + 1 + (20.0f * (1.0f - charge / capacity))), - new Vector2(6, 20 * (charge / capacity)), Color.Green, true); - } - - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - GuiFrame.Draw(spriteBatch); - - int x = GuiFrame.Rect.X; - int y = GuiFrame.Rect.Y; - //GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true); - - GUI.Font.DrawString(spriteBatch, - "Charge: " + (int)charge + "/" + (int)capacity + " kWm (" + (int)((charge / capacity) * 100.0f) + " %)", - new Vector2(x + 30, y + 30), Color.White); - - GUI.Font.DrawString(spriteBatch, "Recharge rate: " + (int)((rechargeSpeed / maxRechargeSpeed) * 100.0f) + " %", new Vector2(x + 30, y + 95), Color.White); - } - - public override void AddToGUIUpdateList() - { - GuiFrame.AddToGUIUpdateList(); - } - - public override void UpdateHUD(Character character) - { - GuiFrame.Update(1.0f / 60.0f); - } - - public void ClientWrite(NetBuffer msg, object[] extraData) - { - msg.WriteRangedInteger(0, 10, (int)(rechargeSpeed / MaxRechargeSpeed * 10)); - } - public void ServerRead(ClientNetObject type, NetBuffer msg, Client c) { float newRechargeSpeed = msg.ReadRangedInteger(0,10) / 10.0f * maxRechargeSpeed; @@ -302,17 +223,5 @@ namespace Barotrauma.Items.Components float chargeRatio = MathHelper.Clamp(charge / capacity, 0.0f, 1.0f); msg.WriteRangedSingle(chargeRatio, 0.0f, 1.0f, 8); } - - public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) - { - if (correctionTimer > 0.0f) - { - StartDelayedCorrection(type, msg.ExtractBits(4 + 8), sendingTime); - return; - } - - RechargeSpeed = msg.ReadRangedInteger(0, 10) / 10.0f * maxRechargeSpeed; - Charge = msg.ReadRangedSingle(0.0f, 1.0f, 8) * capacity; - } } } diff --git a/Barotrauma/Source/Items/Components/Power/PowerTransfer.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs similarity index 90% rename from Barotrauma/Source/Items/Components/Power/PowerTransfer.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs index 26a424436..219051fb5 100644 --- a/Barotrauma/Source/Items/Components/Power/PowerTransfer.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs @@ -8,7 +8,7 @@ using System.Linq; namespace Barotrauma.Items.Components { - class PowerTransfer : Powered + partial class PowerTransfer : Powered { static float fullPower; static float fullLoad; @@ -80,6 +80,7 @@ namespace Barotrauma.Items.Components if (pt.item.Condition <= 0.0f && prevCondition > 0.0f) { +#if CLIENT sparkSounds[Rand.Int(sparkSounds.Length)].Play(1.0f, 600.0f, pt.item.WorldPosition); Vector2 baseVel = Rand.Vector(300.0f); @@ -90,6 +91,7 @@ namespace Barotrauma.Items.Components if (particle != null) particle.Size *= Rand.Range(0.5f, 1.0f); } +#endif if (FireProbability > 0.0f && Rand.Int((int)(1.0f / FireProbability)) == 1) { @@ -173,29 +175,6 @@ namespace Barotrauma.Items.Components } } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - if (!canBeSelected) return; - - int x = GuiFrame.Rect.X; - int y = GuiFrame.Rect.Y; - - GuiFrame.Draw(spriteBatch); - - GUI.Font.DrawString(spriteBatch, "Power: " + (int)(-currPowerConsumption) + " kW", new Vector2(x + 30, y + 30), Color.White); - GUI.Font.DrawString(spriteBatch, "Load: " + (int)powerLoad + " kW", new Vector2(x + 30, y + 100), Color.White); - } - - public override void AddToGUIUpdateList() - { - GuiFrame.AddToGUIUpdateList(); - } - - public override void UpdateHUD(Character character) - { - GuiFrame.Update(1.0f / 60.0f); - } - public override void OnMapLoaded() { var connections = item.Connections; diff --git a/Barotrauma/Source/Items/Components/Power/Powered.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/Powered.cs similarity index 94% rename from Barotrauma/Source/Items/Components/Power/Powered.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Power/Powered.cs index 3f5f8aeba..9ba4f1f55 100644 --- a/Barotrauma/Source/Items/Components/Power/Powered.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/Powered.cs @@ -3,11 +3,8 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { - class Powered : ItemComponent + partial class Powered : ItemComponent { - - protected static Sound[] sparkSounds; - //the amount of power CURRENTLY consumed by the item //negative values mean that the item is providing power to connected items protected float currPowerConsumption; @@ -21,10 +18,6 @@ namespace Barotrauma.Items.Components //the maximum amount of power the item can draw from connected items protected float powerConsumption; - private bool powerOnSoundPlayed; - - private static Sound powerOnSound; - [Editable, HasDefaultValue(0.5f, true)] public float MinVoltage { @@ -68,6 +61,7 @@ namespace Barotrauma.Items.Components public Powered(Item item, XElement element) : base(item, element) { +#if CLIENT if (powerOnSound == null) { powerOnSound = Sound.Load("Content/Items/Electricity/powerOn.ogg", false); @@ -81,6 +75,7 @@ namespace Barotrauma.Items.Components sparkSounds[i] = Sound.Load("Content/Items/Electricity/zap" + (i + 1) + ".ogg", false); } } +#endif } public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power = 0) @@ -92,6 +87,8 @@ namespace Barotrauma.Items.Components public override void Update(float deltaTime, Camera cam) { if (currPowerConsumption == 0.0f) return; + +#if CLIENT if (voltage > minVoltage) { if (!powerOnSoundPlayed) @@ -104,6 +101,7 @@ namespace Barotrauma.Items.Components { powerOnSoundPlayed = false; } +#endif } diff --git a/Barotrauma/Source/Items/Components/Projectile.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Projectile.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Projectile.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Projectile.cs diff --git a/Barotrauma/Source/Items/Components/Rope.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Rope.cs similarity index 89% rename from Barotrauma/Source/Items/Components/Rope.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Rope.cs index 08b4417b3..76445744b 100644 --- a/Barotrauma/Source/Items/Components/Rope.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Rope.cs @@ -13,7 +13,7 @@ using Microsoft.Xna.Framework.Graphics; namespace Barotrauma.Items.Components { - class Rope : ItemComponent, IDrawableComponent + partial class Rope : ItemComponent, IDrawableComponent { PhysicsBody[] ropeBodies; RevoluteJoint[] ropeJoints; @@ -239,41 +239,6 @@ namespace Barotrauma.Items.Components } } - public void Draw(SpriteBatch spriteBatch, bool editing = false) - { - if (!IsActive) return; - - RevoluteJoint firstJoint = null; - - for (int i = 0; i effects; + + public readonly ushort[] wireId; + + public bool IsPower + { + get; + private set; + } + + public List Recipients + { + get + { + List recipients = new List(); + for (int i = 0; i < MaxLinked; i++) + { + if (Wires[i] == null) continue; + Connection recipient = Wires[i].OtherConnection(this); + if (recipient != null) recipients.Add(recipient); + } + return recipients; + } + } + + public Item Item + { + get { return item; } + } + + public Connection(XElement element, Item item) + { + +#if CLIENT + if (connector == null) + { + panelTexture = Sprite.LoadTexture("Content/Items/connectionpanel.png"); + + connector = new Sprite(panelTexture, new Rectangle(470, 102, 19, 43), Vector2.Zero, 0.0f); + connector.Origin = new Vector2(9.5f, 10.0f); + + wireVertical = new Sprite(panelTexture, new Rectangle(408, 1, 11, 102), Vector2.Zero, 0.0f); + } +#endif + + this.item = item; + + //recipient = new Connection[MaxLinked]; + Wires = new Wire[MaxLinked]; + + IsOutput = (element.Name.ToString() == "output"); + Name = ToolBox.GetAttributeString(element, "name", (IsOutput) ? "output" : "input"); + + IsPower = Name == "power_in" || Name == "power" || Name == "power_out"; + + effects = new List(); + + wireId = new ushort[MaxLinked]; + + foreach (XElement subElement in element.Elements()) + { + switch (subElement.Name.ToString().ToLowerInvariant()) + { + case "link": + int index = -1; + for (int i = 0; i < MaxLinked; i++) + { + if (wireId[i] < 1) index = i; + } + if (index == -1) break; + + int id = ToolBox.GetAttributeInt(subElement, "w", 0); + if (id < 0) id = 0; + wireId[index] = (ushort)id; + + break; + + case "statuseffect": + effects.Add(StatusEffect.Load(subElement)); + break; + } + } + } + + public int FindEmptyIndex() + { + for (int i = 0; i < MaxLinked; i++) + { + if (Wires[i] == null) return i; + } + return -1; + } + + //public int FindLinkIndex(Item item) + //{ + // for (int i = 0; i < MaxLinked; i++) + // { + // if (item == null && recipient[i] == null) return i; + // if (recipient[i]!=null && recipient[i].item == item) return i; + // } + // return -1; + //} + + public int FindWireIndex(Item wireItem) + { + for (int i = 0; i < MaxLinked; i++) + { + if (Wires[i] == null && wireItem == null) return i; + if (Wires[i] != null && Wires[i].Item == wireItem) return i; + } + return -1; + } + + public void TryAddLink(Wire wire) + { + for (int i = 0; i < MaxLinked; i++) + { + if (Wires[i] == null) + { + Wires[i] = wire; + return; + } + } + } + + public void AddLink(int index, Wire wire) + { + Wires[index] = wire; + } + + public void SendSignal(int stepsTaken, string signal, Item source, Character sender, float power) + { + for (int i = 0; i < MaxLinked; i++) + { + if (Wires[i] == null) continue; + + Connection recipient = Wires[i].OtherConnection(this); + if (recipient == null) continue; + if (recipient.item == this.item || recipient.item == source) continue; + + foreach (ItemComponent ic in recipient.item.components) + { + ic.ReceiveSignal(stepsTaken, signal, recipient, item, sender, power); + } + + foreach (StatusEffect effect in recipient.effects) + { + + //effect.Apply(ActionType.OnUse, 1.0f, recipient.item, recipient.item); + recipient.item.ApplyStatusEffect(effect, ActionType.OnUse, 1.0f); + } + } + } + + public void ClearConnections() + { + for (int i = 0; i < MaxLinked; i++) + { + if (Wires[i] == null) continue; + + Wires[i].RemoveConnection(this); + Wires[i] = null; + } + } + + public void ConnectLinked() + { + if (wireId == null) return; + + for (int i = 0; i < MaxLinked; i++) + { + if (wireId[i] == 0) continue; + + Item wireItem = MapEntity.FindEntityByID(wireId[i]) as Item; + + if (wireItem == null) continue; + Wires[i] = wireItem.GetComponent(); + + if (Wires[i] != null) + { + if (Wires[i].Item.body != null) Wires[i].Item.body.Enabled = false; + Wires[i].Connect(this, false, false); + } + } + } + + } +} \ No newline at end of file diff --git a/Barotrauma/Source/Items/Components/Signal/ConnectionPanel.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs similarity index 83% rename from Barotrauma/Source/Items/Components/Signal/ConnectionPanel.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs index 5b7aec76b..f405feda8 100644 --- a/Barotrauma/Source/Items/Components/Signal/ConnectionPanel.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs @@ -9,7 +9,7 @@ using Lidgren.Network; namespace Barotrauma.Items.Components { - class ConnectionPanel : ItemComponent, IServerSerializable, IClientSerializable + partial class ConnectionPanel : ItemComponent, IServerSerializable, IClientSerializable { public static Wire HighlightedWire; @@ -38,43 +38,6 @@ namespace Barotrauma.Items.Components IsActive = true; } - public override void UpdateHUD(Character character) - { - if (character != Character.Controlled || character != user) return; - - if (Screen.Selected != GameMain.EditMapScreen && - character.IsKeyHit(InputType.Select) && - character.SelectedConstruction == this.item) character.SelectedConstruction = null; - - if (HighlightedWire != null) - { - HighlightedWire.Item.IsHighlighted = true; - if (HighlightedWire.Connections[0] != null && HighlightedWire.Connections[0].Item != null) HighlightedWire.Connections[0].Item.IsHighlighted = true; - if (HighlightedWire.Connections[1] != null && HighlightedWire.Connections[1].Item != null) HighlightedWire.Connections[1].Item.IsHighlighted = true; - } - } - - public override void DrawHUD(SpriteBatch spriteBatch, Character character) - { - if (character != Character.Controlled || character != user) return; - - HighlightedWire = null; - Connection.DrawConnections(spriteBatch, this, character); - - } - - public override XElement Save(XElement parentElement) - { - XElement componentElement = base.Save(parentElement); - - foreach (Connection c in Connections) - { - c.Save(componentElement); - } - - return componentElement; - } - public override void OnMapLoaded() { foreach (Connection c in Connections) diff --git a/Barotrauma/Source/Items/Components/Signal/DelayComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/DelayComponent.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/DelayComponent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/DelayComponent.cs diff --git a/Barotrauma/Source/Items/Components/Signal/LightComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs similarity index 88% rename from Barotrauma/Source/Items/Components/Signal/LightComponent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs index 72a50d086..2ec42e2e4 100644 --- a/Barotrauma/Source/Items/Components/Signal/LightComponent.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs @@ -1,19 +1,18 @@ using Microsoft.Xna.Framework; -using Barotrauma.Lights; using System; using System.Xml.Linq; using Barotrauma.Networking; using Lidgren.Network; +#if CLIENT +using Barotrauma.Lights; +#endif namespace Barotrauma.Items.Components { - class LightComponent : Powered, IServerSerializable, IDrawableComponent + partial class LightComponent : Powered, IServerSerializable, IDrawableComponent { - private Color lightColor; - private LightSource light; - private float range; private float lightBrightness; @@ -39,7 +38,9 @@ namespace Barotrauma.Items.Components set { castShadows = value; +#if CLIENT if (light != null) light.CastShadows = value; +#endif } } @@ -83,7 +84,9 @@ namespace Barotrauma.Items.Components public override void Move(Vector2 amount) { +#if CLIENT light.Position += amount; +#endif } public override bool IsActive @@ -96,20 +99,23 @@ namespace Barotrauma.Items.Components set { base.IsActive = value; - +#if CLIENT if (light == null) return; light.Color = value ? lightColor : Color.Transparent; if (!value) lightBrightness = 0.0f; +#endif } } public LightComponent(Item item, XElement element) : base (item, element) { +#if CLIENT light = new LightSource(element); light.ParentSub = item.CurrentHull == null ? null : item.CurrentHull.Submarine; light.Position = item.Position; light.CastShadows = castShadows; +#endif IsActive = IsOn; @@ -125,25 +131,32 @@ namespace Barotrauma.Items.Components public override void Update(float deltaTime, Camera cam) { base.Update(deltaTime, cam); - + +#if CLIENT light.ParentSub = item.Submarine; +#endif ApplyStatusEffects(ActionType.OnActive, deltaTime); +#if CLIENT if (item.Container != null) { light.Color = Color.Transparent; return; } +#endif if (item.body != null) { +#if CLIENT light.Position = item.Position; light.Rotation = item.body.Dir > 0.0f ? item.body.Rotation : item.body.Rotation - MathHelper.Pi; - +#endif if (!item.body.Enabled) { +#if CLIENT light.Color = Color.Transparent; +#endif return; } } @@ -159,7 +172,9 @@ namespace Barotrauma.Items.Components if (Rand.Range(0.0f, 1.0f) < 0.05f && voltage < Rand.Range(0.0f, minVoltage)) { +#if CLIENT if (voltage > 0.1f) sparkSounds[Rand.Int(sparkSounds.Length)].Play(1.0f, 400.0f, item.WorldPosition); +#endif lightBrightness = 0.0f; } else @@ -167,8 +182,10 @@ namespace Barotrauma.Items.Components lightBrightness = MathHelper.Lerp(lightBrightness, Math.Min(voltage, 1.0f), 0.1f); } +#if CLIENT light.Color = lightColor * lightBrightness * (1.0f-Rand.Range(0.0f,Flicker)); light.Range = range * (float)Math.Sqrt(lightBrightness); +#endif voltage = 0.0f; } @@ -178,19 +195,13 @@ namespace Barotrauma.Items.Components return true; } - public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, bool editing = false) - { - if (light.LightSprite != null && (item.body == null || item.body.Enabled)) - { - light.LightSprite.Draw(spriteBatch, new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), lightColor * lightBrightness, 0.0f, 1.0f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, item.Sprite.Depth - 0.0001f); - } - } - protected override void RemoveComponentSpecific() { base.RemoveComponentSpecific(); +#if CLIENT light.Remove(); +#endif } public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power=0.0f) @@ -215,10 +226,5 @@ namespace Barotrauma.Items.Components { msg.Write(IsOn); } - - public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) - { - IsOn = msg.ReadBoolean(); - } } } diff --git a/Barotrauma/Source/Items/Components/Signal/MotionSensor.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/MotionSensor.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/MotionSensor.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/MotionSensor.cs diff --git a/Barotrauma/Source/Items/Components/Signal/NotComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/NotComponent.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/NotComponent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/NotComponent.cs diff --git a/Barotrauma/Source/Items/Components/Signal/OrComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/OrComponent.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/OrComponent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/OrComponent.cs diff --git a/Barotrauma/Source/Items/Components/Signal/OxygenDetector.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/OxygenDetector.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/OxygenDetector.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/OxygenDetector.cs diff --git a/Barotrauma/Source/Items/Components/Signal/RegExFindComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/RegExFindComponent.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/RegExFindComponent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/RegExFindComponent.cs diff --git a/Barotrauma/Source/Items/Components/Signal/RelayComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/RelayComponent.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/RelayComponent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/RelayComponent.cs diff --git a/Barotrauma/Source/Items/Components/Signal/SignalCheckComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/SignalCheckComponent.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/SignalCheckComponent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/SignalCheckComponent.cs diff --git a/Barotrauma/Source/Items/Components/Signal/WaterDetector.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/WaterDetector.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/WaterDetector.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/WaterDetector.cs diff --git a/Barotrauma/Source/Items/Components/Signal/WifiComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/WifiComponent.cs similarity index 100% rename from Barotrauma/Source/Items/Components/Signal/WifiComponent.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/WifiComponent.cs diff --git a/Barotrauma/Source/Items/Components/Signal/Wire.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/Wire.cs similarity index 59% rename from Barotrauma/Source/Items/Components/Signal/Wire.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Signal/Wire.cs index a92b9aba8..ea38d0d63 100644 --- a/Barotrauma/Source/Items/Components/Signal/Wire.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/Wire.cs @@ -1,8 +1,6 @@ using Barotrauma.Networking; using Lidgren.Network; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using System; using System.Collections.Generic; using System.Globalization; @@ -11,9 +9,9 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { - class Wire : ItemComponent, IDrawableComponent, IServerSerializable + partial class Wire : ItemComponent, IDrawableComponent, IServerSerializable { - class WireSection + partial class WireSection { private Vector2 start; @@ -27,31 +25,6 @@ namespace Barotrauma.Items.Components angle = MathUtils.VectorToAngle(end - start); length = Vector2.Distance(start, end); } - - public void Draw(SpriteBatch spriteBatch, Color color, Vector2 offset, float depth, float width = 0.3f) - { - spriteBatch.Draw(wireSprite.Texture, - new Vector2(start.X+offset.X, -(start.Y+offset.Y)), null, color, - -angle, - new Vector2(0.0f, wireSprite.size.Y / 2.0f), - new Vector2(length / wireSprite.Texture.Width, width), - SpriteEffects.None, - depth); - } - - public static void Draw(SpriteBatch spriteBatch, Vector2 start, Vector2 end, Color color, float depth, float width = 0.3f) - { - start.Y = -start.Y; - end.Y = -end.Y; - - spriteBatch.Draw(wireSprite.Texture, - start, null, color, - MathUtils.VectorToAngle(end - start), - new Vector2(0.0f, wireSprite.size.Y / 2.0f), - new Vector2((Vector2.Distance(start, end)) / wireSprite.Texture.Width, width), - SpriteEffects.None, - depth); - } } const float nodeDistance = 32.0f; @@ -286,7 +259,9 @@ namespace Barotrauma.Items.Components public override void Move(Vector2 amount) { +#if CLIENT if (item.IsSelected) MoveNodes(amount); +#endif } public List GetNodes() @@ -396,200 +371,6 @@ namespace Barotrauma.Items.Components } - public void Draw(SpriteBatch spriteBatch, bool editing) - { - if (sections.Count == 0 && !IsActive) - { - Drawable = false; - return; - } - - Vector2 drawOffset = Vector2.Zero; - if (item.Submarine != null) - { - drawOffset = item.Submarine.DrawPosition + item.Submarine.HiddenSubPosition; - } - - float depth = item.IsSelected ? 0.0f : wireSprite.Depth + ((item.ID % 100) * 0.00001f); - - if (item.IsHighlighted) - { - foreach (WireSection section in sections) - { - section.Draw(spriteBatch, Color.Gold, drawOffset, depth + 0.00001f, 0.7f); - } - } - else if (item.IsSelected) - { - foreach (WireSection section in sections) - { - section.Draw(spriteBatch, Color.Red, drawOffset, depth + 0.00001f, 0.7f); - } - } - - foreach (WireSection section in sections) - { - section.Draw(spriteBatch, item.Color, drawOffset, depth, 0.3f); - } - - if (IsActive && nodes.Count > 0 && Vector2.Distance(newNodePos, nodes[nodes.Count - 1]) > nodeDistance) - { - WireSection.Draw( - spriteBatch, - new Vector2(nodes[nodes.Count - 1].X, nodes[nodes.Count - 1].Y) + drawOffset, - new Vector2(newNodePos.X, newNodePos.Y) + drawOffset, - item.Color * 0.5f, - depth, - 0.3f); - } - - if (!editing || !GameMain.EditMapScreen.WiringMode) return; - - for (int i = 0; i < nodes.Count; i++) - { - Vector2 drawPos = nodes[i]; - if (item.Submarine != null) drawPos += item.Submarine.Position + item.Submarine.HiddenSubPosition; - drawPos.Y = -drawPos.Y; - - if (item.IsSelected) - { - GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-5, -5), new Vector2(10, 10), item.Color, true, 0.0f); - - if (highlightedNodeIndex == i) - { - GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f); - } - } - else - { - GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-3, -3), new Vector2(6, 6), item.Color, true, 0.0f); - } - } - } - - public static void UpdateEditing(List wires) - { - //dragging a node of some wire - if (draggingWire != null) - { - //cancel dragging - if (!PlayerInput.LeftButtonHeld()) - { - draggingWire = null; - selectedNodeIndex = null; - } - //update dragging - else - { - MapEntity.DisableSelect = true; - - Submarine sub = null; - if (draggingWire.connections[0] != null && draggingWire.connections[0].Item.Submarine != null) sub = draggingWire.connections[0].Item.Submarine; - if (draggingWire.connections[1] != null && draggingWire.connections[1].Item.Submarine != null) sub = draggingWire.connections[1].Item.Submarine; - - Vector2 nodeWorldPos = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition) - sub.HiddenSubPosition - sub.Position;// Nodes[(int)selectedNodeIndex]; - - nodeWorldPos.X = MathUtils.Round(nodeWorldPos.X, Submarine.GridSize.X / 2.0f); - nodeWorldPos.Y = MathUtils.Round(nodeWorldPos.Y, Submarine.GridSize.Y / 2.0f); - - draggingWire.nodes[(int)selectedNodeIndex] = nodeWorldPos; - draggingWire.UpdateSections(); - - MapEntity.SelectEntity(draggingWire.item); - } - - return; - } - - //a wire has been selected -> check if we should start dragging one of the nodes - float nodeSelectDist = 10, sectionSelectDist = 5; - highlightedNodeIndex = null; - if (MapEntity.SelectedList.Count == 1 && MapEntity.SelectedList[0] is Item) - { - Wire selectedWire = ((Item)MapEntity.SelectedList[0]).GetComponent(); - - if (selectedWire != null) - { - Vector2 mousePos = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition); - if (selectedWire.item.Submarine != null) mousePos -= (selectedWire.item.Submarine.Position + selectedWire.item.Submarine.HiddenSubPosition); - - //left click while holding ctrl -> check if the cursor is on a wire section, - //and add a new node if it is - if (PlayerInput.KeyDown(Keys.RightControl) || PlayerInput.KeyDown(Keys.LeftControl)) - { - if (PlayerInput.LeftButtonClicked()) - { - float temp = 0.0f; - int closestSectionIndex = selectedWire.GetClosestSectionIndex(mousePos, sectionSelectDist, out temp); - - if (closestSectionIndex > -1) - { - selectedWire.nodes.Insert(closestSectionIndex + 1, mousePos); - selectedWire.UpdateSections(); - } - } - } - else - { - //check if close enough to a node - float temp = 0.0f; - int closestIndex = selectedWire.GetClosestNodeIndex(mousePos, nodeSelectDist, out temp); - if (closestIndex > -1) - { - highlightedNodeIndex = closestIndex; - //start dragging the node - if (PlayerInput.LeftButtonHeld()) - { - draggingWire = selectedWire; - selectedNodeIndex = closestIndex; - } - //remove the node - else if (PlayerInput.RightButtonClicked() && closestIndex > 0 && closestIndex < selectedWire.nodes.Count - 1) - { - selectedWire.nodes.RemoveAt(closestIndex); - selectedWire.UpdateSections(); - } - } - } - } - } - - //check which wire is highlighted with the cursor - Wire highlighted = null; - float closestDist = 0.0f; - foreach (Wire w in wires) - { - Vector2 mousePos = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition); - if (w.item.Submarine != null) mousePos -= (w.item.Submarine.Position + w.item.Submarine.HiddenSubPosition); - - float dist = 0.0f; - if (w.GetClosestNodeIndex(mousePos, highlighted == null ? nodeSelectDist : closestDist, out dist) > -1) - { - highlighted = w; - closestDist = dist; - } - - if (w.GetClosestSectionIndex(mousePos, highlighted == null ? sectionSelectDist : closestDist, out dist) > -1) - { - highlighted = w; - closestDist = dist; - } - - } - - - if (highlighted != null) - { - highlighted.item.IsHighlighted = true; - - if (PlayerInput.LeftButtonClicked()) - { - MapEntity.DisableSelect = true; - MapEntity.SelectEntity(highlighted.item); - } - } - } - private int GetClosestNodeIndex(Vector2 pos, float maxDist, out float closestDist) { closestDist = 0.0f; @@ -643,24 +424,6 @@ namespace Barotrauma.Items.Components UpdateSections(); } - public override XElement Save(XElement parentElement) - { - XElement componentElement = base.Save(parentElement); - - if (nodes == null || nodes.Count == 0) return componentElement; - - string[] nodeCoords = new string[nodes.Count * 2]; - for (int i = 0; i < nodes.Count; i++) - { - nodeCoords[i * 2] = nodes[i].X.ToString(CultureInfo.InvariantCulture); - nodeCoords[i * 2 + 1] = nodes[i].Y.ToString(CultureInfo.InvariantCulture); - } - - componentElement.Add(new XAttribute("nodes", string.Join(";", nodeCoords))); - - return componentElement; - } - public override void Load(XElement componentElement) { base.Load(componentElement); diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/StatusHUD.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/StatusHUD.cs new file mode 100644 index 000000000..28cf6ceb2 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/StatusHUD.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; +using Microsoft.Xna.Framework; + +namespace Barotrauma.Items.Components +{ + partial class StatusHUD : ItemComponent + { + private static readonly string[] BleedingTexts = {"Minor bleeding", "Bleeding", "Bleeding heavily", "Catastrophic Bleeding"}; + + private static readonly string[] HealthTexts = { "No visible injuries", "Minor injuries", "Injured", "Major injuries", "Critically injured" }; + + private static readonly string[] OxygenTexts = { "Oxygen level normal", "Gasping for air", "Signs of oxygen deprivation", "Not breathing" }; + + public StatusHUD(Item item, XElement element) + : base(item, element) + { + } + } +} diff --git a/Barotrauma/Source/Items/Components/Turret.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs similarity index 86% rename from Barotrauma/Source/Items/Components/Turret.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs index 5297de04e..af6944a7e 100644 --- a/Barotrauma/Source/Items/Components/Turret.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs @@ -10,7 +10,7 @@ using Lidgren.Network; namespace Barotrauma.Items.Components { - class Turret : Powered, IDrawableComponent, IServerSerializable + partial class Turret : Powered, IDrawableComponent, IServerSerializable { Sprite barrelSprite; @@ -94,39 +94,6 @@ namespace Barotrauma.Items.Components } } - public void Draw(SpriteBatch spriteBatch, bool editing = false) - { - Vector2 drawPos = new Vector2(item.Rect.X, item.Rect.Y); - if (item.Submarine != null) drawPos += item.Submarine.DrawPosition; - drawPos.Y = -drawPos.Y; - - if (barrelSprite!=null) - { - barrelSprite.Draw(spriteBatch, - drawPos + barrelPos, Color.White, - rotation + MathHelper.PiOver2, 1.0f, - SpriteEffects.None, item.Sprite.Depth+0.01f); - } - - if (!editing) return; - - GUI.DrawLine(spriteBatch, - drawPos + barrelPos, - drawPos + barrelPos + new Vector2((float)Math.Cos(minRotation), (float)Math.Sin(minRotation))*60.0f, - Color.Green); - - GUI.DrawLine(spriteBatch, - drawPos + barrelPos, - drawPos + barrelPos + new Vector2((float)Math.Cos(maxRotation), (float)Math.Sin(maxRotation)) * 60.0f, - Color.Green); - - GUI.DrawLine(spriteBatch, - drawPos + barrelPos, - drawPos + barrelPos + new Vector2((float)Math.Cos((maxRotation + minRotation) / 2), (float)Math.Sin((maxRotation + minRotation) / 2)) * 60.0f, - Color.LightGreen); - - } - public override void Update(float deltaTime, Camera cam) { this.cam = cam; @@ -402,21 +369,6 @@ namespace Barotrauma.Items.Components //ID of the launched projectile msg.Write(((Item)extraData[2]).ID); } - - public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) - { - UInt16 projectileID = msg.ReadUInt16(); - Item projectile = Entity.FindEntityByID(projectileID) as Item; - - if (projectile == null) - { - DebugConsole.ThrowError("Failed to launch a projectile - item with the ID \""+projectileID+" not found"); - return; - } - - Launch(projectile); - PlaySound(ActionType.OnUse, item.WorldPosition); - } } } diff --git a/Barotrauma/Source/Items/Components/Wearable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs similarity index 99% rename from Barotrauma/Source/Items/Components/Wearable.cs rename to Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs index 0c828a61c..73c776303 100644 --- a/Barotrauma/Source/Items/Components/Wearable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs @@ -173,7 +173,9 @@ namespace Barotrauma.Items.Components ApplyStatusEffects(ActionType.OnWearing, deltaTime, picker); +#if CLIENT PlaySound(ActionType.OnWearing, picker.WorldPosition); +#endif } protected override void RemoveComponentSpecific() diff --git a/Barotrauma/BarotraumaShared/Source/Items/FixRequirement.cs b/Barotrauma/BarotraumaShared/Source/Items/FixRequirement.cs new file mode 100644 index 000000000..b90539c9a --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Items/FixRequirement.cs @@ -0,0 +1,71 @@ +using Barotrauma.Networking; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace Barotrauma +{ + partial class FixRequirement + { + string name; + + List requiredSkills; + List requiredItems; + + public bool Fixed; + + public FixRequirement(XElement element) + { + name = ToolBox.GetAttributeString(element, "name", ""); + + requiredSkills = new List(); + requiredItems = new List(); + + foreach (XElement subElement in element.Elements()) + { + switch (subElement.Name.ToString().ToLowerInvariant()) + { + case "skill": + string skillName = ToolBox.GetAttributeString(subElement, "name", ""); + int level = ToolBox.GetAttributeInt(subElement, "level", 1); + + requiredSkills.Add(new Skill(skillName, level)); + break; + case "item": + string itemName = ToolBox.GetAttributeString(subElement, "name", ""); + + requiredItems.Add(itemName); + break; + } + } + } + + public bool CanBeFixed(Character character) + { + if (character == null) return false; + + bool success = true; + foreach (string itemName in requiredItems) + { + Item item = character.Inventory.FindItem(itemName); + bool itemFound = (item != null); + + if (!itemFound) success = false; + } + + foreach (Skill skill in requiredSkills) + { + float characterSkill = character.GetSkillLevel(skill.Name); + bool sufficientSkill = characterSkill >= skill.Level; + + if (!sufficientSkill) success = false; + } + + return success; + } + } +} diff --git a/Barotrauma/Source/Items/Inventory.cs b/Barotrauma/BarotraumaShared/Source/Items/Inventory.cs similarity index 66% rename from Barotrauma/Source/Items/Inventory.cs rename to Barotrauma/BarotraumaShared/Source/Items/Inventory.cs index caeeaf480..eb4a3fac6 100644 --- a/Barotrauma/Source/Items/Inventory.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Inventory.cs @@ -1,8 +1,6 @@ using System.Linq; using Lidgren.Network; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using Barotrauma.Networking; using System; using System.Collections.Generic; @@ -10,65 +8,26 @@ using Barotrauma.Items.Components; namespace Barotrauma { - class InventorySlot + partial class InventorySlot { public Rectangle Rect; - - public GUIComponent.ComponentState State; - + public bool Disabled; - public bool IsHighlighted - { - get - { - return State == GUIComponent.ComponentState.Hover; - } - } - - public Color Color; - - public Color BorderHighlightColor; - private CoroutineHandle BorderHighlightCoroutine; - public InventorySlot(Rectangle rect) { Rect = rect; +#if CLIENT State = GUIComponent.ComponentState.None; Color = Color.White * 0.4f; +#endif } - public void ShowBorderHighlight(Color color, float fadeInDuration, float fadeOutDuration) - { - if (BorderHighlightCoroutine != null) - { - BorderHighlightCoroutine = null; - } - - BorderHighlightCoroutine = CoroutineManager.StartCoroutine(UpdateBorderHighlight(color, fadeInDuration, fadeOutDuration)); - } - - private IEnumerable UpdateBorderHighlight(Color color, float fadeInDuration, float fadeOutDuration) - { - float t = 0.0f; - while (t < fadeInDuration + fadeOutDuration) - { - BorderHighlightColor = (t < fadeInDuration) ? - Color.Lerp(Color.Transparent, color, t / fadeInDuration) : - Color.Lerp(color, Color.Transparent, (t - fadeInDuration) / fadeOutDuration); - - t += CoroutineManager.DeltaTime; - - yield return CoroutineStatus.Running; - } - - yield return CoroutineStatus.Success; - } } - class Inventory : IServerSerializable, IClientSerializable + partial class Inventory : IServerSerializable, IClientSerializable { public static InventorySlot draggingSlot; public static Item draggingItem; @@ -86,8 +45,6 @@ namespace Barotrauma protected int capacity; - private Vector2 centerPos; - protected int selectedSlot = -1; protected InventorySlot[] slots; @@ -101,14 +58,18 @@ namespace Barotrauma private float syncItemsDelay; private CoroutineHandle syncItemsCoroutine; + private Vector2 centerPos; + public Vector2 CenterPos { get { return centerPos; } set { centerPos = value; +#if CLIENT centerPos.X *= GameMain.GraphicsWidth; centerPos.Y *= GameMain.GraphicsHeight; +#endif } } @@ -195,7 +156,9 @@ namespace Barotrauma } else { +#if CLIENT if (slots != null && createNetworkEvent) slots[i].ShowBorderHighlight(Color.Red, 0.1f, 0.9f); +#endif return false; } } @@ -213,7 +176,9 @@ namespace Barotrauma Items[i] = item; item.ParentInventory = this; +#if CLIENT if (slots != null) slots[i].ShowBorderHighlight(Color.White, 0.1f, 0.4f); +#endif if (item.body != null) { @@ -232,10 +197,12 @@ namespace Barotrauma { GameMain.Server.CreateEntityEvent(Owner as IServerSerializable, new object[] { NetEntityEvent.Type.InventoryState }); } +#if CLIENT else if (GameMain.Client != null) { GameMain.Client.CreateEntityEvent(Owner as IClientSerializable, new object[] { NetEntityEvent.Type.InventoryState }); } +#endif } public Item FindItem(string itemName) @@ -311,79 +278,13 @@ namespace Barotrauma } - public virtual void Draw(SpriteBatch spriteBatch, bool subInventory = false) - { - if (slots == null || isSubInventory != subInventory) return; - - for (int i = 0; i < capacity; i++) - { - if (slots[i].Disabled) continue; - - //don't draw the item if it's being dragged out of the slot - bool drawItem = draggingItem == null || draggingItem != Items[i] || slots[i].IsHighlighted; - - DrawSlot(spriteBatch, slots[i], Items[i], drawItem); - } - - if (draggingItem != null && - (draggingSlot == null || (!draggingSlot.Rect.Contains(PlayerInput.MousePosition) && draggingItem.ParentInventory == this))) - { - Rectangle dragRect = new Rectangle( - (int)PlayerInput.MousePosition.X - 10, - (int)PlayerInput.MousePosition.Y - 10, - 40, 40); - - DrawSlot(spriteBatch, new InventorySlot(dragRect), draggingItem); - } - - for (int i = 0; i < capacity; i++) - { - if (slots[i].IsHighlighted && !slots[i].Disabled && Items[i] != null) - { - string toolTip = ""; - if (GameMain.DebugDraw) - { - toolTip = Items[i].ToString(); - } - else - { - toolTip = string.IsNullOrEmpty(Items[i].Description) ? - Items[i].Name : - Items[i].Name + '\n' + Items[i].Description; - } - - DrawToolTip(spriteBatch, toolTip, slots[i].Rect); - break; - } - } - } - - protected void DrawToolTip(SpriteBatch spriteBatch, string toolTip, Rectangle highlightedSlot) - { - int maxWidth = 300; - - toolTip = ToolBox.WrapText(toolTip, maxWidth, GUI.Font); - - Vector2 textSize = GUI.Font.MeasureString(toolTip); - Vector2 rectSize = textSize * 1.2f; - - Vector2 pos = new Vector2(highlightedSlot.Right, highlightedSlot.Y-rectSize.Y); - pos.X = (int)(pos.X + 3); - pos.Y = (int)pos.Y; - - GUI.DrawRectangle(spriteBatch, pos, rectSize, Color.Black * 0.8f, true); - GUI.Font.DrawString(spriteBatch, toolTip, - new Vector2((int)(pos.X + rectSize.X * 0.5f), (int)(pos.Y + rectSize.Y * 0.5f)), - Color.White, 0.0f, - new Vector2((int)(textSize.X * 0.5f), (int)(textSize.Y * 0.5f)), - 1.0f, SpriteEffects.None, 0.0f); - } - protected void UpdateSlot(InventorySlot slot, int slotIndex, Item item, bool isSubSlot) { bool mouseOn = slot.Rect.Contains(PlayerInput.MousePosition) && !Locked; +#if CLIENT slot.State = GUIComponent.ComponentState.None; +#endif if (!(this is CharacterInventory) && !mouseOn && selectedSlot==slotIndex) { @@ -393,7 +294,9 @@ namespace Barotrauma if (mouseOn && (draggingItem!=null || selectedSlot==slotIndex || selectedSlot==-1)) { +#if CLIENT slot.State = GUIComponent.ComponentState.Hover; +#endif if (!isSubSlot && selectedSlot == -1) { @@ -420,11 +323,15 @@ namespace Barotrauma //selectedSlot = slotIndex; if (TryPutItem(draggingItem, slotIndex, true)) { +#if CLIENT if (slots != null) slots[slotIndex].ShowBorderHighlight(Color.White, 0.1f, 0.4f); +#endif } else { +#if CLIENT if (slots != null) slots[slotIndex].ShowBorderHighlight(Color.Red, 0.1f, 0.9f); +#endif } draggingItem = null; draggingSlot = null; @@ -460,83 +367,11 @@ namespace Barotrauma container.Inventory.isSubInventory = true; +#if CLIENT slots[slotIndex].State = GUIComponent.ComponentState.Hover; - - container.Inventory.Update(deltaTime, true); - } - - public void DrawSubInventory(SpriteBatch spriteBatch, int slotIndex) - { - var item = Items[slotIndex]; - if (item == null) return; - - var container = item.GetComponent(); - if (container == null) return; - - if (container.Inventory.slots == null || !container.Inventory.isSubInventory) return; - - int itemCapacity = container.Capacity; - -#if DEBUG - System.Diagnostics.Debug.Assert(slotIndex >= 0 && slotIndex < Items.Length); -#else - if (slotIndex < 0 || slotIndex >= Items.Length) return; #endif - var slot = slots[slotIndex]; - Rectangle containerRect = new Rectangle(slot.Rect.X - 5, slot.Rect.Y - (40 + 10) * itemCapacity - 5, - slot.Rect.Width + 10, slot.Rect.Height + (40 + 10) * itemCapacity + 10); - - GUI.DrawRectangle(spriteBatch, new Rectangle(containerRect.X, containerRect.Y, containerRect.Width, containerRect.Height - slot.Rect.Height - 5), Color.Black * 0.8f, true); - GUI.DrawRectangle(spriteBatch, containerRect, Color.White); - - container.Inventory.Draw(spriteBatch, true); - - if (!containerRect.Contains(PlayerInput.MousePosition)) - { - if (draggingItem == null || draggingItem.Container != item) selectedSlot = -1; - } - } - - protected void DrawSlot(SpriteBatch spriteBatch, InventorySlot slot, Item item, bool drawItem=true) - { - Rectangle rect = slot.Rect; - - GUI.DrawRectangle(spriteBatch, rect, (slot.IsHighlighted ? Color.Red * 0.4f : slot.Color), true); - - if (item != null && drawItem) - { - if (item.Condition < 100.0f) - { - GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Bottom - 8, rect.Width, 8), Color.Black*0.8f, true); - GUI.DrawRectangle(spriteBatch, - new Rectangle(rect.X, rect.Bottom - 8, (int)(rect.Width * item.Condition / 100.0f), 8), - Color.Lerp(Color.Red, Color.Green, item.Condition / 100.0f)*0.8f, true); - } - - var containedItems = item.ContainedItems; - if (containedItems != null && containedItems.Length == 1 && containedItems[0].Condition < 100.0f) - { - GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Y, rect.Width, 8), Color.Black*0.8f, true); - GUI.DrawRectangle(spriteBatch, - new Rectangle(rect.X, rect.Y, (int)(rect.Width * containedItems[0].Condition / 100.0f), 8), - Color.Lerp(Color.Red, Color.Green, containedItems[0].Condition / 100.0f)*0.8f, true); - } - } - - GUI.DrawRectangle(spriteBatch, rect, (slot.IsHighlighted ? Color.Red * 0.4f : slot.Color), false); - - if (slot.BorderHighlightColor != Color.Transparent) - { - Rectangle highlightRect = slot.Rect; - highlightRect.Inflate(3,3); - - GUI.DrawRectangle(spriteBatch, highlightRect, slot.BorderHighlightColor, false, 0, 5); - } - - if (item == null || !drawItem) return; - - item.Sprite.Draw(spriteBatch, new Vector2(rect.X + rect.Width / 2, rect.Y + rect.Height / 2), item.Color); + container.Inventory.Update(deltaTime, true); } public void ClientWrite(NetBuffer msg, object[] extraData = null) diff --git a/Barotrauma/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs similarity index 73% rename from Barotrauma/Source/Items/Item.cs rename to Barotrauma/BarotraumaShared/Source/Items/Item.cs index 26f502ddc..e1b0186b9 100644 --- a/Barotrauma/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -6,7 +6,6 @@ using FarseerPhysics.Dynamics.Contacts; using Lidgren.Network; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -25,7 +24,7 @@ namespace Barotrauma OnImpact } - class Item : MapEntity, IDamageable, IPropertyObject, IServerSerializable, IClientSerializable + partial class Item : MapEntity, IDamageable, IPropertyObject, IServerSerializable, IClientSerializable { const float MaxVel = 64.0f; @@ -131,11 +130,6 @@ namespace Barotrauma get { return prefab.ImpactTolerance; } } - public override Sprite Sprite - { - get { return prefab.sprite; } - } - public float PickDistance { get { return prefab.PickDistance; } @@ -298,7 +292,11 @@ namespace Barotrauma public override string ToString() { +#if CLIENT return (GameMain.DebugDraw) ? Name + "(ID: " + ID + ")" : Name; +#elif SERVER + return Name + "(ID: " + ID + ")"; +#endif } public List AllPropertyObjects @@ -758,19 +756,20 @@ namespace Barotrauma } - public override void Update(Camera cam, float deltaTime) + public override void Update(float deltaTime, Camera cam) { - ApplyStatusEffects(ActionType.Always, deltaTime, null); foreach (ItemComponent ic in components) { if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive; +#if CLIENT if (!ic.WasUsed) { ic.StopSounds(ActionType.OnUse); } +#endif ic.WasUsed = false; if (parentInventory!=null) ic.ApplyStatusEffects(ActionType.OnContained, deltaTime); @@ -780,8 +779,10 @@ namespace Barotrauma if (condition > 0.0f) { ic.Update(deltaTime, cam); - - if (ic.IsActive) ic.PlaySound(ActionType.OnActive, WorldPosition); + +#if CLIENT + if (ic.IsActive) ic.PlaySound(ActionType.OnActive, WorldPosition); +#endif } else { @@ -907,315 +908,7 @@ namespace Barotrauma { return drawableComponents.Count > 0 || body == null || body.Enabled; } - - public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) - { - if (!Visible) return; - Color color = (IsSelected && editing) ? color = Color.Red : spriteColor; - if (isHighlighted) color = Color.Orange; - - SpriteEffects oldEffects = prefab.sprite.effects; - prefab.sprite.effects ^= SpriteEffects; - - if (prefab.sprite != null) - { - float depth = Sprite.Depth; - depth += (ID % 255) * 0.000001f; - - if (body == null) - { - if (prefab.ResizeHorizontal || prefab.ResizeVertical || SpriteEffects.HasFlag(SpriteEffects.FlipHorizontally) || SpriteEffects.HasFlag(SpriteEffects.FlipVertically)) - { - prefab.sprite.DrawTiled(spriteBatch, new Vector2(DrawPosition.X-rect.Width/2, -(DrawPosition.Y+rect.Height/2)), new Vector2(rect.Width, rect.Height), color); - } - else - { - prefab.sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y), color, 0.0f, 1.0f, SpriteEffects.None, depth); - } - - } - else if (body.Enabled) - { - var holdable = GetComponent(); - if (holdable != null && holdable.Picker?.AnimController != null) - { - if (holdable.Picker.SelectedItems[0] == this) - { - depth = holdable.Picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.000001f; - } - else if (holdable.Picker.SelectedItems[1] == this) - { - depth = holdable.Picker.AnimController.GetLimb(LimbType.LeftArm).sprite.Depth - 0.000001f; - } - - body.Draw(spriteBatch, prefab.sprite, color, depth); - } - else - { - body.Draw(spriteBatch, prefab.sprite, color, depth); - } - } - } - - prefab.sprite.effects = oldEffects; - - List staticDrawableComponents = new List(drawableComponents); //static list to compensate for drawable toggling - for (int i = 0; i < staticDrawableComponents.Count; i++) - { - staticDrawableComponents[i].Draw(spriteBatch, editing); - } - - if (GameMain.DebugDraw && aiTarget!=null) aiTarget.Draw(spriteBatch); - - if (!editing || (body != null && !body.Enabled)) - { - return; - } - - if (IsSelected || isHighlighted) - { - GUI.DrawRectangle(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y+rect.Height/2)), new Vector2(rect.Width, rect.Height), Color.Green,false,0,(int)Math.Max((1.5f/GameScreen.Selected.Cam.Zoom),1.0f)); - - foreach (Rectangle t in prefab.Triggers) - { - Rectangle transformedTrigger = TransformTrigger(t); - - Vector2 rectWorldPos = new Vector2(transformedTrigger.X, transformedTrigger.Y); - if (Submarine!=null) rectWorldPos += Submarine.Position; - rectWorldPos.Y = -rectWorldPos.Y; - - GUI.DrawRectangle(spriteBatch, - rectWorldPos, - new Vector2(transformedTrigger.Width, transformedTrigger.Height), - Color.Green, - false, - 0, - (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); - } - } - - if (!ShowLinks) return; - - foreach (MapEntity e in linkedTo) - { - GUI.DrawLine(spriteBatch, - new Vector2(WorldPosition.X, -WorldPosition.Y), - new Vector2(e.WorldPosition.X, -e.WorldPosition.Y), - Color.Red*0.3f); - } - } - - public override void UpdateEditing(Camera cam) - { - if (editingHUD == null || editingHUD.UserData as Item != this) - { - editingHUD = CreateEditingHUD(Screen.Selected != GameMain.EditMapScreen); - } - - editingHUD.Update((float)Timing.Step); - - if (Screen.Selected != GameMain.EditMapScreen) return; - - if (!prefab.IsLinkable) return; - - if (!PlayerInput.LeftButtonClicked() || !PlayerInput.KeyDown(Keys.Space)) return; - - Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition); - - foreach (MapEntity entity in mapEntityList) - { - if (entity == this || !entity.IsHighlighted) continue; - if (linkedTo.Contains(entity)) continue; - if (!entity.IsMouseOn(position)) continue; - - linkedTo.Add(entity); - if (entity.IsLinkable && entity.linkedTo != null) entity.linkedTo.Add(this); - } - } - - public override void DrawEditing(SpriteBatch spriteBatch, Camera cam) - { - if (editingHUD != null) editingHUD.Draw(spriteBatch); - } - - private GUIComponent CreateEditingHUD(bool inGame = false) - { - List editableProperties = inGame ? GetProperties() : GetProperties(); - - int requiredItemCount = 0; - if (!inGame) - { - foreach (ItemComponent ic in components) - { - requiredItemCount += ic.requiredItems.Count; - } - } - - int width = 450; - int height = 80 + requiredItemCount * 20; - int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10; - foreach (var objectProperty in editableProperties) - { - var editable = objectProperty.Attributes.OfType().FirstOrDefault(); - if (editable != null) height += (int)(Math.Ceiling(editable.MaxLength / 40.0f) * 18.0f) + 5; - } - - editingHUD = new GUIFrame(new Rectangle(x, y, width, height), ""); - editingHUD.Padding = new Vector4(10, 10, 0, 0); - editingHUD.UserData = this; - - new GUITextBlock(new Rectangle(0, 0, 100, 20), prefab.Name, "", - Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont); - - y += 25; - - if (!inGame) - { - if (prefab.IsLinkable) - { - new GUITextBlock(new Rectangle(0, 5, 0, 20), "Hold space to link to another item", - "", Alignment.TopRight, Alignment.TopRight, editingHUD).Font = GUI.SmallFont; - } - foreach (ItemComponent ic in components) - { - foreach (RelatedItem relatedItem in ic.requiredItems) - { - new GUITextBlock(new Rectangle(0, y, 100, 15), ic.Name + ": " + relatedItem.Type.ToString() + " required", "", Alignment.TopLeft, Alignment.CenterLeft, editingHUD, false, GUI.SmallFont); - GUITextBox namesBox = new GUITextBox(new Rectangle(-10, y, 160, 15), Alignment.Right, "", editingHUD); - namesBox.Font = GUI.SmallFont; - - PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(relatedItem); - PropertyDescriptor property = properties.Find("JoinedNames", false); - - namesBox.Text = relatedItem.JoinedNames; - namesBox.UserData = new ObjectProperty(property, relatedItem); - namesBox.OnEnterPressed = EnterProperty; - namesBox.OnTextChanged = PropertyChanged; - - y += 20; - } - } - if (requiredItemCount > 0) y += 10; - } - - foreach (var objectProperty in editableProperties) - { - int boxHeight = 18; - var editable = objectProperty.Attributes.OfType().FirstOrDefault(); - if (editable != null) boxHeight = (int)(Math.Ceiling(editable.MaxLength / 40.0f) * 18.0f); - - object value = objectProperty.GetValue(); - - if (value is bool) - { - GUITickBox propertyTickBox = new GUITickBox(new Rectangle(10, y, 18, 18), objectProperty.Name, - Alignment.Left, editingHUD); - propertyTickBox.Font = GUI.SmallFont; - - propertyTickBox.Selected = (bool)value; - - propertyTickBox.UserData = objectProperty; - propertyTickBox.OnSelected = EnterProperty; - } - else - { - new GUITextBlock(new Rectangle(0, y, 100, 18), objectProperty.Name, "", Alignment.TopLeft, Alignment.Left, editingHUD, false, GUI.SmallFont); - - GUITextBox propertyBox = new GUITextBox(new Rectangle(180, y, 250, boxHeight), "", editingHUD); - propertyBox.Font = GUI.SmallFont; - if (boxHeight > 18) propertyBox.Wrap = true; - - if (value != null) - { - if (value is float) - { - propertyBox.Text = ((float)value).ToString("G", System.Globalization.CultureInfo.InvariantCulture); - } - else - { - - propertyBox.Text = value.ToString(); - } - } - - propertyBox.UserData = objectProperty; - propertyBox.OnEnterPressed = EnterProperty; - propertyBox.OnTextChanged = PropertyChanged; - - } - y = y + boxHeight + 5; - - } - return editingHUD; - } - public virtual void DrawHUD(SpriteBatch spriteBatch, Camera cam, Character character) - { - if (condition <= 0.0f) - { - FixRequirement.DrawHud(spriteBatch, this, character); - return; - } - - if (HasInGameEditableProperties) - { - DrawEditing(spriteBatch, cam); - } - - foreach (ItemComponent ic in components) - { - if (ic.CanBeSelected) ic.DrawHUD(spriteBatch, character); - } - } - - public override void AddToGUIUpdateList() - { - if (Screen.Selected is EditMapScreen) - { - if (editingHUD != null) editingHUD.AddToGUIUpdateList(); - } - else - { - if (HasInGameEditableProperties) - { - if (editingHUD != null) editingHUD.AddToGUIUpdateList(); - } - } - - if (Character.Controlled != null && Character.Controlled.SelectedConstruction == this) - { - if (condition <= 0.0f) - { - FixRequirement.AddToGUIUpdateList(); - return; - } - - foreach (ItemComponent ic in components) - { - if (ic.CanBeSelected) ic.AddToGUIUpdateList(); - } - } - } - - - public virtual void UpdateHUD(Camera cam, Character character) - { - if (condition <= 0.0f) - { - FixRequirement.UpdateHud(this, character); - return; - } - - if (HasInGameEditableProperties) - { - UpdateEditing(cam); - } - - foreach (ItemComponent ic in components) - { - if (ic.CanBeSelected) ic.UpdateHUD(character); - } - } - + public List GetConnectedComponents(bool recursive = false) { List connectedComponents = new List(); @@ -1449,9 +1142,12 @@ namespace Barotrauma { picked = true; ic.ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker); + +#if CLIENT ic.PlaySound(ActionType.OnPicked, picker.WorldPosition); if (picker == Character.Controlled) GUIComponent.ForceMouseOn(null); +#endif if (ic.CanBeSelected) selected = true; } @@ -1469,7 +1165,8 @@ namespace Barotrauma { picker.SelectedConstruction = this; } - + +#if CLIENT if (!hasRequiredSkills && Character.Controlled==picker && Screen.Selected != GameMain.EditMapScreen) { GUI.AddMessage("Your skills may be insufficient to use the item!", Color.Red, 5.0f); @@ -1478,6 +1175,7 @@ namespace Barotrauma GUI.AddMessage("("+requiredSkill.Name+" level "+requiredSkill.Level+" required)", Color.Red, 5.0f); } } +#endif if (Container!=null) Container.RemoveContained(this); @@ -1498,7 +1196,9 @@ namespace Barotrauma { ic.WasUsed = true; +#if CLIENT ic.PlaySound(ActionType.OnUse, WorldPosition); +#endif ic.ApplyStatusEffects(ActionType.OnUse, deltaTime, character); @@ -1599,108 +1299,7 @@ namespace Barotrauma return editableProperties; } - - private bool EnterProperty(GUITickBox tickBox) - { - var objectProperty = tickBox.UserData as ObjectProperty; - if (objectProperty == null) return false; - - objectProperty.TrySetValue(tickBox.Selected); - - return true; - } - - private bool EnterProperty(GUITextBox textBox, string text) - { - textBox.Color = Color.DarkGreen; - - var objectProperty = textBox.UserData as ObjectProperty; - if (objectProperty == null) return false; - - object prevValue = objectProperty.GetValue(); - - textBox.Deselect(); - - if (objectProperty.TrySetValue(text)) - { - textBox.Text = text; - - if (GameMain.Server != null) - { - GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.ChangeProperty, objectProperty }); - } - else if (GameMain.Client != null) - { - GameMain.Client.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.ChangeProperty, objectProperty }); - } - - return true; - } - else - { - if (prevValue != null) - { - textBox.Text = prevValue.ToString(); - } - return false; - } - } - - private bool PropertyChanged(GUITextBox textBox, string text) - { - textBox.Color = Color.Red; - - return true; - } - - public override XElement Save(XElement parentElement) - { - XElement element = new XElement("Item"); - - element.Add(new XAttribute("name", prefab.Name), - new XAttribute("ID", ID)); - - System.Diagnostics.Debug.Assert(Submarine != null); - - if (ResizeHorizontal || ResizeVertical) - { - element.Add(new XAttribute("rect", - (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + - (int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," + - rect.Width + "," + rect.Height)); - } - else - { - element.Add(new XAttribute("rect", - (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + - (int)(rect.Y - Submarine.HiddenSubPosition.Y))); - } - - if (linkedTo != null && linkedTo.Count>0) - { - string[] linkedToIDs = new string[linkedTo.Count]; - - for (int i = 0; i < linkedTo.Count; i++ ) - { - linkedToIDs[i] = linkedTo[i].ID.ToString(); - } - - element.Add(new XAttribute("linked", string.Join(",", linkedToIDs))); - } - - - ObjectProperty.SaveProperties(this, element); - - foreach (ItemComponent ic in components) - { - ic.Save(element); - } - - parentElement.Add(element); - - return element; - } - + public void ServerWrite(NetBuffer msg, Client c, object[] extraData = null) { if (extraData == null || extraData.Length == 0 || !(extraData[0] is NetEntityEvent.Type)) @@ -1745,94 +1344,6 @@ namespace Barotrauma } } - public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) - { - if (type == ServerNetObject.ENTITY_POSITION) - { - ClientReadPosition(type, msg, sendingTime); - return; - } - - NetEntityEvent.Type eventType = - (NetEntityEvent.Type)msg.ReadRangedInteger(0, Enum.GetValues(typeof(NetEntityEvent.Type)).Length - 1); - - switch (eventType) - { - case NetEntityEvent.Type.ComponentState: - int componentIndex = msg.ReadRangedInteger(0, components.Count - 1); - (components[componentIndex] as IServerSerializable).ClientRead(type, msg, sendingTime); - break; - case NetEntityEvent.Type.InventoryState: - ownInventory.ClientRead(type, msg, sendingTime); - break; - case NetEntityEvent.Type.Status: - condition = msg.ReadRangedSingle(0.0f, 100.0f, 8); - - if (FixRequirements.Count > 0) - { - if (Condition <= 0.0f) - { - for (int i = 0; i < FixRequirements.Count; i++) - FixRequirements[i].Fixed = msg.ReadBoolean(); - } - else - { - for (int i = 0; i < FixRequirements.Count; i++) - FixRequirements[i].Fixed = true; - } - } - break; - case NetEntityEvent.Type.ApplyStatusEffect: - ActionType actionType = (ActionType)msg.ReadRangedInteger(0, Enum.GetValues(typeof(ActionType)).Length -1); - ushort targetID = msg.ReadUInt16(); - - Character target = FindEntityByID(targetID) as Character; - ApplyStatusEffects(actionType, (float)Timing.Step, target, true); - break; - case NetEntityEvent.Type.ChangeProperty: - ReadPropertyChange(msg); - break; - } - } - - public void ClientWrite(NetBuffer msg, object[] extraData = null) - { - if (extraData == null || extraData.Length == 0 || !(extraData[0] is NetEntityEvent.Type)) - { - return; - } - - NetEntityEvent.Type eventType = (NetEntityEvent.Type)extraData[0]; - msg.WriteRangedInteger(0, Enum.GetValues(typeof(NetEntityEvent.Type)).Length - 1, (int)eventType); - switch (eventType) - { - case NetEntityEvent.Type.ComponentState: - int componentIndex = (int)extraData[1]; - msg.WriteRangedInteger(0, components.Count - 1, componentIndex); - - (components[componentIndex] as IClientSerializable).ClientWrite(msg, extraData); - break; - case NetEntityEvent.Type.InventoryState: - ownInventory.ClientWrite(msg, extraData); - break; - case NetEntityEvent.Type.Repair: - if (FixRequirements.Count > 0) - { - int requirementIndex = (int)extraData[1]; - msg.WriteRangedInteger(0, FixRequirements.Count - 1, requirementIndex); - } - break; - case NetEntityEvent.Type.ApplyStatusEffect: - //no further data needed, the server applies the effect - //on the character of the client who sent the message - break; - case NetEntityEvent.Type.ChangeProperty: - WritePropertyChange(msg, extraData); - break; - } - msg.WritePadBits(); - } - public void ServerRead(ClientNetObject type, NetBuffer msg, Client c) { NetEntityEvent.Type eventType = @@ -2122,46 +1633,6 @@ namespace Barotrauma lastSentPos = SimPosition; } - public void ClientReadPosition(ServerNetObject type, NetBuffer msg, float sendingTime) - { - Vector2 newPosition = new Vector2(msg.ReadFloat(), msg.ReadFloat()); - float newRotation = msg.ReadRangedSingle(0.0f, MathHelper.TwoPi, 7); - bool awake = msg.ReadBoolean(); - Vector2 newVelocity = Vector2.Zero; - - if (awake) - { - newVelocity = new Vector2( - msg.ReadRangedSingle(-MaxVel, MaxVel, 12), - msg.ReadRangedSingle(-MaxVel, MaxVel, 12)); - } - - if (body == null) - { - DebugConsole.ThrowError("Received a position update for an item with no physics body ("+Name+")"); - return; - } - - body.FarseerBody.Awake = awake; - if (body.FarseerBody.Awake) - { - if ((newVelocity - body.LinearVelocity).Length() > 8.0f) body.LinearVelocity = newVelocity; - } - else - { - body.FarseerBody.Enabled = false; - } - - if ((newPosition - SimPosition).Length() > body.LinearVelocity.Length() * 2.0f) - { - body.SetTransform(newPosition, newRotation); - - Vector2 displayPos = ConvertUnits.ToDisplayUnits(body.SimPosition); - rect.X = (int)(displayPos.X - rect.Width / 2.0f); - rect.Y = (int)(displayPos.Y + rect.Height / 2.0f); - } - } - public static void Load(XElement element, Submarine submarine) { string rectString = ToolBox.GetAttributeString(element, "rect", "0,0,0,0"); @@ -2258,7 +1729,6 @@ namespace Barotrauma } } - public void CreateServerEvent(T ic) where T : ItemComponent, IServerSerializable { if (GameMain.Server == null) return; @@ -2268,17 +1738,7 @@ namespace Barotrauma GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.ComponentState, index }); } - - public void CreateClientEvent(T ic) where T : ItemComponent, IClientSerializable - { - if (GameMain.Client == null) return; - - int index = components.IndexOf(ic); - if (index == -1) return; - - GameMain.Client.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.ComponentState, index }); - } - + /// /// Remove the item so that it doesn't appear to exist in the game world (stop sounds, remove bodies etc) /// but don't reset anything that's required for cloning the item @@ -2330,6 +1790,5 @@ namespace Barotrauma } } } - } } \ No newline at end of file diff --git a/Barotrauma/Source/Items/ItemInventory.cs b/Barotrauma/BarotraumaShared/Source/Items/ItemInventory.cs similarity index 100% rename from Barotrauma/Source/Items/ItemInventory.cs rename to Barotrauma/BarotraumaShared/Source/Items/ItemInventory.cs diff --git a/Barotrauma/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs similarity index 87% rename from Barotrauma/Source/Items/ItemPrefab.cs rename to Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs index 8a154b5aa..ef7e8d130 100644 --- a/Barotrauma/Source/Items/ItemPrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs @@ -5,7 +5,6 @@ using System.Xml.Linq; using FarseerPhysics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; namespace Barotrauma { @@ -21,7 +20,7 @@ namespace Barotrauma } } - class ItemPrefab : MapEntityPrefab + partial class ItemPrefab : MapEntityPrefab { //static string contentFolder = "Content/Items/"; @@ -190,45 +189,6 @@ namespace Barotrauma } - public override void DrawPlacing(SpriteBatch spriteBatch,Camera cam) - { - Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub); - - if (PlayerInput.RightButtonClicked()) - { - selected = null; - return; - } - - if (!resizeHorizontal && !resizeVertical) - { - sprite.Draw(spriteBatch, new Vector2(position.X + sprite.size.X / 2.0f, -position.Y + sprite.size.Y / 2.0f), SpriteColor); - } - else - { - Vector2 placeSize = size; - - if (placePosition == Vector2.Zero) - { - if (PlayerInput.LeftButtonHeld()) placePosition = position; - } - else - { - if (resizeHorizontal) - placeSize.X = Math.Max(position.X - placePosition.X, size.X); - if (resizeVertical) - placeSize.Y = Math.Max(placePosition.Y - position.Y, size.Y); - - position = placePosition; - } - - if (sprite != null) sprite.DrawTiled(spriteBatch, new Vector2(position.X, -position.Y), placeSize, SpriteColor); - } - - //if (PlayerInput.GetMouseState.RightButton == ButtonState.Pressed) selected = null; - - } - public static void LoadAll(List filePaths) { DebugConsole.Log("Loading item prefabs: "); diff --git a/Barotrauma/Source/Items/RelatedItem.cs b/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs similarity index 100% rename from Barotrauma/Source/Items/RelatedItem.cs rename to Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs diff --git a/Barotrauma/Source/Map/Entity.cs b/Barotrauma/BarotraumaShared/Source/Map/Entity.cs similarity index 97% rename from Barotrauma/Source/Map/Entity.cs rename to Barotrauma/BarotraumaShared/Source/Map/Entity.cs index af8550373..2c265aaa5 100644 --- a/Barotrauma/Source/Map/Entity.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Entity.cs @@ -10,6 +10,10 @@ namespace Barotrauma class Entity { private static Dictionary dictionary = new Dictionary(); + public static List GetEntityList() + { + return dictionary.Values.ToList(); + } public static EntitySpawner Spawner; diff --git a/Barotrauma/Source/Map/EntityGrid.cs b/Barotrauma/BarotraumaShared/Source/Map/EntityGrid.cs similarity index 100% rename from Barotrauma/Source/Map/EntityGrid.cs rename to Barotrauma/BarotraumaShared/Source/Map/EntityGrid.cs diff --git a/Barotrauma/Source/Map/Explosion.cs b/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs similarity index 78% rename from Barotrauma/Source/Map/Explosion.cs rename to Barotrauma/BarotraumaShared/Source/Map/Explosion.cs index cb88f3a08..58c684c64 100644 --- a/Barotrauma/Source/Map/Explosion.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs @@ -1,5 +1,4 @@ using Microsoft.Xna.Framework; -using Barotrauma.Lights; using System; using System.Collections.Generic; using System.Xml.Linq; @@ -8,7 +7,7 @@ using FarseerPhysics; namespace Barotrauma { - class Explosion + partial class Explosion { private Attack attack; @@ -45,41 +44,11 @@ namespace Barotrauma { Hull hull = Hull.FindHull(worldPosition); - if (shockwave) - { - GameMain.ParticleManager.CreateParticle("shockwave", worldPosition, - Vector2.Zero, 0.0f, hull); - } - - for (int i = 0; i < attack.Range * 0.1f; i++) - { - Vector2 bubblePos = Rand.Vector(attack.Range * 0.5f); - GameMain.ParticleManager.CreateParticle("bubbles", worldPosition+bubblePos, - bubblePos, 0.0f, hull); - - if (sparks) - { - GameMain.ParticleManager.CreateParticle("spark", worldPosition, - Rand.Vector(Rand.Range(500.0f, 800.0f)), 0.0f, hull); - } - if (flames) - { - GameMain.ParticleManager.CreateParticle("explosionfire", ClampParticlePos(worldPosition + Rand.Vector(50f), hull), - Rand.Vector(Rand.Range(50.0f, 100.0f)), 0.0f, hull); - } - if (smoke) - { - GameMain.ParticleManager.CreateParticle("smoke", ClampParticlePos(worldPosition + Rand.Vector(50f), hull), - Rand.Vector(Rand.Range(1.0f, 10.0f)), 0.0f, hull); - } - } + ExplodeProjSpecific(worldPosition, hull); float displayRange = attack.Range; if (displayRange < 0.1f) return; - var light = new LightSource(worldPosition, displayRange, Color.LightYellow, null); - CoroutineManager.StartCoroutine(DimLight(light)); - float cameraDist = Vector2.Distance(GameMain.GameScreen.Cam.Position, worldPosition)/2.0f; GameMain.GameScreen.Cam.Shake = CameraShake * Math.Max((displayRange - cameraDist) / displayRange, 0.0f); @@ -111,6 +80,8 @@ namespace Barotrauma } + partial void ExplodeProjSpecific(Vector2 worldPosition, Hull hull); + private Vector2 ClampParticlePos(Vector2 particlePos, Hull hull) { if (hull == null) return particlePos; @@ -120,27 +91,6 @@ namespace Barotrauma MathHelper.Clamp(particlePos.Y, hull.WorldRect.Y - hull.WorldRect.Height, hull.WorldRect.Y)); } - - private IEnumerable DimLight(LightSource light) - { - float currBrightness = 1.0f; - float startRange = light.Range; - - while (light.Color.A > 0.0f) - { - light.Color = new Color(light.Color.R, light.Color.G, light.Color.B, currBrightness); - light.Range = startRange * currBrightness; - - currBrightness -= CoroutineManager.DeltaTime * 20.0f; - - yield return CoroutineStatus.Running; - } - - light.Remove(); - - yield return CoroutineStatus.Success; - } - public static void ApplyExplosionForces(Vector2 worldPosition, Attack attack, float force) { if (attack.Range <= 0.0f) return; diff --git a/Barotrauma/Source/Map/FireSource.cs b/Barotrauma/BarotraumaShared/Source/Map/FireSource.cs similarity index 77% rename from Barotrauma/Source/Map/FireSource.cs rename to Barotrauma/BarotraumaShared/Source/Map/FireSource.cs index 977355bed..887d98976 100644 --- a/Barotrauma/Source/Map/FireSource.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/FireSource.cs @@ -1,17 +1,17 @@ -using Barotrauma.Lights; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using Barotrauma.Networking; +#if CLIENT +using Barotrauma.Lights; +#endif namespace Barotrauma { - class FireSource + partial class FireSource { - static Sound fireSoundBasic, fireSoundLarge; - const float OxygenConsumption = 50.0f; const float GrowSpeed = 5.0f; @@ -19,8 +19,6 @@ namespace Barotrauma private Hull hull; - private LightSource lightSource; - private Vector2 position; private Vector2 size; @@ -73,21 +71,23 @@ namespace Barotrauma if (hull == null) return; if (!isNetworkMessage && GameMain.Client != null) return; - - if (fireSoundBasic == null) - { - fireSoundBasic = Sound.Load("Content/Sounds/fire.ogg", false); - fireSoundLarge = Sound.Load("Content/Sounds/firelarge.ogg", false); - } - + hull.AddFireSource(this); Submarine = hull.Submarine; this.position = worldPosition - new Vector2(-5.0f, 5.0f) - Submarine.Position; +#if CLIENT + if (fireSoundBasic == null) + { + fireSoundBasic = Sound.Load("Content/Sounds/fire.ogg", false); + fireSoundLarge = Sound.Load("Content/Sounds/firelarge.ogg", false); + } + lightSource = new LightSource(this.position, 50.0f, new Color(1.0f, 0.9f, 0.7f), hull == null ? null : hull.Submarine); - +#endif + size = new Vector2(10.0f, 10.0f); } @@ -140,71 +140,9 @@ namespace Barotrauma public void Update(float deltaTime) { - float count = Rand.Range(0.0f, size.X/50.0f); - - if (hull.FireSources.Any(fs => fs != this && fs.size.X > size.X)) - { - if (basicSoundIndex > 0) - { - Sounds.SoundManager.Stop(basicSoundIndex); - basicSoundIndex = -1; - } - if (largeSoundIndex > 0) - { - Sounds.SoundManager.Stop(largeSoundIndex); - largeSoundIndex = -1; - } - } - else - { - if (fireSoundBasic != null) - { - basicSoundIndex = fireSoundBasic.Loop(basicSoundIndex, - Math.Min(size.X / 100.0f, 1.0f), WorldPosition + size / 2.0f, 1000.0f); - - } - if (fireSoundLarge != null) - { - largeSoundIndex = fireSoundLarge.Loop(largeSoundIndex, - MathHelper.Clamp((size.X - 200.0f) / 100.0f, 0.0f, 1.0f), WorldPosition + size / 2.0f, 1000.0f); - } - } - //the firesource will start to shrink if oxygen percentage is below 10 float growModifier = Math.Min((hull.OxygenPercentage / 10.0f) - 1.0f, 1.0f); - for (int i = 0; i < count; i++) - { - Vector2 particlePos = new Vector2( - WorldPosition.X + Rand.Range(0.0f, size.X), - Rand.Range(WorldPosition.Y - size.Y, WorldPosition.Y + 20.0f)); - - Vector2 particleVel = new Vector2( - (particlePos.X - (WorldPosition.X + size.X / 2.0f)), - (float)Math.Sqrt(size.X) * Rand.Range(0.0f, 15.0f) * growModifier); - - var particle = GameMain.ParticleManager.CreateParticle("flame", - particlePos, particleVel, 0.0f, hull); - - if (particle == null) continue; - - //make some of the particles create another firesource when they enter another hull - if (Rand.Int(20) == 1) particle.OnChangeHull = OnChangeHull; - - particle.Size *= MathHelper.Clamp(size.X / 60.0f * Math.Max(hull.Oxygen / hull.FullVolume, 0.4f), 0.5f, 1.0f); - - if (Rand.Int(5) == 1) - { - var smokeParticle = GameMain.ParticleManager.CreateParticle("smoke", - particlePos, new Vector2(particleVel.X, particleVel.Y * 0.1f), 0.0f, hull); - - if (smokeParticle != null) - { - smokeParticle.Size *= MathHelper.Clamp(size.X / 100.0f * Math.Max(hull.Oxygen / hull.FullVolume, 0.4f), 0.5f, 1.0f); - } - } - } - DamageCharacters(deltaTime); DamageItems(deltaTime); @@ -224,15 +162,15 @@ namespace Barotrauma LimitSize(); - lightSource.Range = Math.Max(size.X, size.Y) * 10.0f / 2.0f; - lightSource.Color = new Color(1.0f, 0.45f, 0.3f) * Rand.Range(0.8f, 1.0f); - lightSource.Position = position + Vector2.UnitY * 30.0f; + UpdateProjSpecific(growModifier); if (GameMain.Client != null) return; if (size.X < 1.0f) Remove(); } + partial void UpdateProjSpecific(float growModifier); + private void OnChangeHull(Vector2 pos, Hull particleHull) { if (particleHull == hull || particleHull==null) return; @@ -294,6 +232,7 @@ namespace Barotrauma if (extinquishAmount < 0.0f) return; +#if CLIENT float steamCount = Rand.Range(-5.0f, Math.Min(extinquishAmount * 100.0f, 10)); for (int i = 0; i < steamCount; i++) { @@ -310,6 +249,7 @@ namespace Barotrauma particle.Size *= MathHelper.Clamp(size.X / 10.0f, 0.5f, 3.0f); } +#endif position.X += extinquishAmount / 2.0f; size.X -= extinquishAmount; @@ -322,7 +262,7 @@ namespace Barotrauma if (size.X < 1.0f) Remove(); } - public void Extinquish(float deltaTime, float amount, Vector2 pos) + public void Extinguish(float deltaTime, float amount, Vector2 pos) { float range = 100.0f; @@ -331,6 +271,7 @@ namespace Barotrauma float extinquishAmount = amount * deltaTime; +#if CLIENT float steamCount = Rand.Range(-5.0f, (float)Math.Sqrt(amount)); for (int i = 0; i < steamCount; i++) { @@ -345,6 +286,7 @@ namespace Barotrauma particle.Size *= MathHelper.Clamp(size.X / 10.0f, 0.5f, 3.0f); } +#endif position.X += extinquishAmount / 2.0f; size.X -= extinquishAmount; @@ -358,6 +300,7 @@ namespace Barotrauma public void Remove() { +#if CLIENT lightSource.Remove(); if (basicSoundIndex > 0) @@ -370,6 +313,7 @@ namespace Barotrauma Sounds.SoundManager.Stop(largeSoundIndex); largeSoundIndex = -1; } +#endif hull.RemoveFire(this); } diff --git a/Barotrauma/Source/Map/Gap.cs b/Barotrauma/BarotraumaShared/Source/Map/Gap.cs similarity index 88% rename from Barotrauma/Source/Map/Gap.cs rename to Barotrauma/BarotraumaShared/Source/Map/Gap.cs index f91af9527..5c968136d 100644 --- a/Barotrauma/Source/Map/Gap.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Gap.cs @@ -9,7 +9,7 @@ using Barotrauma.Items.Components; namespace Barotrauma { - class Gap : MapEntity + partial class Gap : MapEntity { public static List GapList = new List(); @@ -189,59 +189,7 @@ namespace Barotrauma } } - public override void Draw(SpriteBatch sb, bool editing, bool back = true) - { - if (GameMain.DebugDraw) - { - Vector2 center = new Vector2(WorldRect.X + rect.Width / 2.0f, -(WorldRect.Y - rect.Height/ 2.0f)); - - GUI.DrawLine(sb, center, center + new Vector2(flowForce.X, -flowForce.Y)/10.0f, Color.Red); - - GUI.DrawLine(sb, center + Vector2.One * 5.0f, center + new Vector2(lerpedFlowForce.X, -lerpedFlowForce.Y) / 10.0f + Vector2.One * 5.0f, Color.Orange); - } - - if (!editing || !ShowGaps) return; - - Color clr = (open == 0.0f) ? Color.Red : Color.Cyan; - if (isHighlighted) clr = Color.Gold; - - float depth = (ID % 255) * 0.000001f; - - GUI.DrawRectangle( - sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), - clr * 0.5f, true, - depth, - (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); - - for (int i = 0; i < linkedTo.Count; i++) - { - Vector2 dir = isHorizontal ? - new Vector2(Math.Sign(linkedTo[i].Rect.Center.X - rect.Center.X), 0.0f) - : new Vector2(0.0f, Math.Sign((linkedTo[i].Rect.Y - linkedTo[i].Rect.Height / 2.0f) - (rect.Y - rect.Height / 2.0f))); - - Vector2 arrowPos = new Vector2(WorldRect.Center.X, -(WorldRect.Y - WorldRect.Height / 2)); - arrowPos += new Vector2(dir.X * (WorldRect.Width / 2 + 10), dir.Y * (WorldRect.Height / 2 + 10)); - - GUI.Arrow.Draw(sb, - arrowPos, clr * 0.8f, - GUI.Arrow.Origin, MathUtils.VectorToAngle(dir) + MathHelper.PiOver2, - isHorizontal ? new Vector2(rect.Height / 16.0f, 1.0f) : new Vector2(rect.Width / 16.0f, 1.0f), - SpriteEffects.None, depth); - } - - if (IsSelected) - { - GUI.DrawRectangle(sb, - new Vector2(WorldRect.X - 5, -WorldRect.Y - 5), - new Vector2(rect.Width + 10, rect.Height + 10), - Color.Red, - false, - depth, - (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); - } - } - - public override void Update(Camera cam, float deltaTime) + public override void Update(float deltaTime, Camera cam) { flowForce = Vector2.Zero; @@ -275,11 +223,12 @@ namespace Barotrauma { pos.X += Math.Sign(flowForce.X); pos.Y = MathHelper.Clamp((higherSurface + lowerSurface) / 2.0f, rect.Y - rect.Height, rect.Y) + 10; - + Vector2 velocity = new Vector2( MathHelper.Clamp(flowForce.X, -5000.0f, 5000.0f) * Rand.Range(0.5f, 0.7f), flowForce.Y * Rand.Range(0.5f, 0.7f)); +#if CLIENT var particle = GameMain.ParticleManager.CreateParticle( "watersplash", (Submarine == null ? pos : pos + Submarine.Position) - Vector2.UnitY * Rand.Range(0.0f, 10.0f), @@ -289,16 +238,19 @@ namespace Barotrauma { particle.Size = particle.Size * Math.Min(Math.Abs(flowForce.X / 1000.0f), 5.0f); } +#endif if (Math.Abs(flowForce.X) > 300.0f) { pos.X += Math.Sign(flowForce.X) * 10.0f; pos.Y = Rand.Range(lowerSurface, rect.Y - rect.Height); +#if CLIENT GameMain.ParticleManager.CreateParticle( "bubbles", Submarine == null ? pos : pos + Submarine.Position, flowForce / 10.0f, 0, flowTargetHull); +#endif } } else @@ -314,6 +266,7 @@ namespace Barotrauma lerpedFlowForce.X * Rand.Range(0.5f, 0.7f), Math.Max(lerpedFlowForce.Y, -100.0f) * Rand.Range(0.5f, 0.7f)); +#if CLIENT var splash = GameMain.ParticleManager.CreateParticle( "watersplash", Submarine == null ? pos : pos + Submarine.Position, @@ -325,6 +278,7 @@ namespace Barotrauma "bubbles", Submarine == null ? pos : pos + Submarine.Position, flowForce / 2.0f, 0, FlowTargetHull); +#endif } } @@ -696,37 +650,7 @@ namespace Barotrauma { FindHulls(); } - - public override XElement Save(XElement parentElement) - { - XElement element = new XElement("Gap"); - - element.Add( - new XAttribute("ID", ID), - new XAttribute("horizontal", isHorizontal ? "true" : "false")); - - element.Add(new XAttribute("rect", - (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + - (int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," + - rect.Width + "," + rect.Height)); - - //if (linkedTo != null) - //{ - // int i = 0; - // foreach (Entity e in linkedTo) - // { - // if (e == null) continue; - // element.Add(new XAttribute("linkedto" + i, e.ID)); - // i += 1; - // } - //} - - parentElement.Add(element); - - return element; - } - - + public static void Load(XElement element, Submarine submarine) { Rectangle rect = Rectangle.Empty; diff --git a/Barotrauma/Source/Map/Hull.cs b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs similarity index 75% rename from Barotrauma/Source/Map/Hull.cs rename to Barotrauma/BarotraumaShared/Source/Map/Hull.cs index e92b77ad6..027bd704f 100644 --- a/Barotrauma/Source/Map/Hull.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs @@ -12,8 +12,7 @@ using Barotrauma.Networking; namespace Barotrauma { - - class Hull : MapEntity, IPropertyObject, IServerSerializable + partial class Hull : MapEntity, IPropertyObject, IServerSerializable { const float NetworkUpdateInterval = 0.5f; @@ -31,8 +30,6 @@ namespace Barotrauma public static bool EditWater, EditFire; - public static WaterRenderer renderer; - private List fireSources; public const float OxygenDistributionSpeed = 500.0f; @@ -64,11 +61,7 @@ namespace Barotrauma private bool update; public bool Visible = true; - - private Sound currentFlowSound; - private int soundIndex; - private float soundVolume; - + float[] waveY; //displacement from the surface of the water float[] waveVel; //velocity of the point @@ -288,23 +281,15 @@ namespace Barotrauma { if (grid.Submarine != submarine) continue; - rect.Location -= submarine.HiddenSubPosition.ToPoint(); + rect.Location -= MathUtils.ToPoint(submarine.HiddenSubPosition); grid.InsertEntity(this); - rect.Location += submarine.HiddenSubPosition.ToPoint(); + rect.Location += MathUtils.ToPoint(submarine.HiddenSubPosition); return; } } - public override bool IsMouseOn(Vector2 position) - { - if (!GameMain.DebugDraw && !ShowHulls) return false; - - return (Submarine.RectContains(WorldRect, position) && - !Submarine.RectContains(MathUtils.ExpandRect(WorldRect, -8), position)); - } - public int GetWaveIndex(Vector2 position) { return GetWaveIndex(position.X); @@ -350,11 +335,13 @@ namespace Barotrauma } fireSources.Clear(); +#if CLIENT if (soundIndex > -1) { Sounds.SoundManager.Stop(soundIndex); soundIndex = -1; } +#endif if (entityGrids != null) { @@ -383,11 +370,13 @@ namespace Barotrauma } fireSources.Clear(); +#if CLIENT if (soundIndex > -1) { Sounds.SoundManager.Stop(soundIndex); soundIndex = -1; } +#endif if (entityGrids != null) { @@ -405,7 +394,7 @@ namespace Barotrauma if (GameMain.Server != null) GameMain.Server.CreateEntityEvent(this); } - public override void Update(Camera cam, float deltaTime) + public override void Update(float deltaTime, Camera cam) { Oxygen -= OxygenDetoriationSpeed * deltaTime; @@ -458,7 +447,8 @@ namespace Barotrauma strongestFlow = gapFlow; } } - + +#if CLIENT if (strongestFlow > 1.0f) { soundVolume = soundVolume + ((strongestFlow < 100.0f) ? -deltaTime * 0.5f : deltaTime * 0.5f); @@ -487,6 +477,7 @@ namespace Barotrauma soundIndex = -1; } } +#endif //update client hulls if the amount of water has changed by >10% //or if oxygen percentage has changed by 5% @@ -517,6 +508,7 @@ namespace Barotrauma for (int i = 0; i < waveY.Length; i++) { float maxDelta = Math.Max(Math.Abs(rightDelta[i]), Math.Abs(leftDelta[i])); +#if CLIENT if (maxDelta > Rand.Range(1.0f,10.0f)) { var particlePos = new Vector2(rect.X + WaveWidth * i, surface + waveY[i]); @@ -526,6 +518,7 @@ namespace Barotrauma particlePos, new Vector2(0.0f, -50.0f), 0.0f, this); } +#endif waveY[i] = waveY[i] + waveVel[i]; @@ -595,11 +588,11 @@ namespace Barotrauma } } - public void Extinquish(float deltaTime, float amount, Vector2 position) + public void Extinguish(float deltaTime, float amount, Vector2 position) { for (int i = fireSources.Count - 1; i >= 0; i-- ) { - fireSources[i].Extinquish(deltaTime, amount, position); + fireSources[i].Extinguish(deltaTime, amount, position); } } @@ -637,160 +630,6 @@ namespace Barotrauma return connectedHulls; } - public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) - { - //if (back) return; - Rectangle drawRect; - if (!Visible) - { - drawRect = - Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height); - - GUI.DrawRectangle(spriteBatch, - new Vector2(drawRect.X, -drawRect.Y), - new Vector2(rect.Width, rect.Height), - Color.Black,true, - 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); - } - - if (!ShowHulls && !GameMain.DebugDraw) return; - - if (!editing && !GameMain.DebugDraw) return; - - if (aiTarget != null) aiTarget.Draw(spriteBatch); - - drawRect = - Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height); - - GUI.DrawRectangle(spriteBatch, - new Vector2(drawRect.X, -drawRect.Y), - new Vector2(rect.Width, rect.Height), - Color.Blue, false, (ID % 255) * 0.000001f, (int)Math.Max((1.5f / Screen.Selected.Cam.Zoom), 1.0f)); - - GUI.DrawRectangle(spriteBatch, - new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), - Color.Red * ((100.0f - OxygenPercentage) / 400.0f), true, 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); - - if (GameMain.DebugDraw) - { - GUI.SmallFont.DrawString(spriteBatch, "Pressure: " + ((int)pressure - rect.Y).ToString() + - " - Oxygen: " + ((int)OxygenPercentage), new Vector2(drawRect.X + 5, -drawRect.Y + 5), Color.White); - GUI.SmallFont.DrawString(spriteBatch, volume + " / " + FullVolume, new Vector2(drawRect.X + 5, -drawRect.Y + 20), Color.White); - - foreach (FireSource fs in fireSources) - { - GUI.DrawRectangle(spriteBatch, new Rectangle((int)fs.WorldPosition.X, (int)-fs.WorldPosition.Y, (int)fs.Size.X, (int)fs.Size.Y), Color.Orange, false); - } - } - - if ((IsSelected || isHighlighted) && editing) - { - GUI.DrawRectangle(spriteBatch, - new Vector2(drawRect.X + 5, -drawRect.Y + 5), - new Vector2(rect.Width - 10, rect.Height - 10), - isHighlighted ? Color.LightBlue * 0.5f : Color.Red * 0.5f, true, 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); - } - } - - public void Render(GraphicsDevice graphicsDevice, Camera cam) - { - if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return; - - Vector2 submarinePos = Submarine == null ? Vector2.Zero : Submarine.DrawPosition; - - //calculate where the surface should be based on the water volume - float top = rect.Y + submarinePos.Y; - float bottom = top - rect.Height; - - float drawSurface = surface + submarinePos.Y; - - Matrix transform = cam.Transform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f; - - if (bottom > cam.WorldView.Y || top < cam.WorldView.Y - cam.WorldView.Height) return; - - if (!update) - { - // create the four corners of our triangle. - - Vector3[] corners = new Vector3[4]; - - corners[0] = new Vector3(rect.X, rect.Y, 0.0f); - corners[1] = new Vector3(rect.X + rect.Width, rect.Y, 0.0f); - - corners[2] = new Vector3(corners[1].X, rect.Y-rect.Height, 0.0f); - corners[3] = new Vector3(corners[0].X, corners[2].Y, 0.0f); - - Vector2[] uvCoords = new Vector2[4]; - for (int i = 0; i < 4; i++ ) - { - corners[i] += new Vector3(submarinePos, 0.0f); - uvCoords[i] = Vector2.Transform(new Vector2(corners[i].X, -corners[i].Y), transform); - } - - renderer.vertices[renderer.PositionInBuffer] = new VertexPositionTexture(corners[0], uvCoords[0]); - renderer.vertices[renderer.PositionInBuffer + 1] = new VertexPositionTexture(corners[1], uvCoords[1]); - renderer.vertices[renderer.PositionInBuffer + 2] = new VertexPositionTexture(corners[2], uvCoords[2]); - - renderer.vertices[renderer.PositionInBuffer + 3] = new VertexPositionTexture(corners[0], uvCoords[0]); - renderer.vertices[renderer.PositionInBuffer + 4] = new VertexPositionTexture(corners[2], uvCoords[2]); - renderer.vertices[renderer.PositionInBuffer + 5] = new VertexPositionTexture(corners[3], uvCoords[3]); - - renderer.PositionInBuffer += 6; - - return; - } - - float x = rect.X + Submarine.DrawPosition.X; - int start = (int)Math.Floor((cam.WorldView.X - x) / WaveWidth); - start = Math.Max(start, 0); - - int end = (waveY.Length - 1) - - (int)Math.Floor((float)((x + rect.Width) - (cam.WorldView.X + cam.WorldView.Width)) / WaveWidth); - end = Math.Min(end, waveY.Length - 1); - - x += start * WaveWidth; - - for (int i = start; i < end; i++) - { - if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return; - - Vector3[] corners = new Vector3[4]; - - corners[0] = new Vector3(x, top, 0.0f); - corners[3] = new Vector3(corners[0].X, drawSurface + waveY[i], 0.0f); - - //skip adjacent "water rects" if the surface of the water is roughly at the same position - int width = WaveWidth; - while (i < end - 1 && Math.Abs(waveY[i + 1] - waveY[i]) < 1.0f) - { - width += WaveWidth; - i++; - } - - corners[1] = new Vector3(x + width, top, 0.0f); - corners[2] = new Vector3(corners[1].X, drawSurface + waveY[i + 1], 0.0f); - - Vector2[] uvCoords = new Vector2[4]; - for (int n = 0; n < 4; n++) - { - uvCoords[n] = Vector2.Transform(new Vector2(corners[n].X, -corners[n].Y), transform); - } - - renderer.vertices[renderer.PositionInBuffer] = new VertexPositionTexture(corners[0], uvCoords[0]); - renderer.vertices[renderer.PositionInBuffer + 1] = new VertexPositionTexture(corners[1], uvCoords[1]); - renderer.vertices[renderer.PositionInBuffer + 2] = new VertexPositionTexture(corners[2], uvCoords[2]); - - renderer.vertices[renderer.PositionInBuffer + 3] = new VertexPositionTexture(corners[0], uvCoords[0]); - renderer.vertices[renderer.PositionInBuffer + 4] = new VertexPositionTexture(corners[2], uvCoords[2]); - renderer.vertices[renderer.PositionInBuffer + 5] = new VertexPositionTexture(corners[3], uvCoords[3]); - - renderer.PositionInBuffer += 6; - - x += width; - } - - } - //returns the water block which contains the point (or null if it isn't inside any) public static Hull FindHull(Vector2 position, Hull guess = null, bool useWorldCoordinates = true) { @@ -956,25 +795,6 @@ namespace Barotrauma } } - public override XElement Save(XElement parentElement) - { - XElement element = new XElement("Hull"); - - element.Add - ( - new XAttribute("ID", ID), - new XAttribute("rect", - (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + - (int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," + - rect.Width + "," + rect.Height), - new XAttribute("water", volume) - ); - - parentElement.Add(element); - - return element; - } - public static void Load(XElement element, Submarine submarine) { Rectangle rect = Rectangle.Empty; diff --git a/Barotrauma/Source/Map/IDamageable.cs b/Barotrauma/BarotraumaShared/Source/Map/IDamageable.cs similarity index 100% rename from Barotrauma/Source/Map/IDamageable.cs rename to Barotrauma/BarotraumaShared/Source/Map/IDamageable.cs diff --git a/Barotrauma/Source/Map/Levels/CaveGenerator.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/CaveGenerator.cs similarity index 72% rename from Barotrauma/Source/Map/Levels/CaveGenerator.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/CaveGenerator.cs index 7941b69a7..ce744e8f7 100644 --- a/Barotrauma/Source/Map/Levels/CaveGenerator.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/CaveGenerator.cs @@ -13,7 +13,7 @@ using FarseerPhysics.Factories; namespace Barotrauma { - static class CaveGenerator + static partial class CaveGenerator { public static List CarveCave(List cells, Vector2 startPoint, out List newCells) { @@ -41,9 +41,9 @@ namespace Barotrauma { for (float y = edges.Y + siteInterval; y < edges.W - siteInterval; y += siteInterval) { - if (Rand.Int(5, false) == 0) continue; //skip some positions to make the cells more irregular + if (Rand.Int(5, Rand.RandSync.Server) == 0) continue; //skip some positions to make the cells more irregular - sites.Add(new Vector2(x, y) + Rand.Vector(siteVariance, false)); + sites.Add(new Vector2(x, y) + Rand.Vector(siteVariance, Rand.RandSync.Server)); } } @@ -126,10 +126,10 @@ namespace Barotrauma } //randomly pick one of the adjacent cells as the next cell - pathCell = allowedNextCells[Rand.Int(allowedNextCells.Count, false)]; + pathCell = allowedNextCells[Rand.Int(allowedNextCells.Count, Rand.RandSync.Server)]; //randomly take steps further away from the startpoint to make the cave expand further - if (Rand.Int(4, false) == 0) + if (Rand.Int(4, Rand.RandSync.Server) == 0) { float furthestDist = 0.0f; foreach (VoronoiCell nextCell in allowedNextCells) @@ -312,7 +312,7 @@ namespace Barotrauma } //steer towards target - if (Rand.Range(0.0f, 1.0f, false) > wanderAmount || allowedEdges.Count == 0) + if (Rand.Range(0.0f, 1.0f, Rand.RandSync.Server) > wanderAmount || allowedEdges.Count == 0) { for (int i = 0; i < currentCell.edges.Count; i++) { @@ -333,7 +333,7 @@ namespace Barotrauma //} //else //{ - edgeIndex = Rand.Int(allowedEdges.Count, false); + edgeIndex = Rand.Int(allowedEdges.Count, Rand.RandSync.Server); if (mirror && edgeIndex > 0) edgeIndex = allowedEdges.Count - edgeIndex; edgeIndex = currentCell.edges.IndexOf(allowedEdges[edgeIndex]); //} @@ -359,10 +359,10 @@ namespace Barotrauma return pathCells; } - - public static List GeneratePolygons(List cells, out List verticeList, bool setSolid=true) + + public static List GeneratePolygons(List cells, out List renderTriangles, bool setSolid=true) { - verticeList = new List(); + renderTriangles = null; var bodies = new List(); List tempVertices = new List(); @@ -395,20 +395,8 @@ namespace Barotrauma continue; } - var triangles = MathUtils.TriangulateConvexHull(tempVertices, cell.Center); - for (int i = 0; i < triangles.Count; i++) - { - foreach (Vector2 vertex in triangles[i]) - { - //shift the coordinates around a bit to make the texture repetition less obvious - Vector2 uvCoords = new Vector2( - vertex.X / 2000.0f + (float)Math.Sin(vertex.X / 500.0f) * 0.15f, - vertex.Y / 2000.0f + (float)Math.Sin(vertex.Y / 700.0f) * 0.15f); - - verticeList.Add(new VertexPositionTexture(new Vector3(vertex, 1.0f), uvCoords)); - } - } - + renderTriangles = MathUtils.TriangulateConvexHull(tempVertices, cell.Center); + if (bodyPoints.Count < 2) continue; if (bodyPoints.Count < 3) @@ -430,7 +418,7 @@ namespace Barotrauma if (cell.CellType == CellType.Empty) continue; - triangles = MathUtils.TriangulateConvexHull(bodyPoints, ConvertUnits.ToSimUnits(cell.Center)); + var triangles = MathUtils.TriangulateConvexHull(bodyPoints, ConvertUnits.ToSimUnits(cell.Center)); Body cellBody = new Body(GameMain.World); @@ -458,135 +446,6 @@ namespace Barotrauma return bodies; } - public static VertexPositionTexture[] GenerateWallShapes(List cells) - { - float inwardThickness = 500.0f, outWardThickness = 30.0f; - - List verticeList = new List(); - - foreach (VoronoiCell cell in cells) - { - //if (cell.body == null) continue; - foreach (GraphEdge edge in cell.edges) - { - if (edge.cell1 != null && edge.cell1.body == null && edge.cell1.CellType != CellType.Empty) edge.cell1 = null; - if (edge.cell2 != null && edge.cell2.body == null && edge.cell2.CellType != CellType.Empty) edge.cell2 = null; - - CompareCCW compare = new CompareCCW(cell.Center); - if (compare.Compare(edge.point1, edge.point2) == -1) - { - var temp = edge.point1; - edge.point1 = edge.point2; - edge.point2 = temp; - } - } - } - - foreach (VoronoiCell cell in cells) - { - //if (cell.body == null) continue; - foreach (GraphEdge edge in cell.edges) - { - if (!edge.isSolid) continue; - - GraphEdge leftEdge = cell.edges.Find(e => e != edge && (edge.point1 == e.point1 || edge.point1 == e.point2)); - GraphEdge rightEdge = cell.edges.Find(e => e != edge && (edge.point2 == e.point1 || edge.point2 == e.point2)); - - Vector2 leftNormal = Vector2.Zero, rightNormal = Vector2.Zero; - - if (leftEdge == null) - { - leftNormal = GetEdgeNormal(edge, cell); - } - else - { - leftNormal = (leftEdge.isSolid) ? - Vector2.Normalize(GetEdgeNormal(leftEdge) + GetEdgeNormal(edge, cell)) : - Vector2.Normalize(leftEdge.Center - edge.point1); - } - - - if (!MathUtils.IsValid(leftNormal)) - { -#if DEBUG - DebugConsole.ThrowError("Invalid left normal"); -#endif - if (cell.body != null) - { - GameMain.World.RemoveBody(cell.body); - cell.body = null; - } - leftNormal = Vector2.UnitX; - break; - } - - - if (rightEdge == null) - { - rightNormal = GetEdgeNormal(edge, cell); - } - else - { - rightNormal = (rightEdge.isSolid) ? - Vector2.Normalize(GetEdgeNormal(rightEdge) + GetEdgeNormal(edge, cell)) : - Vector2.Normalize(rightEdge.Center - edge.point2); - } - - if (!MathUtils.IsValid(rightNormal)) - { -#if DEBUG - DebugConsole.ThrowError("Invalid right normal"); -#endif - if (cell.body != null) - { - GameMain.World.RemoveBody(cell.body); - cell.body = null; - } - rightNormal = Vector2.UnitX; - break; - } - - for (int i = 0; i < 2; i++) - { - Vector2[] verts = new Vector2[3]; - VertexPositionTexture[] vertPos = new VertexPositionTexture[3]; - - - if (i == 0) - { - verts[0] = edge.point1 - leftNormal * outWardThickness; - verts[1] = edge.point2 - rightNormal * outWardThickness; - verts[2] = edge.point1 + leftNormal * inwardThickness; - - vertPos[0] = new VertexPositionTexture(new Vector3(verts[0], 0.0f), Vector2.Zero); - vertPos[1] = new VertexPositionTexture(new Vector3(verts[1], 0.0f), Vector2.UnitX); - vertPos[2] = new VertexPositionTexture(new Vector3(verts[2], 0.0f), new Vector2(0, 0.5f)); - } - else - { - verts[0] = edge.point1 + leftNormal * inwardThickness; - verts[1] = edge.point2 - rightNormal * outWardThickness; - verts[2] = edge.point2 + rightNormal * inwardThickness; - - vertPos[0] = new VertexPositionTexture(new Vector3(verts[0], 0.0f), new Vector2(0.0f, 0.5f)); - vertPos[1] = new VertexPositionTexture(new Vector3(verts[1], 0.0f), Vector2.UnitX); - vertPos[2] = new VertexPositionTexture(new Vector3(verts[2], 0.0f), new Vector2(1.0f, 0.5f)); - } - - var comparer = new CompareCCW((verts[0] + verts[1] + verts[2]) / 3.0f); - Array.Sort(verts, vertPos, comparer); - - for (int j = 0; j < 3; j++) - { - verticeList.Add(vertPos[j]); - } - } - } - } - - return verticeList.ToArray(); - } - /// /// find the index of the cell which the point is inside /// (actually finds the cell whose center is closest, but it's always the correct cell assuming the point is inside the borders of the diagram) diff --git a/Barotrauma/Source/Map/Levels/Level.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs similarity index 92% rename from Barotrauma/Source/Map/Levels/Level.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs index ee672d5db..d9fe04fde 100644 --- a/Barotrauma/Source/Map/Levels/Level.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs @@ -14,8 +14,7 @@ using Barotrauma.RuinGeneration; namespace Barotrauma { - - class Level + partial class Level { public const float ShaftHeight = 1000.0f; @@ -44,8 +43,6 @@ namespace Barotrauma static Level loaded; - private LevelRenderer renderer; - //how close the sub has to be to start/endposition to exit public const float ExitDistance = 6000.0f; @@ -151,12 +148,12 @@ namespace Barotrauma { if (seed == "") { - seed = Rand.Range(0, int.MaxValue, false).ToString(); + seed = Rand.Range(0, int.MaxValue, Rand.RandSync.Server).ToString(); } Rand.SetSyncedSeed(ToolBox.StringToInt(seed)); - return new Level(seed, Rand.Range(30.0f, 80.0f, false), LevelGenerationParams.GetRandom(seed)); + return new Level(seed, Rand.Range(30.0f, 80.0f, Rand.RandSync.Server), LevelGenerationParams.GetRandom(seed)); } public void Generate(bool mirror = false) @@ -168,9 +165,7 @@ namespace Barotrauma loaded = this; positionsOfInterest = new List(); - - renderer = new LevelRenderer(this); - + Voronoi voronoi = new Voronoi(1.0); List sites = new List(); @@ -178,10 +173,14 @@ namespace Barotrauma bodies = new List(); Rand.SetSyncedSeed(ToolBox.StringToInt(seed)); - + +#if CLIENT + renderer = new LevelRenderer(this); + backgroundColor = generationParams.BackgroundColor; float avgValue = (backgroundColor.R + backgroundColor.G + backgroundColor.G) / 3; GameMain.LightManager.AmbientLight = new Color(backgroundColor * (10.0f / avgValue), 1.0f); +#endif float minWidth = 6500.0f; if (Submarine.MainSub != null) @@ -191,12 +190,12 @@ namespace Barotrauma } startPosition = new Vector2( - Rand.Range(minWidth, minWidth * 2, false), - Rand.Range(borders.Height * 0.5f, borders.Height - minWidth * 2, false)); + Rand.Range(minWidth, minWidth * 2, Rand.RandSync.Server), + Rand.Range(borders.Height * 0.5f, borders.Height - minWidth * 2, Rand.RandSync.Server)); endPosition = new Vector2( - borders.Width - Rand.Range(minWidth, minWidth * 2, false), - Rand.Range(borders.Height * 0.5f, borders.Height - minWidth * 2, false)); + borders.Width - Rand.Range(minWidth, minWidth * 2, Rand.RandSync.Server), + Rand.Range(borders.Height * 0.5f, borders.Height - minWidth * 2, Rand.RandSync.Server)); List pathNodes = new List(); Rectangle pathBorders = borders;// new Rectangle((int)minWidth, (int)minWidth, borders.Width - (int)minWidth * 2, borders.Height - (int)minWidth); @@ -206,11 +205,11 @@ namespace Barotrauma Vector2 nodeInterval = generationParams.MainPathNodeIntervalRange; - for (float x = startPosition.X + Rand.Range(nodeInterval.X, nodeInterval.Y, false); - x < endPosition.X - Rand.Range(nodeInterval.X, nodeInterval.Y, false); - x += Rand.Range(nodeInterval.X, nodeInterval.Y, false)) + for (float x = startPosition.X + Rand.Range(nodeInterval.X, nodeInterval.Y, Rand.RandSync.Server); + x < endPosition.X - Rand.Range(nodeInterval.X, nodeInterval.Y, Rand.RandSync.Server); + x += Rand.Range(nodeInterval.X, nodeInterval.Y, Rand.RandSync.Server)) { - pathNodes.Add(new Vector2(x, Rand.Range(pathBorders.Y, pathBorders.Bottom, false))); + pathNodes.Add(new Vector2(x, Rand.Range(pathBorders.Y, pathBorders.Bottom, Rand.RandSync.Server))); } pathNodes.Add(new Vector2(endPosition.X, borders.Height)); @@ -223,17 +222,17 @@ namespace Barotrauma List> smallTunnels = new List>(); for (int i = 0; i < generationParams.SmallTunnelCount; i++) { - var tunnelStartPos = pathNodes[Rand.Range(2, pathNodes.Count - 2, false)]; + var tunnelStartPos = pathNodes[Rand.Range(2, pathNodes.Count - 2, Rand.RandSync.Server)]; tunnelStartPos.X = MathHelper.Clamp(tunnelStartPos.X, pathBorders.X, pathBorders.Right); float tunnelLength = Rand.Range( generationParams.SmallTunnelLengthRange.X, generationParams.SmallTunnelLengthRange.Y, - false); + Rand.RandSync.Server); var tunnelNodes = MathUtils.GenerateJaggedLine( tunnelStartPos, - new Vector2(tunnelStartPos.X, pathBorders.Bottom)+Rand.Vector(tunnelLength,false), + new Vector2(tunnelStartPos.X, pathBorders.Bottom)+Rand.Vector(tunnelLength, Rand.RandSync.Server), 4, 1000.0f); List tunnel = new List(); @@ -253,8 +252,8 @@ namespace Barotrauma for (float y = siteInterval.Y / 2; y < borders.Height; y += siteInterval.Y) { Vector2 site = new Vector2( - x + Rand.Range(-siteVariance.X, siteVariance.X, false), - y + Rand.Range(-siteVariance.Y, siteVariance.Y, false)); + x + Rand.Range(-siteVariance.X, siteVariance.X, Rand.RandSync.Server), + y + Rand.Range(-siteVariance.Y, siteVariance.Y, Rand.RandSync.Server)); if (smallTunnels.Any(t => t.Any(node => Vector2.Distance(node, site) < siteInterval.Length()))) { @@ -360,7 +359,7 @@ namespace Barotrauma int maxTries = 5, tries = 0; while (tries cellsWithBody = new List(cells); - - List bodyVertices; - bodies = CaveGenerator.GeneratePolygons(cellsWithBody, out bodyVertices); + + List triangles; + bodies = CaveGenerator.GeneratePolygons(cellsWithBody, out triangles); + +#if CLIENT + List bodyVertices = CaveGenerator.GenerateRenderVerticeList(triangles); renderer.SetBodyVertices(bodyVertices.ToArray()); renderer.SetWallVertices(CaveGenerator.GenerateWallShapes(cells)); renderer.PlaceSprites(generationParams.BackgroundSpriteAmount); - +#endif + ShaftBody = BodyFactory.CreateEdge(GameMain.World, ConvertUnits.ToSimUnits(new Vector2(borders.X, 0)), ConvertUnits.ToSimUnits(new Vector2(borders.Right, 0))); @@ -496,7 +499,7 @@ namespace Barotrauma List toBeRemoved = new List(); foreach (VoronoiCell cell in cells) { - if (Rand.Range(0.0f, 1.0f, false) > holeProbability) continue; + if (Rand.Range(0.0f, 1.0f, Rand.RandSync.Server) > holeProbability) continue; if (!limits.Contains(cell.Center)) continue; @@ -664,10 +667,10 @@ namespace Barotrauma private void GenerateRuin(List mainPath) { - Vector2 ruinSize = new Vector2(Rand.Range(5000.0f, 8000.0f, false), Rand.Range(5000.0f, 8000.0f, false)); + Vector2 ruinSize = new Vector2(Rand.Range(5000.0f, 8000.0f, Rand.RandSync.Server), Rand.Range(5000.0f, 8000.0f, Rand.RandSync.Server)); float ruinRadius = Math.Max(ruinSize.X, ruinSize.Y) * 0.5f; - Vector2 ruinPos = cells[Rand.Int(cells.Count, false)].Center; + Vector2 ruinPos = cells[Rand.Int(cells.Count, Rand.RandSync.Server)].Center; int iter = 0; @@ -712,7 +715,7 @@ namespace Barotrauma } } - var ruin = new Ruin(closestPathCell, cells, new Rectangle((ruinPos - ruinSize * 0.5f).ToPoint(), ruinSize.ToPoint())); + var ruin = new Ruin(closestPathCell, cells, new Rectangle(MathUtils.ToPoint(ruinPos - ruinSize * 0.5f), MathUtils.ToPoint(ruinSize))); ruins.Add(ruin); ruin.RuinShapes.Sort((shape1, shape2) => shape2.DistanceFromEntrance.CompareTo(shape1.DistanceFromEntrance)); @@ -761,7 +764,7 @@ namespace Barotrauma { Vector2 startPos = Level.Loaded.GetRandomInterestingPosition(true, spawnPosType, true); - startPos += Rand.Vector(Rand.Range(0.0f, randomSpread, false), false); + startPos += Rand.Vector(Rand.Range(0.0f, randomSpread, Rand.RandSync.Server), Rand.RandSync.Server); Vector2 endPos = startPos - Vector2.UnitY * Size.Y; @@ -803,10 +806,10 @@ namespace Barotrauma if (!matchingPositions.Any()) { - return positionsOfInterest[Rand.Int(positionsOfInterest.Count, !useSyncedRand)].Position; + return positionsOfInterest[Rand.Int(positionsOfInterest.Count, (useSyncedRand ? Rand.RandSync.Server : Rand.RandSync.Unsynced))].Position; } - return matchingPositions[Rand.Int(matchingPositions.Count, !useSyncedRand)].Position; + return matchingPositions[Rand.Int(matchingPositions.Count, (useSyncedRand ? Rand.RandSync.Server : Rand.RandSync.Unsynced))].Position; } public void Update(float deltaTime) @@ -817,50 +820,14 @@ namespace Barotrauma WrappingWall.UpdateWallShift(Submarine.MainSub.WorldPosition, wrappingWalls); }*/ +#if CLIENT if (Hull.renderer != null) { Hull.renderer.ScrollWater((float)deltaTime); } renderer.Update(deltaTime); - } - - public void DrawFront(SpriteBatch spriteBatch) - { - if (renderer == null) return; - renderer.Draw(spriteBatch); - - if (GameMain.DebugDraw) - { - foreach (InterestingPosition pos in positionsOfInterest) - { - Color color = Color.Yellow; - if (pos.PositionType == PositionType.Cave) - { - color = Color.DarkOrange; - } - else if (pos.PositionType == PositionType.Ruin) - { - color = Color.LightGray; - } - - - GUI.DrawRectangle(spriteBatch, new Vector2(pos.Position.X-15.0f, -pos.Position.Y-15.0f), new Vector2(30.0f, 30.0f), color, true); - } - } - } - - public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundSpriteManager = null) - { - float brightness = MathHelper.Clamp(50.0f + (cam.Position.Y - Size.Y) / 2000.0f, 10.0f, 40.0f); - - float avgValue = (backgroundColor.R + backgroundColor.G + backgroundColor.G) / 3; - GameMain.LightManager.AmbientLight = new Color(backgroundColor * (brightness / avgValue), 1.0f); - - graphics.Clear(backgroundColor); - - if (renderer == null) return; - renderer.DrawBackground(spriteBatch, cam, backgroundSpriteManager); +#endif } public List GetCells(Vector2 pos, int searchDepth = 2) @@ -910,11 +877,13 @@ namespace Barotrauma private void Unload() { +#if CLIENT if (renderer!=null) { renderer.Dispose(); renderer = null; } +#endif if (ruins != null) { diff --git a/Barotrauma/Source/Map/Levels/LevelGenerationParams.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/LevelGenerationParams.cs similarity index 98% rename from Barotrauma/Source/Map/Levels/LevelGenerationParams.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/LevelGenerationParams.cs index e55ea1242..f9f33e5d9 100644 --- a/Barotrauma/Source/Map/Levels/LevelGenerationParams.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/LevelGenerationParams.cs @@ -144,7 +144,7 @@ namespace Barotrauma return new LevelGenerationParams(null); } - return presets[Rand.Range(0, presets.Count, false)]; + return presets[Rand.Range(0, presets.Count, Rand.RandSync.Server)]; } private LevelGenerationParams(XElement element) diff --git a/Barotrauma/Source/Map/Levels/Ruins/BTRoom.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/BTRoom.cs similarity index 96% rename from Barotrauma/Source/Map/Levels/Ruins/BTRoom.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/BTRoom.cs index ec494c04b..4b9cdef63 100644 --- a/Barotrauma/Source/Map/Levels/Ruins/BTRoom.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/BTRoom.cs @@ -46,7 +46,7 @@ namespace Barotrauma.RuinGeneration { subRooms = new BTRoom[2]; - if (Rand.Range(0.0f, 1.0f, false) < verticalProbability && + if (Rand.Range(0.0f, 1.0f, Rand.RandSync.Server) < verticalProbability && rect.Width * minDivRatio >= minWidth) { SplitVertical(minDivRatio); @@ -65,7 +65,7 @@ namespace Barotrauma.RuinGeneration private void SplitHorizontal(float minDivRatio) { - float div = Rand.Range(minDivRatio, 1.0f - minDivRatio, false); + float div = Rand.Range(minDivRatio, 1.0f - minDivRatio, Rand.RandSync.Server); subRooms[0] = new BTRoom(new Rectangle(rect.X, rect.Y, rect.Width, (int)(rect.Height * div))); subRooms[1] = new BTRoom(new Rectangle(rect.X, rect.Y + subRooms[0].rect.Height, rect.Width, rect.Height - subRooms[0].rect.Height)); @@ -73,7 +73,7 @@ namespace Barotrauma.RuinGeneration private void SplitVertical(float minDivRatio) { - float div = Rand.Range(minDivRatio, 1.0f - minDivRatio, false); + float div = Rand.Range(minDivRatio, 1.0f - minDivRatio, Rand.RandSync.Server); subRooms[0] = new BTRoom(new Rectangle(rect.X, rect.Y, (int)(rect.Width * div), rect.Height)); subRooms[1] = new BTRoom(new Rectangle(rect.X + subRooms[0].rect.Width, rect.Y, rect.Width - subRooms[0].rect.Width, rect.Height)); } @@ -118,7 +118,7 @@ namespace Barotrauma.RuinGeneration { if (Adjacent != null && Corridor == null) { - Corridor = new Corridor(this, Rand.Range(minWidth, maxWidth, false), corridors); + Corridor = new Corridor(this, Rand.Range(minWidth, maxWidth, Rand.RandSync.Server), corridors); } if (subRooms != null) diff --git a/Barotrauma/Source/Map/Levels/Ruins/Corridor.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/Corridor.cs similarity index 95% rename from Barotrauma/Source/Map/Levels/Ruins/Corridor.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/Corridor.cs index 48e086267..0131fb698 100644 --- a/Barotrauma/Source/Map/Levels/Ruins/Corridor.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/Corridor.cs @@ -72,7 +72,7 @@ namespace Barotrauma.RuinGeneration int top = Math.Max(room1.Y, room2.Y); int bottom = Math.Min(room1.Bottom, room2.Bottom); - int yPos = Rand.Range(top, bottom - width, false); + int yPos = Rand.Range(top, bottom - width, Rand.RandSync.Server); rect = new Rectangle(left, yPos, right - left, width); } @@ -84,7 +84,7 @@ namespace Barotrauma.RuinGeneration int top = Math.Min(room1.Bottom, room2.Bottom); int bottom = Math.Max(room1.Y, room2.Y); - int xPos = Rand.Range(left, right - width, false); + int xPos = Rand.Range(left, right - width, Rand.RandSync.Server); rect = new Rectangle(xPos, top, width, bottom - top); } @@ -146,8 +146,8 @@ namespace Barotrauma.RuinGeneration /// private BTRoom[] GetSuitableLeafRooms(List leaves1, List leaves2, int width, bool isHorizontal) { - int iOffset = Rand.Int(leaves1.Count, false); - int jOffset = Rand.Int(leaves2.Count, false); + int iOffset = Rand.Int(leaves1.Count, Rand.RandSync.Server); + int jOffset = Rand.Int(leaves2.Count, Rand.RandSync.Server); for (int iCount = 0; iCount < leaves1.Count; iCount++) diff --git a/Barotrauma/Source/Map/Levels/Ruins/RuinGenerator.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinGenerator.cs similarity index 90% rename from Barotrauma/Source/Map/Levels/Ruins/RuinGenerator.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinGenerator.cs index 62f81759b..8b439b67f 100644 --- a/Barotrauma/Source/Map/Levels/Ruins/RuinGenerator.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinGenerator.cs @@ -139,24 +139,24 @@ namespace Barotrauma.RuinGeneration } } - struct Line + struct Line + { + public readonly Vector2 A, B; + + public readonly RuinStructureType Type; + + public Line(Vector2 a, Vector2 b, RuinStructureType type) { - public readonly Vector2 A, B; + Debug.Assert(a.X <= b.X); + Debug.Assert(a.Y <= b.Y); - public readonly RuinStructureType Type; + A = a; + B = b; + Type = type; + } + } - public Line(Vector2 a, Vector2 b, RuinStructureType type) - { - Debug.Assert(a.X <= b.X); - Debug.Assert(a.Y <= b.Y); - - A = a; - B = b; - Type = type; - } - } - - class Ruin + partial class Ruin { private List rooms; private List corridors; @@ -202,9 +202,9 @@ namespace Barotrauma.RuinGeneration //area = new Rectangle(area.X, area.Y - area.Height, area.Width, area.Height); - int iterations = Rand.Range(3, 4, false); + int iterations = Rand.Range(3, 4, Rand.RandSync.Server); - float verticalProbability = Rand.Range(0.4f, 0.6f, false); + float verticalProbability = Rand.Range(0.4f, 0.6f, Rand.RandSync.Server); BTRoom baseRoom = new BTRoom(area); @@ -221,7 +221,7 @@ namespace Barotrauma.RuinGeneration { leaf.Scale ( - new Vector2(Rand.Range(0.5f, 0.9f, false), Rand.Range(0.5f, 0.9f, false)) + new Vector2(Rand.Range(0.5f, 0.9f, Rand.RandSync.Server), Rand.Range(0.5f, 0.9f, Rand.RandSync.Server)) ); } @@ -304,7 +304,7 @@ namespace Barotrauma.RuinGeneration wallType = RuinStructureType.CorridorWall; } //rooms further from the entrance are more likely to have hard-to-break walls - else if (Rand.Range(0.0f, leaf.DistanceFromEntrance, false) > 1.5f) + else if (Rand.Range(0.0f, leaf.DistanceFromEntrance, Rand.RandSync.Server) > 1.5f) { wallType = RuinStructureType.HeavyWall; } @@ -352,28 +352,28 @@ namespace Barotrauma.RuinGeneration { Alignment[] alignments = new Alignment[] { Alignment.Top, Alignment.Bottom, Alignment.Right, Alignment.Left, Alignment.Center }; - var prop = RuinStructure.GetRandom(RuinStructureType.Prop, alignments[Rand.Int(alignments.Length, false)]); + var prop = RuinStructure.GetRandom(RuinStructureType.Prop, alignments[Rand.Int(alignments.Length, Rand.RandSync.Server)]); Vector2 size = (prop.Prefab is StructurePrefab) ? ((StructurePrefab)prop.Prefab).Size : Vector2.Zero; - var shape = shapes[Rand.Int(shapes.Count, false)]; + var shape = shapes[Rand.Int(shapes.Count, Rand.RandSync.Server)]; Vector2 position = shape.Rect.Center.ToVector2(); if (prop.Alignment.HasFlag(Alignment.Top)) { - position = new Vector2(Rand.Range(shape.Rect.X+size.X, shape.Rect.Right - size.X, false), shape.Rect.Bottom - 64); + position = new Vector2(Rand.Range(shape.Rect.X+size.X, shape.Rect.Right - size.X, Rand.RandSync.Server), shape.Rect.Bottom - 64); } else if (prop.Alignment.HasFlag(Alignment.Bottom)) { - position = new Vector2(Rand.Range(shape.Rect.X + size.X, shape.Rect.Right - size.X, false), shape.Rect.Top + 64); + position = new Vector2(Rand.Range(shape.Rect.X + size.X, shape.Rect.Right - size.X, Rand.RandSync.Server), shape.Rect.Top + 64); } else if (prop.Alignment.HasFlag(Alignment.Right)) { - position = new Vector2(shape.Rect.Right - 64, Rand.Range(shape.Rect.Y + size.X, shape.Rect.Bottom - size.Y, false)); + position = new Vector2(shape.Rect.Right - 64, Rand.Range(shape.Rect.Y + size.X, shape.Rect.Bottom - size.Y, Rand.RandSync.Server)); } else if (prop.Alignment.HasFlag(Alignment.Left)) { - position = new Vector2(shape.Rect.X + 64, Rand.Range(shape.Rect.Y + size.X, shape.Rect.Bottom - size.Y, false)); + position = new Vector2(shape.Rect.X + 64, Rand.Range(shape.Rect.Y + size.X, shape.Rect.Bottom - size.Y, Rand.RandSync.Server)); } if (prop.Prefab is ItemPrefab) @@ -410,7 +410,7 @@ namespace Barotrauma.RuinGeneration Vector2 doorPos = corridor.Center; //choose a random wall to place the door next to - var wall = suitableWalls[Rand.Int(suitableWalls.Count, false)]; + var wall = suitableWalls[Rand.Int(suitableWalls.Count, Rand.RandSync.Server)]; if (corridor.IsHorizontal) { doorPos.X = (wall.A.X + wall.B.X) / 2.0f; @@ -423,7 +423,7 @@ namespace Barotrauma.RuinGeneration var door = new Item(doorPrefab.Prefab as ItemPrefab, doorPos, null); door.MoveWithLevel = true; - door.GetComponent().IsOpen = Rand.Range(0.0f, 1.0f, false) < 0.8f; + door.GetComponent().IsOpen = Rand.Range(0.0f, 1.0f, Rand.RandSync.Server) < 0.8f; if (sensorPrefab == null || wirePrefab == null) continue; @@ -431,8 +431,8 @@ namespace Barotrauma.RuinGeneration if (sensorRoom == null) continue; var sensor = new Item(sensorPrefab, new Vector2( - Rand.Range(sensorRoom.Rect.X, sensorRoom.Rect.Right, false), - Rand.Range(sensorRoom.Rect.Y, sensorRoom.Rect.Bottom,false)), null); + Rand.Range(sensorRoom.Rect.X, sensorRoom.Rect.Right, Rand.RandSync.Server), + Rand.Range(sensorRoom.Rect.Y, sensorRoom.Rect.Bottom, Rand.RandSync.Server)), null); sensor.MoveWithLevel = true; var wire = new Item(wirePrefab, sensorRoom.Center, null).GetComponent(); @@ -449,24 +449,5 @@ namespace Barotrauma.RuinGeneration return shapes; } - - public void Draw(SpriteBatch spriteBatch) - { - //foreach (BTRoom room in leaves) - //{ - // GUI.DrawRectangle(spriteBatch, room.Rect, Color.White); - //} - - //foreach (Corridor corr in corridors) - //{ - // GUI.DrawRectangle(spriteBatch, corr.Rect, Color.Blue); - //} - - foreach (Line line in walls) - { - GUI.DrawLine(spriteBatch, new Vector2(line.A.X, -line.A.Y), new Vector2(line.B.X, -line.B.Y), Color.Red, 0.0f, 10); - } - } - } } diff --git a/Barotrauma/Source/Map/Levels/Ruins/RuinStructure.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinStructure.cs similarity index 97% rename from Barotrauma/Source/Map/Levels/Ruins/RuinStructure.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinStructure.cs index cf16af530..dd0b8143e 100644 --- a/Barotrauma/Source/Map/Levels/Ruins/RuinStructure.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinStructure.cs @@ -84,7 +84,7 @@ namespace Barotrauma.RuinGeneration int totalCommonness = matchingStructures.Sum(m => m.commonness); - int randomNumber = Rand.Int(totalCommonness + 1, false); + int randomNumber = Rand.Int(totalCommonness + 1, Rand.RandSync.Server); foreach (RuinStructure ruinStructure in matchingStructures) { diff --git a/Barotrauma/Source/Map/Levels/Voronoi.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Voronoi.cs similarity index 100% rename from Barotrauma/Source/Map/Levels/Voronoi.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/Voronoi.cs diff --git a/Barotrauma/Source/Map/Levels/VoronoiElements.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/VoronoiElements.cs similarity index 100% rename from Barotrauma/Source/Map/Levels/VoronoiElements.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/VoronoiElements.cs diff --git a/Barotrauma/Source/Map/Levels/WrappingWall.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/WrappingWall.cs similarity index 84% rename from Barotrauma/Source/Map/Levels/WrappingWall.cs rename to Barotrauma/BarotraumaShared/Source/Map/Levels/WrappingWall.cs index 1433c97ea..d4f98fc46 100644 --- a/Barotrauma/Source/Map/Levels/WrappingWall.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/WrappingWall.cs @@ -10,12 +10,10 @@ using Voronoi2; namespace Barotrauma { - class WrappingWall : IDisposable + partial class WrappingWall : IDisposable { public const float WallWidth = 20000.0f; - private VertexBuffer wallVertices, bodyVertices; - private Vector2 midPos; private int slot; @@ -23,16 +21,6 @@ namespace Barotrauma private List cells; - public VertexBuffer WallVertices - { - get { return wallVertices; } - } - - public VertexBuffer BodyVertices - { - get { return bodyVertices; } - } - public Vector2 Offset { get { return offset; } @@ -80,7 +68,7 @@ namespace Barotrauma float normalizedDist = distFromEdge / (WallWidth / 2); float variance = 1000.0f * normalizedDist; - bottomVertices.Add(center + new Vector2(Rand.Range(-variance, variance, false), Rand.Range(-variance, variance, false)*2.0f)); + bottomVertices.Add(center + new Vector2(Rand.Range(-variance, variance, Rand.RandSync.Server), Rand.Range(-variance, variance, Rand.RandSync.Server) *2.0f)); } for (int i = 1; i < bottomVertices.Count; i++) @@ -110,20 +98,7 @@ namespace Barotrauma cells.Add(wallCell); } } - - public void SetWallVertices(VertexPositionTexture[] vertices) - { - wallVertices = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly); - wallVertices.SetData(vertices); - } - - public void SetBodyVertices(VertexPositionColor[] vertices) - { - bodyVertices = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColor.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly); - bodyVertices.SetData(vertices); - } - - + public static void UpdateWallShift(Vector2 pos, WrappingWall[,] walls) { if (pos.X < walls[0, 1].midPos.X && walls[0,0].midPos.X > pos.X) @@ -186,6 +161,7 @@ namespace Barotrauma protected virtual void Dispose(bool disposing) { +#if CLIENT if (wallVertices != null) { wallVertices.Dispose(); @@ -196,6 +172,7 @@ namespace Barotrauma bodyVertices.Dispose(); bodyVertices = null; } +#endif } } } diff --git a/Barotrauma/Source/Map/LinkedSubmarine.cs b/Barotrauma/BarotraumaShared/Source/Map/LinkedSubmarine.cs similarity index 50% rename from Barotrauma/Source/Map/LinkedSubmarine.cs rename to Barotrauma/BarotraumaShared/Source/Map/LinkedSubmarine.cs index f3bc5d9f4..04d8e65ec 100644 --- a/Barotrauma/Source/Map/LinkedSubmarine.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/LinkedSubmarine.cs @@ -1,7 +1,6 @@ using Barotrauma.Items.Components; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using System; using System.Collections.Generic; using System.IO; @@ -12,8 +11,7 @@ using System.Xml.Linq; namespace Barotrauma { - - class LinkedSubmarinePrefab : MapEntityPrefab + partial class LinkedSubmarinePrefab : MapEntityPrefab { public readonly Submarine mainSub; @@ -30,7 +28,7 @@ namespace Barotrauma } } - class LinkedSubmarine : MapEntity + partial class LinkedSubmarine : MapEntity { private List wallVertices; @@ -106,142 +104,6 @@ namespace Barotrauma return Vector2.Distance(position, WorldPosition) < 50.0f; } - public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) - { - if (!editing || wallVertices == null) return; - - Color color = (isHighlighted) ? Color.Orange : Color.Green; - if (IsSelected) color = Color.Red; - - Vector2 pos = Position; - - for (int i = 0; i < wallVertices.Count; i++) - { - Vector2 startPos = wallVertices[i] + pos; - startPos.Y = -startPos.Y; - - Vector2 endPos = wallVertices[(i + 1) % wallVertices.Count] + pos; - endPos.Y = -endPos.Y; - - GUI.DrawLine(spriteBatch, - startPos, - endPos, - color, 0.0f, 5); - } - - pos.Y = -pos.Y; - GUI.DrawLine(spriteBatch, pos + Vector2.UnitY * 50.0f, pos - Vector2.UnitY * 50.0f, color, 0.0f, 5); - GUI.DrawLine(spriteBatch, pos + Vector2.UnitX * 50.0f, pos - Vector2.UnitX * 50.0f, color, 0.0f, 5); - - Rectangle drawRect = rect; - drawRect.Y = -rect.Y; - GUI.DrawRectangle(spriteBatch, drawRect, Color.Red, true); - - foreach (MapEntity e in linkedTo) - { - GUI.DrawLine(spriteBatch, - new Vector2(WorldPosition.X, -WorldPosition.Y), - new Vector2(e.WorldPosition.X, -e.WorldPosition.Y), - Color.Red * 0.3f); - } - } - - public override void UpdateEditing(Camera cam) - { - if (editingHUD == null || editingHUD.UserData as LinkedSubmarine != this) - { - editingHUD = CreateEditingHUD(); - } - - editingHUD.Update((float)Timing.Step); - - if (!PlayerInput.LeftButtonClicked() || !PlayerInput.KeyDown(Keys.Space)) return; - - Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition); - - foreach (MapEntity entity in mapEntityList) - { - if (entity == this || !entity.IsHighlighted || !(entity is Item) || !entity.IsMouseOn(position)) continue; - if (((Item)entity).GetComponent() == null) continue; - if (linkedTo.Contains(entity)) - { - linkedTo.Remove(entity); - } - else - { - linkedTo.Add(entity); - } - } - } - - public override void DrawEditing(SpriteBatch spriteBatch, Camera cam) - { - if (editingHUD == null) return; - - editingHUD.Draw(spriteBatch); - } - - - private GUIComponent CreateEditingHUD(bool inGame = false) - { - int width = 450; - int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10; - - editingHUD = new GUIFrame(new Rectangle(x, y, width, 100), ""); - editingHUD.Padding = new Vector4(10, 10, 0, 0); - editingHUD.UserData = this; - - new GUITextBlock(new Rectangle(0, 0, 100, 20), "Linked submarine", "", - Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont); - - var pathBox = new GUITextBox(new Rectangle(10,30,300,20), "", editingHUD); - pathBox.Font = GUI.SmallFont; - pathBox.Text = filePath; - - var reloadButton = new GUIButton(new Rectangle(320,30,80,20), "Refresh", "", editingHUD); - reloadButton.OnClicked = Reload; - reloadButton.UserData = pathBox; - - reloadButton.ToolTip = "Reload the linked submarine from the specified file"; - - y += 20; - - if (!inGame) - { - new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to a docking port", - "", Alignment.TopRight, Alignment.TopRight, editingHUD, false, GUI.SmallFont); - y += 25; - - } - return editingHUD; - } - - private bool Reload(GUIButton button, object obj) - { - var pathBox = obj as GUITextBox; - - if (!File.Exists(pathBox.Text)) - { - new GUIMessageBox("Error", "Submarine file \"" + pathBox.Text + "\" not found!"); - pathBox.Flash(Color.Red); - pathBox.Text = filePath; - return false; - } - - XDocument doc = Submarine.OpenFile(pathBox.Text); - if (doc == null || doc.Root == null) return false; - - pathBox.Flash(Color.Green); - - GenerateWallVertices(doc.Root); - saveElement = doc.Root; - saveElement.Name = "LinkedSubmarine"; - - filePath = pathBox.Text; - - return true; - } - private void GenerateWallVertices(XElement rootElement) { List points = new List(); @@ -267,87 +129,6 @@ namespace Barotrauma wallVertices = MathUtils.GiftWrap(points); } - public override XElement Save(XElement parentElement) - { - XElement saveElement = null; - - if (sub == null) - { - if (this.saveElement == null) - { - var doc = Submarine.OpenFile(filePath); - saveElement = doc.Root; - - saveElement.Name = "LinkedSubmarine"; - - saveElement.Add(new XAttribute("filepath", filePath)); - } - else - { - saveElement = this.saveElement; - } - - if (saveElement.Attribute("pos") != null) saveElement.Attribute("pos").Remove(); - saveElement.Add(new XAttribute("pos", ToolBox.Vector2ToString(Position - Submarine.HiddenSubPosition))); - - - - var linkedPort = linkedTo.FirstOrDefault(lt => (lt is Item) && ((Item)lt).GetComponent() != null); - if (linkedPort != null) - { - if (saveElement.Attribute("linkedto") != null) saveElement.Attribute("linkedto").Remove(); - - saveElement.Add(new XAttribute("linkedto", linkedPort.ID)); - } - } - else - { - - saveElement = new XElement("LinkedSubmarine"); - - - sub.SaveToXElement(saveElement); - } - - if (sub != null) - { - bool leaveBehind = false; - if (!sub.DockedTo.Contains(Submarine.MainSub)) - { - System.Diagnostics.Debug.Assert(Submarine.MainSub.AtEndPosition || Submarine.MainSub.AtStartPosition); - if (Submarine.MainSub.AtEndPosition) - { - leaveBehind = sub.AtEndPosition != Submarine.MainSub.AtEndPosition; - } - else - { - leaveBehind = sub.AtStartPosition != Submarine.MainSub.AtStartPosition; - } - } - - - if (leaveBehind) - { - saveElement.SetAttributeValue("location", Level.Loaded.Seed); - saveElement.SetAttributeValue("worldpos", ToolBox.Vector2ToString(sub.SubBody.Position)); - - } - else - { - if (saveElement.Attribute("location") != null) saveElement.Attribute("location").Remove(); - if (saveElement.Attribute("worldpos") != null) saveElement.Attribute("worldpos").Remove(); - } - - saveElement.SetAttributeValue("pos", ToolBox.Vector2ToString(Position - Submarine.HiddenSubPosition)); - } - - - - parentElement.Add(saveElement); - - return saveElement; - } - public static void Load(XElement element, Submarine submarine) { Vector2 pos = ToolBox.GetAttributeVector2(element, "pos", Vector2.Zero); @@ -375,7 +156,7 @@ namespace Barotrauma linkedSub.loadSub = true; - linkedSub.rect.Location = pos.ToPoint(); + linkedSub.rect.Location = MathUtils.ToPoint(pos); } linkedSub.filePath = ToolBox.GetAttributeString(element, "filepath", ""); diff --git a/Barotrauma/Source/Map/Map/Location.cs b/Barotrauma/BarotraumaShared/Source/Map/Map/Location.cs similarity index 89% rename from Barotrauma/Source/Map/Map/Location.cs rename to Barotrauma/BarotraumaShared/Source/Map/Map/Location.cs index 5b3b193c2..6bbdc3522 100644 --- a/Barotrauma/Source/Map/Map/Location.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Map/Location.cs @@ -3,8 +3,7 @@ using System.Collections.Generic; namespace Barotrauma { - - class Location + partial class Location { private string name; @@ -12,8 +11,6 @@ namespace Barotrauma private LocationType type; - private HireManager hireManager; - public List Connections; public string Name @@ -33,11 +30,6 @@ namespace Barotrauma get { return type; } } - public HireManager HireManager - { - get { return hireManager; } - } - public Location(Vector2 mapPosition) { this.type = LocationType.Random(); @@ -46,11 +38,13 @@ namespace Barotrauma this.mapPosition = mapPosition; +#if CLIENT if (type.HasHireableCharacters) { hireManager = new HireManager(); hireManager.GenerateCharacters(this, HireManager.MaxAvailableCharacters); } +#endif Connections = new List(); } @@ -63,7 +57,7 @@ namespace Barotrauma private string RandomName(LocationType type) { string randomName = ToolBox.GetRandomLine("Content/Map/locationNames.txt"); - int nameFormatIndex = Rand.Int(type.NameFormats.Count, false); + int nameFormatIndex = Rand.Int(type.NameFormats.Count, Rand.RandSync.Server); return type.NameFormats[nameFormatIndex].Replace("[name]", randomName); } } diff --git a/Barotrauma/Source/Map/Map/LocationType.cs b/Barotrauma/BarotraumaShared/Source/Map/Map/LocationType.cs similarity index 98% rename from Barotrauma/Source/Map/Map/LocationType.cs rename to Barotrauma/BarotraumaShared/Source/Map/Map/LocationType.cs index 2fd6dc864..f34f1e2e6 100644 --- a/Barotrauma/Source/Map/Map/LocationType.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Map/LocationType.cs @@ -116,7 +116,7 @@ namespace Barotrauma Rand.SetSyncedSeed(ToolBox.StringToInt(seed)); } - int randInt = Rand.Int(totalWeight, false); + int randInt = Rand.Int(totalWeight, Rand.RandSync.Server); foreach (LocationType type in list) { diff --git a/Barotrauma/Source/Map/Map/Map.cs b/Barotrauma/BarotraumaShared/Source/Map/Map/Map.cs similarity index 52% rename from Barotrauma/Source/Map/Map/Map.cs rename to Barotrauma/BarotraumaShared/Source/Map/Map/Map.cs index f54bf631a..4157e85e0 100644 --- a/Barotrauma/Source/Map/Map/Map.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Map/Map.cs @@ -8,9 +8,9 @@ using Voronoi2; namespace Barotrauma { - class Map + partial class Map { - Vector2 difficultyIncrease = new Vector2(5.0f,10.0f); + Vector2 difficultyIncrease = new Vector2(5.0f, 10.0f); Vector2 difficultyCutoff = new Vector2(80.0f, 100.0f); private List levels; @@ -18,14 +18,10 @@ namespace Barotrauma private List locations; private List connections; - + private string seed; private int size; - private static Sprite iceTexture; - private static Texture2D iceCraters; - private static Texture2D iceCrack; - private Location currentLocation; private Location selectedLocation; @@ -70,12 +66,12 @@ namespace Barotrauma string discoveredStr = ToolBox.GetAttributeString(element, "discovered", ""); string[] discoveredStrs = discoveredStr.Split(','); - for (int i = 0; i < discoveredStrs.Length; i++ ) + for (int i = 0; i < discoveredStrs.Length; i++) { int index = -1; if (int.TryParse(discoveredStrs[i], out index)) map.locations[index].Discovered = true; } - + string passedStr = ToolBox.GetAttributeString(element, "passed", ""); string[] passedStrs = passedStr.Split(','); for (int i = 0; i < passedStrs.Length; i++) @@ -83,7 +79,7 @@ namespace Barotrauma int index = -1; if (int.TryParse(passedStrs[i], out index)) map.connections[index].Passed = true; } - + return map; } @@ -99,17 +95,19 @@ namespace Barotrauma connections = new List(); +#if CLIENT if (iceTexture == null) iceTexture = new Sprite("Content/Map/iceSurface.png", Vector2.Zero); if (iceCraters == null) iceCraters = TextureLoader.FromFile("Content/Map/iceCraters.png"); if (iceCrack == null) iceCrack = TextureLoader.FromFile("Content/Map/iceCrack.png"); - +#endif + Rand.SetSyncedSeed(ToolBox.StringToInt(this.seed)); GenerateLocations(); currentLocation = locations[locations.Count / 2]; currentLocation.Discovered = true; - GenerateDifficulties(currentLocation, new List (connections), 10.0f); + GenerateDifficulties(currentLocation, new List(connections), 10.0f); foreach (LocationConnection connection in connections) { @@ -124,11 +122,11 @@ namespace Barotrauma List sites = new List(); for (int i = 0; i < 50; i++) { - sites.Add(new Vector2(Rand.Range(0.0f, size, false), Rand.Range(0.0f, size, false))); + sites.Add(new Vector2(Rand.Range(0.0f, size, Rand.RandSync.Server), Rand.Range(0.0f, size, Rand.RandSync.Server))); } - + List edges = voronoi.MakeVoronoiGraph(sites, size, size); - + sites.Clear(); foreach (GraphEdge edge in edges) { @@ -143,14 +141,14 @@ namespace Barotrauma Location[] newLocations = new Location[2]; newLocations[0] = locations.Find(l => l.MapPosition == edge.point1 || l.MapPosition == edge.point2); newLocations[1] = locations.Find(l => l != newLocations[0] && (l.MapPosition == edge.point1 || l.MapPosition == edge.point2)); - + for (int i = 0; i < 2; i++) { if (newLocations[i] != null) continue; Vector2[] points = new Vector2[] { edge.point1, edge.point2 }; - int positionIndex = Rand.Int(1, false); + int positionIndex = Rand.Int(1, Rand.RandSync.Server); Vector2 position = points[positionIndex]; if (newLocations[1 - i] != null && newLocations[1 - i].MapPosition == position) position = points[1 - positionIndex]; @@ -182,11 +180,11 @@ namespace Barotrauma } } - foreach (LocationConnection connection in connections) - { - connection.Locations[0].Connections.Add(connection); - connection.Locations[1].Connections.Add(connection); - } + foreach (LocationConnection connection in connections) + { + connection.Locations[0].Connections.Add(connection); + connection.Locations[1].Connections.Add(connection); + } for (int i = connections.Count - 1; i >= 0; i--) { @@ -194,12 +192,12 @@ namespace Barotrauma LocationConnection connection = connections[i]; - for (int n = Math.Min(i - 1,connections.Count - 1); n >= 0; n--) + for (int n = Math.Min(i - 1, connections.Count - 1); n >= 0; n--) { if (connection.Locations.Contains(connections[n].Locations[0]) && connection.Locations.Contains(connections[n].Locations[1])) { - connections.RemoveAt(n); + connections.RemoveAt(n); } } } @@ -217,9 +215,9 @@ namespace Barotrauma private void GenerateDifficulties(Location start, List locations, float currDifficulty) { //start.Difficulty = currDifficulty; - currDifficulty += Rand.Range(difficultyIncrease.X, difficultyIncrease.Y, false); - if (currDifficulty > Rand.Range(difficultyCutoff.X, difficultyCutoff.Y, false)) currDifficulty = 10.0f; - + currDifficulty += Rand.Range(difficultyIncrease.X, difficultyIncrease.Y, Rand.RandSync.Server); + if (currDifficulty > Rand.Range(difficultyCutoff.X, difficultyCutoff.Y, Rand.RandSync.Server)) currDifficulty = 10.0f; + foreach (LocationConnection connection in start.Connections) { if (!locations.Contains(connection)) continue; @@ -228,7 +226,7 @@ namespace Barotrauma locations.Remove(connection); connection.Difficulty = currDifficulty; - + GenerateDifficulties(nextLocation, locations, currDifficulty); } } @@ -253,199 +251,6 @@ namespace Barotrauma currentLocation = locations[index]; currentLocation.Discovered = true; } - - public void Update(float deltaTime, Rectangle rect, float scale = 1.0f) - { - Vector2 rectCenter = new Vector2(rect.Center.X, rect.Center.Y); - Vector2 offset = -currentLocation.MapPosition; - - float maxDist = 20.0f; - float closestDist = 0.0f; - highlightedLocation = null; - for (int i = 0; i < locations.Count; i++) - { - Location location = locations[i]; - Vector2 pos = rectCenter + (location.MapPosition + offset) * scale; - - if (!rect.Contains(pos)) continue; - - float dist = Vector2.Distance(PlayerInput.MousePosition, pos); - if (dist < maxDist && (highlightedLocation == null || dist < closestDist)) - { - closestDist = dist; - highlightedLocation = location; - } - } - - foreach (LocationConnection connection in connections) - { - if (highlightedLocation != currentLocation && - connection.Locations.Contains(highlightedLocation) && connection.Locations.Contains(currentLocation)) - { - if (PlayerInput.LeftButtonClicked() && - selectedLocation != highlightedLocation && highlightedLocation != null) - { - selectedConnection = connection; - selectedLocation = highlightedLocation; - GameMain.LobbyScreen.SelectLocation(highlightedLocation, connection); - } - } - } - } - - public void Draw(SpriteBatch spriteBatch, Rectangle rect, float scale = 1.0f) - { - Vector2 rectCenter = new Vector2(rect.Center.X, rect.Center.Y); - Vector2 offset = -currentLocation.MapPosition; - - iceTexture.DrawTiled(spriteBatch, new Vector2(rect.X, rect.Y), new Vector2(rect.Width, rect.Height), Vector2.Zero, Color.White*0.8f); - - foreach (LocationConnection connection in connections) - { - Color crackColor = Color.White * Math.Max(connection.Difficulty/100.0f, 1.5f); - - if (selectedLocation != currentLocation && - (connection.Locations.Contains(selectedLocation) && connection.Locations.Contains(currentLocation))) - { - crackColor = Color.Red; - } - else if (highlightedLocation != currentLocation && - (connection.Locations.Contains(highlightedLocation) && connection.Locations.Contains(currentLocation))) - { - crackColor = Color.Red * 0.5f; - } - else if (!connection.Passed) - { - crackColor *= 0.2f; - } - - for (int i = 0; i < connection.CrackSegments.Count; i++ ) - { - var segment = connection.CrackSegments[i]; - - Vector2 start = rectCenter + (segment[0] + offset) * scale; - Vector2 end = rectCenter + (segment[1] + offset) * scale; - - if (!rect.Contains(start) && !rect.Contains(end)) - { - continue; - } - else - { - Vector2? intersection = MathUtils.GetLineRectangleIntersection(start, end, new Rectangle(rect.X, rect.Y + rect.Height, rect.Width, rect.Height)); - if (intersection != null) - { - if (!rect.Contains(start)) - { - start = (Vector2)intersection; - } - else - { - end = (Vector2)intersection; - } - } - } - - float dist = Vector2.Distance(start, end); - - int width = (int)(MathHelper.Clamp(connection.Difficulty, 2.0f, 20.0f) * scale); - - spriteBatch.Draw(iceCrack, - new Rectangle((int)start.X, (int)start.Y, (int)dist + 2, width), - new Rectangle(0, 0, iceCrack.Width, 60), crackColor, MathUtils.VectorToAngle(end - start), - new Vector2(0, 30), SpriteEffects.None, 0.01f); - } - } - - rect.Inflate(8, 8); - GUI.DrawRectangle(spriteBatch, rect, Color.Black, false, 0.0f, 8); - GUI.DrawRectangle(spriteBatch, rect, Color.LightGray); - - for (int i = 0; i < locations.Count; i++) - { - Location location = locations[i]; - Vector2 pos = rectCenter + (location.MapPosition + offset) * scale; - - Rectangle drawRect = location.Type.Sprite.SourceRect; - Rectangle sourceRect = drawRect; - drawRect.X = (int)pos.X - drawRect.Width/2; - drawRect.Y = (int)pos.Y - drawRect.Width/2; - - if (!rect.Intersects(drawRect)) continue; - - Color color = location.Connections.Find(c => c.Locations.Contains(currentLocation))==null ? Color.White : Color.Green; - - color *= (location.Discovered) ? 0.8f : 0.2f; - - if (location == currentLocation) color = Color.Orange; - - if (drawRect.X < rect.X) - { - sourceRect.X += rect.X - drawRect.X; - sourceRect.Width -= sourceRect.X; - drawRect.X = rect.X; - } - else if (drawRect.Right > rect.Right) - { - sourceRect.Width -= (drawRect.Right - rect.Right); - } - - if (drawRect.Y < rect.Y) - { - sourceRect.Y += rect.Y - drawRect.Y; - sourceRect.Height -= sourceRect.Y; - drawRect.Y = rect.Y; - } - else if (drawRect.Bottom > rect.Bottom) - { - sourceRect.Height -= drawRect.Bottom - rect.Bottom; - } - - drawRect.Width = sourceRect.Width; - drawRect.Height = sourceRect.Height; - - spriteBatch.Draw(location.Type.Sprite.Texture, drawRect, sourceRect, color); - } - - for (int i = 0; i < 3; i++ ) - { - Location location = (i == 0) ? highlightedLocation : selectedLocation; - if (i == 2) location = currentLocation; - - if (location == null) continue; - - Vector2 pos = rectCenter + (location.MapPosition + offset) * scale; - pos.X = (int)(pos.X + location.Type.Sprite.SourceRect.Width*0.6f); - pos.Y = (int)(pos.Y - 10); - GUI.DrawString(spriteBatch, pos, location.Name, Color.White, Color.Black * 0.8f, 3); - } - - } - - public void Save(XElement element) - { - XElement mapElement = new XElement("map"); - - mapElement.Add(new XAttribute("currentlocation", CurrentLocationIndex)); - mapElement.Add(new XAttribute("seed", Seed)); - mapElement.Add(new XAttribute("size", size)); - - List discoveredLocations = new List(); - for (int i = 0; i < locations.Count; i++ ) - { - if (locations[i].Discovered) discoveredLocations.Add(i); - } - mapElement.Add(new XAttribute("discovered", string.Join(",", discoveredLocations))); - - List passedConnections = new List(); - for (int i = 0; i < connections.Count; i++) - { - if (connections[i].Passed) passedConnections.Add(i); - } - mapElement.Add(new XAttribute("passed", string.Join(",", passedConnections))); - - element.Add(mapElement); - } } diff --git a/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs b/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs new file mode 100644 index 000000000..1d56baa95 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs @@ -0,0 +1,390 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml.Linq; +using FarseerPhysics; +using Microsoft.Xna.Framework; +//using Microsoft.Xna.Framework.Graphics; +using System.Collections.ObjectModel; +using Barotrauma.Items.Components; + +namespace Barotrauma +{ + abstract partial class MapEntity : Entity + { + public static List mapEntityList = new List(); + + private MapEntityPrefab prefab; + + protected List linkedToID; + + //observable collection because some entities may need to be notified when the collection is modified + public ObservableCollection linkedTo; + + //protected float soundRange; + //protected float sightRange; + + public bool MoveWithLevel + { + get; + set; + } + + //the position and dimensions of the entity + protected Rectangle rect; + + //is the mouse inside the rect + protected bool isHighlighted; + + public bool IsHighlighted + { + get { return isHighlighted; } + set { isHighlighted = value; } + } + + private static bool resizing; + private int resizeDirX, resizeDirY; + + public virtual Rectangle Rect { + get { return rect; } + set { rect = value; } + } + + public Rectangle WorldRect + { + get { return Submarine == null ? rect : new Rectangle((int)(Submarine.Position.X + rect.X), (int)(Submarine.Position.Y + rect.Y), rect.Width, rect.Height); } + } + + public virtual Sprite Sprite + { + get { return null; } + } + + public virtual bool DrawBelowWater + { + get + { + return Sprite != null && Sprite.Depth > 0.5f; + } + } + + public virtual bool DrawOverWater + { + get + { + return !DrawBelowWater; + } + } + + public virtual bool DrawDamageEffect + { + get + { + return false; + } + } + + public virtual bool IsLinkable + { + get { return false; } + } + + public virtual bool SelectableInEditor + { + get { return true; } + } + + public override Vector2 Position + { + get + { + Vector2 rectPos = new Vector2( + rect.X + rect.Width / 2.0f, + rect.Y - rect.Height / 2.0f); + + //if (MoveWithLevel) rectPos += Level.Loaded.Position; + return rectPos; + } + } + + public override Vector2 SimPosition + { + get + { + return ConvertUnits.ToSimUnits(Position); + } + } + + public float SoundRange + { + get + { + if (aiTarget == null) return 0.0f; + return aiTarget.SoundRange; + } + set + { + if (aiTarget == null) return; + aiTarget.SoundRange = value; + } + } + + public float SightRange + { + get + { + if (aiTarget == null) return 0.0f; + return aiTarget.SightRange; + } + set { aiTarget.SightRange = value; } + } + + public virtual string Name + { + get { return ""; } + } + + public MapEntity(MapEntityPrefab prefab, Submarine submarine) : base(submarine) + { + this.prefab = prefab; + } + + public virtual void Move(Vector2 amount) + { + rect.X += (int)amount.X; + rect.Y += (int)amount.Y; + } + + public virtual bool IsMouseOn(Vector2 position) + { + return (Submarine.RectContains(WorldRect, position)); + } + + public virtual MapEntity Clone() + { + throw new NotImplementedException(); + } + + public static List Clone(List entitiesToClone) + { + List clones = new List(); + foreach (MapEntity e in entitiesToClone) + { + Debug.Assert(e != null); + clones.Add(e.Clone()); + Debug.Assert(clones.Last() != null); + } + + Debug.Assert(clones.Count == entitiesToClone.Count); + + //clone links between the entities + for (int i = 0; i < clones.Count; i++) + { + if (entitiesToClone[i].linkedTo == null) continue; + foreach (MapEntity linked in entitiesToClone[i].linkedTo) + { + if (!entitiesToClone.Contains(linked)) continue; + + clones[i].linkedTo.Add(clones[entitiesToClone.IndexOf(linked)]); + } + } + + //connect clone wires to the clone items + for (int i = 0; i < clones.Count; i++) + { + var cloneItem = clones[i] as Item; + if (cloneItem == null) continue; + + var cloneWire = cloneItem.GetComponent(); + if (cloneWire == null) continue; + + var originalWire = ((Item)entitiesToClone[i]).GetComponent(); + + cloneWire.SetNodes(originalWire.GetNodes()); + + for (int n = 0; n < 2; n++) + { + if (originalWire.Connections[n] == null) continue; + + var connectedItem = originalWire.Connections[n].Item; + if (connectedItem == null) continue; + + //index of the item the wire is connected to + int itemIndex = entitiesToClone.IndexOf(connectedItem); + //index of the connection in the connectionpanel of the target item + int connectionIndex = connectedItem.Connections.IndexOf(originalWire.Connections[n]); + + (clones[itemIndex] as Item).GetComponent().Connections[connectionIndex].TryAddLink(cloneWire); + cloneWire.Connect((clones[itemIndex] as Item).Connections[connectionIndex], false); + + } + } + + return clones; + } + + protected void InsertToList() + { + int i = 0; + + if (Sprite==null) + { + mapEntityList.Add(this); + return; + } + + while (i + /// Remove the entity from the entity list without removing links to other entities + /// + public virtual void ShallowRemove() + { + base.Remove(); + + mapEntityList.Remove(this); + + if (aiTarget != null) aiTarget.Remove(); + } + + public override void Remove() + { + base.Remove(); + + mapEntityList.Remove(this); + +#if CLIENT + if (selectedList.Contains(this)) + { + selectedList = selectedList.FindAll(e => e != this); + } +#endif + + if (aiTarget != null) aiTarget.Remove(); + + if (linkedTo != null) + { + for (int i = linkedTo.Count - 1; i >= 0; i-- ) + { + linkedTo[i].RemoveLinked(this); + } + linkedTo.Clear(); + } + } + + /// + /// Call Update() on every object in Entity.list + /// + public static void UpdateAll(float deltaTime, Camera cam) + { + foreach (Hull hull in Hull.hullList) + { + hull.Update(deltaTime, cam); + } + + foreach (Gap gap in Gap.GapList) + { + gap.Update(deltaTime, cam); + } + + foreach (Item item in Item.ItemList) + { + item.Update(deltaTime, cam); + } + + Spawner?.Update(); + } + + public virtual void Update(float deltaTime, Camera cam) { } + + public virtual void FlipX() + { + if (Submarine == null) + { + DebugConsole.ThrowError("Couldn't flip MapEntity \""+Name+"\", submarine==null"); + return; + } + + Vector2 relative = WorldPosition - Submarine.WorldPosition; + relative.Y = 0.0f; + + Move(-relative * 2.0f); + } + + /// + /// Update the linkedTo-lists of the entities based on the linkedToID-lists + /// Has to be done after all the entities have been loaded (an entity can't + /// be linked to some other entity that hasn't been loaded yet) + /// + public static void MapLoaded(Submarine sub) + { + foreach (MapEntity e in mapEntityList) + { + if (e.Submarine != sub) continue; + if (e.linkedToID == null) continue; + if (e.linkedToID.Count == 0) continue; + + e.linkedTo.Clear(); + + foreach (ushort i in e.linkedToID) + { + MapEntity linked = FindEntityByID(i) as MapEntity; + + if (linked != null) e.linkedTo.Add(linked); + } + } + + List linkedSubs = new List(); + + for (int i = 0; i list = new List(); @@ -152,7 +151,7 @@ namespace Barotrauma if (Submarine.MainSub != null) { - newRect.Location -= Submarine.MainSub.Position.ToPoint(); + newRect.Location -= MathUtils.ToPoint(Submarine.MainSub.Position); } if (PlayerInput.LeftButtonReleased()) @@ -172,39 +171,6 @@ namespace Barotrauma } } - public virtual void DrawPlacing(SpriteBatch spriteBatch, Camera cam) - { - Vector2 placeSize = Submarine.GridSize; - - if (placePosition == Vector2.Zero) - { - Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub); - - GUI.DrawLine(spriteBatch, new Vector2(position.X - GameMain.GraphicsWidth, -position.Y), new Vector2(position.X + GameMain.GraphicsWidth, -position.Y), Color.White,0,(int)(2.0f/cam.Zoom)); - - GUI.DrawLine(spriteBatch, new Vector2(position.X, -(position.Y - GameMain.GraphicsHeight)), new Vector2(position.X, -(position.Y + GameMain.GraphicsHeight)), Color.White, 0, (int)(2.0f / cam.Zoom)); - } - else - { - Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub); - - if (resizeHorizontal) placeSize.X = position.X - placePosition.X; - if (resizeVertical) placeSize.Y = placePosition.Y - position.Y; - - Rectangle newRect = Submarine.AbsRect(placePosition, placeSize); - newRect.Width = (int)Math.Max(newRect.Width, Submarine.GridSize.X); - newRect.Height = (int)Math.Max(newRect.Height, Submarine.GridSize.Y); - - if (Submarine.MainSub != null) - { - newRect.Location -= Submarine.MainSub.Position.ToPoint(); - } - - newRect.Y = -newRect.Y; - GUI.DrawRectangle(spriteBatch, newRect, Color.DarkBlue); - } - } - protected virtual void CreateInstance(Rectangle rect) { object[] lobject = new object[] { this, rect }; @@ -230,10 +196,5 @@ namespace Barotrauma return (object)selected; } - public void DrawListLine(SpriteBatch spriteBatch, Vector2 pos, Color color) - { - GUI.Font.DrawString(spriteBatch, name, pos, color); - } - } } diff --git a/Barotrauma/Source/Map/Md5Hash.cs b/Barotrauma/BarotraumaShared/Source/Map/Md5Hash.cs similarity index 100% rename from Barotrauma/Source/Map/Md5Hash.cs rename to Barotrauma/BarotraumaShared/Source/Map/Md5Hash.cs diff --git a/Barotrauma/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs similarity index 81% rename from Barotrauma/Source/Map/Structure.cs rename to Barotrauma/BarotraumaShared/Source/Map/Structure.cs index 1ec5885a4..2eac47531 100644 --- a/Barotrauma/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs @@ -10,11 +10,10 @@ using Lidgren.Network; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Barotrauma.Networking; -using Barotrauma.Lights; namespace Barotrauma { - class WallSection + partial class WallSection { public Rectangle rect; public float damage; @@ -24,8 +23,6 @@ namespace Barotrauma //public float lastSentDamage; - public ConvexHull hull; - public WallSection(Rectangle rect) { System.Diagnostics.Debug.Assert(rect.Width > 0 && rect.Height > 0); @@ -43,13 +40,11 @@ namespace Barotrauma } } - class Structure : MapEntity, IDamageable, IServerSerializable + partial class Structure : MapEntity, IDamageable, IServerSerializable { public static int wallSectionSize = 96; public static List WallList = new List(); - List convexHulls; - StructurePrefab prefab; //farseer physics bodies, separated by gaps @@ -202,10 +197,12 @@ namespace Barotrauma } } +#if CLIENT if (convexHulls!=null) { convexHulls.ForEach(x => x.Move(amount)); } +#endif } public Structure(Rectangle rectangle, StructurePrefab sp, Submarine submarine) @@ -257,10 +254,12 @@ namespace Barotrauma } } +#if CLIENT if (prefab.CastShadow) { GenerateConvexHull(); } +#endif InsertToList(); } @@ -361,43 +360,6 @@ namespace Barotrauma } } - private void GenerateConvexHull() - { - // If not null and not empty , remove the hulls from the system - if(convexHulls != null && convexHulls.Any()) - convexHulls.ForEach(x => x.Remove()); - - // list all of hulls for this structure - convexHulls = new List(); - - var mergedSections = new List(); - foreach (var section in sections) - { - if (mergedSections.Count > 5) - { - mergedSections.Add(section); - GenerateMergedHull(mergedSections); - continue; - } - - // if there is a gap and we have sections to merge, do it. - if (section.gap != null) - { - GenerateMergedHull(mergedSections); - } - else - { - mergedSections.Add(section); - } - } - - // take care of any leftover pieces - if (mergedSections.Count > 0) - { - GenerateMergedHull(mergedSections); - } - } - private Rectangle GenerateMergedRect(List mergedSections) { if (isHorizontal) @@ -410,17 +372,6 @@ namespace Barotrauma } } - private void GenerateMergedHull(List mergedSections) - { - if (!mergedSections.Any()) return; - Rectangle mergedRect = GenerateMergedRect(mergedSections); - - var h = new ConvexHull(CalculateExtremes(mergedRect), Color.Black, this); - mergedSections.ForEach(x => x.hull = h); - convexHulls.Add(h); - mergedSections.Clear(); - } - private static Vector2[] CalculateExtremes(Rectangle sectionRect) { Vector2[] corners = new Vector2[4]; @@ -477,7 +428,9 @@ namespace Barotrauma } } +#if CLIENT if (convexHulls != null) convexHulls.ForEach(x => x.Remove()); +#endif } public override void Remove() @@ -504,7 +457,9 @@ namespace Barotrauma } } +#if CLIENT if (convexHulls != null) convexHulls.ForEach(x => x.Remove()); +#endif } public override bool IsVisible(Rectangle WorldView) @@ -517,91 +472,6 @@ namespace Barotrauma return true; } - public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) - { - if (prefab.sprite == null) return; - - Draw(spriteBatch, editing, back, null); - } - - public override void DrawDamage(SpriteBatch spriteBatch, Effect damageEffect) - { - Draw(spriteBatch, false, false, damageEffect); - } - - - private void Draw(SpriteBatch spriteBatch, bool editing, bool back = true, Effect damageEffect = null) - { - if (prefab.sprite == null) return; - - Color color = (isHighlighted) ? Color.Orange : Color.White; - if (IsSelected && editing) - { - color = Color.Red; - - GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height), color); - } - - Vector2 drawOffset = Submarine == null ? Vector2.Zero : Submarine.DrawPosition; - - float depth = prefab.sprite.Depth; - depth -= (ID % 255) * 0.000001f; - - if (back && damageEffect == null) - { - if (prefab.BackgroundSprite != null) - { - prefab.BackgroundSprite.DrawTiled( - spriteBatch, - new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)), - new Vector2(rect.Width, rect.Height), - color, Point.Zero); - } - } - - SpriteEffects oldEffects = prefab.sprite.effects; - prefab.sprite.effects ^= SpriteEffects; - - if (back == prefab.sprite.Depth > 0.5f || editing) - { - for (int i = 0; i < sections.Length; i++) - { - if (damageEffect != null) - { - float newCutoff = Math.Min((sections[i].damage / prefab.MaxHealth), 0.65f); - - if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f) - { - damageEffect.Parameters["aCutoff"].SetValue(newCutoff); - damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f); - - damageEffect.CurrentTechnique.Passes[0].Apply(); - - Submarine.DamageEffectCutoff = newCutoff; - } - } - - Point textureOffset = new Point( - Math.Abs(rect.Location.X - sections[i].rect.Location.X), - Math.Abs(rect.Location.Y - sections[i].rect.Location.Y)); - - if (flippedX && isHorizontal) - { - textureOffset.X = rect.Width - textureOffset.X - sections[i].rect.Width; - } - - prefab.sprite.DrawTiled( - spriteBatch, - new Vector2(sections[i].rect.X + drawOffset.X, -(sections[i].rect.Y + drawOffset.Y)), - new Vector2(sections[i].rect.Width, sections[i].rect.Height), - color, - textureOffset, depth); - } - } - - prefab.sprite.effects = oldEffects; - } - private bool OnWallCollision(Fixture f1, Fixture f2, Contact contact) { if (prefab.IsPlatform) @@ -632,10 +502,12 @@ namespace Barotrauma if (impact < 10.0f) return true; +#if CLIENT SoundPlayer.PlayDamageSound(DamageSoundType.StructureBlunt, impact, new Vector2( sections[section].rect.X + sections[section].rect.Width / 2, sections[section].rect.Y - sections[section].rect.Height / 2)); +#endif AddDamage(section, impact); } @@ -685,6 +557,7 @@ namespace Barotrauma var section = sections[sectionIndex]; +#if CLIENT float particleAmount = Math.Min(Health - section.damage, damage) * Rand.Range(0.01f, 1.0f); particleAmount = Math.Min(particleAmount + Rand.Range(-5,1), 100); @@ -695,10 +568,11 @@ namespace Barotrauma Rand.Range(section.rect.Y - section.rect.Height, section.rect.Y)); if (Submarine != null) particlePos += Submarine.DrawPosition; - + var particle = GameMain.ParticleManager.CreateParticle("shrapnel", particlePos, Rand.Vector(Rand.Range(1.0f, 50.0f))); if (particle == null) break; } +#endif if (GameMain.Client == null) SetDamage(sectionIndex, section.damage + damage); } @@ -753,18 +627,20 @@ namespace Barotrauma int i = FindSectionIndex(transformedPos); if (i == -1) return new AttackResult(0.0f, 0.0f); - GameMain.ParticleManager.CreateParticle("dustcloud", SectionPosition(i), 0.0f, 0.0f); - float damageAmount = attack.GetStructureDamage(deltaTime); + AddDamage(i, damageAmount); + +#if CLIENT + GameMain.ParticleManager.CreateParticle("dustcloud", SectionPosition(i), 0.0f, 0.0f); + if (playSound && !SectionBodyDisabled(i)) { DamageSoundType damageSoundType = (attack.DamageType == DamageType.Blunt) ? DamageSoundType.StructureBlunt : DamageSoundType.StructureSlash; SoundPlayer.PlayDamageSound(damageSoundType, damageAmount, worldPosition); } - - AddDamage(i, damageAmount); - +#endif + return new AttackResult(damageAmount, 0.0f); } @@ -787,8 +663,9 @@ namespace Barotrauma //remove existing gap if damage is below 50% sections[sectionIndex].gap.Remove(); sections[sectionIndex].gap = null; - if(CastShadow) - GenerateConvexHull(); +#if CLIENT + if(CastShadow) GenerateConvexHull(); +#endif } } else @@ -802,8 +679,9 @@ namespace Barotrauma gapRect.Height += 20; sections[sectionIndex].gap = new Gap(gapRect, !isHorizontal, Submarine); sections[sectionIndex].gap.ConnectedWall = this; - +#if CLIENT if(CastShadow) GenerateConvexHull(); +#endif } sections[sectionIndex].gap.Open = (damage / prefab.MaxHealth - 0.5f) * 2.0f; @@ -928,39 +806,6 @@ namespace Barotrauma CreateSections(); } - public override XElement Save(XElement parentElement) - { - XElement element = new XElement("Structure"); - - element.Add(new XAttribute("name", prefab.Name), - new XAttribute("ID", ID), - new XAttribute("rect", - (int)(rect.X - Submarine.HiddenSubPosition.X) + "," + - (int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," + - rect.Width + "," + rect.Height)); - - for (int i = 0; i < sections.Length; i++) - { - if (sections[i].damage == 0.0f) continue; - - var sectionElement = - new XElement("section", - new XAttribute("i", i), - new XAttribute("damage", sections[i].damage)); - - if (sections[i].gap!=null) - { - sectionElement.Add(new XAttribute("gap", sections[i].gap.ID)); - } - - element.Add(sectionElement); - } - - parentElement.Add(element); - - return element; - } - public static void Load(XElement element, Submarine submarine) { string rectString = ToolBox.GetAttributeString(element, "rect", "0,0,0,0"); diff --git a/Barotrauma/Source/Map/StructurePrefab.cs b/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs similarity index 79% rename from Barotrauma/Source/Map/StructurePrefab.cs rename to Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs index ed551a158..cc9a9a9e4 100644 --- a/Barotrauma/Source/Map/StructurePrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace Barotrauma { - class StructurePrefab : MapEntityPrefab + partial class StructurePrefab : MapEntityPrefab { //public static List list = new List(); @@ -175,7 +175,7 @@ namespace Barotrauma //don't allow resizing width/height to zero if ((!resizeHorizontal || placeSize.X != 0.0f) && (!resizeVertical || placeSize.Y != 0.0f)) { - newRect.Location -= Submarine.MainSub.Position.ToPoint(); + newRect.Location -= MathUtils.ToPoint(Submarine.MainSub.Position); var structure = new Structure(newRect, this, Submarine.MainSub); structure.Submarine = Submarine.MainSub; @@ -188,38 +188,5 @@ namespace Barotrauma if (PlayerInput.RightButtonHeld()) selected = null; } - - public override void DrawPlacing(SpriteBatch spriteBatch, Camera cam) - { - Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub); - //Vector2 placeSize = size; - - Rectangle newRect = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y); - - - if (placePosition == Vector2.Zero) - { - if (PlayerInput.LeftButtonHeld()) - placePosition = Submarine.MouseToWorldGrid(cam, Submarine.MainSub); - - newRect.X = (int)position.X; - newRect.Y = (int)position.Y; - - //sprite.Draw(spriteBatch, new Vector2(position.X, -position.Y), placeSize, Color.White); - } - else - { - Vector2 placeSize = size; - if (resizeHorizontal) placeSize.X = position.X - placePosition.X; - if (resizeVertical) placeSize.Y = placePosition.Y - position.Y; - - newRect = Submarine.AbsRect(placePosition, placeSize); - } - - sprite.DrawTiled(spriteBatch, new Vector2(newRect.X, -newRect.Y), new Vector2(newRect.Width, newRect.Height), Color.White); - - GUI.DrawRectangle(spriteBatch, new Rectangle(newRect.X - GameMain.GraphicsWidth, -newRect.Y, newRect.Width + GameMain.GraphicsWidth * 2, newRect.Height), Color.White); - GUI.DrawRectangle(spriteBatch, new Rectangle(newRect.X, -newRect.Y - GameMain.GraphicsHeight, newRect.Width, newRect.Height + GameMain.GraphicsHeight * 2), Color.White); - } } } diff --git a/Barotrauma/Source/Map/Submarine.cs b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs similarity index 82% rename from Barotrauma/Source/Map/Submarine.cs rename to Barotrauma/BarotraumaShared/Source/Map/Submarine.cs index 94e3a0bd6..f6d26a523 100644 --- a/Barotrauma/Source/Map/Submarine.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs @@ -30,7 +30,7 @@ namespace Barotrauma HideInMenus = 2 } - class Submarine : Entity, IServerSerializable + partial class Submarine : Entity, IServerSerializable { public static string SavePath = "Submarines"; @@ -175,7 +175,7 @@ namespace Barotrauma public bool AtEndPosition { get - { + { if (Level.Loaded == null) return false; return (Vector2.Distance(Position + HiddenSubPosition, Level.Loaded.EndPosition) < Level.ExitDistance); } @@ -315,7 +315,7 @@ namespace Barotrauma Rectangle dockedSubBorders = dockedSub.Borders; dockedSubBorders.Y -= dockedSubBorders.Height; - dockedSubBorders.Location += diff.ToPoint(); + dockedSubBorders.Location += MathUtils.ToPoint(diff); dockedBorders = Rectangle.Union(dockedBorders, dockedSubBorders); } @@ -416,100 +416,6 @@ namespace Barotrauma } } - public static void Draw(SpriteBatch spriteBatch, bool editing = false) - { - var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList; - - foreach (MapEntity e in entitiesToRender) - { - e.Draw(spriteBatch, editing); - } - } - - public static void DrawFront(SpriteBatch spriteBatch, bool editing = false, Predicate predicate = null) - { - var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList; - - foreach (MapEntity e in entitiesToRender) - { - if (!e.DrawOverWater) continue; - - if (predicate != null) - { - if (!predicate(e)) continue; - } - - e.Draw(spriteBatch, editing, false); - } - - if (GameMain.DebugDraw) - { - foreach (Submarine sub in Submarine.Loaded) - { - Rectangle worldBorders = sub.Borders; - worldBorders.Location += sub.WorldPosition.ToPoint(); - worldBorders.Y = -worldBorders.Y; - - GUI.DrawRectangle(spriteBatch, worldBorders, Color.White, false, 0, 5); - - if (sub.subBody.MemPos.Count < 2) continue; - - Vector2 prevPos = ConvertUnits.ToDisplayUnits(sub.subBody.MemPos[0].Position); - prevPos.Y = -prevPos.Y; - - for (int i = 1; i < sub.subBody.MemPos.Count; i++) - { - Vector2 currPos = ConvertUnits.ToDisplayUnits(sub.subBody.MemPos[i].Position); - currPos.Y = -currPos.Y; - - GUI.DrawRectangle(spriteBatch, new Rectangle((int)currPos.X - 10, (int)currPos.Y - 10, 20, 20), Color.Blue * 0.6f, true, 0.01f); - GUI.DrawLine(spriteBatch, prevPos, currPos, Color.Cyan * 0.5f, 0, 5); - - prevPos = currPos; - } - } - } - } - - - public static float DamageEffectCutoff; - - public static void DrawDamageable(SpriteBatch spriteBatch, Effect damageEffect, bool editing = false) - { - var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList; - - foreach (MapEntity e in entitiesToRender) - { - if (e.DrawDamageEffect) - e.DrawDamage(spriteBatch, damageEffect); - } - if (damageEffect != null) - { - damageEffect.Parameters["aCutoff"].SetValue(0.0f); - damageEffect.Parameters["cCutoff"].SetValue(0.0f); - - DamageEffectCutoff = 0.0f; - } - } - - - public static void DrawBack(SpriteBatch spriteBatch, bool editing = false, Predicate predicate = null) - { - var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList; - - foreach (MapEntity e in entitiesToRender) - { - if (!e.DrawBelowWater) continue; - - if (predicate != null) - { - if (!predicate(e)) continue; - } - - e.Draw(spriteBatch, editing, true); - } - } - public void UpdateTransform() { DrawPosition = Timing.Interpolate(prevPosition, Position); @@ -842,7 +748,7 @@ namespace Barotrauma foreach (Submarine sub in Submarine.Loaded) { Rectangle subBorders = sub.Borders; - subBorders.Location += sub.HiddenSubPosition.ToPoint() - new Microsoft.Xna.Framework.Point(0, sub.Borders.Height); + subBorders.Location += MathUtils.ToPoint(sub.HiddenSubPosition) - new Microsoft.Xna.Framework.Point(0, sub.Borders.Height); subBorders.Inflate(500.0f, 500.0f); @@ -854,120 +760,6 @@ namespace Barotrauma //saving/loading ---------------------------------------------------- - public bool Save() - { - return SaveAs(filePath); - } - - public bool SaveAs(string filePath) - { - name = System.IO.Path.GetFileNameWithoutExtension(filePath); - - XDocument doc = new XDocument(new XElement("Submarine")); - SaveToXElement(doc.Root); - - hash = new Md5Hash(doc); - doc.Root.Add(new XAttribute("md5hash", hash.Hash)); - - try - { - SaveUtil.CompressStringToFile(filePath, doc.ToString()); - } - catch (Exception e) - { - DebugConsole.ThrowError("Saving submarine \"" + filePath + "\" failed!", e); - return false; - } - - return true; - } - - public void SaveToXElement(XElement element) - { - element.Add(new XAttribute("name", name)); - element.Add(new XAttribute("description", Description == null ? "" : Description)); - - element.Add(new XAttribute("tags", tags.ToString())); - - foreach (MapEntity e in MapEntity.mapEntityList) - { - if (e.MoveWithLevel || e.Submarine != this) continue; - e.Save(element); - } - } - - public static bool SaveCurrent(string filePath) - { - if (Submarine.MainSub == null) - { - Submarine.MainSub = new Submarine(filePath); - // return; - } - - Submarine.MainSub.filePath = filePath; - - return Submarine.MainSub.SaveAs(filePath); - } - - public void CheckForErrors() - { - List errorMsgs = new List(); - - if (!Hull.hullList.Any()) - { - errorMsgs.Add("No hulls found in the submarine. Hulls determine the \"borders\" of an individual room and are required for water and air distribution to work correctly."); - } - - foreach (Item item in Item.ItemList) - { - if (item.GetComponent() == null) continue; - - if (!item.linkedTo.Any()) - { - errorMsgs.Add("The submarine contains vents which haven't been linked to an oxygen generator. Select a vent and click an oxygen generator while holding space to link them."); - break; - } - } - - if (WayPoint.WayPointList.Find(wp => !wp.MoveWithLevel && wp.SpawnType == SpawnType.Path) == null) - { - errorMsgs.Add("No waypoints found in the submarine. AI controlled crew members won't be able to navigate without waypoints."); - } - - if (WayPoint.WayPointList.Find(wp => wp.SpawnType == SpawnType.Cargo) == null) - { - errorMsgs.Add("The submarine doesn't have spawnpoints for cargo (which are used for determining where to place bought items). " - +"To fix this, create a new spawnpoint and change its \"spawn type\" parameter to \"cargo\"."); - } - - if (errorMsgs.Any()) - { - new GUIMessageBox("Warning", string.Join("\n\n", errorMsgs), 400, 0); - } - - foreach (MapEntity e in MapEntity.mapEntityList) - { - if (Vector2.Distance(e.Position, HiddenSubPosition) > 20000) - { - var msgBox = new GUIMessageBox( - "Warning", - "One or more structures have been placed very far from the submarine. Show the structures?", - new string[] {"Yes", "No"}); - - msgBox.Buttons[0].OnClicked += (btn, obj) => - { - GameMain.EditMapScreen.Cam.Position = e.WorldPosition; - return true; - }; - msgBox.Buttons[0].OnClicked += msgBox.Close; - msgBox.Buttons[1].OnClicked += msgBox.Close; - - break; - - } - } - } - public static void RefreshSavedSubs() { SavedSubmarines.Clear(); @@ -1221,10 +1013,12 @@ namespace Barotrauma Loading = false; MapEntity.MapLoaded(this); - + //WayPoint.GenerateSubWaypoints(); +#if CLIENT GameMain.LightManager.OnMapLoaded(); +#endif ID = (ushort)(ushort.MaxValue - Submarine.loaded.IndexOf(this)); } @@ -1270,9 +1064,11 @@ namespace Barotrauma { Unloading = true; +#if CLIENT Sound.OnGameEnd(); if (GameMain.LightManager != null) GameMain.LightManager.ClearLights(); +#endif foreach (Submarine sub in loaded) { diff --git a/Barotrauma/Source/Map/SubmarineBody.cs b/Barotrauma/BarotraumaShared/Source/Map/SubmarineBody.cs similarity index 98% rename from Barotrauma/Source/Map/SubmarineBody.cs rename to Barotrauma/BarotraumaShared/Source/Map/SubmarineBody.cs index 76fc461eb..84e27994b 100644 --- a/Barotrauma/Source/Map/SubmarineBody.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/SubmarineBody.cs @@ -238,7 +238,7 @@ namespace Barotrauma if (Position.X < 0 || Position.X > Level.Loaded.Size.X) { Rectangle worldBorders = Borders; - worldBorders.Location += Position.ToPoint(); + worldBorders.Location += MathUtils.ToPoint(Position); //push the sub back below the upper "barrier" of the level if (worldBorders.Y > Level.Loaded.Size.Y) @@ -276,7 +276,7 @@ namespace Barotrauma private void DisplaceCharacters(Vector2 subTranslation) { Rectangle worldBorders = Borders; - worldBorders.Location += ConvertUnits.ToDisplayUnits(Body.SimPosition).ToPoint(); + worldBorders.Location += MathUtils.ToPoint(ConvertUnits.ToDisplayUnits(Body.SimPosition)); Vector2 translateDir = Vector2.Normalize(subTranslation); @@ -399,7 +399,8 @@ namespace Barotrauma Vector2 n; FixedArray2 particlePos; contact.GetWorldManifold(out n, out particlePos); - + +#if CLIENT int particleAmount = (int)(wallImpact*10.0f); for (int i = 0; i < particleAmount; i++) { @@ -407,6 +408,7 @@ namespace Barotrauma ConvertUnits.ToDisplayUnits(particlePos[0]) + Rand.Vector(Rand.Range(1.0f, 50.0f)), Rand.Vector(Rand.Range(50.0f,500.0f)) + Velocity); } +#endif return true; } @@ -529,6 +531,7 @@ namespace Barotrauma } } +#if CLIENT if (maxDamageStructure != null) { SoundPlayer.PlayDamageSound( @@ -538,6 +541,7 @@ namespace Barotrauma MathHelper.Clamp(maxDamage * 4.0f, 1000.0f, 4000.0f), maxDamageStructure.Tags); } +#endif } } diff --git a/Barotrauma/Source/Map/TransitionCinematic.cs b/Barotrauma/BarotraumaShared/Source/Map/TransitionCinematic.cs similarity index 95% rename from Barotrauma/Source/Map/TransitionCinematic.cs rename to Barotrauma/BarotraumaShared/Source/Map/TransitionCinematic.cs index c6049a701..10064077c 100644 --- a/Barotrauma/Source/Map/TransitionCinematic.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/TransitionCinematic.cs @@ -53,7 +53,9 @@ namespace Barotrauma Character.Controlled = null; cam.TargetPos = Vector2.Zero; +#if CLIENT GameMain.LightManager.LosEnabled = false; +#endif //Vector2 diff = targetPos - sub.Position; float targetSpeed = 10.0f; @@ -69,21 +71,23 @@ namespace Barotrauma { yield return new WaitForSeconds(0.1f); +#if CLIENT GUI.ScreenOverlayColor = Color.TransparentBlack; +#endif Running = false; yield return CoroutineStatus.Success; } cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.UnscaledDeltaTime * 0.1f); - + Vector2 cameraPos = subs.First().Position + Submarine.MainSub.HiddenSubPosition; - cameraPos.Y = Math.Min(cameraPos.Y, ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBody.Position.Y) - cam.WorldView.Height/2.0f); - + cameraPos.Y = Math.Min(cameraPos.Y, ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBody.Position.Y) - cam.WorldView.Height / 2.0f); + cam.Translate((cameraPos - cam.Position) * CoroutineManager.UnscaledDeltaTime * 10.0f); +#if CLIENT GUI.ScreenOverlayColor = Color.Lerp(Color.TransparentBlack, Color.Black, timer/duration); - - cam.Translate((cameraPos - cam.Position) * CoroutineManager.UnscaledDeltaTime*10.0f); - +#endif + foreach (Submarine sub in subs) { if (sub.Position == targetPos) continue; @@ -99,7 +103,9 @@ namespace Barotrauma yield return new WaitForSeconds(0.1f); +#if CLIENT GUI.ScreenOverlayColor = Color.TransparentBlack; +#endif yield return CoroutineStatus.Success; } diff --git a/Barotrauma/Source/Map/WayPoint.cs b/Barotrauma/BarotraumaShared/Source/Map/WayPoint.cs similarity index 68% rename from Barotrauma/Source/Map/WayPoint.cs rename to Barotrauma/BarotraumaShared/Source/Map/WayPoint.cs index 8e7417812..fa3ab031f 100644 --- a/Barotrauma/Source/Map/WayPoint.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/WayPoint.cs @@ -4,8 +4,7 @@ using System.Linq; using System.Xml.Linq; using FarseerPhysics; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; +//using Microsoft.Xna.Framework.Graphics; using System.Collections.ObjectModel; using Barotrauma.Items.Components; using FarseerPhysics.Dynamics; @@ -13,16 +12,12 @@ using FarseerPhysics.Dynamics; namespace Barotrauma { public enum SpawnType { Path, Human, Enemy, Cargo }; - class WayPoint : MapEntity + partial class WayPoint : MapEntity { public static List WayPointList = new List(); public static bool ShowWayPoints = true, ShowSpawnPoints = true; - private static Texture2D iconTexture; - private const int IconSize = 32; - private static int[] iconIndices = { 3, 0, 1, 2 }; - protected SpawnType spawnType; //characters spawning at the waypoint will be given an ID card with these tags @@ -102,10 +97,12 @@ namespace Barotrauma linkedTo = new ObservableCollection(); idCardTags = new string[0]; +#if CLIENT if (iconTexture==null) { iconTexture = Sprite.LoadTexture("Content/Map/waypointIcons.png"); } +#endif InsertToList(); WayPointList.Add(this); @@ -125,203 +122,13 @@ namespace Barotrauma public override bool IsMouseOn(Vector2 position) { +#if CLIENT if (IsHidden()) return false; +#endif return base.IsMouseOn(position); } - public override void Draw(SpriteBatch spriteBatch, bool editing, bool back=true) - { - if (!editing && !GameMain.DebugDraw) return; - - if (IsHidden()) return; - - //Rectangle drawRect = - // Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height); - - Vector2 drawPos = Position; - if (Submarine!=null) drawPos += Submarine.DrawPosition; - drawPos.Y = -drawPos.Y; - - Color clr = currentHull == null ? Color.Blue : Color.White; - if (IsSelected) clr = Color.Red; - if (isHighlighted) clr = Color.DarkRed; - - int iconX = iconIndices[(int)spawnType]*IconSize % iconTexture.Width; - int iconY = (int)(Math.Floor(iconIndices[(int)spawnType]*IconSize / (float)iconTexture.Width))*IconSize; - - int iconSize = ConnectedGap == null && Ladders == null ? IconSize : (int)(IconSize * 1.5f); - - spriteBatch.Draw(iconTexture, - new Rectangle((int)(drawPos.X - iconSize/2), (int)(drawPos.Y - iconSize/2), iconSize, iconSize), - new Rectangle(iconX, iconY, IconSize,IconSize), clr); - - //GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), clr, true); - - //GUI.SmallFont.DrawString(spriteBatch, Position.ToString(), new Vector2(Position.X, -Position.Y), Color.White); - - foreach (MapEntity e in linkedTo) - { - GUI.DrawLine(spriteBatch, - drawPos, - new Vector2(e.DrawPosition.X, -e.DrawPosition.Y), - Color.Green); - } - } - - private bool IsHidden() - { - if (spawnType == SpawnType.Path) - { - return (!GameMain.DebugDraw && !ShowWayPoints); - } - else - { - return (!GameMain.DebugDraw && !ShowSpawnPoints); - } - } - - public override void UpdateEditing(Camera cam) - { - if (editingHUD == null || editingHUD.UserData != this) - { - editingHUD = CreateEditingHUD(); - } - - editingHUD.Update((float)Timing.Step); - - if (PlayerInput.LeftButtonClicked()) - { - Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition); - - foreach (MapEntity e in mapEntityList) - { - if (e.GetType() != typeof(WayPoint)) continue; - if (e == this) continue; - - if (!Submarine.RectContains(e.Rect, position)) continue; - - linkedTo.Add(e); - e.linkedTo.Add(this); - } - } - } - - public override void DrawEditing(SpriteBatch spriteBatch, Camera cam) - { - if (editingHUD != null) editingHUD.Draw(spriteBatch); - } - - private bool ChangeSpawnType(GUIButton button, object obj) - { - GUITextBlock spawnTypeText = button.Parent as GUITextBlock; - - spawnType += (int)button.UserData; - - if (spawnType > SpawnType.Cargo) spawnType = SpawnType.Human; - if (spawnType < SpawnType.Human) spawnType = SpawnType.Cargo; - - spawnTypeText.Text = spawnType.ToString(); - - return true; - } - - private bool EnterIDCardTags(GUITextBox textBox, string text) - { - IdCardTags = text.Split(','); - textBox.Text = text; - textBox.Color = Color.Green; - - textBox.Deselect(); - - return true; - } - - private bool EnterAssignedJob(GUITextBox textBox, string text) - { - string trimmedName = text.ToLowerInvariant().Trim(); - assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == trimmedName); - - if (assignedJob !=null && trimmedName!="none") - { - textBox.Color = Color.Green; - textBox.Text = (assignedJob == null) ? "None" : assignedJob.Name; - } - - textBox.Deselect(); - - return true; - } - - private bool TextBoxChanged(GUITextBox textBox, string text) - { - textBox.Color = Color.Red; - - return true; - } - - private GUIComponent CreateEditingHUD(bool inGame = false) - { - int width = 500; - int height = spawnType == SpawnType.Path ? 100 : 140; - int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10; - - editingHUD = new GUIFrame(new Rectangle(x, y, width, height), Color.Black * 0.5f); - editingHUD.Padding = new Vector4(10, 10, 0, 0); - editingHUD.UserData = this; - - if (spawnType == SpawnType.Path) - { - new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", "", editingHUD); - new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another waypoint", "", editingHUD); - } - else - { - new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing spawnpoint", "", editingHUD); - new GUITextBlock(new Rectangle(0, 25, 100, 20), "Spawn type: ", "", editingHUD); - - var spawnTypeText = new GUITextBlock(new Rectangle(0, 25, 200, 20), spawnType.ToString(), "", Alignment.Right, Alignment.TopLeft, editingHUD); - - var button = new GUIButton(new Rectangle(-30,0,20,20), "-", Alignment.Right, "", spawnTypeText); - button.UserData = -1; - button.OnClicked = ChangeSpawnType; - - button = new GUIButton(new Rectangle(0, 0, 20, 20), "+", Alignment.Right, "", spawnTypeText); - button.UserData = 1; - button.OnClicked = ChangeSpawnType; - - y = 40 + 20; - - new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card tags:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD); - GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), "", editingHUD); - propertyBox.Text = string.Join(", ", idCardTags); - propertyBox.OnEnterPressed = EnterIDCardTags; - propertyBox.OnTextChanged = TextBoxChanged; - propertyBox.ToolTip = "Characters spawning at this spawnpoint will have the specified tags added to their ID card. You can, for example, use these tags to limit access to some parts of the sub."; - - y = y + 30; - - new GUITextBlock(new Rectangle(0, y, 100, 20), "Assigned job:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD); - propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), "", editingHUD); - propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name; - propertyBox.OnEnterPressed = EnterAssignedJob; - propertyBox.OnTextChanged = TextBoxChanged; - propertyBox.ToolTip = "Only characters with the specified job will spawn at this spawnpoint."; - - } - - - - - - //GUI.Font.DrawString(spriteBatch, "Spawnpoint: " + spawnType.ToString() + " +/-", new Vector2(x, y + 40), Color.Black); - - - y = y + 30; - - return editingHUD; - } - public static void GenerateSubWaypoints(Submarine submarine) { if (!Hull.hullList.Any()) @@ -373,7 +180,7 @@ namespace Barotrauma borders.Width += outsideWaypointDist * 2; borders.Height += outsideWaypointDist * 2; - borders.Location -= submarine.HiddenSubPosition.ToPoint(); + borders.Location -= MathUtils.ToPoint(submarine.HiddenSubPosition); if (borders.Width <= outSideWaypointInterval*2) { @@ -667,10 +474,10 @@ namespace Barotrauma if (!wayPoints.Any()) return null; - return wayPoints[Rand.Int(wayPoints.Count, !useSyncedRand)]; + return wayPoints[Rand.Int(wayPoints.Count, (useSyncedRand ? Rand.RandSync.Server : Rand.RandSync.Unsynced))]; } - public static WayPoint[] SelectCrewSpawnPoints(List crew, Submarine submarine) + public static WayPoint[] SelectCrewSpawnPoints(List crew, Submarine submarine, bool tryAssignWayPoint = true) { List subWayPoints = WayPointList.FindAll(wp => wp.Submarine == submarine); @@ -707,12 +514,15 @@ namespace Barotrauma if (assignedWayPoints[i] != null) continue; - //try to assign a spawnpoint that isn't meant for any specific job - var nonJobSpecificPoints = subWayPoints.FindAll(wp => wp.spawnType == SpawnType.Human && wp.assignedJob == null); - - if (nonJobSpecificPoints.Any()) + if (tryAssignWayPoint) { - assignedWayPoints[i] = nonJobSpecificPoints[Rand.Int(nonJobSpecificPoints.Count, false)]; + //try to assign a spawnpoint that isn't meant for any specific job + var nonJobSpecificPoints = subWayPoints.FindAll(wp => wp.spawnType == SpawnType.Human && wp.assignedJob == null); + + if (nonJobSpecificPoints.Any()) + { + assignedWayPoints[i] = nonJobSpecificPoints[Rand.Int(nonJobSpecificPoints.Count, Rand.RandSync.Server)]; + } } if (assignedWayPoints[i] != null) continue; @@ -747,42 +557,6 @@ namespace Barotrauma } } - public override XElement Save(XElement parentElement) - { - if (MoveWithLevel) return null; - XElement element = new XElement("WayPoint"); - - element.Add(new XAttribute("ID", ID), - new XAttribute("x", (int)(rect.X - Submarine.HiddenSubPosition.X)), - new XAttribute("y", (int)(rect.Y - Submarine.HiddenSubPosition.Y)), - new XAttribute("spawn", spawnType)); - - if (idCardTags.Length > 0) - { - element.Add(new XAttribute("idcardtags", string.Join(",", idCardTags))); - } - - if (assignedJob != null) element.Add(new XAttribute("job", assignedJob.Name)); - - - if (ConnectedGap != null) element.Add(new XAttribute("gap", ConnectedGap.ID)); - if (Ladders != null) element.Add(new XAttribute("ladders", Ladders.Item.ID)); - - parentElement.Add(element); - - if (linkedTo != null) - { - int i = 0; - foreach (MapEntity e in linkedTo) - { - element.Add(new XAttribute("linkedto" + i, e.ID)); - i += 1; - } - } - - return element; - } - public static void Load(XElement element, Submarine submarine) { Rectangle rect = new Rectangle( diff --git a/Barotrauma/Source/Networking/BanList.cs b/Barotrauma/BarotraumaShared/Source/Networking/BanList.cs similarity index 62% rename from Barotrauma/Source/Networking/BanList.cs rename to Barotrauma/BarotraumaShared/Source/Networking/BanList.cs index 778f6e463..3e1147ddf 100644 --- a/Barotrauma/Source/Networking/BanList.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/BanList.cs @@ -33,19 +33,12 @@ namespace Barotrauma.Networking } } - class BanList + partial class BanList { const string SavePath = "Data/bannedplayers.txt"; private List bannedPlayers; - private GUIComponent banFrame; - - public GUIComponent BanFrame - { - get { return banFrame; } - } - public BanList() { bannedPlayers = new List(); @@ -91,53 +84,14 @@ namespace Barotrauma.Networking return bannedPlayers.Any(bp => bp.CompareTo(IP)); } - public GUIComponent CreateBanFrame(GUIComponent parent) + private void RemoveBan(BannedPlayer banned) { - banFrame = new GUIListBox(new Rectangle(0, 0, 0, 0), "", parent); - - foreach (BannedPlayer bannedPlayer in bannedPlayers) - { - GUITextBlock textBlock = new GUITextBlock( - new Rectangle(0, 0, 0, 25), - bannedPlayer.IP + " (" + bannedPlayer.Name + ")", - "", - Alignment.Left, Alignment.Left, banFrame); - textBlock.Padding = new Vector4(10.0f, 10.0f, 0.0f, 0.0f); - textBlock.UserData = banFrame; - - var removeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Remove", Alignment.Right | Alignment.CenterY, "", textBlock); - removeButton.UserData = bannedPlayer; - removeButton.OnClicked = RemoveBan; - if (bannedPlayer.IP.IndexOf(".x") <= -1) - { - var rangeBanButton = new GUIButton(new Rectangle(-100, 0, 100, 20), "Ban range", Alignment.Right | Alignment.CenterY, "", textBlock); - rangeBanButton.UserData = bannedPlayer; - rangeBanButton.OnClicked = RangeBan; - } - } - - return banFrame; - } - - private bool RemoveBan(GUIButton button, object obj) - { - BannedPlayer banned = obj as BannedPlayer; - if (banned == null) return false; - DebugConsole.Log("Removing ban from " + banned.Name); GameServer.Log("Removing ban from " + banned.Name, ServerLog.MessageType.ServerMessage); bannedPlayers.Remove(banned); Save(); - - if (banFrame != null) - { - banFrame.Parent.RemoveChild(banFrame); - CreateBanFrame(banFrame.Parent); - } - - return true; } public string ToRange(string ip) @@ -153,15 +107,12 @@ namespace Barotrauma.Networking return ip; } - private bool RangeBan(GUIButton button, object obj) + private void RangeBan(BannedPlayer banned) { - BannedPlayer banned = obj as BannedPlayer; - if (banned == null) return false; - banned.IP = ToRange(banned.IP); BannedPlayer bp; - while ((bp = bannedPlayers.Find(x => banned.CompareTo(x.IP)))!=null) + while ((bp = bannedPlayers.Find(x => banned.CompareTo(x.IP))) != null) { //remove all specific bans that are now covered by the rangeban bannedPlayers.Remove(bp); @@ -170,21 +121,6 @@ namespace Barotrauma.Networking bannedPlayers.Add(banned); Save(); - - if (banFrame != null) - { - banFrame.Parent.RemoveChild(banFrame); - CreateBanFrame(banFrame.Parent); - } - - return true; - } - - private bool CloseFrame(GUIButton button, object obj) - { - banFrame = null; - - return true; } public void Save() diff --git a/Barotrauma/Source/Networking/ChatMessage.cs b/Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs similarity index 100% rename from Barotrauma/Source/Networking/ChatMessage.cs rename to Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs diff --git a/Barotrauma/Source/Networking/Client.cs b/Barotrauma/BarotraumaShared/Source/Networking/Client.cs similarity index 100% rename from Barotrauma/Source/Networking/Client.cs rename to Barotrauma/BarotraumaShared/Source/Networking/Client.cs diff --git a/Barotrauma/Source/Networking/EntitySpawner.cs b/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs similarity index 82% rename from Barotrauma/Source/Networking/EntitySpawner.cs rename to Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs index 17a32b977..fbdbdd10a 100644 --- a/Barotrauma/Source/Networking/EntitySpawner.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs @@ -6,7 +6,7 @@ using System.Linq; namespace Barotrauma { - class EntitySpawner : Entity, IServerSerializable + partial class EntitySpawner : Entity, IServerSerializable { const int MaxEntitiesPerWrite = 10; @@ -185,41 +185,9 @@ namespace Barotrauma else if (entities.Entity is Character) { message.Write((byte)SpawnableType.Character); + DebugConsole.NewMessage("WRITING CHARACTER DATA: " + (entities.Entity).ToString(),Color.Cyan); ((Character)entities.Entity).WriteSpawnData(message); } - } - } - - public void ClientRead(ServerNetObject type, Lidgren.Network.NetBuffer message, float sendingTime) - { - if (GameMain.Server != null) return; - - bool remove = message.ReadBoolean(); - - if (remove) - { - ushort entityId = message.ReadUInt16(); - - var entity = FindEntityByID(entityId); - if (entity != null) - { - entity.Remove(); - } - } - else - { - switch (message.ReadByte()) - { - case (byte)SpawnableType.Item: - Item.ReadSpawnData(message, true); - break; - case (byte)SpawnableType.Character: - Character.ReadSpawnData(message, true); - break; - default: - DebugConsole.ThrowError("Received invalid entity spawn message (unknown spawnable type)"); - break; - } } } } diff --git a/Barotrauma/Source/Networking/FileTransfer/FileSender.cs b/Barotrauma/BarotraumaShared/Source/Networking/FileTransfer/FileSender.cs similarity index 100% rename from Barotrauma/Source/Networking/FileTransfer/FileSender.cs rename to Barotrauma/BarotraumaShared/Source/Networking/FileTransfer/FileSender.cs diff --git a/Barotrauma/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs similarity index 88% rename from Barotrauma/Source/Networking/GameServer.cs rename to Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs index 42a47ed64..3bce7748f 100644 --- a/Barotrauma/Source/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs @@ -17,8 +17,6 @@ namespace Barotrauma.Networking //for keeping track of disconnected clients in case the reconnect shortly after private List disconnectedClients = new List(); - private NetStats netStats; - private int roundStartSeed; //is the server running @@ -38,13 +36,10 @@ namespace Barotrauma.Networking private IRestResponse masterServerResponse; private ServerLog log; - private GUIButton showLogButton; private bool initiatedStartGame; private CoroutineHandle startGameCoroutine; - private GUIScrollBar clientListScrollBar; - public TraitorManager TraitorManager; private ServerEntityEventManager entityEventManager; @@ -91,7 +86,9 @@ namespace Barotrauma.Networking config = new NetPeerConfiguration("barotrauma"); +#if CLIENT netStats = new NetStats(); +#endif #if DEBUG config.SimulatedLoss = 0.05f; @@ -102,7 +99,7 @@ namespace Barotrauma.Networking config.ConnectionTimeout = 60.0f; NetIdUtils.Test(); -#endif +#endif config.Port = port; Port = port; @@ -121,30 +118,9 @@ namespace Barotrauma.Networking config.EnableMessageType(NetIncomingMessageType.ConnectionApproval); - //---------------------------------------- - - var endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170, 20, 150, 20), "End round", Alignment.TopLeft, "", inGameHUD); - endRoundButton.OnClicked = (btn, userdata) => { EndGame(); return true; }; - log = new ServerLog(name); - showLogButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170, 20, 150, 20), "Server Log", Alignment.TopLeft, "", inGameHUD); - showLogButton.OnClicked = (GUIButton button, object userData) => - { - if (log.LogFrame == null) - { - log.CreateLogFrame(); - } - else - { - log.LogFrame = null; - GUIComponent.KeyboardDispatcher.Subscriber = null; - } - return true; - }; - GUIButton settingsButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170 - 170, 20, 150, 20), "Settings", Alignment.TopLeft, "", inGameHUD); - settingsButton.OnClicked = ToggleSettingsFrame; - settingsButton.UserData = "settingsButton"; + InitProjSpecific(); entityEventManager = new ServerEntityEventManager(this); @@ -154,8 +130,6 @@ namespace Barotrauma.Networking LoadSettings(); LoadClientPermissions(); - //---------------------------------------- - CoroutineManager.StartCoroutine(StartServer(isPublic)); } @@ -180,6 +154,7 @@ namespace Barotrauma.Networking System.Net.Sockets.SocketException socketException = e as System.Net.Sockets.SocketException; +#if CLIENT if (socketException != null && socketException.SocketErrorCode == System.Net.Sockets.SocketError.AddressAlreadyInUse) { new GUIMessageBox("Starting the server failed", e.Message + ". Are you trying to run multiple servers on the same port?"); @@ -188,6 +163,7 @@ namespace Barotrauma.Networking { new GUIMessageBox("Starting the server failed", e.Message); } +#endif error = true; } @@ -196,26 +172,27 @@ namespace Barotrauma.Networking { if (server != null) server.Shutdown("Error while starting the server"); +#if CLIENT GameMain.NetworkMember = null; +#elif SERVER + Environment.Exit(-1); +#endif yield return CoroutineStatus.Success; } if (config.EnableUPnP) { - server.UPnP.ForwardPort(config.Port, "barotrauma"); - - GUIMessageBox upnpBox = new GUIMessageBox("Please wait...", "Attempting UPnP port forwarding", new string[] {"Cancel"} ); - upnpBox.Buttons[0].OnClicked = upnpBox.Close; + InitUPnP(); //DateTime upnpTimeout = DateTime.Now + new TimeSpan(0,0,5); - while (server.UPnP.Status == UPnPStatus.Discovering - && GUIMessageBox.VisibleBox == upnpBox)// && upnpTimeout>DateTime.Now) + while (DiscoveringUPnP())// && upnpTimeout>DateTime.Now) { yield return null; } - upnpBox.Close(null,null); - + FinishUPnP(); + +#if CLIENT if (server.UPnP.Status == UPnPStatus.NotAvailable) { new GUIMessageBox("Error", "UPnP not available"); @@ -224,6 +201,7 @@ namespace Barotrauma.Networking { new GUIMessageBox("Error", "UPnP discovery timed out"); } +#endif } if (isPublic) @@ -363,22 +341,16 @@ namespace Barotrauma.Networking masterServerResponded = true; } - public override void AddToGUIUpdateList() - { - if (started) base.AddToGUIUpdateList(); - - if (settingsFrame != null) settingsFrame.AddToGUIUpdateList(); - if (log.LogFrame != null) log.LogFrame.AddToGUIUpdateList(); - } - public override void Update(float deltaTime) { +#if CLIENT if (ShowNetStats) netStats.Update(deltaTime); if (settingsFrame != null) settingsFrame.Update(deltaTime); if (log.LogFrame != null) log.LogFrame.Update(deltaTime); +#endif if (!started) return; - + base.Update(deltaTime); foreach (UnauthenticatedClient unauthClient in unauthenticatedClients) @@ -429,7 +401,7 @@ namespace Barotrauma.Networking if (startGameCoroutine != null && !CoroutineManager.IsCoroutineRunning(startGameCoroutine)) { if (autoRestart) AutoRestartTimer = Math.Max(AutoRestartInterval, 5.0f); - GameMain.NetLobbyScreen.StartButton.Enabled = true; + GameMain.NetLobbyScreen.StartButtonEnabled = true; GameMain.NetLobbyScreen.LastUpdateID++; @@ -440,9 +412,9 @@ namespace Barotrauma.Networking else if (autoRestart && Screen.Selected == GameMain.NetLobbyScreen && connectedClients.Count>0) { AutoRestartTimer -= deltaTime; - if (AutoRestartTimer < 0.0f && GameMain.NetLobbyScreen.StartButton.Enabled) + if (AutoRestartTimer < 0.0f && GameMain.NetLobbyScreen.StartButtonEnabled) { - StartGameClicked(null,null); + StartGame(); } } @@ -944,7 +916,7 @@ namespace Barotrauma.Networking outmsg.Write(GameMain.NetLobbyScreen.LastUpdateID); outmsg.Write(GameMain.NetLobbyScreen.GetServerName()); - outmsg.Write(GameMain.NetLobbyScreen.ServerMessage.Text); + outmsg.Write(GameMain.NetLobbyScreen.ServerMessageText); outmsg.Write(c.lastRecvGeneralUpdate < 1); if (c.lastRecvGeneralUpdate < 1) @@ -952,10 +924,10 @@ namespace Barotrauma.Networking isInitialUpdate = true; ClientWriteInitial(c, outmsg); } - outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).Name); - outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).MD5Hash.ToString()); - outmsg.Write((GameMain.NetLobbyScreen.ShuttleList.SelectedData as Submarine).Name); - outmsg.Write((GameMain.NetLobbyScreen.ShuttleList.SelectedData as Submarine).MD5Hash.ToString()); + outmsg.Write(GameMain.NetLobbyScreen.SelectedSub.Name); + outmsg.Write(GameMain.NetLobbyScreen.SelectedSub.MD5Hash.ToString()); + outmsg.Write(GameMain.NetLobbyScreen.SelectedShuttle.Name); + outmsg.Write(GameMain.NetLobbyScreen.SelectedShuttle.MD5Hash.ToString()); outmsg.Write(Voting.AllowSubVoting); outmsg.Write(Voting.AllowModeVoting); @@ -964,7 +936,7 @@ namespace Barotrauma.Networking outmsg.WriteRangedInteger(0, Mission.MissionTypes.Count - 1, (GameMain.NetLobbyScreen.MissionTypeIndex)); - outmsg.Write((byte)GameMain.NetLobbyScreen.ModeList.SelectedIndex); + outmsg.Write((byte)GameMain.NetLobbyScreen.SelectedModeIndex); outmsg.Write(GameMain.NetLobbyScreen.LevelSeed); outmsg.Write(AutoRestart); @@ -1029,8 +1001,8 @@ namespace Barotrauma.Networking c.chatMsgQueue[i].ServerWrite(outmsg, c); } } - - public bool StartGameClicked(GUIButton button, object obj) + + public bool StartGame() { Submarine selectedSub = null; Submarine selectedShuttle = GameMain.NetLobbyScreen.SelectedShuttle; @@ -1047,13 +1019,17 @@ namespace Barotrauma.Networking if (selectedSub == null) { +#if CLIENT GameMain.NetLobbyScreen.SubList.Flash(); +#endif return false; } if (selectedShuttle == null) { +#if CLIENT GameMain.NetLobbyScreen.ShuttleList.Flash(); +#endif return false; } @@ -1062,7 +1038,9 @@ namespace Barotrauma.Networking if (selectedMode == null) { +#if CLIENT GameMain.NetLobbyScreen.ModeList.Flash(); +#endif return false; } @@ -1073,7 +1051,7 @@ namespace Barotrauma.Networking private IEnumerable InitiateStartGame(Submarine selectedSub, Submarine selectedShuttle, GameModePreset selectedMode) { - GameMain.NetLobbyScreen.StartButton.Enabled = false; + GameMain.NetLobbyScreen.StartButtonEnabled = false; if (connectedClients.Any()) { @@ -1100,19 +1078,23 @@ namespace Barotrauma.Networking if (fileSender.ActiveTransfers.Count > 0) { +#if CLIENT var msgBox = new GUIMessageBox("", "Waiting for file transfers to finish before starting the round...", new string[] { "Start now" }); msgBox.Buttons[0].OnClicked += msgBox.Close; +#endif float waitForTransfersTimer = 20.0f; while (fileSender.ActiveTransfers.Count > 0 && waitForTransfersTimer > 0.0f) { waitForTransfersTimer -= CoroutineManager.UnscaledDeltaTime; +#if CLIENT //message box close, break and start the round immediately if (!GUIMessageBox.MessageBoxes.Contains(msgBox)) { break; } +#endif yield return CoroutineStatus.Running; } @@ -1130,9 +1112,11 @@ namespace Barotrauma.Networking entityEventManager.Clear(); - GameMain.NetLobbyScreen.StartButton.Enabled = false; + GameMain.NetLobbyScreen.StartButtonEnabled = false; +#if CLIENT GUIMessageBox.CloseAll(); +#endif roundStartSeed = DateTime.Now.Millisecond; Rand.SetSyncedSeed(roundStartSeed); @@ -1211,9 +1195,12 @@ namespace Barotrauma.Networking teamClients[i].Character = spawnedCharacter; +#if CLIENT GameMain.GameSession.CrewManager.characters.Add(spawnedCharacter); +#endif } +#if CLIENT if (characterInfo != null && hostTeam == teamID) { myCharacter = Character.Create(characterInfo, assignedWayPoints[assignedWayPoints.Length - 1].WorldPosition, false, false); @@ -1221,8 +1208,10 @@ namespace Barotrauma.Networking myCharacter.TeamID = (byte)teamID; Character.Controlled = myCharacter; + GameMain.GameSession.CrewManager.characters.Add(myCharacter); } +#endif } @@ -1274,9 +1263,9 @@ namespace Barotrauma.Networking GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; GameMain.GameScreen.Select(); - AddChatMessage("Press TAB to chat. Use ''r;'' to talk through the radio.", ChatMessageType.Server); - - GameMain.NetLobbyScreen.StartButton.Enabled = true; + AddChatMessage("Press TAB to chat. Use \"r;\" to talk through the radio.", ChatMessageType.Server); + + GameMain.NetLobbyScreen.StartButtonEnabled = true; gameStarted = true; initiatedStartGame = false; @@ -1363,10 +1352,13 @@ namespace Barotrauma.Networking if (SaveServerLogs) log.Save(); Character.Controlled = null; - myCharacter = null; - GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; - GameMain.LightManager.LosEnabled = false; + GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; +#if CLIENT + myCharacter = null; + GameMain.LightManager.LosEnabled = false; +#endif + entityEventManager.Clear(); foreach (Client c in connectedClients) { @@ -1405,18 +1397,16 @@ namespace Barotrauma.Networking public IEnumerable EndCinematic() { float endPreviewLength = 10.0f; - + var cinematic = new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength); - - new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength); - float secondsLeft = endPreviewLength; + //float secondsLeft = endPreviewLength; do { - secondsLeft -= CoroutineManager.UnscaledDeltaTime; + //secondsLeft -= CoroutineManager.UnscaledDeltaTime; yield return CoroutineStatus.Running; - } while (secondsLeft > 0.0f); + } while (cinematic.Running);//(secondsLeft > 0.0f); Submarine.Unload(); entityEventManager.Clear(); @@ -1437,6 +1427,13 @@ namespace Barotrauma.Networking KickClient(client, ban, range); } + public void KickPlayer(int id,bool ban,bool range=false) + { + Client client = connectedClients.Find(c => c.ID == id); + + KickClient(client, ban, range); + } + public void KickClient(NetConnection conn, bool ban = false, bool range = false) { Client client = connectedClients.Find(c => c.Connection == conn); @@ -1502,7 +1499,9 @@ namespace Barotrauma.Networking client.Connection.Disconnect(targetmsg); - GameMain.NetLobbyScreen.RemovePlayer(client.name); +#if CLIENT + GameMain.NetLobbyScreen.RemovePlayer(client.name); +#endif connectedClients.Remove(client); UpdateVoteStatus(); @@ -1760,85 +1759,12 @@ namespace Barotrauma.Networking return message; } - public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) - { - base.Draw(spriteBatch); - - if (settingsFrame != null) - { - settingsFrame.Draw(spriteBatch); - } - else if (log.LogFrame!=null) - { - log.LogFrame.Draw(spriteBatch); - } - - if (!ShowNetStats) return; - - GUI.Font.DrawString(spriteBatch, "Unique Events: " + entityEventManager.UniqueEvents.Count, new Vector2(10, 50), Color.White); - - int width = 200, height = 300; - int x = GameMain.GraphicsWidth - width, y = (int)(GameMain.GraphicsHeight * 0.3f); - - - if (clientListScrollBar == null) - { - clientListScrollBar = new GUIScrollBar(new Rectangle(x + width - 10, y, 10, height), "", 1.0f); - } - - - GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black * 0.7f, true); - GUI.Font.DrawString(spriteBatch, "Network statistics:", new Vector2(x + 10, y + 10), Color.White); - - GUI.SmallFont.DrawString(spriteBatch, "Connections: "+server.ConnectionsCount, new Vector2(x + 10, y + 30), Color.White); - GUI.SmallFont.DrawString(spriteBatch, "Received bytes: " + MathUtils.GetBytesReadable(server.Statistics.ReceivedBytes), new Vector2(x + 10, y + 45), Color.White); - GUI.SmallFont.DrawString(spriteBatch, "Received packets: " + server.Statistics.ReceivedPackets, new Vector2(x + 10, y + 60), Color.White); - - GUI.SmallFont.DrawString(spriteBatch, "Sent bytes: " + MathUtils.GetBytesReadable(server.Statistics.SentBytes), new Vector2(x + 10, y + 75), Color.White); - GUI.SmallFont.DrawString(spriteBatch, "Sent packets: " + server.Statistics.SentPackets, new Vector2(x + 10, y + 90), Color.White); - - int resentMessages = 0; - - int clientListHeight = connectedClients.Count * 40; - float scrollBarHeight = (height - 110) / (float)Math.Max(clientListHeight, 110); - - if (clientListScrollBar.BarSize != scrollBarHeight) - { - clientListScrollBar.BarSize = scrollBarHeight; - } - - int startY = y + 110; - y = (startY - (int)(clientListScrollBar.BarScroll * (clientListHeight-(height - 110)))); - foreach (Client c in connectedClients) - { - Color clientColor = c.Connection.AverageRoundtripTime > 0.3f ? Color.Red : Color.White; - - if (y >= startY && y < startY + height - 120) - { - GUI.SmallFont.DrawString(spriteBatch, c.name + " ("+c.Connection.RemoteEndPoint.Address.ToString()+")", new Vector2(x + 10, y), clientColor); - GUI.SmallFont.DrawString(spriteBatch, "Ping: " + (int)(c.Connection.AverageRoundtripTime * 1000.0f) + " ms", new Vector2(x+20, y+10), clientColor); - } - if (y + 25 >= startY && y < startY + height - 130) GUI.SmallFont.DrawString(spriteBatch, "Resent messages: " + c.Connection.Statistics.ResentMessages, new Vector2(x + 20, y + 20), clientColor); - - resentMessages += (int)c.Connection.Statistics.ResentMessages; - - y += 40; - } - - clientListScrollBar.Update(1.0f / 60.0f); - clientListScrollBar.Draw(spriteBatch); - - netStats.AddValue(NetStats.NetStatType.ResentMessages, Math.Max(resentMessages, 0)); - netStats.AddValue(NetStats.NetStatType.SentBytes, server.Statistics.SentBytes); - netStats.AddValue(NetStats.NetStatType.ReceivedBytes, server.Statistics.ReceivedBytes); - - netStats.Draw(spriteBatch, new Rectangle(200,0,800,200), this); - } - private void FileTransferChanged(FileSender.FileTransferOut transfer) { Client recipient = connectedClients.Find(c => c.Connection == transfer.Connection); +#if CLIENT UpdateFileTransferIndicator(recipient); +#endif } public void SendCancelTransferMsg(FileSender.FileTransferOut transfer) @@ -1850,42 +1776,6 @@ namespace Barotrauma.Networking server.SendMessage(msg, transfer.Connection, NetDeliveryMethod.ReliableOrdered, transfer.SequenceChannel); } - private void UpdateFileTransferIndicator(Client client) - { - var transfers = fileSender.ActiveTransfers.FindAll(t => t.Connection == client.Connection); - - var clientNameBox = GameMain.NetLobbyScreen.PlayerList.FindChild(client.name); - - var clientInfo = clientNameBox.FindChild("filetransfer"); - if (clientInfo == null) - { - clientNameBox.ClearChildren(); - clientInfo = new GUIFrame(new Rectangle(0, 0, 180, 0), Color.Transparent, Alignment.TopRight, null, clientNameBox); - clientInfo.UserData = "filetransfer"; - } - else if (transfers.Count == 0) - { - clientInfo.Parent.RemoveChild(clientInfo); - } - - clientInfo.ClearChildren(); - - var progressBar = new GUIProgressBar(new Rectangle(0, 4, 160, clientInfo.Rect.Height - 8), Color.Green, "", 0.0f, Alignment.Left, clientInfo); - progressBar.IsHorizontal = true; - progressBar.ProgressGetter = () => { return transfers.Sum(t => t.Progress) / transfers.Count; }; - - var textBlock = new GUITextBlock(new Rectangle(0, 2, 160, 0), "", "", Alignment.TopLeft, Alignment.Left | Alignment.CenterY, clientInfo, true, GUI.SmallFont); - textBlock.TextGetter = () => - { return MathUtils.GetBytesReadable(transfers.Sum(t => t.SentOffset)) + " / " + MathUtils.GetBytesReadable(transfers.Sum(t => t.Data.Length)); }; - - var cancelButton = new GUIButton(new Rectangle(-5, 0, 14, 0), "X", Alignment.Right, "", clientInfo); - cancelButton.OnClicked = (GUIButton button, object userdata) => - { - transfers.ForEach(t => fileSender.CancelTransfer(t)); - return true; - }; - } - public void UpdateVoteStatus() { if (server.Connections.Count == 0|| connectedClients.Count == 0) return; @@ -1936,30 +1826,7 @@ namespace Barotrauma.Networking SaveClientPermissions(); } - - public override bool SelectCrewCharacter(Character character, GUIComponent crewFrame) - { - if (character == null) return false; - - var characterFrame = crewFrame.FindChild("selectedcharacter"); - if (character != myCharacter) - { - var banButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Ban", Alignment.BottomRight, "", characterFrame); - banButton.UserData = character.Name; - banButton.OnClicked += GameMain.NetLobbyScreen.BanPlayer; - - var rangebanButton = new GUIButton(new Rectangle(0, -25, 100, 20), "Ban range", Alignment.BottomRight, "", characterFrame); - rangebanButton.UserData = character.Name; - rangebanButton.OnClicked += GameMain.NetLobbyScreen.BanPlayerRange; - - var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.BottomLeft, "", characterFrame); - kickButton.UserData = character.Name; - kickButton.OnClicked += GameMain.NetLobbyScreen.KickPlayer; - } - - return true; - } - + public void SetClientCharacter(Client client, Character newCharacter) { if (client == null) return; diff --git a/Barotrauma/Source/Networking/GameServerLogin.cs b/Barotrauma/BarotraumaShared/Source/Networking/GameServerLogin.cs similarity index 99% rename from Barotrauma/Source/Networking/GameServerLogin.cs rename to Barotrauma/BarotraumaShared/Source/Networking/GameServerLogin.cs index 9fde7eeaa..454759900 100644 --- a/Barotrauma/Source/Networking/GameServerLogin.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/GameServerLogin.cs @@ -212,7 +212,9 @@ namespace Barotrauma.Networking unauthClient = null; ConnectedClients.Add(newClient); +#if CLIENT GameMain.NetLobbyScreen.AddPlayer(newClient.name); +#endif GameMain.Server.SendChatMessage(clName + " has joined the server.", ChatMessageType.Server, null); var savedPermissions = clientPermissions.Find(cp => cp.IP == newClient.Connection.RemoteEndPoint.Address.ToString()); diff --git a/Barotrauma/BarotraumaShared/Source/Networking/GameServerSettings.cs b/Barotrauma/BarotraumaShared/Source/Networking/GameServerSettings.cs new file mode 100644 index 000000000..a7e204e53 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Networking/GameServerSettings.cs @@ -0,0 +1,360 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Xml; +using System.Xml.Linq; + +namespace Barotrauma.Networking +{ + enum SelectionMode + { + Manual = 0, Random = 1, Vote = 2 + } + + enum YesNoMaybe + { + No = 0, Maybe = 1, Yes = 2 + } + + partial class GameServer : NetworkMember, IPropertyObject + { + private class SavedClientPermission + { + public readonly string IP; + public readonly string Name; + + public ClientPermissions Permissions; + + public SavedClientPermission(string name, string ip, ClientPermissions permissions) + { + this.Name = name; + this.IP = ip; + + this.Permissions = permissions; + } + } + + public const string SettingsFile = "serversettings.xml"; + public static readonly string ClientPermissionsFile = "Data" + Path.DirectorySeparatorChar + "clientpermissions.txt"; + + public Dictionary ObjectProperties + { + get; + private set; + } + + public Dictionary extraCargo; + + public bool ShowNetStats; + + private TimeSpan refreshMasterInterval = new TimeSpan(0, 0, 30); + private TimeSpan sparseUpdateInterval = new TimeSpan(0, 0, 0, 3); + + private SelectionMode subSelectionMode, modeSelectionMode; + + private bool registeredToMaster; + + private WhiteList whitelist; + private BanList banList; + + private string password; + + private string adminAuthPass = ""; + public string AdminAuthPass + { + set + { + DebugConsole.NewMessage("Admin auth pass changed!",Color.Yellow); + adminAuthPass = ""; + if (value.Length > 0) + { + adminAuthPass = Encoding.UTF8.GetString(Lidgren.Network.NetUtility.ComputeSHAHash(Encoding.UTF8.GetBytes(value))); + } + } + } + + public float AutoRestartTimer; + + private bool autoRestart; + + private List clientPermissions = new List(); + + [HasDefaultValue(true, true)] + public bool RandomizeSeed + { + get; + private set; + } + + + [HasDefaultValue(300.0f, true)] + public float RespawnInterval + { + get; + private set; + } + + [HasDefaultValue(180.0f, true)] + public float MaxTransportTime + { + get; + private set; + } + + [HasDefaultValue(0.2f, true)] + public float MinRespawnRatio + { + get; + private set; + } + + + [HasDefaultValue(60.0f, true)] + public float AutoRestartInterval + { + get; + private set; + } + + [HasDefaultValue(true, true)] + public bool AllowSpectating + { + get; + private set; + } + + [HasDefaultValue(true, true)] + public bool EndRoundAtLevelEnd + { + get; + private set; + } + + [HasDefaultValue(true, true)] + public bool SaveServerLogs + { + get; + private set; + } + + [HasDefaultValue(true, true)] + public bool AllowFileTransfers + { + get; + private set; + } + + [HasDefaultValue(800, true)] + private int LinesPerLogFile + { + get + { + return log.LinesPerFile; + } + set + { + log.LinesPerFile = value; + } + } + + public bool AutoRestart + { + get { return (connectedClients.Count != 0) && autoRestart; } + set + { + autoRestart = value; + + AutoRestartTimer = autoRestart ? AutoRestartInterval : 0.0f; + } + } + + public YesNoMaybe TraitorsEnabled + { + get; + set; + } + + [HasDefaultValue(true, true)] + public bool AllowRespawn + { + get; + set; + } + + public SelectionMode SubSelectionMode + { + get { return subSelectionMode; } + } + + public SelectionMode ModeSelectionMode + { + get { return modeSelectionMode; } + } + + public BanList BanList + { + get { return banList; } + } + + [HasDefaultValue(true, true)] + public bool AllowVoteKick + { + get; + private set; + } + + [HasDefaultValue(0.6f, true)] + public float EndVoteRequiredRatio + { + get; + private set; + } + + [HasDefaultValue(0.6f, true)] + public float KickVoteRequiredRatio + { + get; + private set; + } + + private void SaveSettings() + { + XDocument doc = new XDocument(new XElement("serversettings")); + + ObjectProperty.SaveProperties(this, doc.Root, true); + + doc.Root.SetAttributeValue("SubSelection", subSelectionMode.ToString()); + doc.Root.SetAttributeValue("ModeSelection", modeSelectionMode.ToString()); + + doc.Root.SetAttributeValue("TraitorsEnabled", TraitorsEnabled.ToString()); + + if (GameMain.NetLobbyScreen != null +#if CLIENT + && GameMain.NetLobbyScreen.ServerMessage != null +#endif + ) + { + doc.Root.SetAttributeValue("ServerMessage", GameMain.NetLobbyScreen.ServerMessageText); + } + + XmlWriterSettings settings = new XmlWriterSettings(); + settings.Indent = true; + settings.NewLineOnAttributes = true; + + using (var writer = XmlWriter.Create(SettingsFile, settings)) + { + doc.Save(writer); + } + } + + private void LoadSettings() + { + XDocument doc = null; + if (File.Exists(SettingsFile)) + { + doc = ToolBox.TryLoadXml(SettingsFile); + } + + if (doc == null || doc.Root == null) + { + doc = new XDocument(new XElement("serversettings")); + } + + ObjectProperties = ObjectProperty.InitProperties(this, doc.Root); + + subSelectionMode = SelectionMode.Manual; + Enum.TryParse(ToolBox.GetAttributeString(doc.Root, "SubSelection", "Manual"), out subSelectionMode); + Voting.AllowSubVoting = subSelectionMode == SelectionMode.Vote; + + modeSelectionMode = SelectionMode.Manual; + Enum.TryParse(ToolBox.GetAttributeString(doc.Root, "ModeSelection", "Manual"), out modeSelectionMode); + Voting.AllowModeVoting = modeSelectionMode == SelectionMode.Vote; + + var traitorsEnabled = TraitorsEnabled; + Enum.TryParse(ToolBox.GetAttributeString(doc.Root, "TraitorsEnabled", "No"), out traitorsEnabled); + TraitorsEnabled = traitorsEnabled; + GameMain.NetLobbyScreen.SetTraitorsEnabled(traitorsEnabled); + + if (GameMain.NetLobbyScreen != null +#if CLIENT + && GameMain.NetLobbyScreen.ServerMessage != null +#endif + ) + { + GameMain.NetLobbyScreen.ServerMessageText = ToolBox.GetAttributeString(doc.Root, "ServerMessage", ""); + } + +#if CLIENT + showLogButton.Visible = SaveServerLogs; +#endif + + List monsterNames = Directory.GetDirectories("Content/Characters").ToList(); + for (int i = 0; i < monsterNames.Count; i++) + { + monsterNames[i] = monsterNames[i].Replace("Content/Characters", "").Replace("/", "").Replace("\\", ""); + } + monsterEnabled = new Dictionary(); + foreach (string s in monsterNames) + { + monsterEnabled.Add(s, true); + } + extraCargo = new Dictionary(); + } + + public void LoadClientPermissions() + { + if (!File.Exists(ClientPermissionsFile)) return; + + string[] lines; + try + { + lines = File.ReadAllLines(ClientPermissionsFile); + } + catch (Exception e) + { + DebugConsole.ThrowError("Failed to open client permission file " + ClientPermissionsFile, e); + return; + } + + clientPermissions.Clear(); + foreach (string line in lines) + { + string[] separatedLine = line.Split('|'); + if (separatedLine.Length < 3) continue; + + string name = String.Join("|", separatedLine.Take(separatedLine.Length - 2)); + string ip = separatedLine[separatedLine.Length - 2]; + + ClientPermissions permissions = ClientPermissions.None; + if (Enum.TryParse(separatedLine.Last(), out permissions)) + { + clientPermissions.Add(new SavedClientPermission(name, ip, permissions)); + } + } + } + + public void SaveClientPermissions() + { + GameServer.Log("Saving client permissions", ServerLog.MessageType.ServerMessage); + + List lines = new List(); + + foreach (SavedClientPermission clientPermission in clientPermissions) + { + lines.Add(clientPermission.Name + "|" + clientPermission.IP+"|"+clientPermission.Permissions.ToString()); + } + + try + { + File.WriteAllLines(ClientPermissionsFile, lines); + } + catch (Exception e) + { + DebugConsole.ThrowError("Saving client permissions to " + ClientPermissionsFile + " failed", e); + } + } + } +} diff --git a/Barotrauma/Source/Networking/INetSerializable.cs b/Barotrauma/BarotraumaShared/Source/Networking/INetSerializable.cs similarity index 95% rename from Barotrauma/Source/Networking/INetSerializable.cs rename to Barotrauma/BarotraumaShared/Source/Networking/INetSerializable.cs index 8467f11f1..d6159199a 100644 --- a/Barotrauma/Source/Networking/INetSerializable.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/INetSerializable.cs @@ -10,7 +10,9 @@ namespace Barotrauma.Networking /// interface IClientSerializable : INetSerializable { +#if CLIENT void ClientWrite(NetBuffer msg, object[] extraData = null); +#endif void ServerRead(ClientNetObject type, NetBuffer msg, Client c); } @@ -20,6 +22,8 @@ namespace Barotrauma.Networking interface IServerSerializable : INetSerializable { void ServerWrite(NetBuffer msg, Client c, object[] extraData = null); +#if CLIENT void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime); +#endif } } diff --git a/Barotrauma/Source/Networking/NetBufferExtensions.cs b/Barotrauma/BarotraumaShared/Source/Networking/NetBufferExtensions.cs similarity index 100% rename from Barotrauma/Source/Networking/NetBufferExtensions.cs rename to Barotrauma/BarotraumaShared/Source/Networking/NetBufferExtensions.cs diff --git a/Barotrauma/Source/Networking/NetConfig.cs b/Barotrauma/BarotraumaShared/Source/Networking/NetConfig.cs similarity index 100% rename from Barotrauma/Source/Networking/NetConfig.cs rename to Barotrauma/BarotraumaShared/Source/Networking/NetConfig.cs diff --git a/Barotrauma/Source/Networking/NetEntityEvent/NetEntityEvent.cs b/Barotrauma/BarotraumaShared/Source/Networking/NetEntityEvent/NetEntityEvent.cs similarity index 81% rename from Barotrauma/Source/Networking/NetEntityEvent/NetEntityEvent.cs rename to Barotrauma/BarotraumaShared/Source/Networking/NetEntityEvent/NetEntityEvent.cs index 7d304601e..7746e0cac 100644 --- a/Barotrauma/Source/Networking/NetEntityEvent/NetEntityEvent.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/NetEntityEvent/NetEntityEvent.cs @@ -64,6 +64,10 @@ namespace Barotrauma.Networking public bool Sent; +#if DEBUG + public string StackTrace; +#endif + private double createTime; public double CreateTime { @@ -76,6 +80,10 @@ namespace Barotrauma.Networking serializable = entity; createTime = Timing.TotalTime; + +#if DEBUG + StackTrace = Environment.StackTrace.ToString(); +#endif } public void Write(NetBuffer msg, Client recipient) @@ -83,24 +91,4 @@ namespace Barotrauma.Networking serializable.ServerWrite(msg, recipient, Data); } } - - class ClientEntityEvent : NetEntityEvent - { - private IClientSerializable serializable; - - public UInt16 CharacterStateID; - - public ClientEntityEvent(IClientSerializable entity, UInt16 id) - : base(entity, id) - { - serializable = entity; - } - - public void Write(NetBuffer msg) - { - msg.Write(CharacterStateID); - serializable.ClientWrite(msg, Data); - } - } - } diff --git a/Barotrauma/Source/Networking/NetEntityEvent/NetEntityEventManager.cs b/Barotrauma/BarotraumaShared/Source/Networking/NetEntityEvent/NetEntityEventManager.cs similarity index 100% rename from Barotrauma/Source/Networking/NetEntityEvent/NetEntityEventManager.cs rename to Barotrauma/BarotraumaShared/Source/Networking/NetEntityEvent/NetEntityEventManager.cs diff --git a/Barotrauma/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs b/Barotrauma/BarotraumaShared/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs similarity index 93% rename from Barotrauma/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs rename to Barotrauma/BarotraumaShared/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs index 695a247ab..06187974f 100644 --- a/Barotrauma/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs @@ -137,7 +137,7 @@ namespace Barotrauma.Networking { if (GameSettings.VerboseLogging) { - DebugConsole.ThrowError("Failed to read event for entity \"" + bufferedEvent.TargetEntity.ToString() + "!", e); + DebugConsole.ThrowError("Failed to read event for entity \"" + bufferedEvent.TargetEntity.ToString() + "\"!", e); } } @@ -156,16 +156,25 @@ namespace Barotrauma.Networking //it's been 10 seconds since this event was created //kick everyone that hasn't received it yet, this is way too old List toKick = inGameClients.FindAll(c => NetIdUtils.IdMoreRecent((UInt16)(lastSentToAll + 1), c.lastRecvEntityEventID)); - - toKick.ForEach(c => server.DisconnectClient(c, "", "You have been disconnected because of excessive desync")); + toKick.ForEach(c => + { + DebugConsole.NewMessage(c.name + " was kicked due to excessive desync (expected old event " + c.lastRecvEntityEventID.ToString() + ")", Microsoft.Xna.Framework.Color.Red); + server.DisconnectClient(c, "", "You have been disconnected because of excessive desync"); + } + ); } if (events.Count > 0) { //the client is waiting for an event that we don't have anymore //(the ID they're expecting is smaller than the ID of the first event in our list) - List toKick = inGameClients.FindAll(c => NetIdUtils.IdMoreRecent(events[0].ID, (UInt16)(c.lastRecvEntityEventID+1))); - toKick.ForEach(c => server.DisconnectClient(c, "", "You have been disconnected because of excessive desync")); + List toKick = inGameClients.FindAll(c => NetIdUtils.IdMoreRecent(events[0].ID, (UInt16)(c.lastRecvEntityEventID + 1))); + toKick.ForEach(c => + { + DebugConsole.NewMessage(c.name + " was kicked due to excessive desync (expected " + c.lastRecvEntityEventID.ToString() + ", last available is " + events[0].ID.ToString() + ")", Microsoft.Xna.Framework.Color.Red); + server.DisconnectClient(c, "", "You have been disconnected because of excessive desync"); + } + ); } } @@ -232,6 +241,7 @@ namespace Barotrauma.Networking msg.Write(client.UnreceivedEntityEventCount); msg.Write(client.FirstNewEventID); + //DebugConsole.NewMessage(eventsToSync[0].ID.ToString(), Microsoft.Xna.Framework.Color.Yellow); Write(msg, eventsToSync, client); } else diff --git a/Barotrauma/Source/Networking/NetIdUtils.cs b/Barotrauma/BarotraumaShared/Source/Networking/NetIdUtils.cs similarity index 100% rename from Barotrauma/Source/Networking/NetIdUtils.cs rename to Barotrauma/BarotraumaShared/Source/Networking/NetIdUtils.cs diff --git a/Barotrauma/Source/Networking/NetworkMember.cs b/Barotrauma/BarotraumaShared/Source/Networking/NetworkMember.cs similarity index 55% rename from Barotrauma/Source/Networking/NetworkMember.cs rename to Barotrauma/BarotraumaShared/Source/Networking/NetworkMember.cs index a58273954..09e48d9cc 100644 --- a/Barotrauma/Source/Networking/NetworkMember.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/NetworkMember.cs @@ -2,7 +2,6 @@ using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using System.Collections.Generic; using Lidgren.Network; using Barotrauma.Items.Components; @@ -66,7 +65,7 @@ namespace Barotrauma.Networking Kick } - abstract class NetworkMember + abstract partial class NetworkMember { #if DEBUG public Dictionary messageCount = new Dictionary(); @@ -83,10 +82,6 @@ namespace Barotrauma.Networking protected TimeSpan updateInterval; protected DateTime updateTimer; - protected GUIFrame inGameHUD; - protected GUIListBox chatBox; - protected GUITextBox chatMsgBox; - public int EndVoteCount, EndVoteMax; //private GUITextBlock endVoteText; @@ -94,27 +89,12 @@ namespace Barotrauma.Networking protected bool gameStarted; - protected Character myCharacter; - protected CharacterInfo characterInfo; - public Dictionary monsterEnabled; protected RespawnManager respawnManager; public Voting Voting; - public Character Character - { - get { return myCharacter; } - set { myCharacter = value; } - } - - public CharacterInfo CharacterInfo - { - get { return characterInfo; } - set { characterInfo = value; } - } - public string Name { get { return name; } @@ -130,11 +110,6 @@ namespace Barotrauma.Networking get { return gameStarted; } } - public GUIFrame InGameHUD - { - get { return inGameHUD; } - } - public virtual List ConnectedClients { get { return null; } @@ -142,52 +117,11 @@ namespace Barotrauma.Networking public NetworkMember() { - inGameHUD = new GUIFrame(new Rectangle(0,0,0,0), null, null); - inGameHUD.CanBeFocused = false; - - int width = (int)MathHelper.Clamp(GameMain.GraphicsWidth * 0.35f, 350, 500); - int height = (int)MathHelper.Clamp(GameMain.GraphicsHeight * 0.15f, 100, 200); - chatBox = new GUIListBox(new Rectangle( - GameMain.GraphicsWidth - 20 - width, - GameMain.GraphicsHeight - 40 - 25 - height, - width, height), - Color.White * 0.5f, "", inGameHUD); - chatBox.Padding = Vector4.Zero; - - chatMsgBox = new GUITextBox( - new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25), - Color.White * 0.5f, Color.Black, Alignment.TopLeft, Alignment.Left, "", inGameHUD); - chatMsgBox.Font = GUI.SmallFont; - chatMsgBox.MaxTextLength = ChatMessage.MaxLength; - chatMsgBox.Padding = Vector4.Zero; - chatMsgBox.OnEnterPressed = EnterChatMessage; - chatMsgBox.OnTextChanged = TypingChatMessage; - + InitProjSpecific(); + Voting = new Voting(); } - public bool TypingChatMessage(GUITextBox textBox, string text) - { - string tempStr; - string command = ChatMessage.GetChatMessageCommand(text, out tempStr); - switch (command) - { - case "r": - case "radio": - textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Radio]; - break; - case "d": - case "dead": - textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Dead]; - break; - default: - textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default]; - break; - } - - return true; - } - public bool CanUseRadio(Character sender) { if (sender == null) return false; @@ -200,26 +134,6 @@ namespace Barotrauma.Networking return radioComponent.HasRequiredContainedItems(false); } - public bool EnterChatMessage(GUITextBox textBox, string message) - { - textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default]; - - if (string.IsNullOrWhiteSpace(message)) return false; - - if (this == GameMain.Server) - { - GameMain.Server.SendChatMessage(message, null, null); - } - else if (this == GameMain.Client) - { - GameMain.Client.SendChatMessage(message); - } - - if (textBox == chatMsgBox) textBox.Deselect(); - - return true; - } - public void AddChatMessage(string message, ChatMessageType type, string senderName="", Character senderCharacter = null) { AddChatMessage(ChatMessage.Create(senderName, message, type, senderCharacter)); @@ -236,6 +150,7 @@ namespace Barotrauma.Networking message.Sender.ShowSpeechBubble(2.0f, ChatMessage.MessageColor[(int)message.Type]); } +#if CLIENT GameMain.NetLobbyScreen.NewChatMessage(message); while (chatBox.CountChildren > 20) @@ -273,20 +188,14 @@ namespace Barotrauma.Networking } GUI.PlayUISound(soundType); +#endif } public virtual void KickPlayer(string kickedName, bool ban, bool range = false) { } - public virtual void AddToGUIUpdateList() - { - if (gameStarted && Screen.Selected == GameMain.GameScreen) - { - inGameHUD.AddToGUIUpdateList(); - } - } - public virtual void Update(float deltaTime) { +#if CLIENT if (gameStarted && Screen.Selected == GameMain.GameScreen) { chatMsgBox.Visible = Character.Controlled == null || Character.Controlled.CanSpeak; @@ -314,58 +223,7 @@ namespace Barotrauma.Networking chatMsgBox.Select(); } } - } - - public virtual void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) - { - if (!gameStarted || Screen.Selected != GameMain.GameScreen) return; - - GameMain.GameSession.CrewManager.Draw(spriteBatch); - - inGameHUD.Draw(spriteBatch); - - if (EndVoteCount > 0) - { - if (GameMain.NetworkMember.myCharacter == null) - { - GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 180.0f, 40), - "Votes to end the round (y/n): " + EndVoteCount + "/" + (EndVoteMax - EndVoteCount), Color.White, null, 0, GUI.SmallFont); - } - else - { - GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 140.0f, 40), - "Votes (y/n): " + EndVoteCount + "/" + (EndVoteMax - EndVoteCount), Color.White, null, 0, GUI.SmallFont); - } - } - - if (respawnManager != null) - { - string respawnInfo = ""; - - if (respawnManager.CurrentState == RespawnManager.State.Waiting && - respawnManager.CountdownStarted) - { - respawnInfo = respawnManager.RespawnTimer <= 0.0f ? "" : "Respawn Shuttle dispatching in " + ToolBox.SecondsToReadableTime(respawnManager.RespawnTimer); - - } - else if (respawnManager.CurrentState == RespawnManager.State.Transporting) - { - respawnInfo = respawnManager.TransportTimer <= 0.0f ? "" : "Shuttle leaving in " + ToolBox.SecondsToReadableTime(respawnManager.TransportTimer); - } - - if (!string.IsNullOrEmpty(respawnInfo)) - { - GUI.DrawString(spriteBatch, - new Vector2(120.0f, 10), - respawnInfo, Color.White, null, 0, GUI.SmallFont); - } - - } - } - - public virtual bool SelectCrewCharacter(Character character, GUIComponent crewFrame) - { - return false; +#endif } public virtual void Disconnect() { } diff --git a/Barotrauma/Source/Networking/RespawnManager.cs b/Barotrauma/BarotraumaShared/Source/Networking/RespawnManager.cs similarity index 99% rename from Barotrauma/Source/Networking/RespawnManager.cs rename to Barotrauma/BarotraumaShared/Source/Networking/RespawnManager.cs index 400953b97..0e4e167ae 100644 --- a/Barotrauma/Source/Networking/RespawnManager.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/RespawnManager.cs @@ -429,23 +429,32 @@ namespace Barotrauma.Networking for (int i = 0; i < characterInfos.Count; i++) { - bool myCharacter = i >= clients.Count; + bool myCharacter = false; +#if CLIENT + myCharacter = i >= clients.Count; +#endif var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, !myCharacter, false); character.TeamID = 1; +#if CLIENT if (myCharacter) { server.Character = character; Character.Controlled = character; + GameMain.LightManager.LosEnabled = true; + } else { +#endif clients[i].Character = character; +#if CLIENT } - +#endif + Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position; if (divingSuitPrefab != null && oxyPrefab != null) @@ -481,8 +490,9 @@ namespace Barotrauma.Networking item.AddTag(s); } } - +#if CLIENT GameMain.GameSession.CrewManager.characters.Add(character); +#endif } } diff --git a/Barotrauma/BarotraumaShared/Source/Networking/ServerLog.cs b/Barotrauma/BarotraumaShared/Source/Networking/ServerLog.cs new file mode 100644 index 000000000..d7047060f --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Networking/ServerLog.cs @@ -0,0 +1,154 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace Barotrauma.Networking +{ + partial class ServerLog + { + private struct LogMessage + { + public readonly string Text; + public readonly MessageType Type; + + public LogMessage(string text, MessageType type) + { + Text = "[" + DateTime.Now.ToString() + "] " + text; + Type = type; + } + } + + public enum MessageType + { + Chat, + ItemInteraction, + Inventory, + Attack, + ServerMessage, + Error + } + + private readonly Color[] messageColor = + { + Color.LightBlue, + new Color(255, 142, 0), + new Color(238, 208, 0), + new Color(204, 74, 78), + new Color(157, 225, 160), + Color.Red + }; + + private readonly string[] messageTypeName = + { + "Chat message", + "Item interaction", + "Inventory usage", + "Attack & death", + "Server message", + "Error" + }; + + private int linesPerFile = 800; + + public const string SavePath = "ServerLogs"; + + private string serverName; + + private readonly Queue lines; + + private int unsavedLineCount; + + private string msgFilter; + private bool[] msgTypeHidden = new bool[Enum.GetValues(typeof(MessageType)).Length]; + + public int LinesPerFile + { + get { return linesPerFile; } + set { linesPerFile = Math.Max(value, 10); } + } + + public ServerLog(string serverName) + { + this.serverName = serverName; + + lines = new Queue(); + } + + public void WriteLine(string line, MessageType messageType) + { + //string logLine = "[" + DateTime.Now.ToLongTimeString() + "] " + line; + +#if SERVER + DebugConsole.NewMessage(line, Color.White); //TODO: REMOVE +#endif + + var newText = new LogMessage(line, messageType); + + lines.Enqueue(newText); + +#if CLIENT + if (LogFrame != null) + { + AddLine(newText); + + listBox.UpdateScrollBarSize(); + } +#endif + + unsavedLineCount++; + + if (unsavedLineCount >= LinesPerFile) + { + Save(); + unsavedLineCount = 0; + } + + while (lines.Count > LinesPerFile) + { + lines.Dequeue(); + } + +#if CLIENT + while (listBox != null && listBox.children.Count > LinesPerFile) + { + listBox.RemoveChild(listBox.children[0]); + } +#endif + } + + public void Save() + { + if (!Directory.Exists(SavePath)) + { + try + { + Directory.CreateDirectory(SavePath); + } + catch (Exception e) + { + DebugConsole.ThrowError("Failed to create a folder for server logs", e); + return; + } + } + + string fileName = serverName+"_"+DateTime.Now.ToShortDateString()+"_"+DateTime.Now.ToShortTimeString()+".txt"; + + fileName = fileName.Replace(":", ""); + fileName = fileName.Replace("../", ""); + fileName = fileName.Replace("/", ""); + + string filePath = Path.Combine(SavePath, fileName); + + try + { + File.WriteAllLines(filePath, lines.Select(l => l.Text)); + } + catch (Exception e) + { + DebugConsole.ThrowError("Saving the server log to " + filePath + " failed", e); + } + } + } +} diff --git a/Barotrauma/Source/Networking/Voting.cs b/Barotrauma/BarotraumaShared/Source/Networking/Voting.cs similarity index 51% rename from Barotrauma/Source/Networking/Voting.cs rename to Barotrauma/BarotraumaShared/Source/Networking/Voting.cs index 77681c37d..34622ce7a 100644 --- a/Barotrauma/Source/Networking/Voting.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/Voting.cs @@ -8,7 +8,7 @@ using System.Text; namespace Barotrauma { - class Voting + partial class Voting { private bool allowSubVoting, allowModeVoting; @@ -16,83 +16,6 @@ namespace Barotrauma public bool AllowEndVoting = true; - public bool AllowSubVoting - { - get { return allowSubVoting; } - set - { - if (value == allowSubVoting) return; - allowSubVoting = value; - GameMain.NetLobbyScreen.SubList.Enabled = value || GameMain.Server != null; - GameMain.NetLobbyScreen.InfoFrame.FindChild("subvotes").Visible = value; - - if (GameMain.Server != null) - { - UpdateVoteTexts(GameMain.Server.ConnectedClients, VoteType.Sub); - GameMain.Server.UpdateVoteStatus(); - } - else - { - GameMain.NetLobbyScreen.SubList.Deselect(); - } - } - } - public bool AllowModeVoting - { - get { return allowModeVoting; } - set - { - if (value == allowModeVoting) return; - allowModeVoting = value; - GameMain.NetLobbyScreen.ModeList.Enabled = value || GameMain.Server != null; - GameMain.NetLobbyScreen.InfoFrame.FindChild("modevotes").Visible = value; - if (GameMain.Server != null) - { - UpdateVoteTexts(GameMain.Server.ConnectedClients, VoteType.Mode); - GameMain.Server.UpdateVoteStatus(); - } - else - { - GameMain.NetLobbyScreen.ModeList.Deselect(); - } - } - } - - public void UpdateVoteTexts(List clients, VoteType voteType) - { - GUIListBox listBox = (voteType == VoteType.Sub) ? - GameMain.NetLobbyScreen.SubList : GameMain.NetLobbyScreen.ModeList; - - foreach (GUIComponent comp in listBox.children) - { - GUITextBlock voteText = comp.FindChild("votes") as GUITextBlock; - if (voteText != null) comp.RemoveChild(voteText); - } - - List> voteList = GetVoteList(voteType, clients); - foreach (Pair votable in voteList) - { - SetVoteText(listBox, votable.First, votable.Second); - } - } - - private void SetVoteText(GUIListBox listBox, object userData, int votes) - { - if (userData == null) return; - foreach (GUIComponent comp in listBox.children) - { - if (comp.UserData != userData) continue; - GUITextBlock voteText = comp.FindChild("votes") as GUITextBlock; - if (voteText == null) - { - voteText = new GUITextBlock(new Rectangle(0, 0, 30, 0), "", "", Alignment.Right, Alignment.Right, comp); - voteText.UserData = "votes"; - } - - voteText.Text = votes == 0 ? "" : votes.ToString(); - } - } - private List> GetVoteList(VoteType voteType, List voters) { List> voteList = new List>(); @@ -146,44 +69,10 @@ namespace Barotrauma GameMain.NetworkMember.EndVoteCount = 0; GameMain.NetworkMember.EndVoteMax = 0; +#if CLIENT UpdateVoteTexts(connectedClients, VoteType.Mode); UpdateVoteTexts(connectedClients, VoteType.Sub); - } - - public void ClientWrite(NetBuffer msg, VoteType voteType, object data) - { - if (GameMain.Server != null) return; - - msg.Write((byte)voteType); - - switch (voteType) - { - case VoteType.Sub: - Submarine sub = data as Submarine; - if (sub == null) return; - - msg.Write(sub.Name); - break; - case VoteType.Mode: - GameModePreset gameMode = data as GameModePreset; - if (gameMode == null) return; - - msg.Write(gameMode.Name); - break; - case VoteType.EndRound: - if (!(data is bool)) return; - - msg.Write((bool)data); - break; - case VoteType.Kick: - Client votedClient = data as Client; - if (votedClient == null) return; - - msg.Write(votedClient.ID); - break; - } - - msg.WritePadBits(); +#endif } public void ServerRead(NetIncomingMessage inc, Client sender) @@ -208,14 +97,18 @@ namespace Barotrauma string subName = inc.ReadString(); Submarine sub = Submarine.SavedSubmarines.Find(s => s.Name == subName); sender.SetVote(voteType, sub); +#if CLIENT UpdateVoteTexts(GameMain.Server.ConnectedClients, voteType); +#endif break; case VoteType.Mode: string modeName = inc.ReadString(); GameModePreset mode = GameModePreset.list.Find(gm => gm.Name == modeName); sender.SetVote(voteType, mode); +#if CLIENT UpdateVoteTexts(GameMain.Server.ConnectedClients, voteType); +#endif break; case VoteType.EndRound: if (sender.Character == null) return; @@ -283,48 +176,5 @@ namespace Barotrauma msg.WritePadBits(); } - public void ClientRead(NetIncomingMessage inc) - { - if (GameMain.Server != null) return; - - AllowSubVoting = inc.ReadBoolean(); - if (allowSubVoting) - { - foreach (Submarine sub in Submarine.SavedSubmarines) - { - SetVoteText(GameMain.NetLobbyScreen.SubList, sub, 0); - } - int votableCount = inc.ReadByte(); - for (int i = 0; i < votableCount; i++) - { - int votes = inc.ReadByte(); - string subName = inc.ReadString(); - Submarine sub = Submarine.SavedSubmarines.Find(sm => sm.Name == subName); - SetVoteText(GameMain.NetLobbyScreen.SubList, sub, votes); - } - } - AllowModeVoting = inc.ReadBoolean(); - if (allowModeVoting) - { - int votableCount = inc.ReadByte(); - for (int i = 0; i < votableCount; i++) - { - int votes = inc.ReadByte(); - string modeName = inc.ReadString(); - GameModePreset mode = GameModePreset.list.Find(m => m.Name == modeName); - SetVoteText(GameMain.NetLobbyScreen.ModeList, mode, votes); - } - } - AllowEndVoting = inc.ReadBoolean(); - if (AllowEndVoting) - { - GameMain.NetworkMember.EndVoteCount = inc.ReadByte(); - GameMain.NetworkMember.EndVoteMax = inc.ReadByte(); - } - AllowVoteKick = inc.ReadBoolean(); - - inc.ReadPadBits(); - } - } } diff --git a/Barotrauma/BarotraumaShared/Source/Networking/WhiteList.cs b/Barotrauma/BarotraumaShared/Source/Networking/WhiteList.cs new file mode 100644 index 000000000..a0cd042f4 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Networking/WhiteList.cs @@ -0,0 +1,137 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace Barotrauma.Networking +{ + class WhiteListedPlayer + { + public string Name; + public string IP; + + public WhiteListedPlayer(string name,string ip) + { + Name = name; + IP = ip; + } + } + + partial class WhiteList + { + const string SavePath = "Data/whitelist.txt"; + + private List whitelistedPlayers; + public List WhiteListedPlayers + { + get { return whitelistedPlayers; } + } + + public bool Enabled; + + public WhiteList() + { + Enabled = false; + whitelistedPlayers = new List(); + + if (File.Exists(SavePath)) + { + string[] lines; + try + { + lines = File.ReadAllLines(SavePath); + } + catch (Exception e) + { + DebugConsole.ThrowError("Failed to open whitelist in " + SavePath, e); + return; + } + + foreach (string line in lines) + { + if (line[0] == '#') + { + string lineval = line.Substring(1, line.Length - 1); + int intVal = 0; + Int32.TryParse(lineval, out intVal); + if (lineval.ToLower() == "true" || intVal != 0) + { + Enabled = true; + } + else + { + Enabled = false; + } + } + else + { + string[] separatedLine = line.Split(','); + if (separatedLine.Length < 2) continue; + + string name = String.Join(",", separatedLine.Take(separatedLine.Length - 1)); + string ip = separatedLine.Last(); + + whitelistedPlayers.Add(new WhiteListedPlayer(name, ip)); + } + } + } + } + + public void Save() + { + GameServer.Log("Saving whitelist", ServerLog.MessageType.ServerMessage); + + List lines = new List(); + + if (Enabled) + { + lines.Add("#true"); + } + else + { + lines.Add("#false"); + } + foreach (WhiteListedPlayer wlp in whitelistedPlayers) + { + lines.Add(wlp.Name + "," + wlp.IP); + } + + try + { + File.WriteAllLines(SavePath, lines); + } + catch (Exception e) + { + DebugConsole.ThrowError("Saving the whitelist to " + SavePath + " failed", e); + } + } + + public bool IsWhiteListed(string name, string ip) + { + if (!Enabled) return true; + WhiteListedPlayer wlp = whitelistedPlayers.Find(p => p.Name == name); + if (wlp == null) return false; + if (wlp.IP != ip && !string.IsNullOrWhiteSpace(wlp.IP)) return false; + return true; + } + + private void RemoveFromWhiteList(WhiteListedPlayer wlp) + { + DebugConsole.Log("Removing " + wlp.Name + " from whitelist"); + GameServer.Log("Removing " + wlp.Name + " from whitelist", ServerLog.MessageType.ServerMessage); + + whitelistedPlayers.Remove(wlp); + Save(); + } + + private void AddToWhiteList(string name,string ip) + { + if (string.IsNullOrWhiteSpace(name)) return; + if (whitelistedPlayers.Any(x => x.Name.ToLower() == name.ToLower() && x.IP == ip)) return; + whitelistedPlayers.Add(new WhiteListedPlayer(name, ip)); + Save(); + } + } +} diff --git a/Barotrauma/Source/Physics/Physics.cs b/Barotrauma/BarotraumaShared/Source/Physics/Physics.cs similarity index 100% rename from Barotrauma/Source/Physics/Physics.cs rename to Barotrauma/BarotraumaShared/Source/Physics/Physics.cs diff --git a/Barotrauma/Source/Physics/PhysicsBody.cs b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs similarity index 82% rename from Barotrauma/Source/Physics/PhysicsBody.cs rename to Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs index c69cda269..7535d41b5 100644 --- a/Barotrauma/Source/Physics/PhysicsBody.cs +++ b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs @@ -59,7 +59,7 @@ namespace Barotrauma } } - class PhysicsBody + partial class PhysicsBody { public enum Shape { @@ -248,12 +248,6 @@ namespace Barotrauma set { body.CollidesWith = value; } } - private Texture2D bodyShapeTexture; - public Texture2D BodyShapeTexture - { - get { return bodyShapeTexture; } - } - public PhysicsBody(XElement element, float scale = 1.0f) : this(element, Vector2.Zero, scale) { @@ -459,84 +453,6 @@ namespace Barotrauma } } - public void Draw(SpriteBatch spriteBatch, Sprite sprite, Color color, float? depth = null, float scale = 1.0f) - { - if (!Enabled) return; - - UpdateDrawPosition(); - - if (sprite == null) return; - - SpriteEffects spriteEffect = (dir == 1.0f) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - - if (GameMain.DebugDraw) - { - if (!body.Awake) color = Color.Blue; - - if (targetPosition != null) - { - Vector2 pos = ConvertUnits.ToDisplayUnits((Vector2)targetPosition); - if (Submarine != null) pos += Submarine.DrawPosition; - - GUI.DrawRectangle(spriteBatch, - new Vector2(pos.X - 5, -(pos.Y + 5)), - Vector2.One*10.0f, Color.Red, false, 0, 3); - } - - if (offsetFromTargetPos != Vector2.Zero) - { - Vector2 pos = ConvertUnits.ToDisplayUnits(body.Position); - if (Submarine != null) pos += Submarine.DrawPosition; - - GUI.DrawLine(spriteBatch, - new Vector2(pos.X, -pos.Y), - new Vector2(DrawPosition.X, -DrawPosition.Y), - Color.Cyan, 0, 5); - } - } - - sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y), color, -drawRotation, scale, spriteEffect, depth); - } - - public void DebugDraw(SpriteBatch spriteBatch, Color color) - { - if (bodyShapeTexture == null) - { - switch (BodyShape) - { - case PhysicsBody.Shape.Rectangle: - bodyShapeTexture = GUI.CreateRectangle( - (int)ConvertUnits.ToDisplayUnits(width), - (int)ConvertUnits.ToDisplayUnits(height)); - break; - - case PhysicsBody.Shape.Capsule: - bodyShapeTexture = GUI.CreateCapsule( - (int)ConvertUnits.ToDisplayUnits(radius), - (int)ConvertUnits.ToDisplayUnits(Math.Max(height,width))); - break; - case PhysicsBody.Shape.Circle: - bodyShapeTexture = GUI.CreateCircle((int)ConvertUnits.ToDisplayUnits(radius)); - break; - } - } - - float rot = -DrawRotation; - if (bodyShape == PhysicsBody.Shape.Capsule && width > height) - { - rot -= MathHelper.PiOver2; - } - - spriteBatch.Draw( - bodyShapeTexture, - new Vector2(DrawPosition.X, -DrawPosition.Y), - null, - color, - rot, - new Vector2(bodyShapeTexture.Width / 2, bodyShapeTexture.Height / 2), - 1.0f, SpriteEffects.None, 0.0f); - } - public void CorrectPosition(List positionBuffer, float deltaTime, out Vector2 newVelocity) where T : PosInfo { Vector2 newPosition = SimPosition; @@ -616,12 +532,9 @@ namespace Barotrauma list.Remove(this); GameMain.World.RemoveBody(body); - if (bodyShapeTexture != null) - { - bodyShapeTexture.Dispose(); - bodyShapeTexture = null; - } + DisposeProjSpecific(); } + partial void DisposeProjSpecific(); } } diff --git a/Barotrauma/BarotraumaShared/Source/PlayerInput.cs b/Barotrauma/BarotraumaShared/Source/PlayerInput.cs new file mode 100644 index 000000000..bb45cd133 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/PlayerInput.cs @@ -0,0 +1,203 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace Barotrauma +{ + + public enum InputType + { + Select, + Use, + Aim, + Up, Down, Left, Right, + Attack, + Run, Crouch, + Chat, CrewOrders + } + + public class KeyOrMouse + { + Keys keyBinding; + int? mouseButton; + + public Keys Key + { + get { return keyBinding; } + } + public int? MouseButton + { + get { return mouseButton; } + } + + public KeyOrMouse(Keys keyBinding) + { + this.keyBinding = keyBinding; + } + + public KeyOrMouse(int mouseButton) + { + this.mouseButton = mouseButton; + } + + public bool IsDown() + { + if (mouseButton==null) + { + return PlayerInput.KeyDown(keyBinding); + } + else if (mouseButton == 0) + { + return PlayerInput.LeftButtonHeld(); + } + else if (mouseButton == 1) + { + return PlayerInput.RightButtonHeld(); + } + + return false; + } + + public bool IsHit() + { + if (mouseButton == null) + { + return PlayerInput.KeyHit(keyBinding); + } + else if (mouseButton == 0) + { + return PlayerInput.LeftButtonClicked(); + } + else if (mouseButton == 1) + { + return PlayerInput.RightButtonClicked(); + } + + return false; + } + + public override string ToString() + { + if (mouseButton==null) + { + return keyBinding.ToString(); + } + else if (mouseButton==0) + { + return "Mouse1"; + } + else if (mouseButton==1) + { + return "Mouse2"; + } + + return "None"; + } + } + + class Key + { + private bool hit, hitQueue; + private bool held, heldQueue; + + + KeyOrMouse binding; + + //public bool CanBeHeld + //{ + // get { return canBeHeld; } + //} + + public Key(KeyOrMouse binding) + { + this.binding = binding; + } + + public bool Hit + { + get + { + return hit; + } + set + { + hit = value; + } + } + + public bool Held + { + get + { + return held; + } + set + { + held = value; + } + } + + public KeyOrMouse State + { + get { return binding; } + } + + public void SetState() + { + hit = binding.IsHit(); + if (hit) hitQueue = true; + + held = binding.IsDown(); + if (held) heldQueue = true; + } + + public void SetState(bool hit, bool held) + { + if (hit) hitQueue = true; + if (held) heldQueue = true; + } + + public bool DequeueHit() + { + bool value = hitQueue; + hitQueue = false; + return value; + } + + public bool DequeueHeld() + { + bool value = heldQueue; + heldQueue = false; + return value; + } + + public bool GetHeldQueue + { + get { return heldQueue; } + } + + public bool GetHitQueue + { + get { return hitQueue; } + } + + + public void Reset() + { + hit = false; + held = false; + } + + public void ResetHit() + { + hit = false; + //stateQueue = false; + } + + + public void ResetHeld() + { + held = false; + //stateQueue = false; + } + } +} diff --git a/Barotrauma/Source/Properties.cs b/Barotrauma/BarotraumaShared/Source/Properties.cs similarity index 100% rename from Barotrauma/Source/Properties.cs rename to Barotrauma/BarotraumaShared/Source/Properties.cs diff --git a/Barotrauma/BarotraumaShared/Source/Screens/GameScreen.cs b/Barotrauma/BarotraumaShared/Source/Screens/GameScreen.cs new file mode 100644 index 000000000..afff4de93 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Screens/GameScreen.cs @@ -0,0 +1,146 @@ +using Microsoft.Xna.Framework; +#if DEBUG && CLIENT +using Microsoft.Xna.Framework.Input; +#endif + +namespace Barotrauma +{ + partial class GameScreen : Screen + { + private Camera cam; + + public override Camera Cam + { + get { return cam; } + } + + public GameScreen() + { + cam = new Camera(); + cam.Translate(new Vector2(-10.0f, 50.0f)); + } + + public override void Select() + { + base.Select(); + + if (Character.Controlled!=null) + { + cam.Position = Character.Controlled.WorldPosition; + cam.UpdateTransform(); + } + else if (Submarine.MainSub != null) + { + cam.Position = Submarine.MainSub.WorldPosition; + cam.UpdateTransform(); + } + + foreach (MapEntity entity in MapEntity.mapEntityList) + entity.IsHighlighted = false; + } + + public override void Deselect() + { + base.Deselect(); + +#if CLIENT + Sounds.SoundManager.LowPassHFGain = 1.0f; +#endif + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + public override void Update(double deltaTime) + { + +#if DEBUG && CLIENT + if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null && + !DebugConsole.IsOpen) + { + var closestSub = Submarine.FindClosest(cam.WorldViewCenter); + if (closestSub == null) closestSub = GameMain.GameSession.Submarine; + + Vector2 targetMovement = Vector2.Zero; + if (PlayerInput.KeyDown(Keys.I)) targetMovement.Y += 1.0f; + if (PlayerInput.KeyDown(Keys.K)) targetMovement.Y -= 1.0f; + if (PlayerInput.KeyDown(Keys.J)) targetMovement.X -= 1.0f; + if (PlayerInput.KeyDown(Keys.L)) targetMovement.X += 1.0f; + + if (targetMovement != Vector2.Zero) + closestSub.ApplyForce(targetMovement * closestSub.SubBody.Body.Mass * 100.0f); + } +#endif + + foreach (MapEntity e in MapEntity.mapEntityList) + { + e.IsHighlighted = false; + } + +#if CLIENT + if (GameMain.GameSession != null) GameMain.GameSession.Update((float)deltaTime); + + BackgroundCreatureManager.Update((float)deltaTime, cam); + + GameMain.ParticleManager.Update((float)deltaTime); + + GameMain.LightManager.Update((float)deltaTime); +#endif + + if (Level.Loaded != null) Level.Loaded.Update((float)deltaTime); + +#if CLIENT + if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null) + { + if (Character.Controlled.SelectedConstruction == Character.Controlled.ClosestItem) + { + Character.Controlled.SelectedConstruction.UpdateHUD(cam, Character.Controlled); + } + } +#endif + + Character.UpdateAll((float)deltaTime, cam); + + StatusEffect.UpdateAll((float)deltaTime); + +#if CLIENT + if (Character.Controlled != null && Lights.LightManager.ViewTarget != null) + { + cam.TargetPos = Lights.LightManager.ViewTarget.WorldPosition; + } +#endif + + cam.MoveCamera((float)deltaTime); + + foreach (Submarine sub in Submarine.Loaded) + { + sub.SetPrevTransform(sub.Position); + } + + foreach (PhysicsBody pb in PhysicsBody.list) + { + pb.SetPrevTransform(pb.SimPosition, pb.Rotation); + } + + MapEntity.UpdateAll((float)deltaTime, cam); + + Character.UpdateAnimAll((float)deltaTime); + + Ragdoll.UpdateAll((float)deltaTime, cam); + + foreach (Submarine sub in Submarine.Loaded) + { + sub.Update((float)deltaTime); + } + + GameMain.World.Step((float)deltaTime); + + if (!PlayerInput.LeftButtonHeld()) + { + Inventory.draggingSlot = null; + Inventory.draggingItem = null; + } + } + } +} diff --git a/Barotrauma/BarotraumaShared/Source/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaShared/Source/Screens/NetLobbyScreen.cs new file mode 100644 index 000000000..7839f669e --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Screens/NetLobbyScreen.cs @@ -0,0 +1,67 @@ +using System; +using Barotrauma.Networking; +using System.Linq; +using System.Collections.Generic; +using System.Reflection; +using System.ComponentModel; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Barotrauma +{ + partial class NetLobbyScreen : Screen + { + public bool IsServer; + public string ServerName = "Server"; + + private UInt16 lastUpdateID; + public UInt16 LastUpdateID + { + get { if (GameMain.Server != null && lastUpdateID < 1) lastUpdateID++; return lastUpdateID; } + set { if (GameMain.Server != null) return; lastUpdateID = value; } + } + + //for guitextblock delegate + public string GetServerName() + { + return ServerName; + } + + private string levelSeed = ""; + + private float autoRestartTimer; + + public string AutoRestartText() + { + if (GameMain.Server != null) + { + if (!GameMain.Server.AutoRestart) return ""; + return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(GameMain.Server.AutoRestartTimer, 0)); + } + + if (autoRestartTimer == 0.0f) return ""; + return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(autoRestartTimer, 0)); + } + + public void ToggleTraitorsEnabled(int dir) + { + if (GameMain.Server == null) return; + + lastUpdateID++; + + int index = (int)GameMain.Server.TraitorsEnabled + dir; + if (index < 0) index = 2; + if (index > 2) index = 0; + + SetTraitorsEnabled((YesNoMaybe)index); + } + + public void SetTraitorsEnabled(YesNoMaybe enabled) + { + if (GameMain.Server != null) GameMain.Server.TraitorsEnabled = enabled; +#if CLIENT + (traitorProbabilityText as GUITextBlock).Text = enabled.ToString(); +#endif + } + } +} diff --git a/Barotrauma/BarotraumaShared/Source/Screens/Screen.cs b/Barotrauma/BarotraumaShared/Source/Screens/Screen.cs new file mode 100644 index 000000000..8e96b37d0 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Screens/Screen.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; + +namespace Barotrauma +{ + partial class Screen + { + private static Screen selected; + + public static Screen Selected + { + get { return selected; } + } + + public static void SelectNull() + { + selected = null; + } + + public virtual void Deselect() + { + } + + public virtual void Select() + { + if (selected != null && selected != this) + { + selected.Deselect(); +#if CLIENT + GUIComponent.KeyboardDispatcher.Subscriber = null; +#endif + } + selected = this; + } + + public virtual Camera Cam + { + get { return null; } + } + + public virtual void Update(double deltaTime) + { + } + } +} diff --git a/Barotrauma/Source/Screens/sygwkgy0.iv5 b/Barotrauma/BarotraumaShared/Source/Screens/sygwkgy0.iv5 similarity index 100% rename from Barotrauma/Source/Screens/sygwkgy0.iv5 rename to Barotrauma/BarotraumaShared/Source/Screens/sygwkgy0.iv5 diff --git a/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs new file mode 100644 index 000000000..5ec850149 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs @@ -0,0 +1,167 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace Barotrauma +{ + public partial class Sprite + { + static List list = new List(); + //the file from which the texture is loaded + //if two sprites use the same file, they share the same texture + string file; + + //the area in the texture that is supposed to be drawn + Rectangle sourceRect; + + //the offset used when drawing the sprite + protected Vector2 offset; + + protected Vector2 origin; + + //the size of the drawn sprite, if larger than the source, + //the sprite is tiled to fill the target size + public Vector2 size; + + public float rotation; + + public SpriteEffects effects; + + protected float depth; + + public Rectangle SourceRect + { + get { return sourceRect; } + set { sourceRect = value; } + } + + public float Depth + { + get { return depth; } + set { depth = MathHelper.Clamp(value, 0.0f, 1.0f); } + } + + public Vector2 Origin + { + get { return origin; } + set { origin = value; } + } + + public string FilePath + { + get { return file; } + } + + public override string ToString() + { + return FilePath + ": " + sourceRect; + } + + partial void LoadTexture(ref Vector4 sourceVector, ref bool shouldReturn); + partial void CalculateSourceRect(); + + public Sprite(XElement element, string path = "", string file = "") + { + if (file == "") + { + file = ToolBox.GetAttributeString(element, "texture", ""); + } + + if (file == "") + { + DebugConsole.ThrowError("Sprite " + element + " doesn't have a texture specified!"); + return; + } + + if (!string.IsNullOrEmpty(path)) + { + if (!path.EndsWith("/")) path += "/"; + } + + this.file = path + file; + + Vector4 sourceVector = ToolBox.GetAttributeVector4(element, "sourcerect", Vector4.Zero); + + bool shouldReturn = false; + LoadTexture(ref sourceVector, ref shouldReturn); + if (shouldReturn) return; + + sourceRect = new Rectangle( + (int)sourceVector.X, (int)sourceVector.Y, + (int)sourceVector.Z, (int)sourceVector.W); + + origin = ToolBox.GetAttributeVector2(element, "origin", new Vector2(0.5f, 0.5f)); + origin.X = origin.X * sourceRect.Width; + origin.Y = origin.Y * sourceRect.Height; + + size = ToolBox.GetAttributeVector2(element, "size", Vector2.One); + size.X *= sourceRect.Width; + size.Y *= sourceRect.Height; + + Depth = ToolBox.GetAttributeFloat(element, "depth", 0.0f); + + list.Add(this); + } + + public Sprite(string newFile, Vector2 newOrigin) + { + file = newFile; + + Vector4 sourceVector = Vector4.Zero; + bool shouldReturn = false; + LoadTexture(ref sourceVector, ref shouldReturn); + if (shouldReturn) return; + + CalculateSourceRect(); + + size = new Vector2(sourceRect.Width, sourceRect.Height); + + origin = new Vector2((float)sourceRect.Width * newOrigin.X, (float)sourceRect.Height * newOrigin.Y); + + effects = SpriteEffects.None; + + list.Add(this); + } + + public Sprite(string newFile, Rectangle? sourceRectangle, Vector2? newOffset, float newRotation = 0.0f) + { + file = newFile; + Vector4 sourceVector = Vector4.Zero; + bool shouldReturn = false; + LoadTexture(ref sourceVector, ref shouldReturn); + if (shouldReturn) return; + + if (sourceRectangle != null) + { + sourceRect = (Rectangle)sourceRectangle; + } + else + { + CalculateSourceRect(); + } + + offset = newOffset ?? Vector2.Zero; + + size = new Vector2(sourceRect.Width, sourceRect.Height); + + origin = Vector2.Zero; + + rotation = newRotation; + + list.Add(this); + } + + public void Remove() + { + list.Remove(this); + + DisposeTexture(); + } + + partial void DisposeTexture(); + } +} + diff --git a/Barotrauma/Source/SpriteSheet.cs b/Barotrauma/BarotraumaShared/Source/Sprite/SpriteSheet.cs similarity index 55% rename from Barotrauma/Source/SpriteSheet.cs rename to Barotrauma/BarotraumaShared/Source/Sprite/SpriteSheet.cs index eadc93492..12e091d44 100644 --- a/Barotrauma/Source/SpriteSheet.cs +++ b/Barotrauma/BarotraumaShared/Source/Sprite/SpriteSheet.cs @@ -1,11 +1,10 @@ using Microsoft.Xna.Framework; using System; using System.Xml.Linq; -using Microsoft.Xna.Framework.Graphics; namespace Barotrauma { - class SpriteSheet : Sprite + partial class SpriteSheet : Sprite { private Rectangle[] sourceRects; @@ -37,19 +36,5 @@ namespace Barotrauma origin.X = origin.X * cellWidth; origin.Y = origin.Y * cellHeight; } - - public override void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = default(float?)) - { - if (texture == null) return; - - spriteBatch.Draw(texture, pos + offset, sourceRects[0], color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth); - } - - public void Draw(SpriteBatch spriteBatch, int spriteIndex, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = default(float?)) - { - if (texture == null) return; - - spriteBatch.Draw(texture, pos + offset, sourceRects[spriteIndex], color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth); - } } } diff --git a/Barotrauma/Source/Timing.cs b/Barotrauma/BarotraumaShared/Source/Timing.cs similarity index 100% rename from Barotrauma/Source/Timing.cs rename to Barotrauma/BarotraumaShared/Source/Timing.cs diff --git a/Barotrauma/Source/Utils/Homoglyphs.cs b/Barotrauma/BarotraumaShared/Source/Utils/Homoglyphs.cs similarity index 100% rename from Barotrauma/Source/Utils/Homoglyphs.cs rename to Barotrauma/BarotraumaShared/Source/Utils/Homoglyphs.cs diff --git a/Barotrauma/Source/Utils/MTRandom.cs b/Barotrauma/BarotraumaShared/Source/Utils/MTRandom.cs similarity index 100% rename from Barotrauma/Source/Utils/MTRandom.cs rename to Barotrauma/BarotraumaShared/Source/Utils/MTRandom.cs diff --git a/Barotrauma/Source/Utils/MathUtils.cs b/Barotrauma/BarotraumaShared/Source/Utils/MathUtils.cs similarity index 96% rename from Barotrauma/Source/Utils/MathUtils.cs rename to Barotrauma/BarotraumaShared/Source/Utils/MathUtils.cs index 30d09ee5d..c8984c989 100644 --- a/Barotrauma/Source/Utils/MathUtils.cs +++ b/Barotrauma/BarotraumaShared/Source/Utils/MathUtils.cs @@ -6,6 +6,16 @@ using System.Text; namespace Barotrauma { + //TODO: perhaps find a better place for this? + [Flags] + public enum Alignment + { + CenterX = 1, Left = 2, Right = 4, CenterY = 8, Top = 16, Bottom = 32, + TopLeft = (Top | Left), TopCenter = (CenterX | Top), TopRight = (Top | Right), + CenterLeft = (Left | CenterY), Center = (CenterX | CenterY), CenterRight = (Right | CenterY), + BottomLeft = (Bottom | Left), BottomCenter = (CenterX | Bottom), BottomRight = (Bottom | Right), + } + static class MathUtils { public static Vector2 SmoothStep(Vector2 v1, Vector2 v2, float amount) @@ -32,6 +42,11 @@ namespace Barotrauma return (float)Math.Atan2(vector.Y, vector.X); } + public static Point ToPoint(Vector2 vector) + { + return new Point((int)vector.X,(int)vector.Y); + } + public static bool IsValid(float value) { return (!float.IsInfinity(value) && !float.IsNaN(value)); @@ -435,7 +450,7 @@ namespace Barotrauma Vector2 normal = Vector2.Normalize(endSegment - startSegment); normal = new Vector2(-normal.Y, normal.X); - midPoint += normal * Rand.Range(-offsetAmount, offsetAmount, false); + midPoint += normal * Rand.Range(-offsetAmount, offsetAmount, Rand.RandSync.Server); segments.Insert(i, new Vector2[] { startSegment, midPoint }); segments.Insert(i + 1, new Vector2[] { midPoint, endSegment }); @@ -533,18 +548,4 @@ namespace Barotrauma return Math.Sign(d2 - d1); } } - - class CompareSegmentPointCW : IComparer - { - private Vector2 center; - - public CompareSegmentPointCW(Vector2 center) - { - this.center = center; - } - public int Compare(Lights.SegmentPoint a, Lights.SegmentPoint b) - { - return -CompareCCW.Compare(a.WorldPos, b.WorldPos, center); - } - } } diff --git a/Barotrauma/BarotraumaShared/Source/Utils/Rand.cs b/Barotrauma/BarotraumaShared/Source/Utils/Rand.cs new file mode 100644 index 000000000..d47c05318 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Utils/Rand.cs @@ -0,0 +1,65 @@ +using Microsoft.Xna.Framework; +using System; + +namespace Barotrauma +{ + static class Rand + { + public enum RandSync + { + Unsynced = -1, //not synced, used for unimportant details like minor particle properties + Server = 0, //synced with the server (used for gameplay elements that the players can interact with) + ClientOnly = 1 //set to match between clients (used for misc elements that the server doesn't track, but clients want to match anyway) + } + + private static Random localRandom = new Random(); + private static Random[] syncedRandom = new MTRandom[] { + new MTRandom(), new MTRandom() + }; + + public static void SetSyncedSeed(int seed) + { + syncedRandom[(int)RandSync.Server] = new MTRandom(seed); + syncedRandom[(int)RandSync.ClientOnly] = new MTRandom(seed); + } + + private static void Assert(RandSync sync) + { + //TODO: REMOVE AFTER FINDING ALL WRONG RNG USAGE +#if false + string trace = Environment.StackTrace.ToString(); + if (sync != RandSync.Server) return; + if (trace.ToLower().Contains("barotraumaclient\\source")) DebugConsole.NewMessage("WARNING: Client code using RandSync.Server\n"+trace,Color.Yellow); +#endif + } + + public static float Range(float minimum, float maximum, RandSync sync=RandSync.Unsynced) + { + Assert(sync); + return (float)(sync == RandSync.Unsynced ? localRandom : (syncedRandom[(int)sync])).NextDouble() * (maximum - minimum) + minimum; + } + + public static int Range(int minimum, int maximum, RandSync sync = RandSync.Unsynced) + { + Assert(sync); + return (sync == RandSync.Unsynced ? localRandom : (syncedRandom[(int)sync])).Next(maximum - minimum) + minimum; + } + + public static int Int(int max, RandSync sync = RandSync.Unsynced) + { + Assert(sync); + return (sync == RandSync.Unsynced ? localRandom : (syncedRandom[(int)sync])).Next(max); + } + + public static Vector2 Vector(float length, RandSync sync = RandSync.Unsynced) + { + Assert(sync); + Vector2 randomVector = new Vector2(Range(-1.0f, 1.0f, sync), Range(-1.0f, 1.0f, sync)); + + if (randomVector == Vector2.Zero) return new Vector2(0.0f, length); + + return Vector2.Normalize(randomVector) * length; + } + + } +} diff --git a/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs b/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs new file mode 100644 index 000000000..874a27184 --- /dev/null +++ b/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs @@ -0,0 +1,87 @@ +using System; +using System.IO; +using System.IO.Compression; +using System.Text; +using System.Xml.Linq; + +namespace Barotrauma +{ + public partial class SaveUtil + { + public static string SaveFolder = "Data"+Path.DirectorySeparatorChar+"Saves"; + + public delegate void ProgressDelegate(string sMessage); + + public static string TempPath + { + get { return Path.Combine(SaveFolder, "temp"); } + } + + public static Stream DecompressFiletoStream(string fileName) + { + if (!File.Exists(fileName)) + { + DebugConsole.ThrowError("File \""+fileName+" doesn't exist!"); + return null; + } + + using (FileStream originalFileStream = new FileStream(fileName, FileMode.Open)) + { + MemoryStream decompressedFileStream = new MemoryStream(); + + using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress)) + { + decompressionStream.CopyTo(decompressedFileStream); + return decompressedFileStream; + } + } + } + + public static bool DecompressFile(string sDir, GZipStream zipStream, ProgressDelegate progress) + { + //Decompress file name + byte[] bytes = new byte[sizeof(int)]; + int Readed = zipStream.Read(bytes, 0, sizeof(int)); + if (Readed < sizeof(int)) + return false; + + int iNameLen = BitConverter.ToInt32(bytes, 0); + bytes = new byte[sizeof(char)]; + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < iNameLen; i++) + { + zipStream.Read(bytes, 0, sizeof(char)); + char c = BitConverter.ToChar(bytes, 0); + sb.Append(c); + } + string sFileName = sb.ToString(); + if (progress != null) + progress(sFileName); + + //Decompress file content + bytes = new byte[sizeof(int)]; + zipStream.Read(bytes, 0, sizeof(int)); + int iFileLen = BitConverter.ToInt32(bytes, 0); + + bytes = new byte[iFileLen]; + zipStream.Read(bytes, 0, bytes.Length); + + string sFilePath = Path.Combine(sDir, sFileName); + string sFinalDir = Path.GetDirectoryName(sFilePath); + if (!Directory.Exists(sFinalDir)) + Directory.CreateDirectory(sFinalDir); + + using (FileStream outFile = new FileStream(sFilePath, FileMode.Create, FileAccess.Write, FileShare.None)) + outFile.Write(bytes, 0, iFileLen); + + return true; + } + + public static void DecompressToDirectory(string sCompressedFile, string sDir, ProgressDelegate progress) + { + using (FileStream inFile = new FileStream(sCompressedFile, FileMode.Open, FileAccess.Read, FileShare.None)) + using (GZipStream zipStream = new GZipStream(inFile, CompressionMode.Decompress, true)) + while (DecompressFile(sDir, zipStream, progress)) ; + } + } +} diff --git a/Barotrauma/Source/Utils/ToolBox.cs b/Barotrauma/BarotraumaShared/Source/Utils/ToolBox.cs similarity index 85% rename from Barotrauma/Source/Utils/ToolBox.cs rename to Barotrauma/BarotraumaShared/Source/Utils/ToolBox.cs index c75c35cc2..78fad5ddd 100644 --- a/Barotrauma/Source/Utils/ToolBox.cs +++ b/Barotrauma/BarotraumaShared/Source/Utils/ToolBox.cs @@ -26,7 +26,7 @@ namespace Barotrauma } } - public static class ToolBox + public static partial class ToolBox { public static bool IsProperFilenameCase(string filename) { @@ -413,24 +413,6 @@ namespace Barotrauma return str.Substring(0, maxCharacters-3) + "..."; } - public static string LimitString(string str, ScalableFont font, int maxWidth) - { - if (maxWidth <= 0 || string.IsNullOrWhiteSpace(str)) return ""; - - float currWidth = font.MeasureString("...").X; - for (int i = 0; i < str.Length; i++ ) - { - currWidth += font.MeasureString(str[i].ToString()).X; - - if (currWidth > maxWidth) - { - return str.Substring(0, Math.Max(i - 2, 1)) + "..."; - } - } - - return str; - } - public static string RandomSeed(int length) { var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; @@ -495,75 +477,6 @@ namespace Barotrauma return d[n, m]; } - public static string WrapText(string text, float lineLength, ScalableFont font, float textScale = 1.0f) //TODO: could integrate this into the ScalableFont class directly - { - if (font.MeasureString(text).X < lineLength) return text; - - text = text.Replace("\n", " \n "); - - string[] words = text.Split(' '); - - StringBuilder wrappedText = new StringBuilder(); - float linePos = 0f; - float spaceWidth = font.MeasureString(" ").X * textScale; - for (int i = 0; i < words.Length; ++i) - { - if (string.IsNullOrWhiteSpace(words[i]) && words[i] != "\n") continue; - - Vector2 size = font.MeasureString(words[i]) * textScale; - if (size.X > lineLength) - { - if (linePos == 0.0f) - { - wrappedText.AppendLine(words[i]); - } - else - { - do - { - if (words[i].Length == 0) break; - - wrappedText.Append(words[i][0]); - words[i] = words[i].Remove(0, 1); - - linePos += size.X; - } while (words[i].Length > 0 && (size = font.MeasureString((words[i][0]).ToString()) * textScale).X + linePos < lineLength); - - wrappedText.Append("\n"); - linePos = 0.0f; - i--; - } - - continue; - } - - if (linePos + size.X < lineLength) - { - wrappedText.Append(words[i]); - if (words[i] == "\n") - { - linePos = 0.0f; - } - else - { - - linePos += size.X + spaceWidth; - } - } - else - { - wrappedText.Append("\n"); - wrappedText.Append(words[i]); - - linePos = size.X + spaceWidth; - } - - if (i < words.Length - 1) wrappedText.Append(" "); - } - - return wrappedText.ToString(); - } - public static string SecondsToReadableTime(float seconds) { if (seconds < 60.0f) @@ -598,7 +511,7 @@ namespace Barotrauma return ""; } - int lineNumber = Rand.Int(lineCount, false); + int lineNumber = Rand.Int(lineCount, Rand.RandSync.Server); int i = 0; diff --git a/Barotrauma/Source/Utils/UpdaterUtil.cs b/Barotrauma/BarotraumaShared/Source/Utils/UpdaterUtil.cs similarity index 100% rename from Barotrauma/Source/Utils/UpdaterUtil.cs rename to Barotrauma/BarotraumaShared/Source/Utils/UpdaterUtil.cs diff --git a/Barotrauma/Submarines/Aegir Mark III.sub b/Barotrauma/BarotraumaShared/Submarines/Aegir Mark III.sub similarity index 100% rename from Barotrauma/Submarines/Aegir Mark III.sub rename to Barotrauma/BarotraumaShared/Submarines/Aegir Mark III.sub diff --git a/Barotrauma/Submarines/Nehalennia.sub b/Barotrauma/BarotraumaShared/Submarines/Nehalennia.sub similarity index 100% rename from Barotrauma/Submarines/Nehalennia.sub rename to Barotrauma/BarotraumaShared/Submarines/Nehalennia.sub diff --git a/Barotrauma/Submarines/The Blind Carp.sub b/Barotrauma/BarotraumaShared/Submarines/The Blind Carp.sub similarity index 100% rename from Barotrauma/Submarines/The Blind Carp.sub rename to Barotrauma/BarotraumaShared/Submarines/The Blind Carp.sub diff --git a/Barotrauma/Submarines/The Nibbler.sub b/Barotrauma/BarotraumaShared/Submarines/The Nibbler.sub similarity index 100% rename from Barotrauma/Submarines/The Nibbler.sub rename to Barotrauma/BarotraumaShared/Submarines/The Nibbler.sub diff --git a/Barotrauma/Submarines/TutorialSub.sub b/Barotrauma/BarotraumaShared/Submarines/TutorialSub.sub similarity index 100% rename from Barotrauma/Submarines/TutorialSub.sub rename to Barotrauma/BarotraumaShared/Submarines/TutorialSub.sub diff --git a/Barotrauma/Submarines/Vellamo.sub b/Barotrauma/BarotraumaShared/Submarines/Vellamo.sub similarity index 100% rename from Barotrauma/Submarines/Vellamo.sub rename to Barotrauma/BarotraumaShared/Submarines/Vellamo.sub diff --git a/Barotrauma/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt similarity index 100% rename from Barotrauma/changelog.txt rename to Barotrauma/BarotraumaShared/changelog.txt diff --git a/Barotrauma/config.xml b/Barotrauma/BarotraumaShared/config.xml similarity index 100% rename from Barotrauma/config.xml rename to Barotrauma/BarotraumaShared/config.xml diff --git a/Barotrauma/BarotraumaShared/serverconfig.xml b/Barotrauma/BarotraumaShared/serverconfig.xml new file mode 100644 index 000000000..bcfac70f2 --- /dev/null +++ b/Barotrauma/BarotraumaShared/serverconfig.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Barotrauma/Content/damageshader.xnb b/Barotrauma/Content/damageshader.xnb deleted file mode 100644 index 88484654f..000000000 Binary files a/Barotrauma/Content/damageshader.xnb and /dev/null differ diff --git a/Barotrauma/Content/effects.mgfx b/Barotrauma/Content/effects.mgfx deleted file mode 100644 index 613c88437..000000000 Binary files a/Barotrauma/Content/effects.mgfx and /dev/null differ diff --git a/Barotrauma/Content/watershader.xnb b/Barotrauma/Content/watershader.xnb deleted file mode 100644 index 1225ee689..000000000 Binary files a/Barotrauma/Content/watershader.xnb and /dev/null differ diff --git a/Launcher2/Icon.ico b/Barotrauma/Launcher/Icon.ico similarity index 100% rename from Launcher2/Icon.ico rename to Barotrauma/Launcher/Icon.ico diff --git a/Launcher2/Launcher.csproj b/Barotrauma/Launcher/Launcher.csproj similarity index 65% rename from Launcher2/Launcher.csproj rename to Barotrauma/Launcher/Launcher.csproj index 1d9f91c42..7497c06cd 100644 --- a/Launcher2/Launcher.csproj +++ b/Barotrauma/Launcher/Launcher.csproj @@ -8,7 +8,7 @@ {251AAFE1-F24B-4837-9128-9D04FCBFD528} WinExe Properties - Launcher2 + Launcher Barotrauma Launcher 512 Windows @@ -22,7 +22,7 @@ true full false - ..\Subsurface\bin\Windows\Debug\ + ..\bin\Windows\Debug\ DEBUG;TRACE;WINDOWS prompt 4 @@ -32,7 +32,7 @@ x86 pdbonly true - ..\Subsurface\bin\Windows\Release\ + ..\bin\Windows\Release\ TRACE;WINDOWS prompt 4 @@ -47,12 +47,24 @@ - - $(MSBuildProgramFiles32)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll + + ..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\MonoGame.Framework.dll + True - + False - ..\packages\RestSharp.105.2.3\lib\net4\RestSharp.dll + ..\..\Libraries\NuGet\NVorbis.0.8.5.0\lib\NVorbis.dll + + + False + ..\..\Libraries\NuGet\OpenTK.2.0.0\lib\net20\OpenTK.dll + + + ..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll + + + False + ..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\SharpDX.dll @@ -63,19 +75,16 @@ - - - - - {008c0f83-e914-4966-9135-ea885059edd8} - Barotrauma - - - + + + + {008c0f83-e914-4966-9135-ea885059edd8} + BarotraumaClient + + - + + + + + + + diff --git a/Launcher2/Program.cs b/Barotrauma/Launcher/Program.cs similarity index 96% rename from Launcher2/Program.cs rename to Barotrauma/Launcher/Program.cs index e308801da..1925b741c 100644 --- a/Launcher2/Program.cs +++ b/Barotrauma/Launcher/Program.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; #endregion -namespace Launcher2 +namespace Launcher { #if WINDOWS || LINUX /// diff --git a/Launcher2/Properties/AssemblyInfo.cs b/Barotrauma/Launcher/Properties/AssemblyInfo.cs similarity index 100% rename from Launcher2/Properties/AssemblyInfo.cs rename to Barotrauma/Launcher/Properties/AssemblyInfo.cs diff --git a/Barotrauma/Launcher/packages.config b/Barotrauma/Launcher/packages.config new file mode 100644 index 000000000..826869719 --- /dev/null +++ b/Barotrauma/Launcher/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Barotrauma/Source/Networking/disabled/FileStreamReceiver.cs b/Barotrauma/Source/Networking/disabled/FileStreamReceiver.cs deleted file mode 100644 index 9d1852414..000000000 --- a/Barotrauma/Source/Networking/disabled/FileStreamReceiver.cs +++ /dev/null @@ -1,321 +0,0 @@ -using Lidgren.Network; -using System; -using System.IO; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Linq; - -namespace Barotrauma.Networking -{ - class FileStreamReceiver : IDisposable - { - const int MaxFileSize = 1000000; - - public delegate void OnFinished(FileStreamReceiver fileStreamReceiver); - private OnFinished onFinished; - - private NetClient client; - private ulong length; - private ulong received; - private FileStream writeStream; - private int timeStarted; - - private string downloadFolder; - - private FileTransferMessageType fileType; - - public string FileName - { - get; - private set; - } - - public string FilePath - { - get; - private set; - } - - public ulong FileSize - { - get { return length; } - } - - public ulong Received - { - get { return received; } - } - - public FileTransferMessageType FileType - { - get { return fileType; } - } - - public FileTransferStatus Status - { - get; - private set; - } - - public string ErrorMessage - { - get; - private set; - } - - public float BytesPerSecond - { - get; - private set; - } - - public float Progress - { - get { return (float)received / (float)length; } - } - - public FileStreamReceiver(NetClient client, string filePath, FileTransferMessageType fileType, OnFinished onFinished) - { - this.client = client; - - this.downloadFolder = filePath; - this.fileType = fileType; - - this.onFinished = onFinished; - - Status = FileTransferStatus.NotStarted; - } - - public void ReadMessage(NetIncomingMessage inc) - { - try - { - TryReadMessage(inc); - } - catch (Exception e) - { - ErrorMessage = "Error while receiving file ''"+FileName+"'' {"+e.Message+"}"; - DeleteFile(); - - if (onFinished != null) onFinished(this); - } - } - - private bool ValidateInitialData(byte type, string fileName, ulong fileSize) - { - if (fileSize > MaxFileSize) - { - ErrorMessage = "File too large (" + MathUtils.GetBytesReadable((long)fileSize) + ")"; - return false; - } - - if (type != (byte)fileType) - { - ErrorMessage = "Unexpected file type ''" + type + "'' (expected " + fileType + ")"; - return false; - } - - if (!Regex.Match(fileName, @"^[\w\- ]+[\w\-. ]*$").Success) - { - ErrorMessage = "Illegal characters in file name ''" + fileName + "''"; - return false; - } - - switch (type) - { - case (byte)FileTransferMessageType.Submarine: - if (Path.GetExtension(fileName) != ".sub") - { - ErrorMessage = "Wrong file extension ''" + Path.GetExtension(fileName) + "''! (Expected .sub)"; - return false; - } - break; - } - - return true; - } - - public void DeleteFile() - { - if (FileName == null) return; - - string file = Path.Combine(downloadFolder, FileName); - - if (writeStream!=null) - { - writeStream.Flush(); - writeStream.Close(); - writeStream.Dispose(); - writeStream = null; - } - - Status = FileTransferStatus.Canceled; - - if (File.Exists(file)) - { - try - { - File.Delete(file); - } - catch (Exception e) - { - DebugConsole.ThrowError("Couldn't delete file ''" + file + "''!", e); - } - } - } - - private void TryReadMessage(NetIncomingMessage inc) - { - if (Status == FileTransferStatus.Error || - Status == FileTransferStatus.Finished || - Status == FileTransferStatus.Canceled) return; - - byte transferMessageType = inc.ReadByte(); - - //int chunkLen = inc.LengthBytes; - if (length == 0) - { - if (transferMessageType != (byte)FileTransferMessageType.Initiate) return; - - if (!string.IsNullOrWhiteSpace(downloadFolder) && !Directory.Exists(downloadFolder)) - { - Directory.CreateDirectory(downloadFolder); - } - - byte fileTypeByte = inc.ReadByte(); - - - length = inc.ReadUInt64(); - FileName = inc.ReadString(); - - if (!ValidateInitialData(fileTypeByte, FileName, length)) - { - Status = FileTransferStatus.Error; - DeleteFile(); - if (onFinished != null) onFinished(this); - return; - } - - FilePath = Path.Combine(downloadFolder, FileName); - - writeStream = new FileStream(FilePath, FileMode.Create, FileAccess.Write, FileShare.None); - timeStarted = Environment.TickCount; - - Status = FileTransferStatus.NotStarted; - - return; - } - - - if (received + (ulong)inc.LengthBytes > length*1.1f) - { - ErrorMessage = "Receiving more data than expected (> " + MathUtils.GetBytesReadable((long)(received + (ulong)inc.LengthBytes)) + ")"; - Status = FileTransferStatus.Error; - if (onFinished != null) onFinished(this); - return; - } - - byte[] all = inc.ReadBytes(inc.LengthBytes - inc.PositionInBytes); - received += (ulong)all.Length; - writeStream.Write(all, 0, all.Length); - - int passed = Environment.TickCount - timeStarted; - float psec = passed / 1000.0f; - - BytesPerSecond = received / psec; - - Status = FileTransferStatus.Receiving; - - - if (received >= length) - { - writeStream.Flush(); - writeStream.Close(); - writeStream.Dispose(); - writeStream = null; - - Status = IsReceivedFileValid() ? FileTransferStatus.Finished : FileTransferStatus.Error; - if (onFinished!=null) onFinished(this); - - if (Status == FileTransferStatus.Error) DeleteFile(); - Dispose(); - } - } - - private bool IsReceivedFileValid() - { - switch (fileType) - { - case FileTransferMessageType.Submarine: - string file = Path.Combine(downloadFolder, FileName); - Stream stream = null; - - try - { - stream = SaveUtil.DecompressFiletoStream(file); - } - catch (Exception e) - { - ErrorMessage = "Loading submarine ''" + file + "'' failed! {"+ e.Message + "}"; - return false; - } - - if (stream == null) - { - ErrorMessage = "Decompressing submarine file''" + file + "'' failed!"; - return false; - } - - try - { - stream.Position = 0; - - XmlReaderSettings settings = new XmlReaderSettings(); - settings.DtdProcessing = DtdProcessing.Prohibit; - settings.IgnoreProcessingInstructions = true; - - using (var reader = XmlReader.Create(stream, settings)) - { - while (reader.Read()) - { - - } - } - } - catch - { - stream.Close(); - stream.Dispose(); - - ErrorMessage = "Parsing file ''"+file+"'' failed! The file may not be a valid submarine file."; - return false; - } - - stream.Close(); - stream.Dispose(); - break; - } - - return true; - } - - public void Dispose() - { - Dispose(true); - - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (writeStream != null) - { - writeStream.Flush(); - writeStream.Close(); - writeStream.Dispose(); - } - } - } - - -} diff --git a/Barotrauma/Source/Networking/disabled/FileStreamSender.cs b/Barotrauma/Source/Networking/disabled/FileStreamSender.cs deleted file mode 100644 index 6a7ebedde..000000000 --- a/Barotrauma/Source/Networking/disabled/FileStreamSender.cs +++ /dev/null @@ -1,187 +0,0 @@ -using Lidgren.Network; -using System; -using System.IO; - -namespace Barotrauma.Networking -{ - enum FileTransferStatus - { - NotStarted, Sending, Receiving, Finished, Error, Canceled - } - - enum FileTransferMessageType - { - Unknown, Initiate, Submarine, Cancel - } - - class FileStreamSender : IDisposable - { - public static TimeSpan MaxTransferDuration = new TimeSpan(0, 2, 0); - - private FileStream inputStream; - private int sentOffset; - private int chunkLen; - private byte[] tempBuffer; - private NetConnection connection; - - float waitTimer; - - DateTime startingTime; - - private FileTransferMessageType fileType; - - public FileTransferStatus Status - { - get; - private set; - } - - public string FileName - { - get; - private set; - } - - public string FilePath - { - get; - private set; - } - - public float Progress - { - get { return inputStream == null ? 0.0f : (float)sentOffset / (float)inputStream.Length; } - } - - public int Sent - { - get { return sentOffset; } - } - - public long FileSize - { - get { return inputStream == null ? 0 : inputStream.Length; } - } - - public static FileStreamSender Create(NetConnection conn, string filePath, FileTransferMessageType fileType) - { - if (!File.Exists(filePath)) - { - DebugConsole.ThrowError("Sending a file failed. File ''"+filePath+"'' not found."); - return null; - } - - FileStreamSender sender = null; - - try - { - sender = new FileStreamSender(conn, filePath, fileType); - } - - catch (Exception e) - { - DebugConsole.ThrowError("Couldn't open file ''"+filePath+"''",e); - } - - return sender; - } - - private FileStreamSender(NetConnection conn, string filePath, FileTransferMessageType fileType) - { - connection = conn; - inputStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); - chunkLen = connection.Peer.Configuration.MaximumTransmissionUnit - 100; - tempBuffer = new byte[chunkLen]; - sentOffset = 0; - - FilePath = filePath; - FileName = Path.GetFileName(filePath); - - this.fileType = fileType; - - Status = FileTransferStatus.NotStarted; - - startingTime = DateTime.Now; - } - - public void Update(float deltaTime) - { - if (inputStream == null || - Status == FileTransferStatus.Canceled || - Status == FileTransferStatus.Error || - Status == FileTransferStatus.Finished) return; - - if (DateTime.Now > startingTime + MaxTransferDuration) - { - CancelTransfer(); - return; - } - - waitTimer -= deltaTime; - if (waitTimer > 0.0f) return; - - if (!connection.CanSendImmediately(NetDeliveryMethod.ReliableOrdered, 1)) return; - - // send another part of the file! - long remaining = inputStream.Length - sentOffset; - int sendBytes = (remaining > chunkLen ? chunkLen : (int)remaining); - - // just assume we can read the whole thing in one Read() - inputStream.Read(tempBuffer, 0, sendBytes); - - NetOutgoingMessage message; - if (sentOffset == 0) - { - // first message; send length, chunk length and file name - message = connection.Peer.CreateMessage(sendBytes + 8 + 1); - message.Write((byte)PacketTypes.FileStream); - message.Write((byte)FileTransferMessageType.Initiate); - message.Write((byte)fileType); - message.Write((ulong)inputStream.Length); - message.Write(Path.GetFileName(inputStream.Name)); - connection.SendMessage(message, NetDeliveryMethod.ReliableOrdered, 1); - - Status = FileTransferStatus.Sending; - } - - message = connection.Peer.CreateMessage(sendBytes + 8 + 1); - message.Write((byte)PacketTypes.FileStream); - message.Write((byte)fileType); - message.Write(tempBuffer, 0, sendBytes); - - connection.SendMessage(message, NetDeliveryMethod.ReliableOrdered, 1); - sentOffset += sendBytes; - - waitTimer = connection.AverageRoundtripTime; - - //Program.Output("Sent " + m_sentOffset + "/" + m_inputStream.Length + " bytes to " + m_connection); - - if (remaining - sendBytes <= 0) - { - //Dispose(); - - Status = FileTransferStatus.Finished; - } - } - - public void CancelTransfer() - { - Status = FileTransferStatus.Canceled; - } - - - public void Dispose() - { - Dispose(true); - - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - inputStream.Close(); - inputStream.Dispose(); - inputStream = null; - } - } -} diff --git a/Barotrauma/Source/Networking/disabled/NetworkEvent.cs b/Barotrauma/Source/Networking/disabled/NetworkEvent.cs deleted file mode 100644 index e185358e8..000000000 --- a/Barotrauma/Source/Networking/disabled/NetworkEvent.cs +++ /dev/null @@ -1,249 +0,0 @@ -using System.Collections.Generic; -using Lidgren.Network; -using System; -using System.Linq; - -namespace Barotrauma.Networking -{ - enum NetworkEventDeliveryMethod - { - Unreliable = 0, - ReliableChannel = 1, - ReliableLidgren = 2 - } - - enum NetworkEventType - { - EntityUpdate = 0, - ImportantEntityUpdate = 1, - - KillCharacter = 2, - SelectCharacter = 3, - - ComponentUpdate = 4, - ImportantComponentUpdate = 5, - - PickItem = 6, - DropItem = 7, - InventoryUpdate = 8, - ItemFixed = 9, - - UpdateProperty = 10, - WallDamage = 11, - - PhysicsBodyPosition = 12, - - ApplyStatusEffect = 13 - } - - class NetworkEvent - { - public static List Events = new List(); - - private static NetworkEventDeliveryMethod[] deliveryMethod; - private static bool[] overridePrevious; - - static NetworkEvent() - { - deliveryMethod = new NetworkEventDeliveryMethod[Enum.GetNames(typeof(NetworkEventType)).Length]; - deliveryMethod[(int)NetworkEventType.ImportantEntityUpdate] = NetworkEventDeliveryMethod.ReliableChannel; - deliveryMethod[(int)NetworkEventType.ImportantComponentUpdate] = NetworkEventDeliveryMethod.ReliableChannel; - deliveryMethod[(int)NetworkEventType.KillCharacter] = NetworkEventDeliveryMethod.ReliableLidgren; - deliveryMethod[(int)NetworkEventType.SelectCharacter] = NetworkEventDeliveryMethod.ReliableChannel; - - deliveryMethod[(int)NetworkEventType.ImportantComponentUpdate] = NetworkEventDeliveryMethod.ReliableChannel; - deliveryMethod[(int)NetworkEventType.PickItem] = NetworkEventDeliveryMethod.ReliableChannel; - deliveryMethod[(int)NetworkEventType.DropItem] = NetworkEventDeliveryMethod.ReliableChannel; - deliveryMethod[(int)NetworkEventType.InventoryUpdate] = NetworkEventDeliveryMethod.ReliableChannel; - deliveryMethod[(int)NetworkEventType.ItemFixed] = NetworkEventDeliveryMethod.ReliableLidgren; - - deliveryMethod[(int)NetworkEventType.UpdateProperty] = NetworkEventDeliveryMethod.ReliableChannel; - deliveryMethod[(int)NetworkEventType.WallDamage] = NetworkEventDeliveryMethod.ReliableChannel; - - deliveryMethod[(int)NetworkEventType.ApplyStatusEffect] = NetworkEventDeliveryMethod.ReliableLidgren; - - overridePrevious = new bool[deliveryMethod.Length]; - for (int i = 0; i < overridePrevious.Length; i++ ) - { - overridePrevious[i] = true; - } - overridePrevious[(int)NetworkEventType.KillCharacter] = false; - - overridePrevious[(int)NetworkEventType.PickItem] = false; - overridePrevious[(int)NetworkEventType.DropItem] = false; - overridePrevious[(int)NetworkEventType.ItemFixed] = false; - overridePrevious[(int)NetworkEventType.ApplyStatusEffect] = false; - } - - private readonly ushort id; - - private readonly NetworkEventType eventType; - - private readonly bool isClientEvent; - - private readonly object data; - - public NetConnection SenderConnection; - - //private NetOutgoingMessage message; - - public ushort ID - { - get { return id; } - } - - public bool IsClient - { - get { return isClientEvent; } - } - - public NetworkEventDeliveryMethod DeliveryMethod - { - get { return deliveryMethod[(int)eventType]; } - } - - public NetworkEventType Type - { - get { return eventType; } - } - - public NetworkEvent(ushort id, bool allowClientSend) - : this(NetworkEventType.EntityUpdate, id, allowClientSend) - { - } - - public NetworkEvent(NetworkEventType type, ushort id, bool allowClientSend, object data = null) - { - if (!allowClientSend && GameMain.Server == null) return; - - eventType = type; - - if (overridePrevious[(int)type]) - { - if (type == NetworkEventType.ComponentUpdate || type == NetworkEventType.ImportantComponentUpdate) - { - if (Events.Any(e => e.id == id && e.eventType == type && data == e.data)) return; - } - else - { - if (Events.Any(e => e.id == id && e.eventType == type)) return; - } - - } - - this.id = id; - isClientEvent = allowClientSend; - - this.data = data; - - Events.Add(this); - } - - public bool FillData(NetBuffer message) - { - message.Write((byte)eventType); - - Entity e = Entity.FindEntityByID(id); - if (e == null) return false; - - message.Write(id); - - try - { - - } - - catch (Exception exception) - { -#if DEBUG - DebugConsole.ThrowError("Failed to write network message for entity "+e.ToString(), exception); -#endif - - return false; - } - - return true; - } - - public static void ReadMessage(NetIncomingMessage message, bool resend=false) - { - float sendingTime = message.ReadFloat(); - - sendingTime = (float)message.SenderConnection.GetLocalTime(sendingTime); - - byte msgCount = message.ReadByte(); - long currPos = message.PositionInBytes; - - for (int i = 0; i < msgCount; i++) - { - - byte msgLength = message.ReadByte(); - - try - { - ReadData(message, sendingTime, resend); - } - catch - { - - } - //+1 because msgLength is one additional byte - currPos += msgLength + 1; - message.Position = currPos * 8; - } - } - - public static bool ReadData(NetIncomingMessage message, float sendingTime, bool resend=false) - { - NetworkEventType eventType; - ushort id; - - try - { - eventType = (NetworkEventType)message.ReadByte(); - id = message.ReadUInt16(); - } - catch (Exception exception) - { -#if DEBUG - DebugConsole.ThrowError("Received invalid network message", exception); -#endif - return false; - } - - Entity e = Entity.FindEntityByID(id); - if (e == null) - { -#if DEBUG - DebugConsole.ThrowError("Couldn't find an entity matching the ID ''" + id + "''"); -#endif - return false; - } - - - //System.Diagnostics.Debug.WriteLine(e.ToString()); - - object data; - - try - { - - } - catch (Exception exception) - { -#if DEBUG - DebugConsole.ThrowError("Received invalid network message", exception); -#endif - return false; - } - - /*if (resend) - { - var resendEvent = new NetworkEvent(eventType, id, false, data); - resendEvent.SenderConnection = message.SenderConnection; - }*/ - - return true; - } - } -} diff --git a/Barotrauma/Source/Networking/disabled/ReliableSender.cs b/Barotrauma/Source/Networking/disabled/ReliableSender.cs deleted file mode 100644 index c7d1bb4f6..000000000 --- a/Barotrauma/Source/Networking/disabled/ReliableSender.cs +++ /dev/null @@ -1,488 +0,0 @@ -using Lidgren.Network; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; - -namespace Barotrauma.Networking.ReliableMessages -{ - - class ReliableChannel - { - ReliableSender sender; - ReliableReceiver receiver; - - public ReliableChannel(NetPeer host) - { - sender = new ReliableSender(host); - receiver = new ReliableReceiver(host); - } - - public ReliableMessage CreateMessage() - { - return sender.CreateMessage(); - } - - public void SendMessage(ReliableMessage message, NetConnection receiver) - { - try - { - sender.SendMessage(message, receiver); - } - catch (Exception e) - { -#if DEBUG - DebugConsole.ThrowError("Sending a reliable message failed", e); -#endif - } - } - - public void HandleResendRequest(NetIncomingMessage inc) - { - sender.HandleResendRequest(inc); - } - - public void HandleLatestMessageID(NetIncomingMessage inc) - { - //make sure we've received what's been sent to us, if not, rerequest - receiver.HandleLatestMessageID(inc); - } - - public bool CheckMessage(NetIncomingMessage inc) - { - return receiver.CheckMessage(inc); - } - - public void Update(float deltaTime) - { - sender.Update(deltaTime); - //update receiver to rerequest missed messages - receiver.Update(deltaTime); - } - - public static int IdDiff(ushort id1, ushort id2) - { - if (Math.Abs((int)id1 - (int)id2) > ushort.MaxValue / 2) - { - return (ushort.MaxValue - Math.Max(id1, id2)) + Math.Min(id1, id2); - } - - return Math.Abs(id1 - id2); - } - - } - - internal class ReliableSender - { - private Dictionary messageBuffer; - - private ushort messageCount; - - private NetPeer sender; - - private NetConnection recipient; - - private float idSendTimer; - - private float idSendInterval; - - public ReliableSender(NetPeer sender) - { - this.sender = sender; - - messageCount = 1; - - messageBuffer = new Dictionary(); - } - - public ReliableMessage CreateMessage() - { - ushort messageID = (messageCount == ushort.MaxValue) ? (ushort)1 : (ushort)(messageCount + 1); - - NetOutgoingMessage message = sender.CreateMessage(); - - var reliableMessage = new ReliableMessage(message, messageID); - - message.Write((byte)PacketTypes.ReliableMessage); - - message.Write(messageID); - - if (messageBuffer.Count > NetConfig.ReliableMessageBufferSize) - { - int end = messageCount - NetConfig.ReliableMessageBufferSize; - int start = end - (messageBuffer.Count - NetConfig.ReliableMessageBufferSize); - - if (start < 0) - { - int wrappedStart = start + ushort.MaxValue; - if (wrappedStart == 0) wrappedStart = ushort.MaxValue; - int wrappedEnd = end + ushort.MaxValue; - if (wrappedEnd == 0) wrappedEnd = ushort.MaxValue; - - for (ushort i = (ushort)wrappedStart; i <= (ushort)wrappedEnd; i++) - { - messageBuffer.Remove(i); - if (i == ushort.MaxValue) break; - Debug.WriteLine("removing message " + i); - } - } - - for (ushort i = (ushort)Math.Max(start,0); i <= (ushort)Math.Max(end,0); i++) - { - messageBuffer.Remove(i); - if (i == ushort.MaxValue) break; - Debug.WriteLine("removing message " + i); - } - } - - return reliableMessage; - } - - public void SendMessage(ReliableMessage message, NetConnection connection) - { - idSendInterval = 0.0f; - idSendTimer = connection.AverageRoundtripTime; - - messageBuffer.Add(message.ID, message); - - Debug.WriteLine("sending reliable massage (id " + message.ID + ")"); - - if (messageCount == ushort.MaxValue) messageCount = 0; - messageCount++; - - message.SaveInnerMessage(); - - sender.SendMessage(message.InnerMessage, connection, NetDeliveryMethod.Unreliable, 0); - - recipient = connection; - } - - public void HandleResendRequest(NetIncomingMessage inc) - { - ushort messageId = inc.ReadUInt16(); - - Debug.WriteLine("received resend request for msg id "+messageId); - - ResendMessage(messageId, inc.SenderConnection); - } - - private void ResendMessage(ushort messageId, NetConnection connection) - { - ReliableMessage message; - if (!messageBuffer.TryGetValue(messageId, out message)) return; - - Debug.WriteLine("resending " + messageId); - - NetOutgoingMessage resendMessage = sender.CreateMessage(); - message.RestoreInnerMessage(resendMessage); - - idSendTimer = connection.AverageRoundtripTime; - - sender.SendMessage(resendMessage, connection, NetDeliveryMethod.Unreliable); - } - - public void Update(float deltaTime) - { - if (recipient == null) return; - - idSendTimer -= deltaTime; - - if (idSendTimer > 0.0f) return; - - //Debug.WriteLine("Sending ack message: "+messageCount); - - NetOutgoingMessage message = sender.CreateMessage(); - message.Write((byte)PacketTypes.LatestMessageID); - - message.Write(messageCount); - - sender.SendMessage(message, recipient, NetDeliveryMethod.Unreliable); - - float roundTripTime = Math.Min(recipient.AverageRoundtripTime, 1.0f); - - idSendTimer = Math.Max(roundTripTime, NetConfig.IdSendInterval + idSendInterval); - idSendInterval += 0.1f; - } - } - - internal class ReliableReceiver - { - ushort lastMessageID; - - Queue missingMessageIds; - Dictionary missingMessages; - - private NetPeer receiver; - - private NetConnection recipient; - - public ReliableReceiver(NetPeer receiver) - { - this.receiver = receiver; - - lastMessageID = 1; - - missingMessages = new Dictionary(); - missingMessageIds = new Queue(); - } - - public void Update(float deltaTime) - { - foreach (var message in missingMessages.Where(m => m.Value.ResendRequestsSent > NetConfig.ResendAttempts).ToList()) - { - Debug.WriteLine("Max rerequest attempts reached on message "+message.Value.ID); - missingMessages.Remove(message.Key); - } - - while (missingMessageIds.Count>NetConfig.ReliableMessageBufferSize) - { - ushort id = missingMessageIds.Dequeue(); - - missingMessages.Remove(id); - } - - foreach (KeyValuePair valuePair in missingMessages) - { - MissingMessage missingMessage = valuePair.Value; - - missingMessage.ResendTimer -= deltaTime; - - if (missingMessage.ResendTimer > 0.0f) continue; - - Debug.WriteLine("rerequest "+missingMessage.ID+" (try #"+missingMessage.ResendRequestsSent+")"); - - NetOutgoingMessage resendRequest = receiver.CreateMessage(); - resendRequest.Write((byte)PacketTypes.ResendRequest); - - resendRequest.Write(missingMessage.ID); - - receiver.SendMessage(resendRequest, recipient, - missingMessage.ResendRequestsSent==0 ? NetDeliveryMethod.ReliableUnordered : NetDeliveryMethod.Unreliable); - - float roundTripTime = Math.Min(recipient.AverageRoundtripTime, 1.0f); - - missingMessage.ResendTimer = Math.Max(roundTripTime, NetConfig.RerequestInterval); - missingMessage.ResendRequestsSent++; - - } - - } - - public bool CheckMessage(NetIncomingMessage message) - { - recipient = message.SenderConnection; - - ushort id = message.ReadUInt16(); - - if (ReliableChannel.IdDiff(lastMessageID, id) > NetConfig.ReliableMessageBufferSize) - { - Debug.WriteLine("id diff > NetConfig.ReliableMessageBufferSize, resetting reliable channel"); - lastMessageID = id; - return false; - } - - Debug.WriteLine("received message ID " + id + " - last id: " + lastMessageID); - - //wrapped around - if (Math.Abs((int)lastMessageID - (int)id) > ushort.MaxValue / 2) - { - //id wrapped around and we missed some messages in between, rerequest them - if (lastMessageID>ushort.MaxValue/2 && id>=1) - { - for (ushort i = (ushort)(Math.Min(lastMessageID, (ushort)(ushort.MaxValue-1)) + 1); i < ushort.MaxValue; i++) - { - QueueMissingMessage(i); - } - for (ushort i = 1; i < id; i++) - { - QueueMissingMessage(i); - } - - lastMessageID = id; - } - //we already wrapped around but the message hasn't, check if it's a duplicate - else if (lastMessageID < ushort.MaxValue / 2 && id > ushort.MaxValue / 2 && !missingMessages.ContainsKey(id)) - { - Debug.WriteLine("old already received message, ignore"); - return false; - } - else - { - RemoveMissingMessage(id); - } - } - else - { - if (id>lastMessageID+1) - { - for (ushort i = (ushort)(lastMessageID+1); i < id; i++ ) - { - QueueMissingMessage(i); - } - - } - //received an old message and it wasn't marked as missed, lets ignore it - else if (id<=lastMessageID && !missingMessages.ContainsKey(id)) - { - Debug.WriteLine("old already received message, ignore"); - return false; - } - else - { - RemoveMissingMessage(id); - } - - lastMessageID = Math.Max(lastMessageID, id); - } - - return true; - } - - private void QueueMissingMessage(ushort id) - { - //message already marked as missed, continue - if (missingMessages.ContainsKey(id)) return; - - Debug.WriteLine("added " + id + " to missed"); - - float waitTime = Math.Abs(lastMessageID - id)>1 ? 0.0f : recipient.AverageRoundtripTime*0.5f; - - missingMessages.Add(id, new MissingMessage(id, waitTime)); - - missingMessageIds.Enqueue(id); - } - - private void RemoveMissingMessage(ushort id) - { - if (!missingMessages.ContainsKey(id)) return; - - Debug.WriteLine("remove " + id + " from missed"); - missingMessages.Remove(id); - } - - public void HandleLatestMessageID(NetIncomingMessage inc) - { - ushort messageId = inc.ReadUInt16(); - - recipient = inc.SenderConnection; - - //id matches, all good - if (messageId == lastMessageID) - { - //Debug.WriteLine("Received ack message: " + messageId + ", all good"); - return; - } - - if (ReliableChannel.IdDiff(lastMessageID, messageId) > NetConfig.ReliableMessageBufferSize) - { - Debug.WriteLine("id diff > NetConfig.ReliableMessageBufferSize, resetting reliable channel"); - lastMessageID = messageId; - return; - } - - if (messageId < lastMessageID && Math.Abs((int)lastMessageID - (int)messageId) < ushort.MaxValue / 2) - { - Debug.WriteLine("Received id update message: " + messageId + ": ignoring, already received (" + lastMessageID + ")"); - return; - } - - Debug.WriteLine("Received id update message: " + messageId + ", need to rerequest messages (last id: "+lastMessageID+")"); - - if (lastMessageID > ushort.MaxValue / 2 && messageId < short.MaxValue / 2) - { - for (ushort i = (ushort)Math.Min((int)lastMessageID + 1, ushort.MaxValue); i <= ushort.MaxValue; i++) - { - if (i == ushort.MaxValue && lastMessageID == ushort.MaxValue) break; - QueueMissingMessage(i); - if (i == ushort.MaxValue) break; - } - - for (ushort i = 1; i <= messageId; i++) - { - QueueMissingMessage(i); - } - } - else - { - //we already wrapped around but message hasn't, so it's an old message - if (lastMessageID < ushort.MaxValue / 2 && messageId > ushort.MaxValue / 2) - { - Debug.WriteLine("old already received message, ignore"); - return; - } - - for (ushort i = (ushort)Math.Min((int)lastMessageID+1, ushort.MaxValue); i <= messageId; i++) - { - QueueMissingMessage(i); - if (i == ushort.MaxValue) break; - } - } - - lastMessageID = messageId; - } - - - } - - internal class MissingMessage - { - private ushort id; - - public byte ResendRequestsSent; - - public float ResendTimer; - - public ushort ID - { - get { return id; } - } - - public MissingMessage(ushort id) - { - this.id = id; - } - - public MissingMessage(ushort id, float resendTimer) - { - this.id = id; - this.ResendTimer = resendTimer; - } - } - - class ReliableMessage - { - private NetOutgoingMessage innerMessage; - private ushort id; - - private byte[] innerMessageBytes; - - public NetOutgoingMessage InnerMessage - { - get { return innerMessage; } - } - - public ushort ID - { - get { return id; } - } - - - public ReliableMessage(NetOutgoingMessage message, ushort id) - { - this.innerMessage = message; - this.id = id; - } - - public void SaveInnerMessage() - { - innerMessage.WritePadBits(); - innerMessageBytes = innerMessage.PeekBytes(innerMessage.LengthBytes); - //innerMessage = null; - } - - public void RestoreInnerMessage(NetOutgoingMessage message) - { - message.Write(innerMessageBytes); - } - } -} diff --git a/Barotrauma/Source/PlayerInput.cs b/Barotrauma/Source/PlayerInput.cs deleted file mode 100644 index 330be3604..000000000 --- a/Barotrauma/Source/PlayerInput.cs +++ /dev/null @@ -1,364 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Input; - -namespace Barotrauma -{ - - public enum InputType - { - Select, - Use, - Aim, - Up, Down, Left, Right, - Attack, - Run, Crouch, - Chat, CrewOrders - } - - public class KeyOrMouse - { - Keys keyBinding; - int? mouseButton; - - public Keys Key - { - get { return keyBinding; } - } - public int? MouseButton - { - get { return mouseButton; } - } - - public KeyOrMouse(Keys keyBinding) - { - this.keyBinding = keyBinding; - } - - public KeyOrMouse(int mouseButton) - { - this.mouseButton = mouseButton; - } - - public bool IsDown() - { - if (mouseButton==null) - { - return PlayerInput.KeyDown(keyBinding); - } - else if (mouseButton == 0) - { - return PlayerInput.LeftButtonHeld(); - } - else if (mouseButton == 1) - { - return PlayerInput.RightButtonHeld(); - } - - return false; - } - - public bool IsHit() - { - if (mouseButton == null) - { - return PlayerInput.KeyHit(keyBinding); - } - else if (mouseButton == 0) - { - return PlayerInput.LeftButtonClicked(); - } - else if (mouseButton == 1) - { - return PlayerInput.RightButtonClicked(); - } - - return false; - } - - public override string ToString() - { - if (mouseButton==null) - { - return keyBinding.ToString(); - } - else if (mouseButton==0) - { - return "Mouse1"; - } - else if (mouseButton==1) - { - return "Mouse2"; - } - - return "None"; - } - } - - class Key - { - private bool hit, hitQueue; - private bool held, heldQueue; - - - KeyOrMouse binding; - - //public bool CanBeHeld - //{ - // get { return canBeHeld; } - //} - - public Key(KeyOrMouse binding) - { - this.binding = binding; - } - - public bool Hit - { - get - { - return hit; - } - set - { - hit = value; - } - } - - public bool Held - { - get - { - return held; - } - set - { - held = value; - } - } - - public KeyOrMouse State - { - get { return binding; } - } - - public void SetState() - { - hit = binding.IsHit(); - if (hit) hitQueue = true; - - held = binding.IsDown(); - if (held) heldQueue = true; - } - - public void SetState(bool hit, bool held) - { - if (hit) hitQueue = true; - if (held) heldQueue = true; - } - - public bool DequeueHit() - { - bool value = hitQueue; - hitQueue = false; - return value; - } - - public bool DequeueHeld() - { - bool value = heldQueue; - heldQueue = false; - return value; - } - - public bool GetHeldQueue - { - get { return heldQueue; } - } - - public bool GetHitQueue - { - get { return hitQueue; } - } - - - public void Reset() - { - hit = false; - held = false; - } - - public void ResetHit() - { - hit = false; - //stateQueue = false; - } - - - public void ResetHeld() - { - held = false; - //stateQueue = false; - } - } - - public static class PlayerInput - { - static MouseState mouseState, oldMouseState; - static MouseState latestMouseState; //the absolute latest state, do NOT use for player interaction - static KeyboardState keyboardState, oldKeyboardState; - - static double timeSinceClick; - - const double doubleClickDelay = 0.4; - - static bool doubleClicked; - - public static Keys selectKey = Keys.E; - - public static Vector2 MousePosition - { - get { return new Vector2(mouseState.Position.X, mouseState.Position.Y); } - } - - public static Vector2 LatestMousePosition - { - get { return new Vector2(latestMouseState.Position.X, latestMouseState.Position.Y); } - } - - //public static MouseState GetMouseState - //{ - // get { return mouseState; } - //} - //public static MouseState GetOldMouseState - //{ - // get { return oldMouseState; } - //} - - public static bool MouseInsideWindow - { - get { return new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight).Contains(MousePosition); } - } - - public static Vector2 MouseSpeed - { - get - { - return GameMain.WindowActive ? MousePosition - new Vector2(oldMouseState.X, oldMouseState.Y) : Vector2.Zero; - } - } - - public static KeyboardState GetKeyboardState - { - get { return keyboardState; } - } - - public static KeyboardState GetOldKeyboardState - { - get { return oldKeyboardState; } - } - - public static int ScrollWheelSpeed - { - get { return GameMain.WindowActive ? mouseState.ScrollWheelValue - oldMouseState.ScrollWheelValue : 0; } - - } - - public static bool LeftButtonHeld() - { - return GameMain.WindowActive && mouseState.LeftButton == ButtonState.Pressed; - } - - public static bool LeftButtonDown() - { - return GameMain.WindowActive && - oldMouseState.LeftButton == ButtonState.Released && - mouseState.LeftButton == ButtonState.Pressed; - } - - public static bool LeftButtonReleased() - { - return GameMain.WindowActive && mouseState.LeftButton == ButtonState.Released; - } - - - public static bool LeftButtonClicked() - { - return (GameMain.WindowActive && - oldMouseState.LeftButton == ButtonState.Pressed - && mouseState.LeftButton == ButtonState.Released); - } - - public static bool RightButtonHeld() - { - return GameMain.WindowActive && mouseState.RightButton == ButtonState.Pressed; - } - - public static bool RightButtonClicked() - { - return (GameMain.WindowActive && - oldMouseState.RightButton == ButtonState.Pressed - && mouseState.RightButton == ButtonState.Released); - } - - public static bool DoubleClicked() - { - return GameMain.WindowActive && doubleClicked; - } - - public static bool KeyHit(InputType inputType) - { - return GameMain.WindowActive && GameMain.Config.KeyBind(inputType).IsHit(); - } - - public static bool KeyDown(InputType inputType) - { - return GameMain.WindowActive && GameMain.Config.KeyBind(inputType).IsDown(); - } - - public static bool KeyUp(InputType inputType) - { - return GameMain.WindowActive && !GameMain.Config.KeyBind(inputType).IsDown(); - } - - public static bool KeyHit(Keys button) - { - return (GameMain.WindowActive && oldKeyboardState.IsKeyDown(button) && keyboardState.IsKeyUp(button)); - } - - public static bool KeyDown(Keys button) - { - return (GameMain.WindowActive && keyboardState.IsKeyDown(button)); - } - - public static bool KeyUp(Keys button) - { - return GameMain.WindowActive && keyboardState.IsKeyUp(button); - } - - public static void Update(double deltaTime) - { - timeSinceClick += deltaTime; - - oldMouseState = mouseState; - mouseState = latestMouseState; - UpdateVariable(); - - oldKeyboardState = keyboardState; - keyboardState = Keyboard.GetState(); - - doubleClicked = false; - if (LeftButtonClicked()) - { - if (timeSinceClick < doubleClickDelay) doubleClicked = true; - timeSinceClick = 0.0; - } - } - - public static void UpdateVariable() - { - //do NOT use this for actual interaction with the game, this is to be used for debugging and rendering ONLY - - latestMouseState = Mouse.GetState(); - } - } -} diff --git a/Barotrauma/Source/Utils/Rand.cs b/Barotrauma/Source/Utils/Rand.cs deleted file mode 100644 index 49df98208..000000000 --- a/Barotrauma/Source/Utils/Rand.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Microsoft.Xna.Framework; -using System; - -namespace Barotrauma -{ - static class Rand - { - private static Random localRandom = new Random(); - private static Random syncedRandom = new MTRandom(); - - public static void SetSyncedSeed(int seed) - { - syncedRandom = new MTRandom(seed); - } - - public static float Range(float minimum, float maximum, bool local = true) - { - return (float)(local ? localRandom : syncedRandom).NextDouble() * (maximum - minimum) + minimum; - } - - public static int Range(int minimum, int maximum, bool local = true) - { - return (local ? localRandom : syncedRandom).Next(maximum - minimum) + minimum; - } - - public static int Int(int max = int.MaxValue, bool local = true) - { - return (local ? localRandom : syncedRandom).Next(max); - } - - public static Vector2 Vector(float length = 1.0f, bool local = true) - { - Vector2 randomVector = new Vector2(Range(-1.0f, 1.0f, local), Range(-1.0f, 1.0f, local)); - - if (randomVector == Vector2.Zero) return new Vector2(0.0f, length); - - return Vector2.Normalize(randomVector) * length; - } - - } -} diff --git a/Barotrauma/packages.config b/Barotrauma/packages.config deleted file mode 100644 index 065671582..000000000 --- a/Barotrauma/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Barotrauma_Solution.sln b/Barotrauma_Solution.sln index 4bf948c25..7a68d0beb 100644 --- a/Barotrauma_Solution.sln +++ b/Barotrauma_Solution.sln @@ -3,29 +3,46 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Barotrauma", "Barotrauma\Barotrauma.csproj", "{008C0F83-E914-4966-9135-EA885059EDD8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BarotraumaClient", "Barotrauma\BarotraumaClient\BarotraumaClient.csproj", "{008C0F83-E914-4966-9135-EA885059EDD8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Farseer Physics MonoGame", "Libraries\Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj", "{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "Libraries\Lidgren.Network\Lidgren.Network.csproj", "{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Barotrauma\Launcher\Launcher.csproj", "{251AAFE1-F24B-4837-9128-9D04FCBFD528}" ProjectSection(ProjectDependencies) = postProject - {C293DB32-FA42-486D-B128-5A12522FAE4E} = {C293DB32-FA42-486D-B128-5A12522FAE4E} + {85232B20-074D-4723-B0C6-91495391E448} = {85232B20-074D-4723-B0C6-91495391E448} + {008C0F83-E914-4966-9135-EA885059EDD8} = {008C0F83-E914-4966-9135-EA885059EDD8} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Farseer Physics MonoGame", "Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj", "{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "Lidgren.Network\Lidgren.Network.csproj", "{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher2\Launcher.csproj", "{251AAFE1-F24B-4837-9128-9D04FCBFD528}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D32A29D8-AC7B-4189-B734-8ED9EB4120D0}" + ProjectSection(SolutionItems) = preProject + NuGet.Config = NuGet.Config + EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hyper.ComponentModel", "Hyper.ComponentModel\Hyper.ComponentModel.csproj", "{3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hyper.ComponentModel", "Libraries\Hyper.ComponentModel\Hyper.ComponentModel.csproj", "{3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpFont", "SharpFont\Source\SharpFont\SharpFont.csproj", "{C293DB32-FA42-486D-B128-5A12522FAE4E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpFont", "Libraries\SharpFont\Source\SharpFont\SharpFont.csproj", "{C293DB32-FA42-486D-B128-5A12522FAE4E}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharpFontShared", "SharpFont\Source\SharpFontShared\SharpFontShared.shproj", "{2E4773B7-961A-4328-9D77-9749F9071CA2}" +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharpFontShared", "Libraries\SharpFont\Source\SharpFontShared\SharpFontShared.shproj", "{2E4773B7-961A-4328-9D77-9749F9071CA2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BarotraumaServer", "Barotrauma\BarotraumaServer\BarotraumaServer.csproj", "{85232B20-074D-4723-B0C6-91495391E448}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BarotraumaShared", "Barotrauma\BarotraumaShared\BarotraumaShared.shproj", "{561357C2-DB28-4E01-B275-6BF545F70491}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Barotrauma", "Barotrauma", "{F35DF9BF-0BED-4FEF-A51C-DD83C531882F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{DE36F45F-F09E-4719-B953-00D148F7722A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Farseer Physics", "Libraries\Farseer Physics Engine 3.5\Farseer Physics.csproj", "{A4610E4C-DD34-428B-BABB-779CA0B5993A}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution - SharpFont\Source\SharpFontShared\SharpFontShared.projitems*{2e4773b7-961a-4328-9d77-9749f9071ca2}*SharedItemsImports = 13 - SharpFont\Source\SharpFontShared\SharpFontShared.projitems*{c293db32-fa42-486d-b128-5a12522fae4e}*SharedItemsImports = 4 + Barotrauma\BarotraumaShared\BarotraumaShared.projitems*{008c0f83-e914-4966-9135-ea885059edd8}*SharedItemsImports = 4 + Libraries\SharpFont\Source\SharpFontShared\SharpFontShared.projitems*{2e4773b7-961a-4328-9d77-9749f9071ca2}*SharedItemsImports = 13 + Barotrauma\BarotraumaShared\BarotraumaShared.projitems*{561357c2-db28-4e01-b275-6bf545f70491}*SharedItemsImports = 13 + Barotrauma\BarotraumaShared\BarotraumaShared.projitems*{85232b20-074d-4723-b0c6-91495391e448}*SharedItemsImports = 4 + Libraries\SharpFont\Source\SharpFontShared\SharpFontShared.projitems*{c293db32-fa42-486d-b128-5a12522fae4e}*SharedItemsImports = 4 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Android|Any CPU = Android|Any CPU @@ -345,8 +362,126 @@ Global {C293DB32-FA42-486D-B128-5A12522FAE4E}.Windows8|Mixed Platforms.Build.0 = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.Windows8|x86.ActiveCfg = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.Windows8|x86.Build.0 = Release|Any CPU + {85232B20-074D-4723-B0C6-91495391E448}.Android|Any CPU.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Android|Any CPU.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Android|Mixed Platforms.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Android|Mixed Platforms.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Android|x86.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Android|x86.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Debug|Any CPU.ActiveCfg = Debug|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Debug|x86.ActiveCfg = Debug|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Debug|x86.Build.0 = Debug|x86 + {85232B20-074D-4723-B0C6-91495391E448}.iOS|Any CPU.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.iOS|Any CPU.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.iOS|Mixed Platforms.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.iOS|Mixed Platforms.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.iOS|x86.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.iOS|x86.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Linux|Any CPU.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Linux|Any CPU.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Linux|Mixed Platforms.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Linux|Mixed Platforms.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Linux|x86.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Linux|x86.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.OSX|Any CPU.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.OSX|Any CPU.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.OSX|Mixed Platforms.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.OSX|Mixed Platforms.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.OSX|x86.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.OSX|x86.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.PSM|Any CPU.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.PSM|Any CPU.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.PSM|Mixed Platforms.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.PSM|Mixed Platforms.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.PSM|x86.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.PSM|x86.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Release|Any CPU.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Release|Mixed Platforms.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Release|x86.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Release|x86.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows|Any CPU.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows|Any CPU.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows|Mixed Platforms.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows|Mixed Platforms.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows|x86.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows|x86.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows8|Any CPU.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows8|Any CPU.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows8|Mixed Platforms.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows8|Mixed Platforms.Build.0 = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows8|x86.ActiveCfg = Release|x86 + {85232B20-074D-4723-B0C6-91495391E448}.Windows8|x86.Build.0 = Release|x86 + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Android|Any CPU.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Android|Any CPU.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Android|Mixed Platforms.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Android|Mixed Platforms.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Android|x86.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Android|x86.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x86.ActiveCfg = Debug|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x86.Build.0 = Debug|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.iOS|Any CPU.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.iOS|Any CPU.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.iOS|Mixed Platforms.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.iOS|Mixed Platforms.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.iOS|x86.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.iOS|x86.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Linux|Any CPU.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Linux|Any CPU.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Linux|Mixed Platforms.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Linux|Mixed Platforms.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Linux|x86.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Linux|x86.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.OSX|Any CPU.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.OSX|Any CPU.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.OSX|Mixed Platforms.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.OSX|Mixed Platforms.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.OSX|x86.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.OSX|x86.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.PSM|Any CPU.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.PSM|Any CPU.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.PSM|Mixed Platforms.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.PSM|Mixed Platforms.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.PSM|x86.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.PSM|x86.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|Any CPU.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|x86.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|x86.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows|Any CPU.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows|Any CPU.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows|Mixed Platforms.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows|Mixed Platforms.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows|x86.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows|x86.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows8|Any CPU.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows8|Any CPU.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows8|Mixed Platforms.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows8|Mixed Platforms.Build.0 = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows8|x86.ActiveCfg = Release|Any CPU + {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Windows8|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {008C0F83-E914-4966-9135-EA885059EDD8} = {F35DF9BF-0BED-4FEF-A51C-DD83C531882F} + {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7} = {DE36F45F-F09E-4719-B953-00D148F7722A} + {49BA1C69-6104-41AC-A5D8-B54FA9F696E8} = {DE36F45F-F09E-4719-B953-00D148F7722A} + {251AAFE1-F24B-4837-9128-9D04FCBFD528} = {F35DF9BF-0BED-4FEF-A51C-DD83C531882F} + {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50} = {DE36F45F-F09E-4719-B953-00D148F7722A} + {C293DB32-FA42-486D-B128-5A12522FAE4E} = {DE36F45F-F09E-4719-B953-00D148F7722A} + {2E4773B7-961A-4328-9D77-9749F9071CA2} = {DE36F45F-F09E-4719-B953-00D148F7722A} + {85232B20-074D-4723-B0C6-91495391E448} = {F35DF9BF-0BED-4FEF-A51C-DD83C531882F} + {561357C2-DB28-4E01-B275-6BF545F70491} = {F35DF9BF-0BED-4FEF-A51C-DD83C531882F} + {A4610E4C-DD34-428B-BABB-779CA0B5993A} = {DE36F45F-F09E-4719-B953-00D148F7722A} + EndGlobalSection EndGlobal diff --git a/Farseer Physics Engine 3.5/Farseer Physics Engine.v12.suo b/Farseer Physics Engine 3.5/Farseer Physics Engine.v12.suo deleted file mode 100644 index 7d0e3e068..000000000 Binary files a/Farseer Physics Engine 3.5/Farseer Physics Engine.v12.suo and /dev/null differ diff --git a/Launcher2/Content/Content.mgcb b/Launcher2/Content/Content.mgcb deleted file mode 100644 index ccb6d33b2..000000000 --- a/Launcher2/Content/Content.mgcb +++ /dev/null @@ -1,15 +0,0 @@ - -#----------------------------- Global Properties ----------------------------# - -/outputDir:bin/Windows -/intermediateDir:obj/Windows -/platform:Windows -/config: -/profile:Reach -/compress:False - -#-------------------------------- References --------------------------------# - - -#---------------------------------- Content ---------------------------------# - diff --git a/Farseer Physics Engine 3.5/Collision/Collision.cs b/Libraries/Farseer Physics Engine 3.5/Collision/Collision.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/Collision.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/Collision.cs diff --git a/Farseer Physics Engine 3.5/Collision/Distance.cs b/Libraries/Farseer Physics Engine 3.5/Collision/Distance.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/Distance.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/Distance.cs diff --git a/Farseer Physics Engine 3.5/Collision/DynamicTree.cs b/Libraries/Farseer Physics Engine 3.5/Collision/DynamicTree.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/DynamicTree.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/DynamicTree.cs diff --git a/Farseer Physics Engine 3.5/Collision/DynamicTreeBroadPhase.cs b/Libraries/Farseer Physics Engine 3.5/Collision/DynamicTreeBroadPhase.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/DynamicTreeBroadPhase.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/DynamicTreeBroadPhase.cs diff --git a/Farseer Physics Engine 3.5/Collision/IBroadPhase.cs b/Libraries/Farseer Physics Engine 3.5/Collision/IBroadPhase.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/IBroadPhase.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/IBroadPhase.cs diff --git a/Farseer Physics Engine 3.5/Collision/Shapes/ChainShape.cs b/Libraries/Farseer Physics Engine 3.5/Collision/Shapes/ChainShape.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/Shapes/ChainShape.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/Shapes/ChainShape.cs diff --git a/Farseer Physics Engine 3.5/Collision/Shapes/CircleShape.cs b/Libraries/Farseer Physics Engine 3.5/Collision/Shapes/CircleShape.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/Shapes/CircleShape.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/Shapes/CircleShape.cs diff --git a/Farseer Physics Engine 3.5/Collision/Shapes/EdgeShape.cs b/Libraries/Farseer Physics Engine 3.5/Collision/Shapes/EdgeShape.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/Shapes/EdgeShape.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/Shapes/EdgeShape.cs diff --git a/Farseer Physics Engine 3.5/Collision/Shapes/PolygonShape.cs b/Libraries/Farseer Physics Engine 3.5/Collision/Shapes/PolygonShape.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/Shapes/PolygonShape.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/Shapes/PolygonShape.cs diff --git a/Farseer Physics Engine 3.5/Collision/Shapes/Shape.cs b/Libraries/Farseer Physics Engine 3.5/Collision/Shapes/Shape.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/Shapes/Shape.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/Shapes/Shape.cs diff --git a/Farseer Physics Engine 3.5/Collision/TimeOfImpact.cs b/Libraries/Farseer Physics Engine 3.5/Collision/TimeOfImpact.cs similarity index 100% rename from Farseer Physics Engine 3.5/Collision/TimeOfImpact.cs rename to Libraries/Farseer Physics Engine 3.5/Collision/TimeOfImpact.cs diff --git a/Farseer Physics Engine 3.5/Common/ConvexHull/ChainHull.cs b/Libraries/Farseer Physics Engine 3.5/Common/ConvexHull/ChainHull.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/ConvexHull/ChainHull.cs rename to Libraries/Farseer Physics Engine 3.5/Common/ConvexHull/ChainHull.cs diff --git a/Farseer Physics Engine 3.5/Common/ConvexHull/GiftWrap.cs b/Libraries/Farseer Physics Engine 3.5/Common/ConvexHull/GiftWrap.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/ConvexHull/GiftWrap.cs rename to Libraries/Farseer Physics Engine 3.5/Common/ConvexHull/GiftWrap.cs diff --git a/Farseer Physics Engine 3.5/Common/ConvexHull/Melkman.cs b/Libraries/Farseer Physics Engine 3.5/Common/ConvexHull/Melkman.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/ConvexHull/Melkman.cs rename to Libraries/Farseer Physics Engine 3.5/Common/ConvexHull/Melkman.cs diff --git a/Farseer Physics Engine 3.5/Common/Curve.cs b/Libraries/Farseer Physics Engine 3.5/Common/Curve.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Curve.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Curve.cs diff --git a/Farseer Physics Engine 3.5/Common/CurveKey.cs b/Libraries/Farseer Physics Engine 3.5/Common/CurveKey.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/CurveKey.cs rename to Libraries/Farseer Physics Engine 3.5/Common/CurveKey.cs diff --git a/Farseer Physics Engine 3.5/Common/CurveKeyCollection.cs b/Libraries/Farseer Physics Engine 3.5/Common/CurveKeyCollection.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/CurveKeyCollection.cs rename to Libraries/Farseer Physics Engine 3.5/Common/CurveKeyCollection.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/BayazitDecomposer.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/BayazitDecomposer.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/BayazitDecomposer.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/BayazitDecomposer.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/DelaunayTriangle.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/DelaunayTriangle.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/DelaunayTriangle.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/DelaunayTriangle.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/AdvancingFront.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/AdvancingFront.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/AdvancingFront.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/AdvancingFront.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/AdvancingFrontNode.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/AdvancingFrontNode.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/AdvancingFrontNode.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/AdvancingFrontNode.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweep.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweep.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweep.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweep.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepConstraint.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepConstraint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepConstraint.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepConstraint.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepContext.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepContext.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepContext.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepContext.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepPointComparator.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepPointComparator.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepPointComparator.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/DTSweepPointComparator.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/PointOnEdgeException.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/PointOnEdgeException.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/PointOnEdgeException.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Delaunay/Sweep/PointOnEdgeException.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/ITriangulatable.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/ITriangulatable.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/ITriangulatable.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/ITriangulatable.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Orientation.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Orientation.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Orientation.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Orientation.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/Polygon.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/Polygon.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/Polygon.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/Polygon.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/PolygonPoint.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/PolygonPoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/PolygonPoint.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/PolygonPoint.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/PolygonSet.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/PolygonSet.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/PolygonSet.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Polygon/PolygonSet.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Sets/ConstrainedPointSet.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Sets/ConstrainedPointSet.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Sets/ConstrainedPointSet.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Sets/ConstrainedPointSet.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Sets/PointSet.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Sets/PointSet.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Sets/PointSet.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Sets/PointSet.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationConstraint.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationConstraint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationConstraint.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationConstraint.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationContext.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationContext.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationContext.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationContext.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationMode.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationMode.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationMode.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationMode.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationPoint.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationPoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationPoint.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationPoint.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationUtil.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationUtil.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationUtil.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/TriangulationUtil.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/FixedArray3.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/FixedArray3.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/FixedArray3.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/FixedArray3.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/FixedBitArray3.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/FixedBitArray3.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/FixedBitArray3.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/FixedBitArray3.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/PointGenerator.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/PointGenerator.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/PointGenerator.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/PointGenerator.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/PolygonGenerator.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/PolygonGenerator.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/PolygonGenerator.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDT/Util/PolygonGenerator.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/CDTDecomposer.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDTDecomposer.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/CDTDecomposer.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/CDTDecomposer.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/EarclipDecomposer.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/EarclipDecomposer.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/EarclipDecomposer.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/EarclipDecomposer.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/FlipcodeDecomposer.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/FlipcodeDecomposer.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/FlipcodeDecomposer.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/FlipcodeDecomposer.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Edge.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Edge.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Edge.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Edge.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/MonotoneMountain.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/MonotoneMountain.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/MonotoneMountain.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/MonotoneMountain.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Node.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Node.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Node.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Node.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Point.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Point.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Point.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Point.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/QueryGraph.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/QueryGraph.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/QueryGraph.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/QueryGraph.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Sink.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Sink.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Sink.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Sink.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Trapezoid.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Trapezoid.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Trapezoid.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Trapezoid.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/TrapezoidalMap.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/TrapezoidalMap.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/TrapezoidalMap.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/TrapezoidalMap.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Triangulator.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Triangulator.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Triangulator.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/Triangulator.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/XNode.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/XNode.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/XNode.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/XNode.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/YNode.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/YNode.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Seidel/YNode.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Seidel/YNode.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/SeidelDecomposer.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/SeidelDecomposer.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/SeidelDecomposer.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/SeidelDecomposer.cs diff --git a/Farseer Physics Engine 3.5/Common/Decomposition/Triangulate.cs b/Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Triangulate.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Decomposition/Triangulate.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Decomposition/Triangulate.cs diff --git a/Farseer Physics Engine 3.5/Common/FixedArray.cs b/Libraries/Farseer Physics Engine 3.5/Common/FixedArray.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/FixedArray.cs rename to Libraries/Farseer Physics Engine 3.5/Common/FixedArray.cs diff --git a/Farseer Physics Engine 3.5/Common/HashSet.cs b/Libraries/Farseer Physics Engine 3.5/Common/HashSet.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/HashSet.cs rename to Libraries/Farseer Physics Engine 3.5/Common/HashSet.cs diff --git a/Farseer Physics Engine 3.5/Common/LineTools.cs b/Libraries/Farseer Physics Engine 3.5/Common/LineTools.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/LineTools.cs rename to Libraries/Farseer Physics Engine 3.5/Common/LineTools.cs diff --git a/Farseer Physics Engine 3.5/Common/Math.cs b/Libraries/Farseer Physics Engine 3.5/Common/Math.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Math.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Math.cs diff --git a/Farseer Physics Engine 3.5/Common/MathHelper.cs b/Libraries/Farseer Physics Engine 3.5/Common/MathHelper.cs similarity index 93% rename from Farseer Physics Engine 3.5/Common/MathHelper.cs rename to Libraries/Farseer Physics Engine 3.5/Common/MathHelper.cs index 3f48a8b76..02a4cbb0c 100644 --- a/Farseer Physics Engine 3.5/Common/MathHelper.cs +++ b/Libraries/Farseer Physics Engine 3.5/Common/MathHelper.cs @@ -72,6 +72,18 @@ namespace Microsoft.Xna.Framework return value; } + public static int Clamp(int value, int min, int max) + { + // First we check to see if we're greater than the max + value = (value > max) ? max : value; + + // Then we check to see if we're less than the min. + value = (value < min) ? min : value; + + // There's no check to see if min > max. + return value; + } + public static float Distance(float value1, float value2) { return Math.Abs(value1 - value2); diff --git a/Farseer Physics Engine 3.5/Common/Matrix.cs b/Libraries/Farseer Physics Engine 3.5/Common/Matrix.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Matrix.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Matrix.cs diff --git a/Farseer Physics Engine 3.5/Common/Path.cs b/Libraries/Farseer Physics Engine 3.5/Common/Path.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Path.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Path.cs diff --git a/Farseer Physics Engine 3.5/Common/PathManager.cs b/Libraries/Farseer Physics Engine 3.5/Common/PathManager.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PathManager.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PathManager.cs diff --git a/Farseer Physics Engine 3.5/Common/PhysicsLogic/FilterData.cs b/Libraries/Farseer Physics Engine 3.5/Common/PhysicsLogic/FilterData.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PhysicsLogic/FilterData.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PhysicsLogic/FilterData.cs diff --git a/Farseer Physics Engine 3.5/Common/PhysicsLogic/PhysicsLogic.cs b/Libraries/Farseer Physics Engine 3.5/Common/PhysicsLogic/PhysicsLogic.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PhysicsLogic/PhysicsLogic.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PhysicsLogic/PhysicsLogic.cs diff --git a/Farseer Physics Engine 3.5/Common/PhysicsLogic/RealExplosion.cs b/Libraries/Farseer Physics Engine 3.5/Common/PhysicsLogic/RealExplosion.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PhysicsLogic/RealExplosion.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PhysicsLogic/RealExplosion.cs diff --git a/Farseer Physics Engine 3.5/Common/PhysicsLogic/SimpleExplosion.cs b/Libraries/Farseer Physics Engine 3.5/Common/PhysicsLogic/SimpleExplosion.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PhysicsLogic/SimpleExplosion.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PhysicsLogic/SimpleExplosion.cs diff --git a/Farseer Physics Engine 3.5/Common/PolygonManipulation/CuttingTools.cs b/Libraries/Farseer Physics Engine 3.5/Common/PolygonManipulation/CuttingTools.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PolygonManipulation/CuttingTools.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PolygonManipulation/CuttingTools.cs diff --git a/Farseer Physics Engine 3.5/Common/PolygonManipulation/SimpleCombiner.cs b/Libraries/Farseer Physics Engine 3.5/Common/PolygonManipulation/SimpleCombiner.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PolygonManipulation/SimpleCombiner.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PolygonManipulation/SimpleCombiner.cs diff --git a/Farseer Physics Engine 3.5/Common/PolygonManipulation/SimplifyTools.cs b/Libraries/Farseer Physics Engine 3.5/Common/PolygonManipulation/SimplifyTools.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PolygonManipulation/SimplifyTools.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PolygonManipulation/SimplifyTools.cs diff --git a/Farseer Physics Engine 3.5/Common/PolygonManipulation/YuPengClipper.cs b/Libraries/Farseer Physics Engine 3.5/Common/PolygonManipulation/YuPengClipper.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PolygonManipulation/YuPengClipper.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PolygonManipulation/YuPengClipper.cs diff --git a/Farseer Physics Engine 3.5/Common/PolygonTools.cs b/Libraries/Farseer Physics Engine 3.5/Common/PolygonTools.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/PolygonTools.cs rename to Libraries/Farseer Physics Engine 3.5/Common/PolygonTools.cs diff --git a/Farseer Physics Engine 3.5/Common/Serialization.cs b/Libraries/Farseer Physics Engine 3.5/Common/Serialization.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Serialization.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Serialization.cs diff --git a/Farseer Physics Engine 3.5/Common/Stopwatch.cs b/Libraries/Farseer Physics Engine 3.5/Common/Stopwatch.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Stopwatch.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Stopwatch.cs diff --git a/Farseer Physics Engine 3.5/Common/TextureTools/MarchingSquares.cs b/Libraries/Farseer Physics Engine 3.5/Common/TextureTools/MarchingSquares.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/TextureTools/MarchingSquares.cs rename to Libraries/Farseer Physics Engine 3.5/Common/TextureTools/MarchingSquares.cs diff --git a/Farseer Physics Engine 3.5/Common/TextureTools/Terrain.cs b/Libraries/Farseer Physics Engine 3.5/Common/TextureTools/Terrain.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/TextureTools/Terrain.cs rename to Libraries/Farseer Physics Engine 3.5/Common/TextureTools/Terrain.cs diff --git a/Farseer Physics Engine 3.5/Common/TextureTools/TextureConverter.cs b/Libraries/Farseer Physics Engine 3.5/Common/TextureTools/TextureConverter.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/TextureTools/TextureConverter.cs rename to Libraries/Farseer Physics Engine 3.5/Common/TextureTools/TextureConverter.cs diff --git a/Farseer Physics Engine 3.5/Common/Vector2.cs b/Libraries/Farseer Physics Engine 3.5/Common/Vector2.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Vector2.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Vector2.cs diff --git a/Farseer Physics Engine 3.5/Common/Vector3.cs b/Libraries/Farseer Physics Engine 3.5/Common/Vector3.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Vector3.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Vector3.cs diff --git a/Farseer Physics Engine 3.5/Common/Vertices.cs b/Libraries/Farseer Physics Engine 3.5/Common/Vertices.cs similarity index 100% rename from Farseer Physics Engine 3.5/Common/Vertices.cs rename to Libraries/Farseer Physics Engine 3.5/Common/Vertices.cs diff --git a/Farseer Physics Engine 3.5/Controllers/AbstractForceController.cs b/Libraries/Farseer Physics Engine 3.5/Controllers/AbstractForceController.cs similarity index 100% rename from Farseer Physics Engine 3.5/Controllers/AbstractForceController.cs rename to Libraries/Farseer Physics Engine 3.5/Controllers/AbstractForceController.cs diff --git a/Farseer Physics Engine 3.5/Controllers/BuoyancyController.cs b/Libraries/Farseer Physics Engine 3.5/Controllers/BuoyancyController.cs similarity index 100% rename from Farseer Physics Engine 3.5/Controllers/BuoyancyController.cs rename to Libraries/Farseer Physics Engine 3.5/Controllers/BuoyancyController.cs diff --git a/Farseer Physics Engine 3.5/Controllers/Controller.cs b/Libraries/Farseer Physics Engine 3.5/Controllers/Controller.cs similarity index 100% rename from Farseer Physics Engine 3.5/Controllers/Controller.cs rename to Libraries/Farseer Physics Engine 3.5/Controllers/Controller.cs diff --git a/Farseer Physics Engine 3.5/Controllers/GravityController.cs b/Libraries/Farseer Physics Engine 3.5/Controllers/GravityController.cs similarity index 100% rename from Farseer Physics Engine 3.5/Controllers/GravityController.cs rename to Libraries/Farseer Physics Engine 3.5/Controllers/GravityController.cs diff --git a/Farseer Physics Engine 3.5/Controllers/SimpleWindForce.cs b/Libraries/Farseer Physics Engine 3.5/Controllers/SimpleWindForce.cs similarity index 100% rename from Farseer Physics Engine 3.5/Controllers/SimpleWindForce.cs rename to Libraries/Farseer Physics Engine 3.5/Controllers/SimpleWindForce.cs diff --git a/Farseer Physics Engine 3.5/Controllers/VelocityLimitController.cs b/Libraries/Farseer Physics Engine 3.5/Controllers/VelocityLimitController.cs similarity index 100% rename from Farseer Physics Engine 3.5/Controllers/VelocityLimitController.cs rename to Libraries/Farseer Physics Engine 3.5/Controllers/VelocityLimitController.cs diff --git a/Farseer Physics Engine 3.5/ConvertUnits.cs b/Libraries/Farseer Physics Engine 3.5/ConvertUnits.cs similarity index 100% rename from Farseer Physics Engine 3.5/ConvertUnits.cs rename to Libraries/Farseer Physics Engine 3.5/ConvertUnits.cs diff --git a/Farseer Physics Engine 3.5/DebugViewBase.cs b/Libraries/Farseer Physics Engine 3.5/DebugViewBase.cs similarity index 100% rename from Farseer Physics Engine 3.5/DebugViewBase.cs rename to Libraries/Farseer Physics Engine 3.5/DebugViewBase.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Body.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Body.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Body.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Body.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/BreakableBody.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/BreakableBody.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/BreakableBody.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/BreakableBody.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/ContactManager.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/ContactManager.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/ContactManager.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/ContactManager.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Contacts/Contact.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Contacts/Contact.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Contacts/Contact.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Contacts/Contact.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Contacts/ContactSolver.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Contacts/ContactSolver.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Contacts/ContactSolver.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Contacts/ContactSolver.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Fixture.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Fixture.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Fixture.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Fixture.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Island.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Island.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Island.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Island.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/AngleJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/AngleJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/AngleJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/AngleJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/DistanceJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/DistanceJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/DistanceJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/DistanceJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/FixedMouseJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/FixedMouseJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/FixedMouseJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/FixedMouseJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/FrictionJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/FrictionJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/FrictionJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/FrictionJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/GearJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/GearJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/GearJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/GearJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/Joint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/Joint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/Joint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/Joint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/MotorJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/MotorJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/MotorJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/MotorJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/PrismaticJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/PrismaticJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/PrismaticJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/PrismaticJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/PulleyJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/PulleyJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/PulleyJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/PulleyJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/RevoluteJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/RevoluteJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/RevoluteJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/RevoluteJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/RopeJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/RopeJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/RopeJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/RopeJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/WeldJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/WeldJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/WeldJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/WeldJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/Joints/WheelJoint.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/WheelJoint.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/Joints/WheelJoint.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/Joints/WheelJoint.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/TimeStep.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/TimeStep.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/TimeStep.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/TimeStep.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/World.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/World.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/World.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/World.cs diff --git a/Farseer Physics Engine 3.5/Dynamics/WorldCallbacks.cs b/Libraries/Farseer Physics Engine 3.5/Dynamics/WorldCallbacks.cs similarity index 100% rename from Farseer Physics Engine 3.5/Dynamics/WorldCallbacks.cs rename to Libraries/Farseer Physics Engine 3.5/Dynamics/WorldCallbacks.cs diff --git a/Farseer Physics Engine 3.5/Factories/BodyFactory.cs b/Libraries/Farseer Physics Engine 3.5/Factories/BodyFactory.cs similarity index 100% rename from Farseer Physics Engine 3.5/Factories/BodyFactory.cs rename to Libraries/Farseer Physics Engine 3.5/Factories/BodyFactory.cs diff --git a/Farseer Physics Engine 3.5/Factories/FixtureFactory.cs b/Libraries/Farseer Physics Engine 3.5/Factories/FixtureFactory.cs similarity index 100% rename from Farseer Physics Engine 3.5/Factories/FixtureFactory.cs rename to Libraries/Farseer Physics Engine 3.5/Factories/FixtureFactory.cs diff --git a/Farseer Physics Engine 3.5/Factories/JointFactory.cs b/Libraries/Farseer Physics Engine 3.5/Factories/JointFactory.cs similarity index 100% rename from Farseer Physics Engine 3.5/Factories/JointFactory.cs rename to Libraries/Farseer Physics Engine 3.5/Factories/JointFactory.cs diff --git a/Farseer Physics Engine 3.5/Factories/LinkFactory.cs b/Libraries/Farseer Physics Engine 3.5/Factories/LinkFactory.cs similarity index 100% rename from Farseer Physics Engine 3.5/Factories/LinkFactory.cs rename to Libraries/Farseer Physics Engine 3.5/Factories/LinkFactory.cs diff --git a/Farseer Physics Engine 3.5/Farseer Physics Engine.sln b/Libraries/Farseer Physics Engine 3.5/Farseer Physics Engine.sln similarity index 100% rename from Farseer Physics Engine 3.5/Farseer Physics Engine.sln rename to Libraries/Farseer Physics Engine 3.5/Farseer Physics Engine.sln diff --git a/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj similarity index 100% rename from Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj rename to Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj diff --git a/Farseer Physics Engine 3.5/Farseer Physics Silverlight.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics Silverlight.csproj similarity index 100% rename from Farseer Physics Engine 3.5/Farseer Physics Silverlight.csproj rename to Libraries/Farseer Physics Engine 3.5/Farseer Physics Silverlight.csproj diff --git a/Farseer Physics Engine 3.5/Farseer Physics WP7.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics WP7.csproj similarity index 100% rename from Farseer Physics Engine 3.5/Farseer Physics WP7.csproj rename to Libraries/Farseer Physics Engine 3.5/Farseer Physics WP7.csproj diff --git a/Farseer Physics Engine 3.5/Farseer Physics XNA.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics XNA.csproj similarity index 100% rename from Farseer Physics Engine 3.5/Farseer Physics XNA.csproj rename to Libraries/Farseer Physics Engine 3.5/Farseer Physics XNA.csproj diff --git a/Farseer Physics Engine 3.5/Farseer Physics Xbox360.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics Xbox360.csproj similarity index 100% rename from Farseer Physics Engine 3.5/Farseer Physics Xbox360.csproj rename to Libraries/Farseer Physics Engine 3.5/Farseer Physics Xbox360.csproj diff --git a/Farseer Physics Engine 3.5/Farseer Physics.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics.csproj similarity index 100% rename from Farseer Physics Engine 3.5/Farseer Physics.csproj rename to Libraries/Farseer Physics Engine 3.5/Farseer Physics.csproj diff --git a/Farseer Physics Engine 3.5/Properties/AssemblyInfo.cs b/Libraries/Farseer Physics Engine 3.5/Properties/AssemblyInfo.cs similarity index 100% rename from Farseer Physics Engine 3.5/Properties/AssemblyInfo.cs rename to Libraries/Farseer Physics Engine 3.5/Properties/AssemblyInfo.cs diff --git a/Farseer Physics Engine 3.5/Settings.cs b/Libraries/Farseer Physics Engine 3.5/Settings.cs similarity index 100% rename from Farseer Physics Engine 3.5/Settings.cs rename to Libraries/Farseer Physics Engine 3.5/Settings.cs diff --git a/Farseer Physics Engine 3.5/StyleCop.Cache b/Libraries/Farseer Physics Engine 3.5/StyleCop.Cache similarity index 100% rename from Farseer Physics Engine 3.5/StyleCop.Cache rename to Libraries/Farseer Physics Engine 3.5/StyleCop.Cache diff --git a/Hyper.ComponentModel/ChainingPropertyDescriptor.cs b/Libraries/Hyper.ComponentModel/ChainingPropertyDescriptor.cs similarity index 100% rename from Hyper.ComponentModel/ChainingPropertyDescriptor.cs rename to Libraries/Hyper.ComponentModel/ChainingPropertyDescriptor.cs diff --git a/Hyper.ComponentModel/Hyper.ComponentModel.csproj b/Libraries/Hyper.ComponentModel/Hyper.ComponentModel.csproj similarity index 91% rename from Hyper.ComponentModel/Hyper.ComponentModel.csproj rename to Libraries/Hyper.ComponentModel/Hyper.ComponentModel.csproj index 40cc4e68e..b2c9b109b 100644 --- a/Hyper.ComponentModel/Hyper.ComponentModel.csproj +++ b/Libraries/Hyper.ComponentModel/Hyper.ComponentModel.csproj @@ -9,8 +9,9 @@ Properties Hyper.ComponentModel Hyper.ComponentModel - v3.5 + v4.5 512 + true @@ -20,6 +21,8 @@ DEBUG;TRACE prompt 4 + false + x86 pdbonly @@ -29,6 +32,8 @@ prompt 4 bin\Release\Hyper.ComponentModel.XML + false + x86 diff --git a/Hyper.ComponentModel/HyperTypeDescriptionProvider.cs b/Libraries/Hyper.ComponentModel/HyperTypeDescriptionProvider.cs similarity index 100% rename from Hyper.ComponentModel/HyperTypeDescriptionProvider.cs rename to Libraries/Hyper.ComponentModel/HyperTypeDescriptionProvider.cs diff --git a/Hyper.ComponentModel/HyperTypeDescriptor.cs b/Libraries/Hyper.ComponentModel/HyperTypeDescriptor.cs similarity index 100% rename from Hyper.ComponentModel/HyperTypeDescriptor.cs rename to Libraries/Hyper.ComponentModel/HyperTypeDescriptor.cs diff --git a/Hyper.ComponentModel/Properties/AssemblyInfo.cs b/Libraries/Hyper.ComponentModel/Properties/AssemblyInfo.cs similarity index 100% rename from Hyper.ComponentModel/Properties/AssemblyInfo.cs rename to Libraries/Hyper.ComponentModel/Properties/AssemblyInfo.cs diff --git a/Lidgren.Network/Documentation/ChangedFromV2.txt b/Libraries/Lidgren.Network/Documentation/ChangedFromV2.txt similarity index 100% rename from Lidgren.Network/Documentation/ChangedFromV2.txt rename to Libraries/Lidgren.Network/Documentation/ChangedFromV2.txt diff --git a/Lidgren.Network/Documentation/Discovery.html b/Libraries/Lidgren.Network/Documentation/Discovery.html similarity index 100% rename from Lidgren.Network/Documentation/Discovery.html rename to Libraries/Lidgren.Network/Documentation/Discovery.html diff --git a/Lidgren.Network/Documentation/Improvements.txt b/Libraries/Lidgren.Network/Documentation/Improvements.txt similarity index 100% rename from Lidgren.Network/Documentation/Improvements.txt rename to Libraries/Lidgren.Network/Documentation/Improvements.txt diff --git a/Lidgren.Network/Documentation/PacketLayout.txt b/Libraries/Lidgren.Network/Documentation/PacketLayout.txt similarity index 100% rename from Lidgren.Network/Documentation/PacketLayout.txt rename to Libraries/Lidgren.Network/Documentation/PacketLayout.txt diff --git a/Lidgren.Network/Documentation/SimulatingBadNetwork.html b/Libraries/Lidgren.Network/Documentation/SimulatingBadNetwork.html similarity index 100% rename from Lidgren.Network/Documentation/SimulatingBadNetwork.html rename to Libraries/Lidgren.Network/Documentation/SimulatingBadNetwork.html diff --git a/Lidgren.Network/Documentation/TODO.txt b/Libraries/Lidgren.Network/Documentation/TODO.txt similarity index 100% rename from Lidgren.Network/Documentation/TODO.txt rename to Libraries/Lidgren.Network/Documentation/TODO.txt diff --git a/Lidgren.Network/Documentation/Tutorial.html b/Libraries/Lidgren.Network/Documentation/Tutorial.html similarity index 100% rename from Lidgren.Network/Documentation/Tutorial.html rename to Libraries/Lidgren.Network/Documentation/Tutorial.html diff --git a/Lidgren.Network/Encryption/NetAESEncryption.cs b/Libraries/Lidgren.Network/Encryption/NetAESEncryption.cs similarity index 100% rename from Lidgren.Network/Encryption/NetAESEncryption.cs rename to Libraries/Lidgren.Network/Encryption/NetAESEncryption.cs diff --git a/Lidgren.Network/Encryption/NetBlockEncryptionBase.cs b/Libraries/Lidgren.Network/Encryption/NetBlockEncryptionBase.cs similarity index 100% rename from Lidgren.Network/Encryption/NetBlockEncryptionBase.cs rename to Libraries/Lidgren.Network/Encryption/NetBlockEncryptionBase.cs diff --git a/Lidgren.Network/Encryption/NetCryptoProviderBase.cs b/Libraries/Lidgren.Network/Encryption/NetCryptoProviderBase.cs similarity index 100% rename from Lidgren.Network/Encryption/NetCryptoProviderBase.cs rename to Libraries/Lidgren.Network/Encryption/NetCryptoProviderBase.cs diff --git a/Lidgren.Network/Encryption/NetCryptoProviderEncryption.cs b/Libraries/Lidgren.Network/Encryption/NetCryptoProviderEncryption.cs similarity index 100% rename from Lidgren.Network/Encryption/NetCryptoProviderEncryption.cs rename to Libraries/Lidgren.Network/Encryption/NetCryptoProviderEncryption.cs diff --git a/Lidgren.Network/Encryption/NetDESEncryption.cs b/Libraries/Lidgren.Network/Encryption/NetDESEncryption.cs similarity index 100% rename from Lidgren.Network/Encryption/NetDESEncryption.cs rename to Libraries/Lidgren.Network/Encryption/NetDESEncryption.cs diff --git a/Lidgren.Network/Encryption/NetEncryption.cs b/Libraries/Lidgren.Network/Encryption/NetEncryption.cs similarity index 100% rename from Lidgren.Network/Encryption/NetEncryption.cs rename to Libraries/Lidgren.Network/Encryption/NetEncryption.cs diff --git a/Lidgren.Network/Encryption/NetRC2Encryption.cs b/Libraries/Lidgren.Network/Encryption/NetRC2Encryption.cs similarity index 100% rename from Lidgren.Network/Encryption/NetRC2Encryption.cs rename to Libraries/Lidgren.Network/Encryption/NetRC2Encryption.cs diff --git a/Lidgren.Network/Encryption/NetTripleDESEncryption.cs b/Libraries/Lidgren.Network/Encryption/NetTripleDESEncryption.cs similarity index 100% rename from Lidgren.Network/Encryption/NetTripleDESEncryption.cs rename to Libraries/Lidgren.Network/Encryption/NetTripleDESEncryption.cs diff --git a/Lidgren.Network/Encryption/NetXorEncryption.cs b/Libraries/Lidgren.Network/Encryption/NetXorEncryption.cs similarity index 100% rename from Lidgren.Network/Encryption/NetXorEncryption.cs rename to Libraries/Lidgren.Network/Encryption/NetXorEncryption.cs diff --git a/Lidgren.Network/Encryption/NetXteaEncryption.cs b/Libraries/Lidgren.Network/Encryption/NetXteaEncryption.cs similarity index 100% rename from Lidgren.Network/Encryption/NetXteaEncryption.cs rename to Libraries/Lidgren.Network/Encryption/NetXteaEncryption.cs diff --git a/Lidgren.Network/Lidgren.Network.csproj b/Libraries/Lidgren.Network/Lidgren.Network.csproj similarity index 100% rename from Lidgren.Network/Lidgren.Network.csproj rename to Libraries/Lidgren.Network/Lidgren.Network.csproj diff --git a/Lidgren.Network/NamespaceDoc.cs b/Libraries/Lidgren.Network/NamespaceDoc.cs similarity index 100% rename from Lidgren.Network/NamespaceDoc.cs rename to Libraries/Lidgren.Network/NamespaceDoc.cs diff --git a/Lidgren.Network/NetBigInteger.cs b/Libraries/Lidgren.Network/NetBigInteger.cs similarity index 100% rename from Lidgren.Network/NetBigInteger.cs rename to Libraries/Lidgren.Network/NetBigInteger.cs diff --git a/Lidgren.Network/NetBitVector.cs b/Libraries/Lidgren.Network/NetBitVector.cs similarity index 100% rename from Lidgren.Network/NetBitVector.cs rename to Libraries/Lidgren.Network/NetBitVector.cs diff --git a/Lidgren.Network/NetBitWriter.cs b/Libraries/Lidgren.Network/NetBitWriter.cs similarity index 100% rename from Lidgren.Network/NetBitWriter.cs rename to Libraries/Lidgren.Network/NetBitWriter.cs diff --git a/Lidgren.Network/NetBuffer.Peek.cs b/Libraries/Lidgren.Network/NetBuffer.Peek.cs similarity index 100% rename from Lidgren.Network/NetBuffer.Peek.cs rename to Libraries/Lidgren.Network/NetBuffer.Peek.cs diff --git a/Lidgren.Network/NetBuffer.Read.Reflection.cs b/Libraries/Lidgren.Network/NetBuffer.Read.Reflection.cs similarity index 100% rename from Lidgren.Network/NetBuffer.Read.Reflection.cs rename to Libraries/Lidgren.Network/NetBuffer.Read.Reflection.cs diff --git a/Lidgren.Network/NetBuffer.Read.cs b/Libraries/Lidgren.Network/NetBuffer.Read.cs similarity index 100% rename from Lidgren.Network/NetBuffer.Read.cs rename to Libraries/Lidgren.Network/NetBuffer.Read.cs diff --git a/Lidgren.Network/NetBuffer.Write.Reflection.cs b/Libraries/Lidgren.Network/NetBuffer.Write.Reflection.cs similarity index 100% rename from Lidgren.Network/NetBuffer.Write.Reflection.cs rename to Libraries/Lidgren.Network/NetBuffer.Write.Reflection.cs diff --git a/Lidgren.Network/NetBuffer.Write.cs b/Libraries/Lidgren.Network/NetBuffer.Write.cs similarity index 100% rename from Lidgren.Network/NetBuffer.Write.cs rename to Libraries/Lidgren.Network/NetBuffer.Write.cs diff --git a/Lidgren.Network/NetBuffer.cs b/Libraries/Lidgren.Network/NetBuffer.cs similarity index 100% rename from Lidgren.Network/NetBuffer.cs rename to Libraries/Lidgren.Network/NetBuffer.cs diff --git a/Lidgren.Network/NetClient.cs b/Libraries/Lidgren.Network/NetClient.cs similarity index 100% rename from Lidgren.Network/NetClient.cs rename to Libraries/Lidgren.Network/NetClient.cs diff --git a/Lidgren.Network/NetConnection.Handshake.cs b/Libraries/Lidgren.Network/NetConnection.Handshake.cs similarity index 100% rename from Lidgren.Network/NetConnection.Handshake.cs rename to Libraries/Lidgren.Network/NetConnection.Handshake.cs diff --git a/Lidgren.Network/NetConnection.Latency.cs b/Libraries/Lidgren.Network/NetConnection.Latency.cs similarity index 100% rename from Lidgren.Network/NetConnection.Latency.cs rename to Libraries/Lidgren.Network/NetConnection.Latency.cs diff --git a/Lidgren.Network/NetConnection.MTU.cs b/Libraries/Lidgren.Network/NetConnection.MTU.cs similarity index 100% rename from Lidgren.Network/NetConnection.MTU.cs rename to Libraries/Lidgren.Network/NetConnection.MTU.cs diff --git a/Lidgren.Network/NetConnection.cs b/Libraries/Lidgren.Network/NetConnection.cs similarity index 100% rename from Lidgren.Network/NetConnection.cs rename to Libraries/Lidgren.Network/NetConnection.cs diff --git a/Lidgren.Network/NetConnectionStatistics.cs b/Libraries/Lidgren.Network/NetConnectionStatistics.cs similarity index 100% rename from Lidgren.Network/NetConnectionStatistics.cs rename to Libraries/Lidgren.Network/NetConnectionStatistics.cs diff --git a/Lidgren.Network/NetConnectionStatus.cs b/Libraries/Lidgren.Network/NetConnectionStatus.cs similarity index 100% rename from Lidgren.Network/NetConnectionStatus.cs rename to Libraries/Lidgren.Network/NetConnectionStatus.cs diff --git a/Lidgren.Network/NetConstants.cs b/Libraries/Lidgren.Network/NetConstants.cs similarity index 100% rename from Lidgren.Network/NetConstants.cs rename to Libraries/Lidgren.Network/NetConstants.cs diff --git a/Lidgren.Network/NetDeliveryMethod.cs b/Libraries/Lidgren.Network/NetDeliveryMethod.cs similarity index 100% rename from Lidgren.Network/NetDeliveryMethod.cs rename to Libraries/Lidgren.Network/NetDeliveryMethod.cs diff --git a/Lidgren.Network/NetException.cs b/Libraries/Lidgren.Network/NetException.cs similarity index 100% rename from Lidgren.Network/NetException.cs rename to Libraries/Lidgren.Network/NetException.cs diff --git a/Lidgren.Network/NetFragmentationHelper.cs b/Libraries/Lidgren.Network/NetFragmentationHelper.cs similarity index 100% rename from Lidgren.Network/NetFragmentationHelper.cs rename to Libraries/Lidgren.Network/NetFragmentationHelper.cs diff --git a/Lidgren.Network/NetFragmentationInfo.cs b/Libraries/Lidgren.Network/NetFragmentationInfo.cs similarity index 100% rename from Lidgren.Network/NetFragmentationInfo.cs rename to Libraries/Lidgren.Network/NetFragmentationInfo.cs diff --git a/Lidgren.Network/NetIncomingMessage.cs b/Libraries/Lidgren.Network/NetIncomingMessage.cs similarity index 100% rename from Lidgren.Network/NetIncomingMessage.cs rename to Libraries/Lidgren.Network/NetIncomingMessage.cs diff --git a/Lidgren.Network/NetIncomingMessageType.cs b/Libraries/Lidgren.Network/NetIncomingMessageType.cs similarity index 100% rename from Lidgren.Network/NetIncomingMessageType.cs rename to Libraries/Lidgren.Network/NetIncomingMessageType.cs diff --git a/Lidgren.Network/NetMessageType.cs b/Libraries/Lidgren.Network/NetMessageType.cs similarity index 100% rename from Lidgren.Network/NetMessageType.cs rename to Libraries/Lidgren.Network/NetMessageType.cs diff --git a/Lidgren.Network/NetNatIntroduction.cs b/Libraries/Lidgren.Network/NetNatIntroduction.cs similarity index 100% rename from Lidgren.Network/NetNatIntroduction.cs rename to Libraries/Lidgren.Network/NetNatIntroduction.cs diff --git a/Lidgren.Network/NetOutgoingMessage.cs b/Libraries/Lidgren.Network/NetOutgoingMessage.cs similarity index 100% rename from Lidgren.Network/NetOutgoingMessage.cs rename to Libraries/Lidgren.Network/NetOutgoingMessage.cs diff --git a/Lidgren.Network/NetPeer.Discovery.cs b/Libraries/Lidgren.Network/NetPeer.Discovery.cs similarity index 100% rename from Lidgren.Network/NetPeer.Discovery.cs rename to Libraries/Lidgren.Network/NetPeer.Discovery.cs diff --git a/Lidgren.Network/NetPeer.Fragmentation.cs b/Libraries/Lidgren.Network/NetPeer.Fragmentation.cs similarity index 100% rename from Lidgren.Network/NetPeer.Fragmentation.cs rename to Libraries/Lidgren.Network/NetPeer.Fragmentation.cs diff --git a/Lidgren.Network/NetPeer.Internal.cs b/Libraries/Lidgren.Network/NetPeer.Internal.cs similarity index 100% rename from Lidgren.Network/NetPeer.Internal.cs rename to Libraries/Lidgren.Network/NetPeer.Internal.cs diff --git a/Lidgren.Network/NetPeer.LatencySimulation.cs b/Libraries/Lidgren.Network/NetPeer.LatencySimulation.cs similarity index 100% rename from Lidgren.Network/NetPeer.LatencySimulation.cs rename to Libraries/Lidgren.Network/NetPeer.LatencySimulation.cs diff --git a/Lidgren.Network/NetPeer.Logging.cs b/Libraries/Lidgren.Network/NetPeer.Logging.cs similarity index 100% rename from Lidgren.Network/NetPeer.Logging.cs rename to Libraries/Lidgren.Network/NetPeer.Logging.cs diff --git a/Lidgren.Network/NetPeer.MessagePools.cs b/Libraries/Lidgren.Network/NetPeer.MessagePools.cs similarity index 100% rename from Lidgren.Network/NetPeer.MessagePools.cs rename to Libraries/Lidgren.Network/NetPeer.MessagePools.cs diff --git a/Lidgren.Network/NetPeer.Send.cs b/Libraries/Lidgren.Network/NetPeer.Send.cs similarity index 100% rename from Lidgren.Network/NetPeer.Send.cs rename to Libraries/Lidgren.Network/NetPeer.Send.cs diff --git a/Lidgren.Network/NetPeer.cs b/Libraries/Lidgren.Network/NetPeer.cs similarity index 100% rename from Lidgren.Network/NetPeer.cs rename to Libraries/Lidgren.Network/NetPeer.cs diff --git a/Lidgren.Network/NetPeerConfiguration.cs b/Libraries/Lidgren.Network/NetPeerConfiguration.cs similarity index 100% rename from Lidgren.Network/NetPeerConfiguration.cs rename to Libraries/Lidgren.Network/NetPeerConfiguration.cs diff --git a/Lidgren.Network/NetPeerStatistics.cs b/Libraries/Lidgren.Network/NetPeerStatistics.cs similarity index 100% rename from Lidgren.Network/NetPeerStatistics.cs rename to Libraries/Lidgren.Network/NetPeerStatistics.cs diff --git a/Lidgren.Network/NetPeerStatus.cs b/Libraries/Lidgren.Network/NetPeerStatus.cs similarity index 100% rename from Lidgren.Network/NetPeerStatus.cs rename to Libraries/Lidgren.Network/NetPeerStatus.cs diff --git a/Lidgren.Network/NetQueue.cs b/Libraries/Lidgren.Network/NetQueue.cs similarity index 100% rename from Lidgren.Network/NetQueue.cs rename to Libraries/Lidgren.Network/NetQueue.cs diff --git a/Lidgren.Network/NetRandom.Implementations.cs b/Libraries/Lidgren.Network/NetRandom.Implementations.cs similarity index 100% rename from Lidgren.Network/NetRandom.Implementations.cs rename to Libraries/Lidgren.Network/NetRandom.Implementations.cs diff --git a/Lidgren.Network/NetRandom.cs b/Libraries/Lidgren.Network/NetRandom.cs similarity index 100% rename from Lidgren.Network/NetRandom.cs rename to Libraries/Lidgren.Network/NetRandom.cs diff --git a/Lidgren.Network/NetRandomSeed.cs b/Libraries/Lidgren.Network/NetRandomSeed.cs similarity index 100% rename from Lidgren.Network/NetRandomSeed.cs rename to Libraries/Lidgren.Network/NetRandomSeed.cs diff --git a/Lidgren.Network/NetReceiverChannelBase.cs b/Libraries/Lidgren.Network/NetReceiverChannelBase.cs similarity index 100% rename from Lidgren.Network/NetReceiverChannelBase.cs rename to Libraries/Lidgren.Network/NetReceiverChannelBase.cs diff --git a/Lidgren.Network/NetReliableOrderedReceiver.cs b/Libraries/Lidgren.Network/NetReliableOrderedReceiver.cs similarity index 100% rename from Lidgren.Network/NetReliableOrderedReceiver.cs rename to Libraries/Lidgren.Network/NetReliableOrderedReceiver.cs diff --git a/Lidgren.Network/NetReliableSenderChannel.cs b/Libraries/Lidgren.Network/NetReliableSenderChannel.cs similarity index 100% rename from Lidgren.Network/NetReliableSenderChannel.cs rename to Libraries/Lidgren.Network/NetReliableSenderChannel.cs diff --git a/Lidgren.Network/NetReliableSequencedReceiver.cs b/Libraries/Lidgren.Network/NetReliableSequencedReceiver.cs similarity index 100% rename from Lidgren.Network/NetReliableSequencedReceiver.cs rename to Libraries/Lidgren.Network/NetReliableSequencedReceiver.cs diff --git a/Lidgren.Network/NetReliableUnorderedReceiver.cs b/Libraries/Lidgren.Network/NetReliableUnorderedReceiver.cs similarity index 100% rename from Lidgren.Network/NetReliableUnorderedReceiver.cs rename to Libraries/Lidgren.Network/NetReliableUnorderedReceiver.cs diff --git a/Lidgren.Network/NetSRP.cs b/Libraries/Lidgren.Network/NetSRP.cs similarity index 100% rename from Lidgren.Network/NetSRP.cs rename to Libraries/Lidgren.Network/NetSRP.cs diff --git a/Lidgren.Network/NetSendResult.cs b/Libraries/Lidgren.Network/NetSendResult.cs similarity index 100% rename from Lidgren.Network/NetSendResult.cs rename to Libraries/Lidgren.Network/NetSendResult.cs diff --git a/Lidgren.Network/NetSenderChannelBase.cs b/Libraries/Lidgren.Network/NetSenderChannelBase.cs similarity index 100% rename from Lidgren.Network/NetSenderChannelBase.cs rename to Libraries/Lidgren.Network/NetSenderChannelBase.cs diff --git a/Lidgren.Network/NetServer.cs b/Libraries/Lidgren.Network/NetServer.cs similarity index 100% rename from Lidgren.Network/NetServer.cs rename to Libraries/Lidgren.Network/NetServer.cs diff --git a/Lidgren.Network/NetStoredReliableMessage.cs b/Libraries/Lidgren.Network/NetStoredReliableMessage.cs similarity index 100% rename from Lidgren.Network/NetStoredReliableMessage.cs rename to Libraries/Lidgren.Network/NetStoredReliableMessage.cs diff --git a/Lidgren.Network/NetTime.cs b/Libraries/Lidgren.Network/NetTime.cs similarity index 100% rename from Lidgren.Network/NetTime.cs rename to Libraries/Lidgren.Network/NetTime.cs diff --git a/Lidgren.Network/NetTuple.cs b/Libraries/Lidgren.Network/NetTuple.cs similarity index 100% rename from Lidgren.Network/NetTuple.cs rename to Libraries/Lidgren.Network/NetTuple.cs diff --git a/Lidgren.Network/NetUPnP.cs b/Libraries/Lidgren.Network/NetUPnP.cs similarity index 100% rename from Lidgren.Network/NetUPnP.cs rename to Libraries/Lidgren.Network/NetUPnP.cs diff --git a/Lidgren.Network/NetUnreliableSenderChannel.cs b/Libraries/Lidgren.Network/NetUnreliableSenderChannel.cs similarity index 100% rename from Lidgren.Network/NetUnreliableSenderChannel.cs rename to Libraries/Lidgren.Network/NetUnreliableSenderChannel.cs diff --git a/Lidgren.Network/NetUnreliableSequencedReceiver.cs b/Libraries/Lidgren.Network/NetUnreliableSequencedReceiver.cs similarity index 100% rename from Lidgren.Network/NetUnreliableSequencedReceiver.cs rename to Libraries/Lidgren.Network/NetUnreliableSequencedReceiver.cs diff --git a/Lidgren.Network/NetUnreliableUnorderedReceiver.cs b/Libraries/Lidgren.Network/NetUnreliableUnorderedReceiver.cs similarity index 100% rename from Lidgren.Network/NetUnreliableUnorderedReceiver.cs rename to Libraries/Lidgren.Network/NetUnreliableUnorderedReceiver.cs diff --git a/Lidgren.Network/NetUtility.cs b/Libraries/Lidgren.Network/NetUtility.cs similarity index 100% rename from Lidgren.Network/NetUtility.cs rename to Libraries/Lidgren.Network/NetUtility.cs diff --git a/Lidgren.Network/Platform/PlatformAndroid.cs b/Libraries/Lidgren.Network/Platform/PlatformAndroid.cs similarity index 100% rename from Lidgren.Network/Platform/PlatformAndroid.cs rename to Libraries/Lidgren.Network/Platform/PlatformAndroid.cs diff --git a/Lidgren.Network/Platform/PlatformConstrained.cs b/Libraries/Lidgren.Network/Platform/PlatformConstrained.cs similarity index 100% rename from Lidgren.Network/Platform/PlatformConstrained.cs rename to Libraries/Lidgren.Network/Platform/PlatformConstrained.cs diff --git a/Lidgren.Network/Platform/PlatformWin32.cs b/Libraries/Lidgren.Network/Platform/PlatformWin32.cs similarity index 100% rename from Lidgren.Network/Platform/PlatformWin32.cs rename to Libraries/Lidgren.Network/Platform/PlatformWin32.cs diff --git a/Lidgren.Network/Platform/PlatformWinRT.cs b/Libraries/Lidgren.Network/Platform/PlatformWinRT.cs similarity index 100% rename from Lidgren.Network/Platform/PlatformWinRT.cs rename to Libraries/Lidgren.Network/Platform/PlatformWinRT.cs diff --git a/Lidgren.Network/Properties/AssemblyInfo.cs b/Libraries/Lidgren.Network/Properties/AssemblyInfo.cs similarity index 100% rename from Lidgren.Network/Properties/AssemblyInfo.cs rename to Libraries/Lidgren.Network/Properties/AssemblyInfo.cs diff --git a/Libraries/NuGet/.gitignore b/Libraries/NuGet/.gitignore new file mode 100644 index 000000000..63ea916ef --- /dev/null +++ b/Libraries/NuGet/.gitignore @@ -0,0 +1 @@ +/*/ diff --git a/Libraries/NuGet/readme.txt b/Libraries/NuGet/readme.txt new file mode 100644 index 000000000..db83223ad --- /dev/null +++ b/Libraries/NuGet/readme.txt @@ -0,0 +1,4 @@ +Not including NuGet packages in the repository, Visual Studio +should download them automatically when you build the solution. +You can also manually restore them all by going into the package +manager and clicking "Restore" when prompted. diff --git a/SharpFont/.gitignore b/Libraries/SharpFont/.gitignore similarity index 100% rename from SharpFont/.gitignore rename to Libraries/SharpFont/.gitignore diff --git a/SharpFont/.gitmodules b/Libraries/SharpFont/.gitmodules similarity index 100% rename from SharpFont/.gitmodules rename to Libraries/SharpFont/.gitmodules diff --git a/SharpFont/Dependencies/freetype2/2.5.4-alldeps/README.md b/Libraries/SharpFont/Dependencies/freetype2/2.5.4-alldeps/README.md similarity index 100% rename from SharpFont/Dependencies/freetype2/2.5.4-alldeps/README.md rename to Libraries/SharpFont/Dependencies/freetype2/2.5.4-alldeps/README.md diff --git a/SharpFont/Dependencies/freetype2/2.5.4-alldeps/patches/fttypes-h-win32.patch b/Libraries/SharpFont/Dependencies/freetype2/2.5.4-alldeps/patches/fttypes-h-win32.patch similarity index 100% rename from SharpFont/Dependencies/freetype2/2.5.4-alldeps/patches/fttypes-h-win32.patch rename to Libraries/SharpFont/Dependencies/freetype2/2.5.4-alldeps/patches/fttypes-h-win32.patch diff --git a/SharpFont/Dependencies/freetype2/2.5.5-alldeps/README.md b/Libraries/SharpFont/Dependencies/freetype2/2.5.5-alldeps/README.md similarity index 100% rename from SharpFont/Dependencies/freetype2/2.5.5-alldeps/README.md rename to Libraries/SharpFont/Dependencies/freetype2/2.5.5-alldeps/README.md diff --git a/SharpFont/Dependencies/freetype2/FTL.TXT b/Libraries/SharpFont/Dependencies/freetype2/FTL.TXT similarity index 100% rename from SharpFont/Dependencies/freetype2/FTL.TXT rename to Libraries/SharpFont/Dependencies/freetype2/FTL.TXT diff --git a/SharpFont/Dependencies/freetype2/README.md b/Libraries/SharpFont/Dependencies/freetype2/README.md similarity index 100% rename from SharpFont/Dependencies/freetype2/README.md rename to Libraries/SharpFont/Dependencies/freetype2/README.md diff --git a/SharpFont/Dependencies/freetype2/win64.patch b/Libraries/SharpFont/Dependencies/freetype2/win64.patch similarity index 100% rename from SharpFont/Dependencies/freetype2/win64.patch rename to Libraries/SharpFont/Dependencies/freetype2/win64.patch diff --git a/SharpFont/LICENSE b/Libraries/SharpFont/LICENSE similarity index 100% rename from SharpFont/LICENSE rename to Libraries/SharpFont/LICENSE diff --git a/SharpFont/Makefile b/Libraries/SharpFont/Makefile similarity index 100% rename from SharpFont/Makefile rename to Libraries/SharpFont/Makefile diff --git a/SharpFont/README.md b/Libraries/SharpFont/README.md similarity index 100% rename from SharpFont/README.md rename to Libraries/SharpFont/README.md diff --git a/SharpFont/Source/.editorconfig b/Libraries/SharpFont/Source/.editorconfig similarity index 100% rename from SharpFont/Source/.editorconfig rename to Libraries/SharpFont/Source/.editorconfig diff --git a/SharpFont/Source/Settings.StyleCop b/Libraries/SharpFont/Source/Settings.StyleCop similarity index 100% rename from SharpFont/Source/Settings.StyleCop rename to Libraries/SharpFont/Source/Settings.StyleCop diff --git a/SharpFont/Source/SharpFont.dll.config b/Libraries/SharpFont/Source/SharpFont.dll.config similarity index 100% rename from SharpFont/Source/SharpFont.dll.config rename to Libraries/SharpFont/Source/SharpFont.dll.config diff --git a/SharpFont/Source/SharpFont.sln b/Libraries/SharpFont/Source/SharpFont.sln similarity index 100% rename from SharpFont/Source/SharpFont.sln rename to Libraries/SharpFont/Source/SharpFont.sln diff --git a/SharpFont/Source/SharpFont.snk b/Libraries/SharpFont/Source/SharpFont.snk similarity index 100% rename from SharpFont/Source/SharpFont.snk rename to Libraries/SharpFont/Source/SharpFont.snk diff --git a/SharpFont/Source/SharpFont/SharpFont.csproj b/Libraries/SharpFont/Source/SharpFont/SharpFont.csproj similarity index 100% rename from SharpFont/Source/SharpFont/SharpFont.csproj rename to Libraries/SharpFont/Source/SharpFont/SharpFont.csproj diff --git a/SharpFont/Source/SharpFontShared/AutoHinterScript.cs b/Libraries/SharpFont/Source/SharpFontShared/AutoHinterScript.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/AutoHinterScript.cs rename to Libraries/SharpFont/Source/SharpFontShared/AutoHinterScript.cs diff --git a/SharpFont/Source/SharpFontShared/BBox.cs b/Libraries/SharpFont/Source/SharpFontShared/BBox.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/BBox.cs rename to Libraries/SharpFont/Source/SharpFontShared/BBox.cs diff --git a/SharpFont/Source/SharpFontShared/Bdf/Internal/PropertyRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Bdf/Internal/PropertyRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Bdf/Internal/PropertyRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Bdf/Internal/PropertyRec.cs diff --git a/SharpFont/Source/SharpFontShared/Bdf/Property.cs b/Libraries/SharpFont/Source/SharpFontShared/Bdf/Property.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Bdf/Property.cs rename to Libraries/SharpFont/Source/SharpFontShared/Bdf/Property.cs diff --git a/SharpFont/Source/SharpFontShared/Bdf/PropertyType.cs b/Libraries/SharpFont/Source/SharpFontShared/Bdf/PropertyType.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Bdf/PropertyType.cs rename to Libraries/SharpFont/Source/SharpFontShared/Bdf/PropertyType.cs diff --git a/SharpFont/Source/SharpFontShared/BitmapGlyph.cs b/Libraries/SharpFont/Source/SharpFontShared/BitmapGlyph.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/BitmapGlyph.cs rename to Libraries/SharpFont/Source/SharpFontShared/BitmapGlyph.cs diff --git a/SharpFont/Source/SharpFontShared/BitmapSize.cs b/Libraries/SharpFont/Source/SharpFontShared/BitmapSize.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/BitmapSize.cs rename to Libraries/SharpFont/Source/SharpFontShared/BitmapSize.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/CMapCache.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/CMapCache.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/CMapCache.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/CMapCache.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/FaceRequester.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/FaceRequester.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/FaceRequester.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/FaceRequester.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/ImageCache.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/ImageCache.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/ImageCache.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/ImageCache.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/ImageType.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/ImageType.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/ImageType.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/ImageType.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Internal/CMapCacheRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/CMapCacheRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Internal/CMapCacheRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/CMapCacheRec.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Internal/ImageCacheRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/ImageCacheRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Internal/ImageCacheRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/ImageCacheRec.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Internal/ImageTypeRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/ImageTypeRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Internal/ImageTypeRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/ImageTypeRec.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Internal/ManagerRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/ManagerRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Internal/ManagerRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/ManagerRec.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Internal/NodeRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/NodeRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Internal/NodeRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/NodeRec.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Internal/SBitCacheRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/SBitCacheRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Internal/SBitCacheRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/SBitCacheRec.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Internal/SBitRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/SBitRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Internal/SBitRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/SBitRec.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Internal/ScalerRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/ScalerRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Internal/ScalerRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Internal/ScalerRec.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Manager.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Manager.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Manager.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Manager.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Node.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Node.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Node.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Node.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/SBit.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/SBit.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/SBit.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/SBit.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/SBitCache.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/SBitCache.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/SBitCache.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/SBitCache.cs diff --git a/SharpFont/Source/SharpFontShared/Cache/Scaler.cs b/Libraries/SharpFont/Source/SharpFontShared/Cache/Scaler.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cache/Scaler.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cache/Scaler.cs diff --git a/SharpFont/Source/SharpFontShared/Cff/HintingEngine.cs b/Libraries/SharpFont/Source/SharpFontShared/Cff/HintingEngine.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Cff/HintingEngine.cs rename to Libraries/SharpFont/Source/SharpFontShared/Cff/HintingEngine.cs diff --git a/SharpFont/Source/SharpFontShared/CharMap.cs b/Libraries/SharpFont/Source/SharpFontShared/CharMap.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/CharMap.cs rename to Libraries/SharpFont/Source/SharpFontShared/CharMap.cs diff --git a/SharpFont/Source/SharpFontShared/ClassicKernValidationFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/ClassicKernValidationFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/ClassicKernValidationFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/ClassicKernValidationFlags.cs diff --git a/SharpFont/Source/SharpFontShared/Data.cs b/Libraries/SharpFont/Source/SharpFontShared/Data.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Data.cs rename to Libraries/SharpFont/Source/SharpFontShared/Data.cs diff --git a/SharpFont/Source/SharpFontShared/EmbeddingTypes.cs b/Libraries/SharpFont/Source/SharpFontShared/EmbeddingTypes.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/EmbeddingTypes.cs rename to Libraries/SharpFont/Source/SharpFontShared/EmbeddingTypes.cs diff --git a/SharpFont/Source/SharpFontShared/Encoding.cs b/Libraries/SharpFont/Source/SharpFontShared/Encoding.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Encoding.cs rename to Libraries/SharpFont/Source/SharpFontShared/Encoding.cs diff --git a/SharpFont/Source/SharpFontShared/Error.cs b/Libraries/SharpFont/Source/SharpFontShared/Error.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Error.cs rename to Libraries/SharpFont/Source/SharpFontShared/Error.cs diff --git a/SharpFont/Source/SharpFontShared/FT.Internal.cs b/Libraries/SharpFont/Source/SharpFontShared/FT.Internal.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FT.Internal.cs rename to Libraries/SharpFont/Source/SharpFontShared/FT.Internal.cs diff --git a/SharpFont/Source/SharpFontShared/FT.Public.cs b/Libraries/SharpFont/Source/SharpFontShared/FT.Public.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FT.Public.cs rename to Libraries/SharpFont/Source/SharpFontShared/FT.Public.cs diff --git a/SharpFont/Source/SharpFontShared/FTBitmap.cs b/Libraries/SharpFont/Source/SharpFontShared/FTBitmap.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FTBitmap.cs rename to Libraries/SharpFont/Source/SharpFontShared/FTBitmap.cs diff --git a/SharpFont/Source/SharpFontShared/FTList.cs b/Libraries/SharpFont/Source/SharpFontShared/FTList.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FTList.cs rename to Libraries/SharpFont/Source/SharpFontShared/FTList.cs diff --git a/SharpFont/Source/SharpFontShared/FTMatrix.cs b/Libraries/SharpFont/Source/SharpFontShared/FTMatrix.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FTMatrix.cs rename to Libraries/SharpFont/Source/SharpFontShared/FTMatrix.cs diff --git a/SharpFont/Source/SharpFontShared/FTSize.cs b/Libraries/SharpFont/Source/SharpFontShared/FTSize.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FTSize.cs rename to Libraries/SharpFont/Source/SharpFontShared/FTSize.cs diff --git a/SharpFont/Source/SharpFontShared/FTStream.cs b/Libraries/SharpFont/Source/SharpFontShared/FTStream.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FTStream.cs rename to Libraries/SharpFont/Source/SharpFontShared/FTStream.cs diff --git a/SharpFont/Source/SharpFontShared/FTUnitVector.cs b/Libraries/SharpFont/Source/SharpFontShared/FTUnitVector.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FTUnitVector.cs rename to Libraries/SharpFont/Source/SharpFontShared/FTUnitVector.cs diff --git a/SharpFont/Source/SharpFontShared/FTVector.cs b/Libraries/SharpFont/Source/SharpFontShared/FTVector.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FTVector.cs rename to Libraries/SharpFont/Source/SharpFontShared/FTVector.cs diff --git a/SharpFont/Source/SharpFontShared/FTVector26Dot6.cs b/Libraries/SharpFont/Source/SharpFontShared/FTVector26Dot6.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FTVector26Dot6.cs rename to Libraries/SharpFont/Source/SharpFontShared/FTVector26Dot6.cs diff --git a/SharpFont/Source/SharpFontShared/Face.cs b/Libraries/SharpFont/Source/SharpFontShared/Face.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Face.cs rename to Libraries/SharpFont/Source/SharpFontShared/Face.cs diff --git a/SharpFont/Source/SharpFontShared/FaceFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/FaceFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FaceFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/FaceFlags.cs diff --git a/SharpFont/Source/SharpFontShared/Fixed16Dot16.cs b/Libraries/SharpFont/Source/SharpFontShared/Fixed16Dot16.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Fixed16Dot16.cs rename to Libraries/SharpFont/Source/SharpFontShared/Fixed16Dot16.cs diff --git a/SharpFont/Source/SharpFontShared/Fixed26Dot6.cs b/Libraries/SharpFont/Source/SharpFontShared/Fixed26Dot6.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Fixed26Dot6.cs rename to Libraries/SharpFont/Source/SharpFontShared/Fixed26Dot6.cs diff --git a/SharpFont/Source/SharpFontShared/Fixed2Dot14.cs b/Libraries/SharpFont/Source/SharpFontShared/Fixed2Dot14.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Fixed2Dot14.cs rename to Libraries/SharpFont/Source/SharpFontShared/Fixed2Dot14.cs diff --git a/SharpFont/Source/SharpFontShared/Fnt/Header.cs b/Libraries/SharpFont/Source/SharpFontShared/Fnt/Header.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Fnt/Header.cs rename to Libraries/SharpFont/Source/SharpFontShared/Fnt/Header.cs diff --git a/SharpFont/Source/SharpFontShared/Fnt/Internal/HeaderRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Fnt/Internal/HeaderRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Fnt/Internal/HeaderRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Fnt/Internal/HeaderRec.cs diff --git a/SharpFont/Source/SharpFontShared/Fnt/WinFntID.cs b/Libraries/SharpFont/Source/SharpFontShared/Fnt/WinFntID.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Fnt/WinFntID.cs rename to Libraries/SharpFont/Source/SharpFontShared/Fnt/WinFntID.cs diff --git a/SharpFont/Source/SharpFontShared/FreeTypeException.cs b/Libraries/SharpFont/Source/SharpFontShared/FreeTypeException.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/FreeTypeException.cs rename to Libraries/SharpFont/Source/SharpFontShared/FreeTypeException.cs diff --git a/SharpFont/Source/SharpFontShared/Gasp.cs b/Libraries/SharpFont/Source/SharpFontShared/Gasp.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Gasp.cs rename to Libraries/SharpFont/Source/SharpFontShared/Gasp.cs diff --git a/SharpFont/Source/SharpFontShared/Generic.cs b/Libraries/SharpFont/Source/SharpFontShared/Generic.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Generic.cs rename to Libraries/SharpFont/Source/SharpFontShared/Generic.cs diff --git a/SharpFont/Source/SharpFontShared/Glyph.cs b/Libraries/SharpFont/Source/SharpFontShared/Glyph.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Glyph.cs rename to Libraries/SharpFont/Source/SharpFontShared/Glyph.cs diff --git a/SharpFont/Source/SharpFontShared/GlyphBBoxMode.cs b/Libraries/SharpFont/Source/SharpFontShared/GlyphBBoxMode.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/GlyphBBoxMode.cs rename to Libraries/SharpFont/Source/SharpFontShared/GlyphBBoxMode.cs diff --git a/SharpFont/Source/SharpFontShared/GlyphFormat.cs b/Libraries/SharpFont/Source/SharpFontShared/GlyphFormat.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/GlyphFormat.cs rename to Libraries/SharpFont/Source/SharpFontShared/GlyphFormat.cs diff --git a/SharpFont/Source/SharpFontShared/GlyphMetrics.cs b/Libraries/SharpFont/Source/SharpFontShared/GlyphMetrics.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/GlyphMetrics.cs rename to Libraries/SharpFont/Source/SharpFontShared/GlyphMetrics.cs diff --git a/SharpFont/Source/SharpFontShared/GlyphSlot.cs b/Libraries/SharpFont/Source/SharpFontShared/GlyphSlot.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/GlyphSlot.cs rename to Libraries/SharpFont/Source/SharpFontShared/GlyphSlot.cs diff --git a/SharpFont/Source/SharpFontShared/GlyphToScriptMapProperty.cs b/Libraries/SharpFont/Source/SharpFontShared/GlyphToScriptMapProperty.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/GlyphToScriptMapProperty.cs rename to Libraries/SharpFont/Source/SharpFontShared/GlyphToScriptMapProperty.cs diff --git a/SharpFont/Source/SharpFontShared/IncreaseXHeightProperty.cs b/Libraries/SharpFont/Source/SharpFontShared/IncreaseXHeightProperty.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/IncreaseXHeightProperty.cs rename to Libraries/SharpFont/Source/SharpFontShared/IncreaseXHeightProperty.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/BitmapGlyphRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/BitmapGlyphRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/BitmapGlyphRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/BitmapGlyphRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/BitmapRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/BitmapRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/BitmapRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/BitmapRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/BitmapSizeRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/BitmapSizeRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/BitmapSizeRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/BitmapSizeRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/CharMapRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/CharMapRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/CharMapRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/CharMapRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/FaceRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/FaceRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/FaceRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/FaceRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/GenericRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/GenericRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/GenericRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/GenericRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/GlyphMetricsRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/GlyphMetricsRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/GlyphMetricsRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/GlyphMetricsRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/GlyphRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/GlyphRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/GlyphRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/GlyphRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/GlyphSlotRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/GlyphSlotRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/GlyphSlotRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/GlyphSlotRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/GlyphToScriptMapPropertyRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/GlyphToScriptMapPropertyRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/GlyphToScriptMapPropertyRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/GlyphToScriptMapPropertyRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/IncreaseXHeightPropertyRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/IncreaseXHeightPropertyRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/IncreaseXHeightPropertyRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/IncreaseXHeightPropertyRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/ListNodeRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/ListNodeRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/ListNodeRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/ListNodeRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/ListRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/ListRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/ListRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/ListRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/MemoryRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/MemoryRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/MemoryRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/MemoryRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/ModuleClassRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/ModuleClassRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/ModuleClassRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/ModuleClassRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/NativeObject.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/NativeObject.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/NativeObject.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/NativeObject.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/NativeReference.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/NativeReference.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/NativeReference.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/NativeReference.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/OpenArgsRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/OpenArgsRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/OpenArgsRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/OpenArgsRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/OutlineFuncsRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/OutlineFuncsRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/OutlineFuncsRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/OutlineFuncsRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/OutlineGlyphRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/OutlineGlyphRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/OutlineGlyphRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/OutlineGlyphRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/OutlineRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/OutlineRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/OutlineRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/OutlineRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/ParameterRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/ParameterRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/ParameterRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/ParameterRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/RasterFuncsRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/RasterFuncsRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/RasterFuncsRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/RasterFuncsRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/RasterParamsRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/RasterParamsRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/RasterParamsRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/RasterParamsRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/RendererClassRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/RendererClassRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/RendererClassRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/RendererClassRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/SizeMetricsRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/SizeMetricsRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/SizeMetricsRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/SizeMetricsRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/SizeRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/SizeRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/SizeRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/SizeRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/SizeRequestRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/SizeRequestRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/SizeRequestRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/SizeRequestRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/SpanRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/SpanRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/SpanRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/SpanRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/StreamDescRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/StreamDescRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/StreamDescRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/StreamDescRec.cs diff --git a/SharpFont/Source/SharpFontShared/Internal/StreamRec.cs b/Libraries/SharpFont/Source/SharpFontShared/Internal/StreamRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Internal/StreamRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/Internal/StreamRec.cs diff --git a/SharpFont/Source/SharpFontShared/KerningMode.cs b/Libraries/SharpFont/Source/SharpFontShared/KerningMode.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/KerningMode.cs rename to Libraries/SharpFont/Source/SharpFontShared/KerningMode.cs diff --git a/SharpFont/Source/SharpFontShared/LcdFilter.cs b/Libraries/SharpFont/Source/SharpFontShared/LcdFilter.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/LcdFilter.cs rename to Libraries/SharpFont/Source/SharpFontShared/LcdFilter.cs diff --git a/SharpFont/Source/SharpFontShared/Library.cs b/Libraries/SharpFont/Source/SharpFontShared/Library.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Library.cs rename to Libraries/SharpFont/Source/SharpFontShared/Library.cs diff --git a/SharpFont/Source/SharpFontShared/ListNode.cs b/Libraries/SharpFont/Source/SharpFontShared/ListNode.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/ListNode.cs rename to Libraries/SharpFont/Source/SharpFontShared/ListNode.cs diff --git a/SharpFont/Source/SharpFontShared/LoadFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/LoadFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/LoadFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/LoadFlags.cs diff --git a/SharpFont/Source/SharpFontShared/LoadTarget.cs b/Libraries/SharpFont/Source/SharpFontShared/LoadTarget.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/LoadTarget.cs rename to Libraries/SharpFont/Source/SharpFontShared/LoadTarget.cs diff --git a/SharpFont/Source/SharpFontShared/Memory.cs b/Libraries/SharpFont/Source/SharpFontShared/Memory.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Memory.cs rename to Libraries/SharpFont/Source/SharpFontShared/Memory.cs diff --git a/SharpFont/Source/SharpFontShared/Module.cs b/Libraries/SharpFont/Source/SharpFontShared/Module.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Module.cs rename to Libraries/SharpFont/Source/SharpFontShared/Module.cs diff --git a/SharpFont/Source/SharpFontShared/ModuleClass.cs b/Libraries/SharpFont/Source/SharpFontShared/ModuleClass.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/ModuleClass.cs rename to Libraries/SharpFont/Source/SharpFontShared/ModuleClass.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MMAxisRec.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MMAxisRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MMAxisRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MMAxisRec.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MMVarRec.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MMVarRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MMVarRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MMVarRec.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MultiMasterRec.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MultiMasterRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MultiMasterRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/MultiMasterRec.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/VarAxisRec.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/VarAxisRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/Internal/VarAxisRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/VarAxisRec.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/VarNamedStyleRec.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/VarNamedStyleRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/Internal/VarNamedStyleRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/Internal/VarNamedStyleRec.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/MMAxis.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/MMAxis.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/MMAxis.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/MMAxis.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/MMVar.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/MMVar.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/MMVar.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/MMVar.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/MultiMaster.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/MultiMaster.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/MultiMaster.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/MultiMaster.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/VarAxis.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/VarAxis.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/VarAxis.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/VarAxis.cs diff --git a/SharpFont/Source/SharpFontShared/MultipleMasters/VarNamedStyle.cs b/Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/VarNamedStyle.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/MultipleMasters/VarNamedStyle.cs rename to Libraries/SharpFont/Source/SharpFontShared/MultipleMasters/VarNamedStyle.cs diff --git a/SharpFont/Source/SharpFontShared/OpenArgs.cs b/Libraries/SharpFont/Source/SharpFontShared/OpenArgs.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/OpenArgs.cs rename to Libraries/SharpFont/Source/SharpFontShared/OpenArgs.cs diff --git a/SharpFont/Source/SharpFontShared/OpenFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/OpenFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/OpenFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/OpenFlags.cs diff --git a/SharpFont/Source/SharpFontShared/OpenTypeValidationFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/OpenTypeValidationFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/OpenTypeValidationFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/OpenTypeValidationFlags.cs diff --git a/SharpFont/Source/SharpFontShared/Orientation.cs b/Libraries/SharpFont/Source/SharpFontShared/Orientation.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Orientation.cs rename to Libraries/SharpFont/Source/SharpFontShared/Orientation.cs diff --git a/SharpFont/Source/SharpFontShared/Outline.cs b/Libraries/SharpFont/Source/SharpFontShared/Outline.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Outline.cs rename to Libraries/SharpFont/Source/SharpFontShared/Outline.cs diff --git a/SharpFont/Source/SharpFontShared/OutlineFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/OutlineFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/OutlineFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/OutlineFlags.cs diff --git a/SharpFont/Source/SharpFontShared/OutlineFuncs.cs b/Libraries/SharpFont/Source/SharpFontShared/OutlineFuncs.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/OutlineFuncs.cs rename to Libraries/SharpFont/Source/SharpFontShared/OutlineFuncs.cs diff --git a/SharpFont/Source/SharpFontShared/OutlineGlyph.cs b/Libraries/SharpFont/Source/SharpFontShared/OutlineGlyph.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/OutlineGlyph.cs rename to Libraries/SharpFont/Source/SharpFontShared/OutlineGlyph.cs diff --git a/SharpFont/Source/SharpFontShared/PInvokeHelper.cs b/Libraries/SharpFont/Source/SharpFontShared/PInvokeHelper.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PInvokeHelper.cs rename to Libraries/SharpFont/Source/SharpFontShared/PInvokeHelper.cs diff --git a/SharpFont/Source/SharpFontShared/ParamTag.cs b/Libraries/SharpFont/Source/SharpFontShared/ParamTag.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/ParamTag.cs rename to Libraries/SharpFont/Source/SharpFontShared/ParamTag.cs diff --git a/SharpFont/Source/SharpFontShared/Parameter.cs b/Libraries/SharpFont/Source/SharpFontShared/Parameter.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Parameter.cs rename to Libraries/SharpFont/Source/SharpFontShared/Parameter.cs diff --git a/SharpFont/Source/SharpFontShared/PixelMode.cs b/Libraries/SharpFont/Source/SharpFontShared/PixelMode.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PixelMode.cs rename to Libraries/SharpFont/Source/SharpFontShared/PixelMode.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/BlendFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/BlendFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/BlendFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/BlendFlags.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/DictionaryKeys.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/DictionaryKeys.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/DictionaryKeys.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/DictionaryKeys.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/EncodingType.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/EncodingType.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/EncodingType.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/EncodingType.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/FaceDict.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/FaceDict.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/FaceDict.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/FaceDict.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/FaceInfo.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/FaceInfo.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/FaceInfo.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/FaceInfo.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/FontInfo.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/FontInfo.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/FontInfo.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/FontInfo.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/Internal/FaceDictRec.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/Internal/FaceDictRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/Internal/FaceDictRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/Internal/FaceDictRec.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/Internal/FaceInfoRec.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/Internal/FaceInfoRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/Internal/FaceInfoRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/Internal/FaceInfoRec.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/Internal/FontInfoRec.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/Internal/FontInfoRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/Internal/FontInfoRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/Internal/FontInfoRec.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/Internal/PrivateRec.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/Internal/PrivateRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/Internal/PrivateRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/Internal/PrivateRec.cs diff --git a/SharpFont/Source/SharpFontShared/PostScript/Private.cs b/Libraries/SharpFont/Source/SharpFontShared/PostScript/Private.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/PostScript/Private.cs rename to Libraries/SharpFont/Source/SharpFontShared/PostScript/Private.cs diff --git a/SharpFont/Source/SharpFontShared/Properties/AssemblyInfo.cs b/Libraries/SharpFont/Source/SharpFontShared/Properties/AssemblyInfo.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Properties/AssemblyInfo.cs rename to Libraries/SharpFont/Source/SharpFontShared/Properties/AssemblyInfo.cs diff --git a/SharpFont/Source/SharpFontShared/Raster.cs b/Libraries/SharpFont/Source/SharpFontShared/Raster.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Raster.cs rename to Libraries/SharpFont/Source/SharpFontShared/Raster.cs diff --git a/SharpFont/Source/SharpFontShared/RasterFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/RasterFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/RasterFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/RasterFlags.cs diff --git a/SharpFont/Source/SharpFontShared/RasterFuncs.cs b/Libraries/SharpFont/Source/SharpFontShared/RasterFuncs.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/RasterFuncs.cs rename to Libraries/SharpFont/Source/SharpFontShared/RasterFuncs.cs diff --git a/SharpFont/Source/SharpFontShared/RasterParams.cs b/Libraries/SharpFont/Source/SharpFontShared/RasterParams.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/RasterParams.cs rename to Libraries/SharpFont/Source/SharpFontShared/RasterParams.cs diff --git a/SharpFont/Source/SharpFontShared/RenderMode.cs b/Libraries/SharpFont/Source/SharpFontShared/RenderMode.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/RenderMode.cs rename to Libraries/SharpFont/Source/SharpFontShared/RenderMode.cs diff --git a/SharpFont/Source/SharpFontShared/Renderer.cs b/Libraries/SharpFont/Source/SharpFontShared/Renderer.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Renderer.cs rename to Libraries/SharpFont/Source/SharpFontShared/Renderer.cs diff --git a/SharpFont/Source/SharpFontShared/RendererClass.cs b/Libraries/SharpFont/Source/SharpFontShared/RendererClass.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/RendererClass.cs rename to Libraries/SharpFont/Source/SharpFontShared/RendererClass.cs diff --git a/SharpFont/Source/SharpFontShared/Settings.StyleCop b/Libraries/SharpFont/Source/SharpFontShared/Settings.StyleCop similarity index 100% rename from SharpFont/Source/SharpFontShared/Settings.StyleCop rename to Libraries/SharpFont/Source/SharpFontShared/Settings.StyleCop diff --git a/SharpFont/Source/SharpFontShared/SharpFontShared.projitems b/Libraries/SharpFont/Source/SharpFontShared/SharpFontShared.projitems similarity index 100% rename from SharpFont/Source/SharpFontShared/SharpFontShared.projitems rename to Libraries/SharpFont/Source/SharpFontShared/SharpFontShared.projitems diff --git a/SharpFont/Source/SharpFontShared/SharpFontShared.shproj b/Libraries/SharpFont/Source/SharpFontShared/SharpFontShared.shproj similarity index 100% rename from SharpFont/Source/SharpFontShared/SharpFontShared.shproj rename to Libraries/SharpFont/Source/SharpFontShared/SharpFontShared.shproj diff --git a/SharpFont/Source/SharpFontShared/SizeMetrics.cs b/Libraries/SharpFont/Source/SharpFontShared/SizeMetrics.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/SizeMetrics.cs rename to Libraries/SharpFont/Source/SharpFontShared/SizeMetrics.cs diff --git a/SharpFont/Source/SharpFontShared/SizeRequest.cs b/Libraries/SharpFont/Source/SharpFontShared/SizeRequest.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/SizeRequest.cs rename to Libraries/SharpFont/Source/SharpFontShared/SizeRequest.cs diff --git a/SharpFont/Source/SharpFontShared/SizeRequestType.cs b/Libraries/SharpFont/Source/SharpFontShared/SizeRequestType.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/SizeRequestType.cs rename to Libraries/SharpFont/Source/SharpFontShared/SizeRequestType.cs diff --git a/SharpFont/Source/SharpFontShared/Span.cs b/Libraries/SharpFont/Source/SharpFontShared/Span.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Span.cs rename to Libraries/SharpFont/Source/SharpFontShared/Span.cs diff --git a/SharpFont/Source/SharpFontShared/StreamDesc.cs b/Libraries/SharpFont/Source/SharpFontShared/StreamDesc.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/StreamDesc.cs rename to Libraries/SharpFont/Source/SharpFontShared/StreamDesc.cs diff --git a/SharpFont/Source/SharpFontShared/Stroker.cs b/Libraries/SharpFont/Source/SharpFontShared/Stroker.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/Stroker.cs rename to Libraries/SharpFont/Source/SharpFontShared/Stroker.cs diff --git a/SharpFont/Source/SharpFontShared/StrokerBorder.cs b/Libraries/SharpFont/Source/SharpFontShared/StrokerBorder.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/StrokerBorder.cs rename to Libraries/SharpFont/Source/SharpFontShared/StrokerBorder.cs diff --git a/SharpFont/Source/SharpFontShared/StrokerLineCap.cs b/Libraries/SharpFont/Source/SharpFontShared/StrokerLineCap.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/StrokerLineCap.cs rename to Libraries/SharpFont/Source/SharpFontShared/StrokerLineCap.cs diff --git a/SharpFont/Source/SharpFontShared/StrokerLineJoin.cs b/Libraries/SharpFont/Source/SharpFontShared/StrokerLineJoin.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/StrokerLineJoin.cs rename to Libraries/SharpFont/Source/SharpFontShared/StrokerLineJoin.cs diff --git a/SharpFont/Source/SharpFontShared/StyleFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/StyleFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/StyleFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/StyleFlags.cs diff --git a/SharpFont/Source/SharpFontShared/SubGlyph.cs b/Libraries/SharpFont/Source/SharpFontShared/SubGlyph.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/SubGlyph.cs rename to Libraries/SharpFont/Source/SharpFontShared/SubGlyph.cs diff --git a/SharpFont/Source/SharpFontShared/SubGlyphFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/SubGlyphFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/SubGlyphFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/SubGlyphFlags.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/EncodingId.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/EncodingId.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/EncodingId.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/EncodingId.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/EngineType.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/EngineType.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/EngineType.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/EngineType.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Header.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Header.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Header.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Header.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/HoriHeader.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/HoriHeader.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/HoriHeader.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/HoriHeader.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Internal/HeaderRec.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/HeaderRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Internal/HeaderRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/HeaderRec.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Internal/HoriHeaderRec.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/HoriHeaderRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Internal/HoriHeaderRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/HoriHeaderRec.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Internal/MaxProfileRec.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/MaxProfileRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Internal/MaxProfileRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/MaxProfileRec.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Internal/OS2Rec.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/OS2Rec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Internal/OS2Rec.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/OS2Rec.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Internal/PCLTRec.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/PCLTRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Internal/PCLTRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/PCLTRec.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Internal/PostscriptRec.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/PostscriptRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Internal/PostscriptRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/PostscriptRec.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Internal/SfntNameRec.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/SfntNameRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Internal/SfntNameRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/SfntNameRec.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Internal/VertHeaderRec.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/VertHeaderRec.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Internal/VertHeaderRec.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Internal/VertHeaderRec.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/MaxProfile.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/MaxProfile.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/MaxProfile.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/MaxProfile.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/OS2.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/OS2.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/OS2.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/OS2.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Pclt.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Pclt.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Pclt.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Pclt.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/PlatformId.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/PlatformId.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/PlatformId.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/PlatformId.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/Postscript.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/Postscript.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/Postscript.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/Postscript.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/SfntName.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/SfntName.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/SfntName.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/SfntName.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/SfntTag.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/SfntTag.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/SfntTag.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/SfntTag.cs diff --git a/SharpFont/Source/SharpFontShared/TrueType/VertHeader.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueType/VertHeader.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueType/VertHeader.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueType/VertHeader.cs diff --git a/SharpFont/Source/SharpFontShared/TrueTypeValidationFlags.cs b/Libraries/SharpFont/Source/SharpFontShared/TrueTypeValidationFlags.cs similarity index 100% rename from SharpFont/Source/SharpFontShared/TrueTypeValidationFlags.cs rename to Libraries/SharpFont/Source/SharpFontShared/TrueTypeValidationFlags.cs diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 000000000..0a318d8c6 --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/packages/NVorbis.0.8.5.0/LICENSE b/packages/NVorbis.0.8.5.0/LICENSE deleted file mode 100644 index bd12e52a0..000000000 --- a/packages/NVorbis.0.8.5.0/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2015 Andrew Ward, Ms-PL - -Microsoft Public License (Ms-PL) - -This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - -Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. -A "contribution" is the original software, or any additions or changes to the software. -A "contributor" is any person that distributes its contribution under this license. -"Licensed patents" are a contributor's patent claims that read directly on its contribution. -Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. -Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. diff --git a/packages/NVorbis.0.8.5.0/NVorbis.0.8.5.0.nupkg b/packages/NVorbis.0.8.5.0/NVorbis.0.8.5.0.nupkg deleted file mode 100644 index a6208fde2..000000000 Binary files a/packages/NVorbis.0.8.5.0/NVorbis.0.8.5.0.nupkg and /dev/null differ diff --git a/packages/NVorbis.0.8.5.0/NVorbis.0.8.5.0.nuspec b/packages/NVorbis.0.8.5.0/NVorbis.0.8.5.0.nuspec deleted file mode 100644 index 61a783b73..000000000 --- a/packages/NVorbis.0.8.5.0/NVorbis.0.8.5.0.nuspec +++ /dev/null @@ -1,21 +0,0 @@ - - - - NVorbis - 0.8.5.0 - NVorbis - Andrew Ward - Andrew Ward - http://nvorbis.codeplex.com/license - http://nvorbis.codeplex.com/ - false - A fully managed implementation of a Xiph.org Foundation Ogg Vorbis decoder. - A managed Xiph.org Foundation Ogg Vorbis decoder - - BugFix: Fix occasional crashes streaming tracks on multiple threads - en-US - ogg vorbis xiph audio c# sound .NET - - - - - \ No newline at end of file diff --git a/packages/NVorbis.0.8.5.0/README b/packages/NVorbis.0.8.5.0/README deleted file mode 100644 index 6d37a3395..000000000 --- a/packages/NVorbis.0.8.5.0/README +++ /dev/null @@ -1,123 +0,0 @@ -NVorbis -------- - -NVorbis is a .Net library for decoding Xiph.org Vorbis files. It is designed to run in -partial trust environments and does not require P/Invoke or unsafe code. - -This implementation is based on the Vorbis specification found on xiph.org. The MDCT -and Huffman codeword generator were borrowed from public domain implementations in -https://github.com/nothings/stb/blob/master/stb_vorbis.c. - -Currently the only container supported is Xiph.org Ogg. Ogg Skeleton and Matroska / WebM -are planned (no ETA, though). RTP support is possible, but not planned. - -To use: - -- Create an instance of NVorbis.VorbisReader (pass the Ogg Vorbis filename in) -- Use these properties to gather data about the logical stream: - - Channels - - SampleRate - - TotalTime - A TimeSpan indicating the total length of the audio data - - DecodedTime - A TimeSpan indicating the last returned sample's timestamp - - NominalBitrate, UpperBitrate, and LowerBitrate - - These are the encoder's reported bitrates - - Vendor - The encoder's vendor string - - Comments - An array of comments in the file (usually tags) -- Call "int ReadSamples(float[], int, int)" to retrieve the next batch of - samples. It will return 0 when the logical Vorbis stream is done. - - -- For NAudio support: - - Reference NVorbis.NAudioSupport.dll - - Create an instance of NVorbis.NAudioSupport.VorbisWaveReader - - VorbisWaveReader implements NAudio.Wave.WaveStream. - -History -------- -0.1 - 08/03/2012 - * Initial Release -0.2 - 08/07/2012 - * Swapped out LGPL code for public domain implementations - * Relicensed under Ms-PL - * Added NAudio support project - * Added test files & app - * Performance improvements -0.3 - 08/08/2012 - * Fixed Page / Packet decode (packets overlapping 2 pages) - * Fixed "no energy" packet handling - * Fixed packet reader not merging when unsolicited packets are added - * Added .gitignore - * Added initial multi-stream support - * Added statistics (see VorbisReader.Stats) -0.4 - 08/14/2012 - * Refactoring to clean up code and make room for later improvements - * Changed lapping algorithm to be simpler - * Switched to higher-performance clipping algorithm - * Some cleanup -0.4.1 - 09/11/2012 - * Fixed a couple Ogg container bugs - * Optimized memory allocations for better performance / memory usage -0.5 - 09/20/2012 - * Added seeking support - * Changed OggPacketReader to use a doubly-linked list for the packet queue / history - * Changed OggPacketReader.GetTotalPageCount() to count pages directly instead of making .AddPacket(...) keep a list - * Fixed a few bugs (mostly race conditions in multi-threaded playback scenarios) - * Added multi-stream support to VorbisWaveReader - * Added several info properties to VorbisWaveReader -0.5.5 - 11/15/2012 - * Added OpenTK support - * Added makefiles for Mono - * Added constructor to NAudioSupport for already opened Stream instances - * Made Ogg container logic thread-safe - * Cleanup & Optimization -0.6.0 - 06/27/2013 - * Remove ACache from project - * Make clipping optional (default: on) - * Set clipping to clamp at +/-.99999994 instead of +/-1 as a courtesy to those not outputing float samples - * Performance improvements for RingBuffer - * Performance improvements in ThreadSafeStream -0.7.0 - 07/15/2013 - * Rewrite Ogg Reader buffering logic to vastly improve memory usage - * Reorganize to more easily support other container types / work with other Ogg stream decoders - * Exposed Ogg reading types - * Performance improvements - * Bugfix: Don't throw on Vorbis streams that only have a single mode -0.7.1 - 07/18/2013 - * Removed use of generics & lambda from Huffman decoder - * Reduced computation by only processing samples that are required for output - * Bugfix: Seeking now works again - * Bugfix: OpenTKSupport.OggStream now only queues as many source buffers as it filled -0.7.2 - 07/22/2013 - * Bugfix: Floor 0 implementation is now correct - * Bugfix: Residue 0 & 1 implementation is now correct - * Bugfix: Seeking back less than the current buffer size no longer corrupts the read buffer -0.7.3 - 08/02/2013 - * Bugfix: Fix residue 1 -0.7.4 - 09/16/2013 - * Bugfix: Some stereo files with sound on only one channel decoded noise on the silent channel. -0.8.0test1 - 09/16/2013 - * Rebuilt container reading infrastructure so it is properly decoupled from the decoder - * Added unit tests for the packet reader, Ogg container reader -0.8.0 - 01/16/2014 - * Minor bugfixing to test1 - * Replaces 0.7.4 as recommended release -0.8.1 - 02/24/2014 - * Bugfix: Threading issues in Ogg reader - * Rewrite StreamReadBuffer (again) for simplicity and correctness - * Add "saved buffer" concept to StreamReadBuffer for multi-threaded performance - * Reduce Ogg reader memory usage - * Add locking for multi-threading support in Ogg reader - * Remove exception-based logic where possible for better performance -0.8.2 - 03/19/2014 - * BugFix: Don't try to copy StreamReadBuffer data when offset is bigger than source - * Add parameter change event to packet provider interface - * Refactored decoder setup so parameter change can be handled - * Rewrote packet peek / get logic for simplicity - * Refactored locking in OggPacketReader / OggContainerReader - * Improved Ogg end of stream handling - * Changed container seek API to use packets instead of indexes to reduce linked list traversals -0.8.3 - 04/29/2014 - * BugFix: Don't set the end of stream flag until the last packet of the page -0.8.4 - 11/20/2014 - * BugFix: Forward seeking when target page ends with partial packet should ignore partial packet - * Changed MDCT to be thread-safe diff --git a/packages/NVorbis.0.8.5.0/lib/NVorbis.XML b/packages/NVorbis.0.8.5.0/lib/NVorbis.XML deleted file mode 100644 index 8d4248df0..000000000 --- a/packages/NVorbis.0.8.5.0/lib/NVorbis.XML +++ /dev/null @@ -1,672 +0,0 @@ - - - - NVorbis - - - - - A thread-safe, read-only, buffering stream wrapper. - - - - - Provides a interface for a Vorbis logical stream container. - - - - - Gets the list of stream serials found in the container so far. - - - - - Gets whether the container supports seeking. - - - - - Gets the number of bits in the container that are not associated with a logical stream. - - - - - Gets the number of pages that have been read in the container. - - - - - Event raised when a new logical stream is found in the container. - - - - - Initializes the container and finds the first stream. - - True if a valid logical stream is found, otherwise False. - - - - Finds the next new stream in the container. - - True if a new stream was found, otherwise False. - is False. - - - - Retrieves the total number of pages in the container. - - The total number of pages. - is False. - - - - Provides packets on-demand for the Vorbis stream decoder. - - - - - Gets the serial number associated with this stream. - - - - - Gets whether seeking is supported on this stream. - - - - - Gets the number of bits of overhead in this stream's container. - - - - - Retrieves the total number of pages (or frames) this stream uses. - - The page count. - is False. - - - - Retrieves the next packet in the stream. - - The next packet in the stream or null if no more packets. - - - - Retrieves the next packet in the stream but does not advance to the following packet. - - The next packet in the stream or null if no more packets. - - - - Retrieves the packet specified from the stream. - - The index of the packet to retrieve. - The specified packet. - is less than 0 or past the end of the stream. - is False. - - - - Retrieves the total number of granules in this Vorbis stream. - - The number of samples - is False. - - - - Finds the packet index to the granule position specified in the current stream. - - The granule position to seek to. - A callback method that takes the current and previous packets and returns the number of granules in the current packet. - The index of the packet that includes the specified granule position or -1 if none found. - is less than 0 or is after the last granule. - - - - Sets the next packet to be returned, applying a pre-roll as necessary. - - The packet to key from. - The number of packets to return before the indicated packet. - - - - Occurs when the stream is about to change parameters. - - - - - Event data for when a new logical stream is found in a container. - - - - - Creates a new instance of with the specified . - - An instance. - - - - Gets new the instance. - - - - - Gets or sets whether to ignore the logical stream associated with the packet provider. - - - - - Provides an implementation for basic Ogg files. - - - - - Gets the list of stream serials found in the container so far. - - - - - Event raised when a new logical stream is found in the container. - - - - - Creates a new instance with the specified file. - - The full path to the file. - - - - Creates a new instance with the specified stream. Optionally sets to close the stream when disposed. - - The stream to read. - True to close the stream when is called, otherwise False. - - - - Initializes the container and finds the first stream. - - True if a valid logical stream is found, otherwise False. - - - - Disposes this instance. - - - - - Gets the instance for the specified stream serial. - - The stream serial to look for. - An instance. - The specified stream serial was not found. - - - - Finds the next new stream in the container. - - True if a new stream was found, otherwise False. - is False. - - - - Gets the number of pages that have been read in the container. - - - - - Retrieves the total number of pages in the container. - - The total number of pages. - is False. - - - - Gets whether the container supports seeking. - - - - - Gets the number of bits in the container that are not associated with a logical stream. - - - - - A single data packet from a logical Vorbis stream. - - - - - Defines flags to apply to the current packet - - - - - Packet is first since reader had to resync with stream. - - - - - Packet is the last in the logical stream. - - - - - Packet does not have all its data available. - - - - - Packet has a granule count defined. - - - - - Flag for use by inheritors. - - - - - Flag for use by inheritors. - - - - - Flag for use by inheritors. - - - - - Flag for use by inheritors. - - - - - Gets the value of the specified flag. - - - - - Sets the value of the specified flag. - - - - - Creates a new instance with the specified length. - - The length of the packet. - - - - Reads the next byte of the packet. - - The next byte if available, otherwise -1. - - - - Indicates that the packet has been read and its data is no longer needed. - - - - - Attempts to read the specified number of bits from the packet, but may return fewer. Does not advance the position counter. - - The number of bits to attempt to read. - The number of bits actually read. - The value of the bits read. - is not between 0 and 64. - - - - Advances the position counter by the specified number of bits. - - The number of bits to advance. - - - - Resets the bit reader. - - - - - Gets whether the packet was found after a stream resync. - - - - - Gets the position of the last granule in the packet. - - - - - Gets the position of the last granule in the page the packet is in. - - - - - Gets the length of the packet. - - - - - Gets whether the packet is the last one in the logical stream. - - - - - Gets the number of bits read from the packet. - - - - - Gets the number of granules in the packet. If null, the packet has not been decoded yet. - - - - - Reads the specified number of bits from the packet and advances the position counter. - - The number of bits to read. - The value of the bits read. - The number of bits specified is not between 0 and 64. - - - - Reads the next byte from the packet. Does not advance the position counter. - - The byte read from the packet. - - - - Reads the next byte from the packet and advances the position counter. - - The byte read from the packet. - - - - Reads the specified number of bytes from the packet and advances the position counter. - - The number of bytes to read. - A byte array holding the data read. - - - - Reads the specified number of bytes from the packet into the buffer specified and advances the position counter. - - The buffer to read into. - The index into the buffer to start placing the read data. - The number of bytes to read. - The number of bytes read. - is less than 0 or + is past the end of . - - - - Reads the next bit from the packet and advances the position counter. - - The value of the bit read. - - - - Retrieves the next 16 bits from the packet as a and advances the position counter. - - The value of the next 16 bits. - - - - Retrieves the next 32 bits from the packet as a and advances the position counter. - - The value of the next 32 bits. - - - - Retrieves the next 64 bits from the packet as a and advances the position counter. - - The value of the next 64 bits. - - - - Retrieves the next 16 bits from the packet as a and advances the position counter. - - The value of the next 16 bits. - - - - Retrieves the next 32 bits from the packet as a and advances the position counter. - - The value of the next 32 bits. - - - - Retrieves the next 64 bits from the packet as a and advances the position counter. - - The value of the next 64 bits. - - - - Advances the position counter by the specified number of bytes. - - The number of bytes to advance. - - - - Event data for when a logical stream has a parameter change. - - - - - Creates a new instance of . - - The first packet after the parameter change. - - - - Gets the first packet after the parameter change. This would typically be the parameters packet. - - - - - Gets or Sets whether to limit reads to the smallest size possible. - - - - - Gets or Sets the maximum size of the buffer. This is not a hard limit. - - - - - Gets the offset of the start of the buffered data. Reads to offsets before this are likely to require a seek. - - - - - Gets the number of bytes currently buffered. - - - - - Gets the number of bytes the buffer can hold. - - - - - Reads the number of bytes specified into the buffer given, starting with the offset indicated. - - The offset into the stream to start reading. - The buffer to read to. - The index into the buffer to start writing to. - The number of bytes to read. - The number of bytes read. - - - - Tells the buffer that it no longer needs to maintain any bytes before the indicated offset. - - The offset to discard through. - - - - Gets the number of channels in the current selected Vorbis stream - - - - - Gets the sample rate of the current selected Vorbis stream - - - - - Gets the encoder's upper bitrate of the current selected Vorbis stream - - - - - Gets the encoder's nominal bitrate of the current selected Vorbis stream - - - - - Gets the encoder's lower bitrate of the current selected Vorbis stream - - - - - Gets the encoder's vendor string for the current selected Vorbis stream - - - - - Gets the comments in the current selected Vorbis stream - - - - - Gets whether the previous short sample count was due to a parameter change in the stream. - - - - - Gets the number of bits read that are related to framing and transport alone - - - - - Gets or sets whether to automatically apply clipping to samples returned by . - - - - - Gets stats from each decoder stream available - - - - - Gets the currently-selected stream's index - - - - - Reads decoded samples from the current logical stream - - The buffer to write the samples to - The offset into the buffer to write the samples to - The number of samples to write - The number of samples written - - - - Clears the parameter change flag so further samples can be requested. - - - - - Returns the number of logical streams found so far in the physical container - - - - - Searches for the next stream in a concatenated file - - True if a new stream was found, otherwise false. - - - - Switches to an alternate logical stream. - - The logical stream index to switch to - True if the properties of the logical stream differ from those of the one previously being decoded. Otherwise, False. - - - - Gets or Sets the current timestamp of the decoder. Is the timestamp before the next sample to be decoded - - - - - Gets or Sets the current position of the next sample to be decoded. - - - - - Gets the total length of the current logical stream - - - - - Gets the counters for latency and bitrate calculations, as well as overall bit counts - - - - - Gets the calculated bit rate of audio stream data for the everything decoded so far - - - - - Gets the calculated bit rate for the last ~1 second of audio - - - - - Gets the calculated latency per page - - - - - Gets the calculated latency per packet - - - - - Gets the calculated latency per second of output - - - - - Gets the number of bits read that do not contribute to the output audio - - - - - Gets the number of bits read that contribute to the output audio - - - - - Gets the number of pages read so far in the current stream - - - - - Gets the total number of pages in the current stream - - - - - Gets whether the stream has been clipped since the last reset - - - - diff --git a/packages/NVorbis.0.8.5.0/lib/NVorbis.dll b/packages/NVorbis.0.8.5.0/lib/NVorbis.dll deleted file mode 100644 index 979cd8122..000000000 Binary files a/packages/NVorbis.0.8.5.0/lib/NVorbis.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/RestSharp.105.1.0.nupkg b/packages/RestSharp.105.1.0/RestSharp.105.1.0.nupkg deleted file mode 100644 index 104ae821e..000000000 Binary files a/packages/RestSharp.105.1.0/RestSharp.105.1.0.nupkg and /dev/null differ diff --git a/packages/RestSharp.105.1.0/RestSharp.105.1.0.nuspec b/packages/RestSharp.105.1.0/RestSharp.105.1.0.nuspec deleted file mode 100644 index 3125c0f64..000000000 --- a/packages/RestSharp.105.1.0/RestSharp.105.1.0.nuspec +++ /dev/null @@ -1,17 +0,0 @@ - - - - RestSharp - 105.1.0 - John Sheehan, RestSharp Community - John Sheehan, RestSharp Community - https://github.com/restsharp/RestSharp/blob/master/LICENSE.txt - http://restsharp.org/ - http://dl.dropbox.com/u/1827/restsharp100.png - false - Simple REST and HTTP API Client - For full release notes see https://github.com/restsharp/RestSharp/blob/master/releasenotes.markdown - en-US - REST HTTP API JSON XML - - \ No newline at end of file diff --git a/packages/RestSharp.105.1.0/lib/net35-client/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net35-client/RestSharp.dll deleted file mode 100644 index 4c2ab856f..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net35-client/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net35-client/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net35-client/RestSharp.xml deleted file mode 100644 index e3ab26a9f..000000000 --- a/packages/RestSharp.105.1.0/lib/net35-client/RestSharp.xml +++ /dev/null @@ -1,2777 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - HttpWebRequest wrapper (sync methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (async methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - diff --git a/packages/RestSharp.105.1.0/lib/net35/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net35/RestSharp.dll deleted file mode 100644 index 4c2ab856f..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net35/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net35/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net35/RestSharp.xml deleted file mode 100644 index e3ab26a9f..000000000 --- a/packages/RestSharp.105.1.0/lib/net35/RestSharp.xml +++ /dev/null @@ -1,2777 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - HttpWebRequest wrapper (sync methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (async methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - diff --git a/packages/RestSharp.105.1.0/lib/net4-client/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net4-client/RestSharp.dll deleted file mode 100644 index a7331ed6e..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net4-client/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net4-client/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net4-client/RestSharp.xml deleted file mode 100644 index 1820325a0..000000000 --- a/packages/RestSharp.105.1.0/lib/net4-client/RestSharp.xml +++ /dev/null @@ -1,3014 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.1.0/lib/net4/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net4/RestSharp.dll deleted file mode 100644 index a7331ed6e..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net4/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net4/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net4/RestSharp.xml deleted file mode 100644 index 1820325a0..000000000 --- a/packages/RestSharp.105.1.0/lib/net4/RestSharp.xml +++ /dev/null @@ -1,3014 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.1.0/lib/net45-client/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net45-client/RestSharp.dll deleted file mode 100644 index 59d82f941..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net45-client/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net45-client/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net45-client/RestSharp.xml deleted file mode 100644 index 1820325a0..000000000 --- a/packages/RestSharp.105.1.0/lib/net45-client/RestSharp.xml +++ /dev/null @@ -1,3014 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.1.0/lib/net45/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net45/RestSharp.dll deleted file mode 100644 index 59d82f941..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net45/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net45/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net45/RestSharp.xml deleted file mode 100644 index 1820325a0..000000000 --- a/packages/RestSharp.105.1.0/lib/net45/RestSharp.xml +++ /dev/null @@ -1,3014 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.1.0/lib/net451-client/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net451-client/RestSharp.dll deleted file mode 100644 index 19bd72b38..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net451-client/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net451-client/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net451-client/RestSharp.xml deleted file mode 100644 index 1820325a0..000000000 --- a/packages/RestSharp.105.1.0/lib/net451-client/RestSharp.xml +++ /dev/null @@ -1,3014 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.1.0/lib/net451/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net451/RestSharp.dll deleted file mode 100644 index 19bd72b38..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net451/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net451/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net451/RestSharp.xml deleted file mode 100644 index 1820325a0..000000000 --- a/packages/RestSharp.105.1.0/lib/net451/RestSharp.xml +++ /dev/null @@ -1,3014 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.1.0/lib/net452-client/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net452-client/RestSharp.dll deleted file mode 100644 index f1e3745f8..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net452-client/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net452-client/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net452-client/RestSharp.xml deleted file mode 100644 index 1820325a0..000000000 --- a/packages/RestSharp.105.1.0/lib/net452-client/RestSharp.xml +++ /dev/null @@ -1,3014 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.1.0/lib/net452/RestSharp.dll b/packages/RestSharp.105.1.0/lib/net452/RestSharp.dll deleted file mode 100644 index f1e3745f8..000000000 Binary files a/packages/RestSharp.105.1.0/lib/net452/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/net452/RestSharp.xml b/packages/RestSharp.105.1.0/lib/net452/RestSharp.xml deleted file mode 100644 index 1820325a0..000000000 --- a/packages/RestSharp.105.1.0/lib/net452/RestSharp.xml +++ /dev/null @@ -1,3014 +0,0 @@ - - - - RestSharp - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.1.0/lib/sl4/RestSharp.Silverlight.dll b/packages/RestSharp.105.1.0/lib/sl4/RestSharp.Silverlight.dll deleted file mode 100644 index ddf6bac38..000000000 Binary files a/packages/RestSharp.105.1.0/lib/sl4/RestSharp.Silverlight.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/sl4/RestSharp.Silverlight.xml b/packages/RestSharp.105.1.0/lib/sl4/RestSharp.Silverlight.xml deleted file mode 100644 index 5a6f90356..000000000 --- a/packages/RestSharp.105.1.0/lib/sl4/RestSharp.Silverlight.xml +++ /dev/null @@ -1,2588 +0,0 @@ - - - - RestSharp.Silverlight - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - diff --git a/packages/RestSharp.105.1.0/lib/windowsphone8/RestSharp.WindowsPhone.dll b/packages/RestSharp.105.1.0/lib/windowsphone8/RestSharp.WindowsPhone.dll deleted file mode 100644 index 9e258a385..000000000 Binary files a/packages/RestSharp.105.1.0/lib/windowsphone8/RestSharp.WindowsPhone.dll and /dev/null differ diff --git a/packages/RestSharp.105.1.0/lib/windowsphone8/RestSharp.WindowsPhone.xml b/packages/RestSharp.105.1.0/lib/windowsphone8/RestSharp.WindowsPhone.xml deleted file mode 100644 index 0fb7f9840..000000000 --- a/packages/RestSharp.105.1.0/lib/windowsphone8/RestSharp.WindowsPhone.xml +++ /dev/null @@ -1,3821 +0,0 @@ - - - - RestSharp.WindowsPhone - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Calculates a 32bit Cyclic Redundancy Checksum (CRC) using the same polynomial - used by Zip. This type is used internally by DotNetZip; it is generally not used - directly by applications wishing to create, read, or manipulate zip archive - files. - - - - - Returns the CRC32 for the specified stream. - - The stream over which to calculate the CRC32 - the CRC32 calculation - - - - Returns the CRC32 for the specified stream, and writes the input into the - output stream. - - The stream over which to calculate the CRC32 - The stream into which to deflate the input - the CRC32 calculation - - - - Get the CRC32 for the given (word,byte) combo. This is a computation - defined by PKzip. - - The word to start with. - The byte to combine it with. - The CRC-ized result. - - - - Update the value for the running CRC32 using the given block of bytes. - This is useful when using the CRC32() class in a Stream. - - block of bytes to slurp - starting point in the block - how many bytes within the block to slurp - - - - indicates the total number of bytes read on the CRC stream. - This is used when writing the ZipDirEntry when compressing files. - - - - - Indicates the current CRC for all blocks slurped in. - - - - - A Stream that calculates a CRC32 (a checksum) on all bytes read, - or on all bytes written. - - - - - This class can be used to verify the CRC of a ZipEntry when - reading from a stream, or to calculate a CRC when writing to a - stream. The stream should be used to either read, or write, but - not both. If you intermix reads and writes, the results are not - defined. - - - - This class is intended primarily for use internally by the - DotNetZip library. - - - - - - The default constructor. - - - Instances returned from this constructor will leave the underlying stream - open upon Close(). - - The underlying stream - - - - The constructor allows the caller to specify how to handle the underlying - stream at close. - - The underlying stream - true to leave the underlying stream - open upon close of the CrcCalculatorStream.; false otherwise. - - - - A constructor allowing the specification of the length of the stream to read. - - - Instances returned from this constructor will leave the underlying stream open - upon Close(). - - The underlying stream - The length of the stream to slurp - - - - A constructor allowing the specification of the length of the stream to - read, as well as whether to keep the underlying stream open upon Close(). - - The underlying stream - The length of the stream to slurp - true to leave the underlying stream - open upon close of the CrcCalculatorStream.; false otherwise. - - - - Read from the stream - - the buffer to read - the offset at which to start - the number of bytes to read - the number of bytes actually read - - - - Write to the stream. - - the buffer from which to write - the offset at which to start writing - the number of bytes to write - - - - Flush the stream. - - - - - Not implemented. - - N/A - N/A - N/A - - - - Not implemented. - - N/A - - - - Closes the stream. - - - - - Gets the total number of bytes run through the CRC32 calculator. - - - - This is either the total number of bytes read, or the total number of bytes - written, depending on the direction of this stream. - - - - - Provides the current CRC for all blocks slurped in. - - - - - Indicates whether the underlying stream will be left open when the - CrcCalculatorStream is Closed. - - - - - Indicates whether the stream supports reading. - - - - - Indicates whether the stream supports seeking. - - - - - Indicates whether the stream supports writing. - - - - - Not implemented. - - - - - Not implemented. - - - - - Describes how to flush the current deflate operation. - - - The different FlushType values are useful when using a Deflate in a streaming application. - - - - No flush at all. - - - Closes the current block, but doesn't flush it to - the output. Used internally only in hypothetical - scenarios. This was supposed to be removed by Zlib, but it is - still in use in some edge cases. - - - - - Use this during compression to specify that all pending output should be - flushed to the output buffer and the output should be aligned on a byte - boundary. You might use this in a streaming communication scenario, so that - the decompressor can get all input data available so far. When using this - with a ZlibCodec, AvailableBytesIn will be zero after the call if - enough output space has been provided before the call. Flushing will - degrade compression and so it should be used only when necessary. - - - - - Use this during compression to specify that all output should be flushed, as - with FlushType.Sync, but also, the compression state should be reset - so that decompression can restart from this point if previous compressed - data has been damaged or if random access is desired. Using - FlushType.Full too often can significantly degrade the compression. - - - - Signals the end of the compression/decompression stream. - - - - A class for compressing and decompressing GZIP streams. - - - - - The GZipStream is a Decorator on a . It adds GZIP compression or decompression to any stream. - - - Like the Compression.GZipStream in the .NET Base - Class Library, the Ionic.Zlib.GZipStream can compress while writing, or decompress - while reading, but not vice versa. The compression method used is GZIP, which is - documented in IETF RFC 1952, - "GZIP file format specification version 4.3". - - A GZipStream can be used to decompress data (through Read()) or to compress - data (through Write()), but not both. - - If you wish to use the GZipStream to compress data, you must wrap it around a - write-able stream. As you call Write() on the GZipStream, the data will be - compressed into the GZIP format. If you want to decompress data, you must wrap the - GZipStream around a readable stream that contains an IETF RFC 1952-compliant stream. - The data will be decompressed as you call Read() on the GZipStream. - - Though the GZIP format allows data from multiple files to be concatenated - together, this stream handles only a single segment of GZIP format, typically - representing a single file. - - - This class is similar to and . - ZlibStream handles RFC1950-compliant streams. - handles RFC1951-compliant streams. This class handles RFC1952-compliant streams. - - - - - - - - - - The last modified time for the GZIP stream. - - - GZIP allows the storage of a last modified time with each GZIP entry. - When compressing data, you can set this before the first call to Write(). When - decompressing, you can retrieve this value any time after the first call to - Read(). - - - - Create a GZipStream using the specified CompressionMode and the specified CompressionLevel, - and explicitly specify whether the stream should be left open after Deflation or Inflation. - - - - This constructor allows the application to request that the captive stream remain open after - the deflation or inflation occurs. By default, after Close() is called on the stream, the - captive stream is also closed. In some cases this is not desired, for example if the stream - is a memory stream that will be re-read after compressed data has been written to it. Specify true for the - leaveOpen parameter to leave the stream open. - - - As noted in the class documentation, - the CompressionMode (Compress or Decompress) also establishes the "direction" of the stream. - A GZipStream with CompressionMode.Compress works only through Write(). A GZipStream with - CompressionMode.Decompress works only through Read(). - - - - This example shows how to use a DeflateStream to compress data. - - using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) - { - using (var raw = System.IO.File.Create(outputFile)) - { - using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true)) - { - byte[] buffer = new byte[WORKING_BUFFER_SIZE]; - int n; - while ((n= input.Read(buffer, 0, buffer.Length)) != 0) - { - compressor.Write(buffer, 0, n); - } - } - } - } - - - Dim outputFile As String = (fileToCompress & ".compressed") - Using input As Stream = File.OpenRead(fileToCompress) - Using raw As FileStream = File.Create(outputFile) - Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True) - Dim buffer As Byte() = New Byte(4096) {} - Dim n As Integer = -1 - Do While (n <> 0) - If (n > 0) Then - compressor.Write(buffer, 0, n) - End If - n = input.Read(buffer, 0, buffer.Length) - Loop - End Using - End Using - End Using - - - The stream which will be read or written. - Indicates whether the GZipStream will compress or decompress. - true if the application would like the stream to remain open after inflation/deflation. - A tuning knob to trade speed for effectiveness. - - - - Dispose the stream. - - - This may or may not result in a Close() call on the captive stream. - See the ctor's with leaveOpen parameters for more information. - - - - - Flush the stream. - - - - - Read and decompress data from the source stream. - - - With a GZipStream, decompression is done through reading. - - - - byte[] working = new byte[WORKING_BUFFER_SIZE]; - using (System.IO.Stream input = System.IO.File.OpenRead(_CompressedFile)) - { - using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true)) - { - using (var output = System.IO.File.Create(_DecompressedFile)) - { - int n; - while ((n= decompressor.Read(working, 0, working.Length)) !=0) - { - output.Write(working, 0, n); - } - } - } - } - - - The buffer into which the decompressed data should be placed. - the offset within that data array to put the first byte read. - the number of bytes to read. - the number of bytes actually read - - - - Calling this method always throws a . - - irrelevant; it will always throw! - irrelevant; it will always throw! - irrelevant! - - - - Calling this method always throws a NotImplementedException. - - irrelevant; this method will always throw! - - - - The Comment on the GZIP stream. - - - - The GZIP format allows for each file to optionally have an associated comment stored with the - file. The comment is encoded with the ISO-8859-1 code page. To include a comment in - a GZIP stream you create, set this property before calling Write() for the first time - on the GZipStream. - - - - When using GZipStream to decompress, you can retrieve this property after the first - call to Read(). If no comment has been set in the GZIP bytestream, the Comment - property will return null (Nothing in VB). - - - - - - The FileName for the GZIP stream. - - - - The GZIP format optionally allows each file to have an associated filename. When - compressing data (through Write()), set this FileName before calling Write() the first - time on the GZipStream. The actual filename is encoded into the GZIP bytestream with - the ISO-8859-1 code page, according to RFC 1952. It is the application's responsibility to - insure that the FileName can be encoded and decoded correctly with this code page. - - - When decompressing (through Read()), you can retrieve this value any time after the - first Read(). In the case where there was no filename encoded into the GZIP - bytestream, the property will return null (Nothing in VB). - - - - - - The CRC on the GZIP stream. - - - This is used for internal error checking. You probably don't need to look at this property. - - - - - This property sets the flush behavior on the stream. - - - - - The size of the working buffer for the compression codec. - - - - - The working buffer is used for all stream operations. The default size is 1024 bytes. - The minimum size is 128 bytes. You may get better performance with a larger buffer. - Then again, you might not. You would have to test it. - - - - Set this before the first call to Read() or Write() on the stream. If you try to set it - afterwards, it will throw. - - - - - Returns the total number of bytes input so far. - - - Returns the total number of bytes output so far. - - - - Indicates whether the stream can be read. - - - The return value depends on whether the captive stream supports reading. - - - - - Indicates whether the stream supports Seek operations. - - - Always returns false. - - - - - Indicates whether the stream can be written. - - - The return value depends on whether the captive stream supports writing. - - - - - Reading this property always throws a NotImplementedException. - - - - - The position of the stream pointer. - - - Writing this property always throws a NotImplementedException. Reading will - return the total bytes written out, if used in writing, or the total bytes - read in, if used in reading. The count may refer to compressed bytes or - uncompressed bytes, depending on how you've used the stream. - - - - - A general purpose exception class for exceptions in the Zlib library. - - - - - The ZlibException class captures exception information generated - by the Zlib library. - - - - - This ctor collects a message attached to the exception. - - - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - Reads a number of characters from the current source TextReader and writes the data to the target array at the specified index. - The source TextReader to read from - Contains the array of characteres read from the source TextReader. - The starting index of the target array. - The maximum number of characters to read from the source TextReader. - The number of characters read. The number will be less than or equal to count depending on the data available in the source TextReader. Returns -1 if the end of the stream is reached. - - - - Computes an Adler-32 checksum. - - - The Adler checksum is similar to a CRC checksum, but faster to compute, though less - reliable. It is used in producing RFC1950 compressed streams. The Adler checksum - is a required part of the "ZLIB" standard. Applications will almost never need to - use this class directly. - - - - - Encoder and Decoder for ZLIB and DEFLATE (IETF RFC1950 and RFC1951). - - - - This class compresses and decompresses data according to the Deflate algorithm - and optionally, the ZLIB format, as documented in RFC 1950 - ZLIB and RFC 1951 - DEFLATE. - - - - - The buffer from which data is taken. - - - - - An index into the InputBuffer array, indicating where to start reading. - - - - - The number of bytes available in the InputBuffer, starting at NextIn. - - - Generally you should set this to InputBuffer.Length before the first Inflate() or Deflate() call. - The class will update this number as calls to Inflate/Deflate are made. - - - - - Total number of bytes read so far, through all calls to Inflate()/Deflate(). - - - - - Buffer to store output data. - - - - - An index into the OutputBuffer array, indicating where to start writing. - - - - - The number of bytes available in the OutputBuffer, starting at NextOut. - - - Generally you should set this to OutputBuffer.Length before the first Inflate() or Deflate() call. - The class will update this number as calls to Inflate/Deflate are made. - - - - - Total number of bytes written to the output so far, through all calls to Inflate()/Deflate(). - - - - - used for diagnostics, when something goes wrong! - - - - - The number of Window Bits to use. - - - This gauges the size of the sliding window, and hence the - compression effectiveness as well as memory consumption. It's best to just leave this - setting alone if you don't know what it is. The maximum value is 15 bits, which implies - a 32k window. - - - - - Create a ZlibCodec that decompresses. - - - - - Initialize the inflation state. - - - It is not necessary to call this before using the ZlibCodec to inflate data; - It is implicitly called when you call the constructor. - - Z_OK if everything goes well. - - - - Initialize the inflation state with an explicit flag to - govern the handling of RFC1950 header bytes. - - - - By default, the ZLIB header defined in RFC 1950 is expected. If - you want to read a zlib stream you should specify true for - expectRfc1950Header. If you have a deflate stream, you will want to specify - false. It is only necessary to invoke this initializer explicitly if you - want to specify false. - - - whether to expect an RFC1950 header byte - pair when reading the stream of data to be inflated. - - Z_OK if everything goes well. - - - - Initialize the ZlibCodec for inflation, with the specified number of window bits. - - The number of window bits to use. If you need to ask what that is, - then you shouldn't be calling this initializer. - Z_OK if all goes well. - - - - Initialize the inflation state with an explicit flag to govern the handling of - RFC1950 header bytes. - - - - If you want to read a zlib stream you should specify true for - expectRfc1950Header. In this case, the library will expect to find a ZLIB - header, as defined in RFC - 1950, in the compressed stream. If you will be reading a DEFLATE or - GZIP stream, which does not have such a header, you will want to specify - false. - - - whether to expect an RFC1950 header byte pair when reading - the stream of data to be inflated. - The number of window bits to use. If you need to ask what that is, - then you shouldn't be calling this initializer. - Z_OK if everything goes well. - - - - Inflate the data in the InputBuffer, placing the result in the OutputBuffer. - - - You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and - AvailableBytesOut before calling this method. - - - - private void InflateBuffer() - { - int bufferSize = 1024; - byte[] buffer = new byte[bufferSize]; - ZlibCodec decompressor = new ZlibCodec(); - - Console.WriteLine("\n============================================"); - Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length); - MemoryStream ms = new MemoryStream(DecompressedBytes); - - int rc = decompressor.InitializeInflate(); - - decompressor.InputBuffer = CompressedBytes; - decompressor.NextIn = 0; - decompressor.AvailableBytesIn = CompressedBytes.Length; - - decompressor.OutputBuffer = buffer; - - // pass 1: inflate - do - { - decompressor.NextOut = 0; - decompressor.AvailableBytesOut = buffer.Length; - rc = decompressor.Inflate(ZlibConstants.Z_NO_FLUSH); - - if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END) - throw new Exception("inflating: " + decompressor.Message); - - ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut); - } - while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); - - // pass 2: finish and flush - do - { - decompressor.NextOut = 0; - decompressor.AvailableBytesOut = buffer.Length; - rc = decompressor.Inflate(ZlibConstants.Z_FINISH); - - if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK) - throw new Exception("inflating: " + decompressor.Message); - - if (buffer.Length - decompressor.AvailableBytesOut > 0) - ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut); - } - while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); - - decompressor.EndInflate(); - } - - - - The flush to use when inflating. - Z_OK if everything goes well. - - - - Ends an inflation session. - - - Call this after successively calling Inflate(). This will cause all buffers to be flushed. - After calling this you cannot call Inflate() without a intervening call to one of the - InitializeInflate() overloads. - - Z_OK if everything goes well. - - - - I don't know what this does! - - Z_OK if everything goes well. - - - - Set the dictionary to be used for either Inflation or Deflation. - - The dictionary bytes to use. - Z_OK if all goes well. - - - - The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this. - - - - - A bunch of constants used in the Zlib interface. - - - - - The maximum number of window bits for the Deflate algorithm. - - - - - The default number of window bits for the Deflate algorithm. - - - - - indicates everything is A-OK - - - - - Indicates that the last operation reached the end of the stream. - - - - - The operation ended in need of a dictionary. - - - - - There was an error with the stream - not enough data, not open and readable, etc. - - - - - There was an error with the data - not enough data, bad data, etc. - - - - - There was an error with the working buffer. - - - - - The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes. - - - - - The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes. - - - - - Represents a Zlib stream for compression or decompression. - - - - - The ZlibStream is a Decorator on a . It adds ZLIB compression or decompression to any - stream. - - - Using this stream, applications can compress or decompress data via - stream Read and Write operations. Either compresssion or - decompression can occur through either reading or writing. The compression - format used is ZLIB, which is documented in IETF RFC 1950, "ZLIB Compressed - Data Format Specification version 3.3". This implementation of ZLIB always uses - DEFLATE as the compression method. (see IETF RFC 1951, "DEFLATE - Compressed Data Format Specification version 1.3.") - - - The ZLIB format allows for varying compression methods, window sizes, and dictionaries. - This implementation always uses the DEFLATE compression method, a preset dictionary, - and 15 window bits by default. - - - - This class is similar to , except that it adds the - RFC1950 header and trailer bytes to a compressed stream when compressing, or expects - the RFC1950 header and trailer bytes when decompressing. It is also similar to the - . - - - - - - - - Dispose the stream. - - - This may or may not result in a Close() call on the captive stream. - See the constructors that have a leaveOpen parameter for more information. - - - - - Flush the stream. - - - - - Read data from the stream. - - - - - - If you wish to use the ZlibStream to compress data while reading, you can create a - ZlibStream with CompressionMode.Compress, providing an uncompressed data stream. Then - call Read() on that ZlibStream, and the data read will be compressed. If you wish to - use the ZlibStream to decompress data while reading, you can create a ZlibStream with - CompressionMode.Decompress, providing a readable compressed data stream. Then call - Read() on that ZlibStream, and the data will be decompressed as it is read. - - - - A ZlibStream can be used for Read() or Write(), but not both. - - - The buffer into which the read data should be placed. - the offset within that data array to put the first byte read. - the number of bytes to read. - - - - Calling this method always throws a NotImplementedException. - - - - - Calling this method always throws a NotImplementedException. - - - - - Write data to the stream. - - - - - - If you wish to use the ZlibStream to compress data while writing, you can create a - ZlibStream with CompressionMode.Compress, and a writable output stream. Then call - Write() on that ZlibStream, providing uncompressed data as input. The data sent to - the output stream will be the compressed form of the data written. If you wish to use - the ZlibStream to decompress data while writing, you can create a ZlibStream with - CompressionMode.Decompress, and a writable output stream. Then call Write() on that - stream, providing previously compressed data. The data sent to the output stream will - be the decompressed form of the data written. - - - - A ZlibStream can be used for Read() or Write(), but not both. - - - The buffer holding data to write to the stream. - the offset within that data array to find the first byte to write. - the number of bytes to write. - - - - Uncompress a byte array into a single string. - - - - A buffer containing ZLIB-compressed data. - - - - - Uncompress a byte array into a byte array. - - - - - A buffer containing ZLIB-compressed data. - - - - - This property sets the flush behavior on the stream. - Sorry, though, not sure exactly how to describe all the various settings. - - - - - The size of the working buffer for the compression codec. - - - - - The working buffer is used for all stream operations. The default size is 1024 bytes. - The minimum size is 128 bytes. You may get better performance with a larger buffer. - Then again, you might not. You would have to test it. - - - - Set this before the first call to Read() or Write() on the stream. If you try to set it - afterwards, it will throw. - - - - - Returns the total number of bytes input so far. - - - Returns the total number of bytes output so far. - - - - Indicates whether the stream can be read. - - - The return value depends on whether the captive stream supports reading. - - - - - Indicates whether the stream supports Seek operations. - - - Always returns false. - - - - - Indicates whether the stream can be written. - - - The return value depends on whether the captive stream supports writing. - - - - - Reading this property always throws a NotImplementedException. - - - - - The position of the stream pointer. - - - Writing this property always throws a NotImplementedException. Reading will - return the total bytes written out, if used in writing, or the total bytes - read in, if used in reading. The count may refer to compressed bytes or - uncompressed bytes, depending on how you've used the stream. - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - diff --git a/packages/RestSharp.105.1.0/readme.txt b/packages/RestSharp.105.1.0/readme.txt deleted file mode 100644 index 44a1b2fe7..000000000 --- a/packages/RestSharp.105.1.0/readme.txt +++ /dev/null @@ -1,22 +0,0 @@ -*** IMPORTANT CHANGE IN RESTSHARP VERSION 103 *** - -In 103.0, JSON.NET was removed as a dependency. - -If this is still installed in your project and no other libraries depend on -it you may remove it from your installed packages. - -There is one breaking change: the default Json*Serializer* is no longer -compatible with Json.NET. To use Json.NET for serialization, copy the code -from https://github.com/restsharp/RestSharp/blob/86b31f9adf049d7fb821de8279154f41a17b36f7/RestSharp/Serializers/JsonSerializer.cs -and register it with your client: - -var client = new RestClient(); -client.JsonSerializer = new YourCustomSerializer(); - -The default Json*Deserializer* is mostly compatible, but it does not support -all features which Json.NET has (like the ability to support a custom [JsonConverter] -by decorating a certain property with an attribute). If you need these features, you -must take care of the deserialization yourself to get it working. - -If you run into any compatibility issues with deserialization, -please report it to http://groups.google.com/group/restsharp diff --git a/packages/RestSharp.105.2.3/RestSharp.105.2.3.nupkg b/packages/RestSharp.105.2.3/RestSharp.105.2.3.nupkg deleted file mode 100644 index af89bdafb..000000000 Binary files a/packages/RestSharp.105.2.3/RestSharp.105.2.3.nupkg and /dev/null differ diff --git a/packages/RestSharp.105.2.3/RestSharp.105.2.3.nuspec b/packages/RestSharp.105.2.3/RestSharp.105.2.3.nuspec deleted file mode 100644 index 312823988..000000000 --- a/packages/RestSharp.105.2.3/RestSharp.105.2.3.nuspec +++ /dev/null @@ -1,17 +0,0 @@ - - - - RestSharp - 105.2.3 - John Sheehan, RestSharp Community - John Sheehan, RestSharp Community - https://github.com/restsharp/RestSharp/blob/master/LICENSE.txt - http://restsharp.org/ - http://dl.dropbox.com/u/1827/restsharp100.png - false - Simple REST and HTTP API Client - For full release notes see https://github.com/restsharp/RestSharp/blob/master/releasenotes.markdown - en-US - REST HTTP API JSON XML - - \ No newline at end of file diff --git a/packages/RestSharp.105.2.3/lib/MonoAndroid10/RestSharp.dll b/packages/RestSharp.105.2.3/lib/MonoAndroid10/RestSharp.dll deleted file mode 100644 index 9f15b1b04..000000000 Binary files a/packages/RestSharp.105.2.3/lib/MonoAndroid10/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/MonoAndroid10/RestSharp.xml b/packages/RestSharp.105.2.3/lib/MonoAndroid10/RestSharp.xml deleted file mode 100644 index d48b0034a..000000000 --- a/packages/RestSharp.105.2.3/lib/MonoAndroid10/RestSharp.xml +++ /dev/null @@ -1,3020 +0,0 @@ - - - - RestSharp - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Deserialized entity data - - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - diff --git a/packages/RestSharp.105.2.3/lib/MonoTouch10/RestSharp.dll b/packages/RestSharp.105.2.3/lib/MonoTouch10/RestSharp.dll deleted file mode 100644 index aff63af03..000000000 Binary files a/packages/RestSharp.105.2.3/lib/MonoTouch10/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/MonoTouch10/RestSharp.xml b/packages/RestSharp.105.2.3/lib/MonoTouch10/RestSharp.xml deleted file mode 100644 index d48b0034a..000000000 --- a/packages/RestSharp.105.2.3/lib/MonoTouch10/RestSharp.xml +++ /dev/null @@ -1,3020 +0,0 @@ - - - - RestSharp - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Deserialized entity data - - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - diff --git a/packages/RestSharp.105.2.3/lib/Xamarin.iOS10/RestSharp.dll b/packages/RestSharp.105.2.3/lib/Xamarin.iOS10/RestSharp.dll deleted file mode 100644 index 5c24dc22b..000000000 Binary files a/packages/RestSharp.105.2.3/lib/Xamarin.iOS10/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/Xamarin.iOS10/RestSharp.xml b/packages/RestSharp.105.2.3/lib/Xamarin.iOS10/RestSharp.xml deleted file mode 100644 index d48b0034a..000000000 --- a/packages/RestSharp.105.2.3/lib/Xamarin.iOS10/RestSharp.xml +++ /dev/null @@ -1,3020 +0,0 @@ - - - - RestSharp - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Deserialized entity data - - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - diff --git a/packages/RestSharp.105.2.3/lib/net35/RestSharp.dll b/packages/RestSharp.105.2.3/lib/net35/RestSharp.dll deleted file mode 100644 index 0b0001b5a..000000000 Binary files a/packages/RestSharp.105.2.3/lib/net35/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/net35/RestSharp.xml b/packages/RestSharp.105.2.3/lib/net35/RestSharp.xml deleted file mode 100644 index 543b8b01d..000000000 --- a/packages/RestSharp.105.2.3/lib/net35/RestSharp.xml +++ /dev/null @@ -1,2858 +0,0 @@ - - - - RestSharp - - - - - JSON WEB TOKEN (JWT) Authenticator class. - https://tools.ietf.org/html/draft-ietf-oauth-json-web-token - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - HttpWebRequest wrapper (sync methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (async methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - diff --git a/packages/RestSharp.105.2.3/lib/net4-client/RestSharp.dll b/packages/RestSharp.105.2.3/lib/net4-client/RestSharp.dll deleted file mode 100644 index b48af8715..000000000 Binary files a/packages/RestSharp.105.2.3/lib/net4-client/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/net4-client/RestSharp.xml b/packages/RestSharp.105.2.3/lib/net4-client/RestSharp.xml deleted file mode 100644 index 16ca278fa..000000000 --- a/packages/RestSharp.105.2.3/lib/net4-client/RestSharp.xml +++ /dev/null @@ -1,3095 +0,0 @@ - - - - RestSharp - - - - - JSON WEB TOKEN (JWT) Authenticator class. - https://tools.ietf.org/html/draft-ietf-oauth-json-web-token - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.2.3/lib/net4/RestSharp.dll b/packages/RestSharp.105.2.3/lib/net4/RestSharp.dll deleted file mode 100644 index b48af8715..000000000 Binary files a/packages/RestSharp.105.2.3/lib/net4/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/net4/RestSharp.xml b/packages/RestSharp.105.2.3/lib/net4/RestSharp.xml deleted file mode 100644 index 16ca278fa..000000000 --- a/packages/RestSharp.105.2.3/lib/net4/RestSharp.xml +++ /dev/null @@ -1,3095 +0,0 @@ - - - - RestSharp - - - - - JSON WEB TOKEN (JWT) Authenticator class. - https://tools.ietf.org/html/draft-ietf-oauth-json-web-token - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.2.3/lib/net45/RestSharp.dll b/packages/RestSharp.105.2.3/lib/net45/RestSharp.dll deleted file mode 100644 index 533b3cc8a..000000000 Binary files a/packages/RestSharp.105.2.3/lib/net45/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/net45/RestSharp.xml b/packages/RestSharp.105.2.3/lib/net45/RestSharp.xml deleted file mode 100644 index 16ca278fa..000000000 --- a/packages/RestSharp.105.2.3/lib/net45/RestSharp.xml +++ /dev/null @@ -1,3095 +0,0 @@ - - - - RestSharp - - - - - JSON WEB TOKEN (JWT) Authenticator class. - https://tools.ietf.org/html/draft-ietf-oauth-json-web-token - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.2.3/lib/net451/RestSharp.dll b/packages/RestSharp.105.2.3/lib/net451/RestSharp.dll deleted file mode 100644 index d8414d1a9..000000000 Binary files a/packages/RestSharp.105.2.3/lib/net451/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/net451/RestSharp.xml b/packages/RestSharp.105.2.3/lib/net451/RestSharp.xml deleted file mode 100644 index 16ca278fa..000000000 --- a/packages/RestSharp.105.2.3/lib/net451/RestSharp.xml +++ /dev/null @@ -1,3095 +0,0 @@ - - - - RestSharp - - - - - JSON WEB TOKEN (JWT) Authenticator class. - https://tools.ietf.org/html/draft-ietf-oauth-json-web-token - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.2.3/lib/net452/RestSharp.dll b/packages/RestSharp.105.2.3/lib/net452/RestSharp.dll deleted file mode 100644 index 31e4704f8..000000000 Binary files a/packages/RestSharp.105.2.3/lib/net452/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/net452/RestSharp.xml b/packages/RestSharp.105.2.3/lib/net452/RestSharp.xml deleted file mode 100644 index 16ca278fa..000000000 --- a/packages/RestSharp.105.2.3/lib/net452/RestSharp.xml +++ /dev/null @@ -1,3095 +0,0 @@ - - - - RestSharp - - - - - JSON WEB TOKEN (JWT) Authenticator class. - https://tools.ietf.org/html/draft-ietf-oauth-json-web-token - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.2.3/lib/net46/RestSharp.dll b/packages/RestSharp.105.2.3/lib/net46/RestSharp.dll deleted file mode 100644 index 8af7bc116..000000000 Binary files a/packages/RestSharp.105.2.3/lib/net46/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/net46/RestSharp.xml b/packages/RestSharp.105.2.3/lib/net46/RestSharp.xml deleted file mode 100644 index 16ca278fa..000000000 --- a/packages/RestSharp.105.2.3/lib/net46/RestSharp.xml +++ /dev/null @@ -1,3095 +0,0 @@ - - - - RestSharp - - - - - JSON WEB TOKEN (JWT) Authenticator class. - https://tools.ietf.org/html/draft-ietf-oauth-json-web-token - - - - - Tries to Authenticate with the credentials of the currently logged in user, or impersonate a user - - - - - Authenticate with the credentials of the currently logged in user - - - - - Authenticate by impersonation - - - - - - - Authenticate by impersonation, using an existing ICredentials instance - - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Decodes an HTML-encoded string and returns the decoded string. - - The HTML string to decode. - The decoded text. - - - - Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream. - - The HTML string to decode - The TextWriter output stream containing the decoded string. - - - - HTML-encodes a string and sends the resulting output to a TextWriter output stream. - - The string to encode. - The TextWriter output stream containing the encoded string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - HttpWebRequest wrapper (sync methods) - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - Execute a POST request - - - - - Execute a PUT request - - - - - Execute a GET request - - - - - Execute a HEAD request - - - - - Execute an OPTIONS request - - - - - Execute a DELETE request - - - - - Execute a PATCH request - - - - - Execute a MERGE request - - - - - Execute a GET-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - Execute a POST-style request with the specified HTTP Method. - - The HTTP method to execute. - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - X509CertificateCollection to be sent with request - - - - - Maximum number of automatic redirects to follow if FollowRedirects is true - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Proxy info to be sent with request - - - - - Caching policy for requests created with this wrapper. - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - X509CertificateCollection to be sent with request - - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Executes the specified request and downloads the response data - - Request to execute - Response data - - - - Executes the request and returns a response, authenticating if needed - - Request to be executed - RestResponse - - - - Executes the specified request and deserializes the response content using the appropriate content handler - - Target deserialization type - Request to execute - RestResponse[[T]] with deserialized data in Data property - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - X509CertificateCollection to be sent with request - - - - - Proxy to use for requests made by this client instance. - Passed on to underlying WebRequest if set. - - - - - The cache policy to use for requests initiated by this client instance. - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. - - Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the class, binder.Type returns the type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion. - The result of the type conversion operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. - - Provides information about the deletion. - - Alwasy returns true. - - - - - Provides the implementation for operations that get a value by index. Classes derived from the class can override this method to specify dynamic behavior for indexing operations. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, is equal to 3. - The result of the index operation. - - Alwasy returns true. - - - - - Provides the implementation for operations that get member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as getting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The result of the get operation. For example, if the method is called for a property, you can assign the property value to . - - Alwasy returns true. - - - - - Provides the implementation for operations that set a value by index. Classes derived from the class can override this method to specify dynamic behavior for operations that access objects by a specified index. - - Provides information about the operation. - The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 3. - The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the class, is equal to 10. - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown. - - - - - Provides the implementation for operations that set member values. Classes derived from the class can override this method to specify dynamic behavior for operations such as setting a value for a property. - - Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive. - The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the class, the is "Test". - - true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.) - - - - - Returns the enumeration of all dynamic member names. - - - A sequence that contains dynamic member names. - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - diff --git a/packages/RestSharp.105.2.3/lib/sl5/RestSharp.dll b/packages/RestSharp.105.2.3/lib/sl5/RestSharp.dll deleted file mode 100644 index 9b07a2d48..000000000 Binary files a/packages/RestSharp.105.2.3/lib/sl5/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/sl5/RestSharp.xml b/packages/RestSharp.105.2.3/lib/sl5/RestSharp.xml deleted file mode 100644 index 0fdfe6cc4..000000000 --- a/packages/RestSharp.105.2.3/lib/sl5/RestSharp.xml +++ /dev/null @@ -1,2649 +0,0 @@ - - - - RestSharp - - - - - JSON WEB TOKEN (JWT) Authenticator class. - https://tools.ietf.org/html/draft-ietf-oauth-json-web-token - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Save a byte array to a file - - Bytes to save - Full path to save file to - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - diff --git a/packages/RestSharp.105.2.3/lib/windowsphone8/RestSharp.dll b/packages/RestSharp.105.2.3/lib/windowsphone8/RestSharp.dll deleted file mode 100644 index e7289c244..000000000 Binary files a/packages/RestSharp.105.2.3/lib/windowsphone8/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/windowsphone8/RestSharp.xml b/packages/RestSharp.105.2.3/lib/windowsphone8/RestSharp.xml deleted file mode 100644 index 83f9ce605..000000000 --- a/packages/RestSharp.105.2.3/lib/windowsphone8/RestSharp.xml +++ /dev/null @@ -1,3866 +0,0 @@ - - - - RestSharp - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Calculates a 32bit Cyclic Redundancy Checksum (CRC) using the same polynomial - used by Zip. This type is used internally by DotNetZip; it is generally not used - directly by applications wishing to create, read, or manipulate zip archive - files. - - - - - Returns the CRC32 for the specified stream. - - The stream over which to calculate the CRC32 - the CRC32 calculation - - - - Returns the CRC32 for the specified stream, and writes the input into the - output stream. - - The stream over which to calculate the CRC32 - The stream into which to deflate the input - the CRC32 calculation - - - - Get the CRC32 for the given (word,byte) combo. This is a computation - defined by PKzip. - - The word to start with. - The byte to combine it with. - The CRC-ized result. - - - - Update the value for the running CRC32 using the given block of bytes. - This is useful when using the CRC32() class in a Stream. - - block of bytes to slurp - starting point in the block - how many bytes within the block to slurp - - - - indicates the total number of bytes read on the CRC stream. - This is used when writing the ZipDirEntry when compressing files. - - - - - Indicates the current CRC for all blocks slurped in. - - - - - A Stream that calculates a CRC32 (a checksum) on all bytes read, - or on all bytes written. - - - - - This class can be used to verify the CRC of a ZipEntry when - reading from a stream, or to calculate a CRC when writing to a - stream. The stream should be used to either read, or write, but - not both. If you intermix reads and writes, the results are not - defined. - - - - This class is intended primarily for use internally by the - DotNetZip library. - - - - - - The default constructor. - - - Instances returned from this constructor will leave the underlying stream - open upon Close(). - - The underlying stream - - - - The constructor allows the caller to specify how to handle the underlying - stream at close. - - The underlying stream - true to leave the underlying stream - open upon close of the CrcCalculatorStream.; false otherwise. - - - - A constructor allowing the specification of the length of the stream to read. - - - Instances returned from this constructor will leave the underlying stream open - upon Close(). - - The underlying stream - The length of the stream to slurp - - - - A constructor allowing the specification of the length of the stream to - read, as well as whether to keep the underlying stream open upon Close(). - - The underlying stream - The length of the stream to slurp - true to leave the underlying stream - open upon close of the CrcCalculatorStream.; false otherwise. - - - - Read from the stream - - the buffer to read - the offset at which to start - the number of bytes to read - the number of bytes actually read - - - - Write to the stream. - - the buffer from which to write - the offset at which to start writing - the number of bytes to write - - - - Flush the stream. - - - - - Not implemented. - - N/A - N/A - N/A - - - - Not implemented. - - N/A - - - - Closes the stream. - - - - - Gets the total number of bytes run through the CRC32 calculator. - - - - This is either the total number of bytes read, or the total number of bytes - written, depending on the direction of this stream. - - - - - Provides the current CRC for all blocks slurped in. - - - - - Indicates whether the underlying stream will be left open when the - CrcCalculatorStream is Closed. - - - - - Indicates whether the stream supports reading. - - - - - Indicates whether the stream supports seeking. - - - - - Indicates whether the stream supports writing. - - - - - Not implemented. - - - - - Not implemented. - - - - - Describes how to flush the current deflate operation. - - - The different FlushType values are useful when using a Deflate in a streaming application. - - - - No flush at all. - - - Closes the current block, but doesn't flush it to - the output. Used internally only in hypothetical - scenarios. This was supposed to be removed by Zlib, but it is - still in use in some edge cases. - - - - - Use this during compression to specify that all pending output should be - flushed to the output buffer and the output should be aligned on a byte - boundary. You might use this in a streaming communication scenario, so that - the decompressor can get all input data available so far. When using this - with a ZlibCodec, AvailableBytesIn will be zero after the call if - enough output space has been provided before the call. Flushing will - degrade compression and so it should be used only when necessary. - - - - - Use this during compression to specify that all output should be flushed, as - with FlushType.Sync, but also, the compression state should be reset - so that decompression can restart from this point if previous compressed - data has been damaged or if random access is desired. Using - FlushType.Full too often can significantly degrade the compression. - - - - Signals the end of the compression/decompression stream. - - - - A class for compressing and decompressing GZIP streams. - - - - - The GZipStream is a Decorator on a . It adds GZIP compression or decompression to any stream. - - - Like the Compression.GZipStream in the .NET Base - Class Library, the Ionic.Zlib.GZipStream can compress while writing, or decompress - while reading, but not vice versa. The compression method used is GZIP, which is - documented in IETF RFC 1952, - "GZIP file format specification version 4.3". - - A GZipStream can be used to decompress data (through Read()) or to compress - data (through Write()), but not both. - - If you wish to use the GZipStream to compress data, you must wrap it around a - write-able stream. As you call Write() on the GZipStream, the data will be - compressed into the GZIP format. If you want to decompress data, you must wrap the - GZipStream around a readable stream that contains an IETF RFC 1952-compliant stream. - The data will be decompressed as you call Read() on the GZipStream. - - Though the GZIP format allows data from multiple files to be concatenated - together, this stream handles only a single segment of GZIP format, typically - representing a single file. - - - This class is similar to and . - ZlibStream handles RFC1950-compliant streams. - handles RFC1951-compliant streams. This class handles RFC1952-compliant streams. - - - - - - - - - - Create a GZipStream using the specified CompressionMode and the specified CompressionLevel, - and explicitly specify whether the stream should be left open after Deflation or Inflation. - - - - This constructor allows the application to request that the captive stream remain open after - the deflation or inflation occurs. By default, after Close() is called on the stream, the - captive stream is also closed. In some cases this is not desired, for example if the stream - is a memory stream that will be re-read after compressed data has been written to it. Specify true for the - leaveOpen parameter to leave the stream open. - - - As noted in the class documentation, - the CompressionMode (Compress or Decompress) also establishes the "direction" of the stream. - A GZipStream with CompressionMode.Compress works only through Write(). A GZipStream with - CompressionMode.Decompress works only through Read(). - - - - This example shows how to use a DeflateStream to compress data. - - using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) - { - using (var raw = System.IO.File.Create(outputFile)) - { - using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true)) - { - byte[] buffer = new byte[WORKING_BUFFER_SIZE]; - int n; - while ((n= input.Read(buffer, 0, buffer.Length)) != 0) - { - compressor.Write(buffer, 0, n); - } - } - } - } - - - Dim outputFile As String = (fileToCompress & ".compressed") - Using input As Stream = File.OpenRead(fileToCompress) - Using raw As FileStream = File.Create(outputFile) - Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True) - Dim buffer As Byte() = New Byte(4096) {} - Dim n As Integer = -1 - Do While (n <> 0) - If (n > 0) Then - compressor.Write(buffer, 0, n) - End If - n = input.Read(buffer, 0, buffer.Length) - Loop - End Using - End Using - End Using - - - The stream which will be read or written. - Indicates whether the GZipStream will compress or decompress. - true if the application would like the stream to remain open after inflation/deflation. - A tuning knob to trade speed for effectiveness. - - - - Dispose the stream. - - - This may or may not result in a Close() call on the captive stream. - See the ctor's with leaveOpen parameters for more information. - - - - - Flush the stream. - - - - - Read and decompress data from the source stream. - - - With a GZipStream, decompression is done through reading. - - - - byte[] working = new byte[WORKING_BUFFER_SIZE]; - using (System.IO.Stream input = System.IO.File.OpenRead(_CompressedFile)) - { - using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true)) - { - using (var output = System.IO.File.Create(_DecompressedFile)) - { - int n; - while ((n= decompressor.Read(working, 0, working.Length)) !=0) - { - output.Write(working, 0, n); - } - } - } - } - - - The buffer into which the decompressed data should be placed. - the offset within that data array to put the first byte read. - the number of bytes to read. - the number of bytes actually read - - - - Calling this method always throws a . - - irrelevant; it will always throw! - irrelevant; it will always throw! - irrelevant! - - - - Calling this method always throws a NotImplementedException. - - irrelevant; this method will always throw! - - - - The Comment on the GZIP stream. - - - - The GZIP format allows for each file to optionally have an associated comment stored with the - file. The comment is encoded with the ISO-8859-1 code page. To include a comment in - a GZIP stream you create, set this property before calling Write() for the first time - on the GZipStream. - - - - When using GZipStream to decompress, you can retrieve this property after the first - call to Read(). If no comment has been set in the GZIP bytestream, the Comment - property will return null (Nothing in VB). - - - - - - The FileName for the GZIP stream. - - - - The GZIP format optionally allows each file to have an associated filename. When - compressing data (through Write()), set this FileName before calling Write() the first - time on the GZipStream. The actual filename is encoded into the GZIP bytestream with - the ISO-8859-1 code page, according to RFC 1952. It is the application's responsibility to - insure that the FileName can be encoded and decoded correctly with this code page. - - - When decompressing (through Read()), you can retrieve this value any time after the - first Read(). In the case where there was no filename encoded into the GZIP - bytestream, the property will return null (Nothing in VB). - - - - - - The CRC on the GZIP stream. - - - This is used for internal error checking. You probably don't need to look at this property. - - - - - This property sets the flush behavior on the stream. - - - - - The size of the working buffer for the compression codec. - - - - - The working buffer is used for all stream operations. The default size is 1024 bytes. - The minimum size is 128 bytes. You may get better performance with a larger buffer. - Then again, you might not. You would have to test it. - - - - Set this before the first call to Read() or Write() on the stream. If you try to set it - afterwards, it will throw. - - - - - Returns the total number of bytes input so far. - - - Returns the total number of bytes output so far. - - - - Indicates whether the stream can be read. - - - The return value depends on whether the captive stream supports reading. - - - - - Indicates whether the stream supports Seek operations. - - - Always returns false. - - - - - Indicates whether the stream can be written. - - - The return value depends on whether the captive stream supports writing. - - - - - Reading this property always throws a NotImplementedException. - - - - - The position of the stream pointer. - - - Writing this property always throws a NotImplementedException. Reading will - return the total bytes written out, if used in writing, or the total bytes - read in, if used in reading. The count may refer to compressed bytes or - uncompressed bytes, depending on how you've used the stream. - - - - - A general purpose exception class for exceptions in the Zlib library. - - - - - The ZlibException class captures exception information generated - by the Zlib library. - - - - - This ctor collects a message attached to the exception. - - - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - Reads a number of characters from the current source TextReader and writes the data to the target array at the specified index. - The source TextReader to read from - Contains the array of characteres read from the source TextReader. - The starting index of the target array. - The maximum number of characters to read from the source TextReader. - The number of characters read. The number will be less than or equal to count depending on the data available in the source TextReader. Returns -1 if the end of the stream is reached. - - - - Computes an Adler-32 checksum. - - - The Adler checksum is similar to a CRC checksum, but faster to compute, though less - reliable. It is used in producing RFC1950 compressed streams. The Adler checksum - is a required part of the "ZLIB" standard. Applications will almost never need to - use this class directly. - - - - - Encoder and Decoder for ZLIB and DEFLATE (IETF RFC1950 and RFC1951). - - - - This class compresses and decompresses data according to the Deflate algorithm - and optionally, the ZLIB format, as documented in RFC 1950 - ZLIB and RFC 1951 - DEFLATE. - - - - - The buffer from which data is taken. - - - - - An index into the InputBuffer array, indicating where to start reading. - - - - - The number of bytes available in the InputBuffer, starting at NextIn. - - - Generally you should set this to InputBuffer.Length before the first Inflate() or Deflate() call. - The class will update this number as calls to Inflate/Deflate are made. - - - - - Total number of bytes read so far, through all calls to Inflate()/Deflate(). - - - - - Buffer to store output data. - - - - - An index into the OutputBuffer array, indicating where to start writing. - - - - - The number of bytes available in the OutputBuffer, starting at NextOut. - - - Generally you should set this to OutputBuffer.Length before the first Inflate() or Deflate() call. - The class will update this number as calls to Inflate/Deflate are made. - - - - - Total number of bytes written to the output so far, through all calls to Inflate()/Deflate(). - - - - - used for diagnostics, when something goes wrong! - - - - - The number of Window Bits to use. - - - This gauges the size of the sliding window, and hence the - compression effectiveness as well as memory consumption. It's best to just leave this - setting alone if you don't know what it is. The maximum value is 15 bits, which implies - a 32k window. - - - - - Create a ZlibCodec that decompresses. - - - - - Initialize the inflation state. - - - It is not necessary to call this before using the ZlibCodec to inflate data; - It is implicitly called when you call the constructor. - - Z_OK if everything goes well. - - - - Initialize the inflation state with an explicit flag to - govern the handling of RFC1950 header bytes. - - - - By default, the ZLIB header defined in RFC 1950 is expected. If - you want to read a zlib stream you should specify true for - expectRfc1950Header. If you have a deflate stream, you will want to specify - false. It is only necessary to invoke this initializer explicitly if you - want to specify false. - - - whether to expect an RFC1950 header byte - pair when reading the stream of data to be inflated. - - Z_OK if everything goes well. - - - - Initialize the ZlibCodec for inflation, with the specified number of window bits. - - The number of window bits to use. If you need to ask what that is, - then you shouldn't be calling this initializer. - Z_OK if all goes well. - - - - Initialize the inflation state with an explicit flag to govern the handling of - RFC1950 header bytes. - - - - If you want to read a zlib stream you should specify true for - expectRfc1950Header. In this case, the library will expect to find a ZLIB - header, as defined in RFC - 1950, in the compressed stream. If you will be reading a DEFLATE or - GZIP stream, which does not have such a header, you will want to specify - false. - - - whether to expect an RFC1950 header byte pair when reading - the stream of data to be inflated. - The number of window bits to use. If you need to ask what that is, - then you shouldn't be calling this initializer. - Z_OK if everything goes well. - - - - Inflate the data in the InputBuffer, placing the result in the OutputBuffer. - - - You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and - AvailableBytesOut before calling this method. - - - - private void InflateBuffer() - { - int bufferSize = 1024; - byte[] buffer = new byte[bufferSize]; - ZlibCodec decompressor = new ZlibCodec(); - - Console.WriteLine("\n============================================"); - Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length); - MemoryStream ms = new MemoryStream(DecompressedBytes); - - int rc = decompressor.InitializeInflate(); - - decompressor.InputBuffer = CompressedBytes; - decompressor.NextIn = 0; - decompressor.AvailableBytesIn = CompressedBytes.Length; - - decompressor.OutputBuffer = buffer; - - // pass 1: inflate - do - { - decompressor.NextOut = 0; - decompressor.AvailableBytesOut = buffer.Length; - rc = decompressor.Inflate(ZlibConstants.Z_NO_FLUSH); - - if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END) - throw new Exception("inflating: " + decompressor.Message); - - ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut); - } - while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); - - // pass 2: finish and flush - do - { - decompressor.NextOut = 0; - decompressor.AvailableBytesOut = buffer.Length; - rc = decompressor.Inflate(ZlibConstants.Z_FINISH); - - if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK) - throw new Exception("inflating: " + decompressor.Message); - - if (buffer.Length - decompressor.AvailableBytesOut > 0) - ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut); - } - while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); - - decompressor.EndInflate(); - } - - - - The flush to use when inflating. - Z_OK if everything goes well. - - - - Ends an inflation session. - - - Call this after successively calling Inflate(). This will cause all buffers to be flushed. - After calling this you cannot call Inflate() without a intervening call to one of the - InitializeInflate() overloads. - - Z_OK if everything goes well. - - - - I don't know what this does! - - Z_OK if everything goes well. - - - - Set the dictionary to be used for either Inflation or Deflation. - - The dictionary bytes to use. - Z_OK if all goes well. - - - - The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this. - - - - - A bunch of constants used in the Zlib interface. - - - - - The maximum number of window bits for the Deflate algorithm. - - - - - The default number of window bits for the Deflate algorithm. - - - - - indicates everything is A-OK - - - - - Indicates that the last operation reached the end of the stream. - - - - - The operation ended in need of a dictionary. - - - - - There was an error with the stream - not enough data, not open and readable, etc. - - - - - There was an error with the data - not enough data, bad data, etc. - - - - - There was an error with the working buffer. - - - - - The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes. - - - - - The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes. - - - - - Represents a Zlib stream for compression or decompression. - - - - - The ZlibStream is a Decorator on a . It adds ZLIB compression or decompression to any - stream. - - - Using this stream, applications can compress or decompress data via - stream Read and Write operations. Either compresssion or - decompression can occur through either reading or writing. The compression - format used is ZLIB, which is documented in IETF RFC 1950, "ZLIB Compressed - Data Format Specification version 3.3". This implementation of ZLIB always uses - DEFLATE as the compression method. (see IETF RFC 1951, "DEFLATE - Compressed Data Format Specification version 1.3.") - - - The ZLIB format allows for varying compression methods, window sizes, and dictionaries. - This implementation always uses the DEFLATE compression method, a preset dictionary, - and 15 window bits by default. - - - - This class is similar to , except that it adds the - RFC1950 header and trailer bytes to a compressed stream when compressing, or expects - the RFC1950 header and trailer bytes when decompressing. It is also similar to the - . - - - - - - - - Dispose the stream. - - - This may or may not result in a Close() call on the captive stream. - See the constructors that have a leaveOpen parameter for more information. - - - - - Flush the stream. - - - - - Read data from the stream. - - - - - - If you wish to use the ZlibStream to compress data while reading, you can create a - ZlibStream with CompressionMode.Compress, providing an uncompressed data stream. Then - call Read() on that ZlibStream, and the data read will be compressed. If you wish to - use the ZlibStream to decompress data while reading, you can create a ZlibStream with - CompressionMode.Decompress, providing a readable compressed data stream. Then call - Read() on that ZlibStream, and the data will be decompressed as it is read. - - - - A ZlibStream can be used for Read() or Write(), but not both. - - - The buffer into which the read data should be placed. - the offset within that data array to put the first byte read. - the number of bytes to read. - - - - Calling this method always throws a NotImplementedException. - - - - - Calling this method always throws a NotImplementedException. - - - - - Write data to the stream. - - - - - - If you wish to use the ZlibStream to compress data while writing, you can create a - ZlibStream with CompressionMode.Compress, and a writable output stream. Then call - Write() on that ZlibStream, providing uncompressed data as input. The data sent to - the output stream will be the compressed form of the data written. If you wish to use - the ZlibStream to decompress data while writing, you can create a ZlibStream with - CompressionMode.Decompress, and a writable output stream. Then call Write() on that - stream, providing previously compressed data. The data sent to the output stream will - be the decompressed form of the data written. - - - - A ZlibStream can be used for Read() or Write(), but not both. - - - The buffer holding data to write to the stream. - the offset within that data array to find the first byte to write. - the number of bytes to write. - - - - Uncompress a byte array into a single string. - - - - A buffer containing ZLIB-compressed data. - - - - - Uncompress a byte array into a byte array. - - - - - A buffer containing ZLIB-compressed data. - - - - - This property sets the flush behavior on the stream. - Sorry, though, not sure exactly how to describe all the various settings. - - - - - The size of the working buffer for the compression codec. - - - - - The working buffer is used for all stream operations. The default size is 1024 bytes. - The minimum size is 128 bytes. You may get better performance with a larger buffer. - Then again, you might not. You would have to test it. - - - - Set this before the first call to Read() or Write() on the stream. If you try to set it - afterwards, it will throw. - - - - - Returns the total number of bytes input so far. - - - Returns the total number of bytes output so far. - - - - Indicates whether the stream can be read. - - - The return value depends on whether the captive stream supports reading. - - - - - Indicates whether the stream supports Seek operations. - - - Always returns false. - - - - - Indicates whether the stream can be written. - - - The return value depends on whether the captive stream supports writing. - - - - - Reading this property always throws a NotImplementedException. - - - - - The position of the stream pointer. - - - Writing this property always throws a NotImplementedException. Reading will - return the total bytes written out, if used in writing, or the total bytes - read in, if used in reading. The count may refer to compressed bytes or - uncompressed bytes, depending on how you've used the stream. - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - diff --git a/packages/RestSharp.105.2.3/lib/windowsphone81/RestSharp.dll b/packages/RestSharp.105.2.3/lib/windowsphone81/RestSharp.dll deleted file mode 100644 index 66e79802b..000000000 Binary files a/packages/RestSharp.105.2.3/lib/windowsphone81/RestSharp.dll and /dev/null differ diff --git a/packages/RestSharp.105.2.3/lib/windowsphone81/RestSharp.xml b/packages/RestSharp.105.2.3/lib/windowsphone81/RestSharp.xml deleted file mode 100644 index 83f9ce605..000000000 --- a/packages/RestSharp.105.2.3/lib/windowsphone81/RestSharp.xml +++ /dev/null @@ -1,3866 +0,0 @@ - - - - RestSharp - - - - - - - - Base class for OAuth 2 Authenticators. - - - Since there are many ways to authenticate in OAuth2, - this is used as a base class to differentiate between - other authenticators. - - Any other OAuth2 authenticators must derive from this - abstract class. - - - - - Access token to be used when authenticating. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Gets the access token. - - - - - The OAuth 2 authenticator using URI query parameter. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.2 - - - - - Initializes a new instance of the class. - - - The access token. - - - - - The OAuth 2 authenticator using the authorization request header field. - - - Based on http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-5.1.1 - - - - - Stores the Authorization header value as "[tokenType] accessToken". used for performance. - - - - - Initializes a new instance of the class. - - - The access token. - - - - - Initializes a new instance of the class. - - - The access token. - - - The token type. - - - - - All text parameters are UTF-8 encoded (per section 5.1). - - - - - - Generates a random 16-byte lowercase alphanumeric string. - - - - - - - Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT" - - - - - - - Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT" - - - A specified point in time. - - - - - The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - The value to escape. - The escaped value. - - The method is supposed to take on - RFC 3986 behavior if certain elements are present in a .config file. Even if this - actually worked (which in my experiments it doesn't), we can't rely on every - host actually having this configuration element present. - - - - - - - URL encodes a string based on section 5.1 of the OAuth spec. - Namely, percent encoding with [RFC3986], avoiding unreserved characters, - upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs. - - - - - - - Sorts a collection of key-value pairs by name, and then value if equal, - concatenating them into a single string. This string should be encoded - prior to, or after normalization is run. - - - - - - - - Sorts a by name, and then value if equal. - - A collection of parameters to sort - A sorted parameter collection - - - - Creates a request URL suitable for making OAuth requests. - Resulting URLs must exclude port 80 or port 443 when accompanied by HTTP and HTTPS, respectively. - Resulting URLs must be lower case. - - - The original request URL - - - - - Creates a request elements concatentation value to send with a request. - This is also known as the signature base. - - - - The request's HTTP method type - The request URL - The request's parameters - A signature base string - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret. - This method is used when the token secret is currently unknown. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer key - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The signature base - The consumer secret - The token secret - - - - - Creates a signature value given a signature base and the consumer secret and a known token secret. - - - The hashing method - The treatment to use on a signature value - The signature base - The consumer secret - The token secret - - - - - A class to encapsulate OAuth authentication flow. - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - - - - - - Generates a instance to pass to an - for the purpose of requesting an - unauthorized request token. - - The HTTP method for the intended request - Any existing, non-OAuth query parameters desired in the request - - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - - - - Generates a instance to pass to an - for the purpose of exchanging a request token - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - Generates a instance to pass to an - for the purpose of exchanging user credentials - for an access token authorized by the user at the Service Provider site. - - The HTTP method for the intended request - - Any existing, non-OAuth query parameters desired in the request - - - - - - - - - - - - - Calculates a 32bit Cyclic Redundancy Checksum (CRC) using the same polynomial - used by Zip. This type is used internally by DotNetZip; it is generally not used - directly by applications wishing to create, read, or manipulate zip archive - files. - - - - - Returns the CRC32 for the specified stream. - - The stream over which to calculate the CRC32 - the CRC32 calculation - - - - Returns the CRC32 for the specified stream, and writes the input into the - output stream. - - The stream over which to calculate the CRC32 - The stream into which to deflate the input - the CRC32 calculation - - - - Get the CRC32 for the given (word,byte) combo. This is a computation - defined by PKzip. - - The word to start with. - The byte to combine it with. - The CRC-ized result. - - - - Update the value for the running CRC32 using the given block of bytes. - This is useful when using the CRC32() class in a Stream. - - block of bytes to slurp - starting point in the block - how many bytes within the block to slurp - - - - indicates the total number of bytes read on the CRC stream. - This is used when writing the ZipDirEntry when compressing files. - - - - - Indicates the current CRC for all blocks slurped in. - - - - - A Stream that calculates a CRC32 (a checksum) on all bytes read, - or on all bytes written. - - - - - This class can be used to verify the CRC of a ZipEntry when - reading from a stream, or to calculate a CRC when writing to a - stream. The stream should be used to either read, or write, but - not both. If you intermix reads and writes, the results are not - defined. - - - - This class is intended primarily for use internally by the - DotNetZip library. - - - - - - The default constructor. - - - Instances returned from this constructor will leave the underlying stream - open upon Close(). - - The underlying stream - - - - The constructor allows the caller to specify how to handle the underlying - stream at close. - - The underlying stream - true to leave the underlying stream - open upon close of the CrcCalculatorStream.; false otherwise. - - - - A constructor allowing the specification of the length of the stream to read. - - - Instances returned from this constructor will leave the underlying stream open - upon Close(). - - The underlying stream - The length of the stream to slurp - - - - A constructor allowing the specification of the length of the stream to - read, as well as whether to keep the underlying stream open upon Close(). - - The underlying stream - The length of the stream to slurp - true to leave the underlying stream - open upon close of the CrcCalculatorStream.; false otherwise. - - - - Read from the stream - - the buffer to read - the offset at which to start - the number of bytes to read - the number of bytes actually read - - - - Write to the stream. - - the buffer from which to write - the offset at which to start writing - the number of bytes to write - - - - Flush the stream. - - - - - Not implemented. - - N/A - N/A - N/A - - - - Not implemented. - - N/A - - - - Closes the stream. - - - - - Gets the total number of bytes run through the CRC32 calculator. - - - - This is either the total number of bytes read, or the total number of bytes - written, depending on the direction of this stream. - - - - - Provides the current CRC for all blocks slurped in. - - - - - Indicates whether the underlying stream will be left open when the - CrcCalculatorStream is Closed. - - - - - Indicates whether the stream supports reading. - - - - - Indicates whether the stream supports seeking. - - - - - Indicates whether the stream supports writing. - - - - - Not implemented. - - - - - Not implemented. - - - - - Describes how to flush the current deflate operation. - - - The different FlushType values are useful when using a Deflate in a streaming application. - - - - No flush at all. - - - Closes the current block, but doesn't flush it to - the output. Used internally only in hypothetical - scenarios. This was supposed to be removed by Zlib, but it is - still in use in some edge cases. - - - - - Use this during compression to specify that all pending output should be - flushed to the output buffer and the output should be aligned on a byte - boundary. You might use this in a streaming communication scenario, so that - the decompressor can get all input data available so far. When using this - with a ZlibCodec, AvailableBytesIn will be zero after the call if - enough output space has been provided before the call. Flushing will - degrade compression and so it should be used only when necessary. - - - - - Use this during compression to specify that all output should be flushed, as - with FlushType.Sync, but also, the compression state should be reset - so that decompression can restart from this point if previous compressed - data has been damaged or if random access is desired. Using - FlushType.Full too often can significantly degrade the compression. - - - - Signals the end of the compression/decompression stream. - - - - A class for compressing and decompressing GZIP streams. - - - - - The GZipStream is a Decorator on a . It adds GZIP compression or decompression to any stream. - - - Like the Compression.GZipStream in the .NET Base - Class Library, the Ionic.Zlib.GZipStream can compress while writing, or decompress - while reading, but not vice versa. The compression method used is GZIP, which is - documented in IETF RFC 1952, - "GZIP file format specification version 4.3". - - A GZipStream can be used to decompress data (through Read()) or to compress - data (through Write()), but not both. - - If you wish to use the GZipStream to compress data, you must wrap it around a - write-able stream. As you call Write() on the GZipStream, the data will be - compressed into the GZIP format. If you want to decompress data, you must wrap the - GZipStream around a readable stream that contains an IETF RFC 1952-compliant stream. - The data will be decompressed as you call Read() on the GZipStream. - - Though the GZIP format allows data from multiple files to be concatenated - together, this stream handles only a single segment of GZIP format, typically - representing a single file. - - - This class is similar to and . - ZlibStream handles RFC1950-compliant streams. - handles RFC1951-compliant streams. This class handles RFC1952-compliant streams. - - - - - - - - - - Create a GZipStream using the specified CompressionMode and the specified CompressionLevel, - and explicitly specify whether the stream should be left open after Deflation or Inflation. - - - - This constructor allows the application to request that the captive stream remain open after - the deflation or inflation occurs. By default, after Close() is called on the stream, the - captive stream is also closed. In some cases this is not desired, for example if the stream - is a memory stream that will be re-read after compressed data has been written to it. Specify true for the - leaveOpen parameter to leave the stream open. - - - As noted in the class documentation, - the CompressionMode (Compress or Decompress) also establishes the "direction" of the stream. - A GZipStream with CompressionMode.Compress works only through Write(). A GZipStream with - CompressionMode.Decompress works only through Read(). - - - - This example shows how to use a DeflateStream to compress data. - - using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) - { - using (var raw = System.IO.File.Create(outputFile)) - { - using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true)) - { - byte[] buffer = new byte[WORKING_BUFFER_SIZE]; - int n; - while ((n= input.Read(buffer, 0, buffer.Length)) != 0) - { - compressor.Write(buffer, 0, n); - } - } - } - } - - - Dim outputFile As String = (fileToCompress & ".compressed") - Using input As Stream = File.OpenRead(fileToCompress) - Using raw As FileStream = File.Create(outputFile) - Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True) - Dim buffer As Byte() = New Byte(4096) {} - Dim n As Integer = -1 - Do While (n <> 0) - If (n > 0) Then - compressor.Write(buffer, 0, n) - End If - n = input.Read(buffer, 0, buffer.Length) - Loop - End Using - End Using - End Using - - - The stream which will be read or written. - Indicates whether the GZipStream will compress or decompress. - true if the application would like the stream to remain open after inflation/deflation. - A tuning knob to trade speed for effectiveness. - - - - Dispose the stream. - - - This may or may not result in a Close() call on the captive stream. - See the ctor's with leaveOpen parameters for more information. - - - - - Flush the stream. - - - - - Read and decompress data from the source stream. - - - With a GZipStream, decompression is done through reading. - - - - byte[] working = new byte[WORKING_BUFFER_SIZE]; - using (System.IO.Stream input = System.IO.File.OpenRead(_CompressedFile)) - { - using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true)) - { - using (var output = System.IO.File.Create(_DecompressedFile)) - { - int n; - while ((n= decompressor.Read(working, 0, working.Length)) !=0) - { - output.Write(working, 0, n); - } - } - } - } - - - The buffer into which the decompressed data should be placed. - the offset within that data array to put the first byte read. - the number of bytes to read. - the number of bytes actually read - - - - Calling this method always throws a . - - irrelevant; it will always throw! - irrelevant; it will always throw! - irrelevant! - - - - Calling this method always throws a NotImplementedException. - - irrelevant; this method will always throw! - - - - The Comment on the GZIP stream. - - - - The GZIP format allows for each file to optionally have an associated comment stored with the - file. The comment is encoded with the ISO-8859-1 code page. To include a comment in - a GZIP stream you create, set this property before calling Write() for the first time - on the GZipStream. - - - - When using GZipStream to decompress, you can retrieve this property after the first - call to Read(). If no comment has been set in the GZIP bytestream, the Comment - property will return null (Nothing in VB). - - - - - - The FileName for the GZIP stream. - - - - The GZIP format optionally allows each file to have an associated filename. When - compressing data (through Write()), set this FileName before calling Write() the first - time on the GZipStream. The actual filename is encoded into the GZIP bytestream with - the ISO-8859-1 code page, according to RFC 1952. It is the application's responsibility to - insure that the FileName can be encoded and decoded correctly with this code page. - - - When decompressing (through Read()), you can retrieve this value any time after the - first Read(). In the case where there was no filename encoded into the GZIP - bytestream, the property will return null (Nothing in VB). - - - - - - The CRC on the GZIP stream. - - - This is used for internal error checking. You probably don't need to look at this property. - - - - - This property sets the flush behavior on the stream. - - - - - The size of the working buffer for the compression codec. - - - - - The working buffer is used for all stream operations. The default size is 1024 bytes. - The minimum size is 128 bytes. You may get better performance with a larger buffer. - Then again, you might not. You would have to test it. - - - - Set this before the first call to Read() or Write() on the stream. If you try to set it - afterwards, it will throw. - - - - - Returns the total number of bytes input so far. - - - Returns the total number of bytes output so far. - - - - Indicates whether the stream can be read. - - - The return value depends on whether the captive stream supports reading. - - - - - Indicates whether the stream supports Seek operations. - - - Always returns false. - - - - - Indicates whether the stream can be written. - - - The return value depends on whether the captive stream supports writing. - - - - - Reading this property always throws a NotImplementedException. - - - - - The position of the stream pointer. - - - Writing this property always throws a NotImplementedException. Reading will - return the total bytes written out, if used in writing, or the total bytes - read in, if used in reading. The count may refer to compressed bytes or - uncompressed bytes, depending on how you've used the stream. - - - - - A general purpose exception class for exceptions in the Zlib library. - - - - - The ZlibException class captures exception information generated - by the Zlib library. - - - - - This ctor collects a message attached to the exception. - - - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - - Performs an unsigned bitwise right shift with the specified number - - Number to operate on - Ammount of bits to shift - The resulting number from the shift operation - - - Reads a number of characters from the current source TextReader and writes the data to the target array at the specified index. - The source TextReader to read from - Contains the array of characteres read from the source TextReader. - The starting index of the target array. - The maximum number of characters to read from the source TextReader. - The number of characters read. The number will be less than or equal to count depending on the data available in the source TextReader. Returns -1 if the end of the stream is reached. - - - - Computes an Adler-32 checksum. - - - The Adler checksum is similar to a CRC checksum, but faster to compute, though less - reliable. It is used in producing RFC1950 compressed streams. The Adler checksum - is a required part of the "ZLIB" standard. Applications will almost never need to - use this class directly. - - - - - Encoder and Decoder for ZLIB and DEFLATE (IETF RFC1950 and RFC1951). - - - - This class compresses and decompresses data according to the Deflate algorithm - and optionally, the ZLIB format, as documented in RFC 1950 - ZLIB and RFC 1951 - DEFLATE. - - - - - The buffer from which data is taken. - - - - - An index into the InputBuffer array, indicating where to start reading. - - - - - The number of bytes available in the InputBuffer, starting at NextIn. - - - Generally you should set this to InputBuffer.Length before the first Inflate() or Deflate() call. - The class will update this number as calls to Inflate/Deflate are made. - - - - - Total number of bytes read so far, through all calls to Inflate()/Deflate(). - - - - - Buffer to store output data. - - - - - An index into the OutputBuffer array, indicating where to start writing. - - - - - The number of bytes available in the OutputBuffer, starting at NextOut. - - - Generally you should set this to OutputBuffer.Length before the first Inflate() or Deflate() call. - The class will update this number as calls to Inflate/Deflate are made. - - - - - Total number of bytes written to the output so far, through all calls to Inflate()/Deflate(). - - - - - used for diagnostics, when something goes wrong! - - - - - The number of Window Bits to use. - - - This gauges the size of the sliding window, and hence the - compression effectiveness as well as memory consumption. It's best to just leave this - setting alone if you don't know what it is. The maximum value is 15 bits, which implies - a 32k window. - - - - - Create a ZlibCodec that decompresses. - - - - - Initialize the inflation state. - - - It is not necessary to call this before using the ZlibCodec to inflate data; - It is implicitly called when you call the constructor. - - Z_OK if everything goes well. - - - - Initialize the inflation state with an explicit flag to - govern the handling of RFC1950 header bytes. - - - - By default, the ZLIB header defined in RFC 1950 is expected. If - you want to read a zlib stream you should specify true for - expectRfc1950Header. If you have a deflate stream, you will want to specify - false. It is only necessary to invoke this initializer explicitly if you - want to specify false. - - - whether to expect an RFC1950 header byte - pair when reading the stream of data to be inflated. - - Z_OK if everything goes well. - - - - Initialize the ZlibCodec for inflation, with the specified number of window bits. - - The number of window bits to use. If you need to ask what that is, - then you shouldn't be calling this initializer. - Z_OK if all goes well. - - - - Initialize the inflation state with an explicit flag to govern the handling of - RFC1950 header bytes. - - - - If you want to read a zlib stream you should specify true for - expectRfc1950Header. In this case, the library will expect to find a ZLIB - header, as defined in RFC - 1950, in the compressed stream. If you will be reading a DEFLATE or - GZIP stream, which does not have such a header, you will want to specify - false. - - - whether to expect an RFC1950 header byte pair when reading - the stream of data to be inflated. - The number of window bits to use. If you need to ask what that is, - then you shouldn't be calling this initializer. - Z_OK if everything goes well. - - - - Inflate the data in the InputBuffer, placing the result in the OutputBuffer. - - - You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and - AvailableBytesOut before calling this method. - - - - private void InflateBuffer() - { - int bufferSize = 1024; - byte[] buffer = new byte[bufferSize]; - ZlibCodec decompressor = new ZlibCodec(); - - Console.WriteLine("\n============================================"); - Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length); - MemoryStream ms = new MemoryStream(DecompressedBytes); - - int rc = decompressor.InitializeInflate(); - - decompressor.InputBuffer = CompressedBytes; - decompressor.NextIn = 0; - decompressor.AvailableBytesIn = CompressedBytes.Length; - - decompressor.OutputBuffer = buffer; - - // pass 1: inflate - do - { - decompressor.NextOut = 0; - decompressor.AvailableBytesOut = buffer.Length; - rc = decompressor.Inflate(ZlibConstants.Z_NO_FLUSH); - - if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END) - throw new Exception("inflating: " + decompressor.Message); - - ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut); - } - while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); - - // pass 2: finish and flush - do - { - decompressor.NextOut = 0; - decompressor.AvailableBytesOut = buffer.Length; - rc = decompressor.Inflate(ZlibConstants.Z_FINISH); - - if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK) - throw new Exception("inflating: " + decompressor.Message); - - if (buffer.Length - decompressor.AvailableBytesOut > 0) - ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut); - } - while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); - - decompressor.EndInflate(); - } - - - - The flush to use when inflating. - Z_OK if everything goes well. - - - - Ends an inflation session. - - - Call this after successively calling Inflate(). This will cause all buffers to be flushed. - After calling this you cannot call Inflate() without a intervening call to one of the - InitializeInflate() overloads. - - Z_OK if everything goes well. - - - - I don't know what this does! - - Z_OK if everything goes well. - - - - Set the dictionary to be used for either Inflation or Deflation. - - The dictionary bytes to use. - Z_OK if all goes well. - - - - The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this. - - - - - A bunch of constants used in the Zlib interface. - - - - - The maximum number of window bits for the Deflate algorithm. - - - - - The default number of window bits for the Deflate algorithm. - - - - - indicates everything is A-OK - - - - - Indicates that the last operation reached the end of the stream. - - - - - The operation ended in need of a dictionary. - - - - - There was an error with the stream - not enough data, not open and readable, etc. - - - - - There was an error with the data - not enough data, bad data, etc. - - - - - There was an error with the working buffer. - - - - - The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes. - - - - - The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes. - - - - - Represents a Zlib stream for compression or decompression. - - - - - The ZlibStream is a Decorator on a . It adds ZLIB compression or decompression to any - stream. - - - Using this stream, applications can compress or decompress data via - stream Read and Write operations. Either compresssion or - decompression can occur through either reading or writing. The compression - format used is ZLIB, which is documented in IETF RFC 1950, "ZLIB Compressed - Data Format Specification version 3.3". This implementation of ZLIB always uses - DEFLATE as the compression method. (see IETF RFC 1951, "DEFLATE - Compressed Data Format Specification version 1.3.") - - - The ZLIB format allows for varying compression methods, window sizes, and dictionaries. - This implementation always uses the DEFLATE compression method, a preset dictionary, - and 15 window bits by default. - - - - This class is similar to , except that it adds the - RFC1950 header and trailer bytes to a compressed stream when compressing, or expects - the RFC1950 header and trailer bytes when decompressing. It is also similar to the - . - - - - - - - - Dispose the stream. - - - This may or may not result in a Close() call on the captive stream. - See the constructors that have a leaveOpen parameter for more information. - - - - - Flush the stream. - - - - - Read data from the stream. - - - - - - If you wish to use the ZlibStream to compress data while reading, you can create a - ZlibStream with CompressionMode.Compress, providing an uncompressed data stream. Then - call Read() on that ZlibStream, and the data read will be compressed. If you wish to - use the ZlibStream to decompress data while reading, you can create a ZlibStream with - CompressionMode.Decompress, providing a readable compressed data stream. Then call - Read() on that ZlibStream, and the data will be decompressed as it is read. - - - - A ZlibStream can be used for Read() or Write(), but not both. - - - The buffer into which the read data should be placed. - the offset within that data array to put the first byte read. - the number of bytes to read. - - - - Calling this method always throws a NotImplementedException. - - - - - Calling this method always throws a NotImplementedException. - - - - - Write data to the stream. - - - - - - If you wish to use the ZlibStream to compress data while writing, you can create a - ZlibStream with CompressionMode.Compress, and a writable output stream. Then call - Write() on that ZlibStream, providing uncompressed data as input. The data sent to - the output stream will be the compressed form of the data written. If you wish to use - the ZlibStream to decompress data while writing, you can create a ZlibStream with - CompressionMode.Decompress, and a writable output stream. Then call Write() on that - stream, providing previously compressed data. The data sent to the output stream will - be the decompressed form of the data written. - - - - A ZlibStream can be used for Read() or Write(), but not both. - - - The buffer holding data to write to the stream. - the offset within that data array to find the first byte to write. - the number of bytes to write. - - - - Uncompress a byte array into a single string. - - - - A buffer containing ZLIB-compressed data. - - - - - Uncompress a byte array into a byte array. - - - - - A buffer containing ZLIB-compressed data. - - - - - This property sets the flush behavior on the stream. - Sorry, though, not sure exactly how to describe all the various settings. - - - - - The size of the working buffer for the compression codec. - - - - - The working buffer is used for all stream operations. The default size is 1024 bytes. - The minimum size is 128 bytes. You may get better performance with a larger buffer. - Then again, you might not. You would have to test it. - - - - Set this before the first call to Read() or Write() on the stream. If you try to set it - afterwards, it will throw. - - - - - Returns the total number of bytes input so far. - - - Returns the total number of bytes output so far. - - - - Indicates whether the stream can be read. - - - The return value depends on whether the captive stream supports reading. - - - - - Indicates whether the stream supports Seek operations. - - - Always returns false. - - - - - Indicates whether the stream can be written. - - - The return value depends on whether the captive stream supports writing. - - - - - Reading this property always throws a NotImplementedException. - - - - - The position of the stream pointer. - - - Writing this property always throws a NotImplementedException. Reading will - return the total bytes written out, if used in writing, or the total bytes - read in, if used in reading. The count may refer to compressed bytes or - uncompressed bytes, depending on how you've used the stream. - - - - - Allows control how class and property names and values are deserialized by XmlAttributeDeserializer - - - - - The name to use for the serialized element - - - - - Sets if the property to Deserialize is an Attribute or Element (Default: false) - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Types of parameters that can be added to requests - - - - - Data formats - - - - - HTTP method to use when making requests - - - - - Format strings for commonly-used date formats - - - - - .NET format string for ISO 8601 date format - - - - - .NET format string for roundtrip date format - - - - - Status for responses (surprised?) - - - - - Extension method overload! - - - - - Read a stream into a byte array - - Stream to read - byte[] - - - - Copies bytes from one stream to another - - The input stream. - The output stream. - - - - Converts a byte array to a string, using its byte order mark to convert it to the right encoding. - http://www.shrinkrays.net/code-snippets/csharp/an-extension-method-for-converting-a-byte-array-to-a-string.aspx - - An array of bytes to convert - The byte as a string. - - - - Reflection extensions - - - - - Retrieve an attribute from a member (property) - - Type of attribute to retrieve - Member to retrieve attribute from - - - - - Retrieve an attribute from a type - - Type of attribute to retrieve - Type to retrieve attribute from - - - - - Checks a type to see if it derives from a raw generic (e.g. List[[]]) - - - - - - - - Find a value from a System.Enum by trying several possible variants - of the string value of the enum. - - Type of enum - Value for which to search - The culture used to calculate the name variants - - - - - Convert a to a instance. - - The response status. - - responseStatus - - - - Uses Uri.EscapeDataString() based on recommendations on MSDN - http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx - - - - - Check that a string is not null or empty - - String to check - bool - - - - Remove underscores from a string - - String to process - string - - - - Parses most common JSON date formats - - JSON value to parse - - DateTime - - - - Remove leading and trailing " from a string - - String to parse - String - - - - Checks a string to see if it matches a regex - - String to check - Pattern to match - bool - - - - Converts a string to pascal case - - String to convert - - string - - - - Converts a string to pascal case with the option to remove underscores - - String to convert - Option to remove underscores - - - - - - Converts a string to camel case - - String to convert - - String - - - - Convert the first letter of a string to lower case - - String to convert - string - - - - Checks to see if a string is all uppper case - - String to check - bool - - - - Add underscores to a pascal-cased string - - String to convert - string - - - - Add dashes to a pascal-cased string - - String to convert - string - - - - Add an undescore prefix to a pascasl-cased string - - - - - - - Add spaces to a pascal-cased string - - String to convert - string - - - - Return possible variants of a name for name matching. - - String to convert - The culture to use for conversion - IEnumerable<string> - - - - XML Extension Methods - - - - - Returns the name of an element with the namespace if specified - - Element name - XML Namespace - - - - - Container for files to be uploaded with requests - - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The content type to use in the request. - The - - - - Creates a file parameter from an array of bytes. - - The parameter name to use in the request. - The data to use as the file's contents. - The filename to use in the request. - The using the default content type. - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - HttpWebRequest wrapper (async methods) - - - HttpWebRequest wrapper - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - Execute an async POST-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Execute an async GET-style request with the specified HTTP Method. - - - The HTTP method to execute. - - - - - Creates an IHttp - - - - - - Default constructor - - - - - True if this HTTP request has any HTTP parameters - - - - - True if this HTTP request has any HTTP cookies - - - - - True if a request body has been specified - - - - - True if files have been set to be uploaded - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - UserAgent to be sent with request - - - - - Timeout in milliseconds to be used for the request - - - - - The number of milliseconds before the writing or reading times out. - - - - - System.Net.ICredentials to be sent with request - - - - - The System.Net.CookieContainer to be used for the request - - - - - The method to use to write the response instead of reading into RawBytes - - - - - Collection of files to be sent with request - - - - - Whether or not HTTP 3xx response redirects should be automatically followed - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. - - - - - HTTP headers to be sent with request - - - - - HTTP parameters (QueryString or Form values) to be sent with request - - - - - HTTP cookies to be sent with request - - - - - Request body to be sent with request - - - - - Content type of the request body. - - - - - An alternative to RequestBody, for when the caller already has the byte array. - - - - - URL to call for this request - - - - - Flag to send authorisation header with the HttpWebRequest - - - - - Representation of an HTTP cookie - - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - - Container for HTTP file - - - - - The length of data to be sent - - - - - Provides raw data for file - - - - - Name of the file to use when uploading - - - - - MIME content type of file - - - - - Name of the parameter - - - - - Representation of an HTTP header - - - - - Name of the header - - - - - Value of the header - - - - - Representation of an HTTP parameter (QueryString or Form value) - - - - - Name of the parameter - - - - - Value of the parameter - - - - - Content-Type of the parameter - - - - - HTTP response data - - - - - HTTP response data - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Default constructor - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - Lazy-loaded string representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Headers returned by server with the response - - - - - Cookies returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exception thrown when error is encountered. - - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are five types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - Cookie: Adds the name/value pair to the HTTP request's Cookies collection - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container for data sent back from API - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - Exceptions thrown during the request, if any. - - Will contain only network transport or framework exceptions thrown during the request. - HTTP protocol errors are handled by RestSharp and will not appear here. - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Parameter container for REST requests - - - - - Return a human-readable representation of this parameter - - String - - - - Name of the parameter - - - - - Value of the parameter - - - - - Type of the parameter - - - - - MIME content type of the parameter - - - - - Client to translate RestRequests into Http requests and process response result - - - - - Executes the request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Request to be executed - Callback function to be executed upon completion providing access to the async handle. - The HTTP method to execute - - - - Executes the request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - - - - Executes a GET-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a POST-style request and callback asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - Callback function to be executed upon completion - The HTTP method to execute - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a GET-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes a POST-style request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - - - - Executes the request asynchronously, authenticating if needed - - Target deserialization type - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a GET-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - - - - Executes a POST-style asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Executes the request asynchronously, authenticating if needed - - Request to be executed - The cancellation token - - - - Default constructor that registers default content handlers - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Sets the BaseUrl property for requests made by this client instance - - - - - - Registers a content handler to process response content - - MIME content type of the response content - Deserializer to use to process content - - - - Remove a content handler for the specified MIME content type - - MIME content type to remove - - - - Remove all content handlers - - - - - Retrieve the handler for the specified MIME content type - - MIME content type to retrieve - IDeserializer instance - - - - Assembles URL to call based on parameters, method and resource - - RestRequest to execute - Assembled System.Uri - - - - Maximum number of redirects to follow if FollowRedirects is true - - - - - Default is true. Determine whether or not requests that result in - HTTP status codes of 3xx should follow returned redirect - - - - - The CookieContainer used for requests made by this client instance - - - - - UserAgent to use for requests made by this client instance - - - - - Timeout in milliseconds to use for requests made by this client instance - - - - - The number of milliseconds before the writing or reading times out. - - - - - Whether to invoke async callbacks using the SynchronizationContext.Current captured when invoked - - - - - Authenticator to use for requests made by this client instance - - - - - Combined with Request.Resource to construct URL for request - Should include scheme and domain without trailing slash. - - - client.BaseUrl = new Uri("http://example.com"); - - - - - Parameters included with every request made with this instance of RestClient - If specified in both client and request, the request wins - - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Request to be executed - Callback function to be executed upon completion - - - - Executes the request and callback asynchronously, authenticating if needed - - The IRestClient this method extends - Target deserialization type - Request to be executed - Callback function to be executed upon completion providing access to the async handle - - - - Add a parameter to use on every request made with this client instance - - The IRestClient instance - Parameter to add - - - - - Removes a parameter from the default parameters that are used on every request made with this client instance - - The IRestClient instance - The name of the parameter that needs to be removed - - - - - Adds a HTTP parameter (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - Used on every request made by this client instance - - The IRestClient instance - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - The IRestClient instance - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Shortcut to AddDefaultParameter(name, value, HttpHeader) overload - - The IRestClient instance - Name of the header to add - Value of the header to add - - - - - Shortcut to AddDefaultParameter(name, value, UrlSegment) overload - - The IRestClient instance - Name of the segment to add - Value of the segment to add - - - - - Container for data used to make requests - - - - - Default constructor - - - - - Sets Method property to value of method - - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Sets Resource property - - Resource to use for this request - - - - Sets Resource and Method properties - - Resource to use for this request - Method to use for this request - - - - Adds a file to the Files collection to be included with a POST or PUT request - (other methods do not support file uploads). - - The parameter name to use in the request - Full path to file to upload - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name - - The parameter name to use in the request - The file data - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Adds the bytes to the Files collection with the specified file name and content type - - The parameter name to use in the request - A function that writes directly to the stream. Should NOT close the stream. - The file name to use for the uploaded file - The MIME type of the file to upload - This request - - - - Add bytes to the Files collection as if it was a file of specific type - - A form parameter name - The file data - The file name to use for the uploaded file - Specific content type. Es: application/x-gzip - - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Serializes obj to data format specified by RequestFormat and adds it to the request body. - The default format is XML. Change RequestFormat if you wish to use a different serialization format. - - The object to serialize - This request - - - - Serializes obj to JSON format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to XML format and adds it to the request body. - - The object to serialize - This request - - - - Serializes obj to format specified by RequestFormat, but passes xmlNamespace if using the default XmlSerializer - Serializes obj to XML format and passes xmlNamespace then adds it to the request body. - - The object to serialize - The XML namespace to use when serializing - This request - - - - Calls AddParameter() for all public, readable properties specified in the includedProperties list - - - request.AddObject(product, "ProductId", "Price", ...); - - The object with properties to add as parameters - The names of the properties to include - This request - - - - Calls AddParameter() for all public, readable properties of obj - - The object with properties to add as parameters - This request - - - - Add the parameter to the request - - Parameter to add - - - - - Adds a HTTP parameter to the request (QueryString for GET, DELETE, OPTIONS and HEAD; Encoded form for POST and PUT) - - Name of the parameter - Value of the parameter - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - The type of parameter to add - This request - - - - Adds a parameter to the request. There are four types of parameters: - - GetOrPost: Either a QueryString value or encoded form value based on method - - HttpHeader: Adds the name/value pair to the HTTP request's Headers collection - - UrlSegment: Inserted into URL if there is a matching url token e.g. {AccountId} - - RequestBody: Used by AddBody() (not recommended to use directly) - - Name of the parameter - Value of the parameter - Content-Type of the parameter - The type of parameter to add - This request - - - - Shortcut to AddParameter(name, value, HttpHeader) overload - - Name of the header to add - Value of the header to add - - - - - Shortcut to AddParameter(name, value, Cookie) overload - - Name of the cookie to add - Value of the cookie to add - - - - - Shortcut to AddParameter(name, value, UrlSegment) overload - - Name of the segment to add - Value of the segment to add - - - - - Shortcut to AddParameter(name, value, QueryString) overload - - Name of the parameter to add - Value of the parameter to add - - - - - Internal Method so that RestClient can increase the number of attempts - - - - - Always send a multipart/form-data request - even when no Files are present. - - - - - Serializer to use when writing JSON request bodies. Used if RequestFormat is Json. - By default the included JsonSerializer is used (currently using JSON.NET default serialization). - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default the included XmlSerializer is used. - - - - - Set this to write response to Stream rather than reading into memory. - - - - - Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) - will be sent along to the server. The default is false. - - - - - Container of all HTTP parameters to be passed with the request. - See AddParameter() for explanation of the types of parameters that can be passed - - - - - Container of all the files to be uploaded with the request. - - - - - Determines what HTTP method to use for this request. Supported methods: GET, POST, PUT, DELETE, HEAD, OPTIONS - Default is GET - - - - - The Resource URL to make the request against. - Tokens are substituted with UrlSegment parameters and match by name. - Should not include the scheme or domain. Do not include leading slash. - Combined with RestClient.BaseUrl to assemble final URL: - {BaseUrl}/{Resource} (BaseUrl is scheme + domain, e.g. http://example.com) - - - // example for url token replacement - request.Resource = "Products/{ProductId}"; - request.AddParameter("ProductId", 123, ParameterType.UrlSegment); - - - - - Serializer to use when writing XML request bodies. Used if RequestFormat is Xml. - By default XmlSerializer is used. - - - - - Used by the default deserializers to determine where to start deserializing from. - Can be used to skip container or root elements that do not have corresponding deserialzation targets. - - - - - A function to run prior to deserializing starting (e.g. change settings if error encountered) - - - - - Used by the default deserializers to explicitly set which date format string to use when parsing dates. - - - - - Used by XmlDeserializer. If not specified, XmlDeserializer will flatten response by removing namespaces from element names. - - - - - In general you would not need to set this directly. Used by the NtlmAuthenticator. - - - - - Gets or sets a user-defined state object that contains information about a request and which can be later - retrieved when the request completes. - - - - - Timeout in milliseconds to be used for the request. This timeout value overrides a timeout set on the RestClient. - - - - - The number of milliseconds before the writing or reading times out. This timeout value overrides a timeout set on the RestClient. - - - - - How many attempts were made to send this Request? - - - This Number is incremented each time the RestClient sends the request. - Useful when using Asynchronous Execution with Callbacks - - - - - Base class for common properties shared by RestResponse and RestResponse[[T]] - - - - - Default constructor - - - - - Assists with debugging responses by displaying in the debugger output - - - - - - The RestRequest that was made to get this RestResponse - - - Mainly for debugging if ResponseStatus is not OK - - - - - MIME content type of response - - - - - Length in bytes of the response content - - - - - Encoding of the response content - - - - - String representation of response content - - - - - HTTP response status code - - - - - Description of HTTP status returned - - - - - Response content - - - - - The URL that actually responded to the content (different from request if redirected) - - - - - HttpWebResponse.Server - - - - - Cookies returned by server with the response - - - - - Headers returned by server with the response - - - - - Status of the request. Will return Error for transport errors. - HTTP errors will still return ResponseStatus.Completed, check StatusCode instead - - - - - Transport or other non-HTTP error generated while attempting request - - - - - The exception thrown during the request, if any - - - - - Container for data sent back from API including deserialized data - - Type of data to deserialize to - - - - Deserialized entity data - - - - - Container for data sent back from API - - - - - Wrapper for System.Xml.Serialization.XmlSerializer. - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Encoding for serialized content - - - - - Need to subclass StringWriter in order to override Encoding - - - - - Default JSON serializer for request bodies - Doesn't currently use the SerializeAs attribute, defers to Newtonsoft's attributes - - - - - Default serializer - - - - - Serialize the object as JSON - - Object to serialize - JSON as String - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Unused for JSON Serialization - - - - - Content type for serialized content - - - - - Allows control how class and property names and values are serialized by XmlSerializer - Currently not supported with the JsonSerializer - When specified at the property level the class-level specification is overridden - - - - - Called by the attribute when NameStyle is speficied - - The string to transform - String - - - - The name to use for the serialized element - - - - - Sets the value to be serialized as an Attribute instead of an Element - - - - - The culture to use when serializing - - - - - Transforms the casing of the name based on the selected value. - - - - - The order to serialize the element. Default is int.MaxValue. - - - - - Options for transforming casing of element names - - - - - Default XML Serializer - - - - - Default constructor, does not specify namespace - - - - - Specify the namespaced to be used when serializing - - XML namespace - - - - Serialize the object as XML - - Object to serialize - XML as string - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Name of the root element to use when serializing - - - - - XML namespace to use when serializing - - - - - Format string to use when serializing dates - - - - - Content type for serialized content - - - - - Represents the json array. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The capacity of the json array. - - - - The json representation of the array. - - The json representation of the array. - - - - Represents the json object. - - - - - The internal member dictionary. - - - - - Initializes a new instance of . - - - - - Initializes a new instance of . - - The implementation to use when comparing keys, or null to use the default for the type of the key. - - - - Adds the specified key. - - The key. - The value. - - - - Determines whether the specified key contains key. - - The key. - - true if the specified key contains key; otherwise, false. - - - - - Removes the specified key. - - The key. - - - - - Tries the get value. - - The key. - The value. - - - - - Adds the specified item. - - The item. - - - - Clears this instance. - - - - - Determines whether [contains] [the specified item]. - - The item. - - true if [contains] [the specified item]; otherwise, false. - - - - - Copies to. - - The array. - Index of the array. - - - - Removes the specified item. - - The item. - - - - - Gets the enumerator. - - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Returns a json that represents the current . - - - A json that represents the current . - - - - - Gets the at the specified index. - - - - - - Gets the keys. - - The keys. - - - - Gets the values. - - The values. - - - - Gets or sets the with the specified key. - - - - - - Gets the count. - - The count. - - - - Gets a value indicating whether this instance is read only. - - - true if this instance is read only; otherwise, false. - - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>). - All numbers are parsed to doubles. - - - - - Parses the string json into a value - - A JSON string. - An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false - - - - Try parsing the json string into a value. - - - A JSON string. - - - The object. - - - Returns true if successfull otherwise false. - - - - - Converts a IDictionary<string,object> / IList<object> object into a JSON string - - A IDictionary<string,object> / IList<object> - Serializer strategy to use - A JSON encoded string, or null if object 'json' is not serializable - - - - Determines if a given object is numeric in any way - (can be integer, double, null, etc). - - - - - Helper methods for validating required values - - - - - Require a parameter to not be null - - Name of the parameter - Value of the parameter - - - - Helper methods for validating values - - - - - Validate an integer value is between the specified values (exclusive of min/max) - - Value to validate - Exclusive minimum value - Exclusive maximum value - - - - Validate a string length - - String to be validated - Maximum length of the string - - - - Comment of the cookie - - - - - Comment of the cookie - - - - - Indicates whether the cookie should be discarded at the end of the session - - - - - Domain of the cookie - - - - - Indicates whether the cookie is expired - - - - - Date and time that the cookie expires - - - - - Indicates that this cookie should only be accessed by the server - - - - - Name of the cookie - - - - - Path of the cookie - - - - - Port of the cookie - - - - - Indicates that the cookie should only be sent over secure channels - - - - - Date and time the cookie was created - - - - - Value of the cookie - - - - - Version of the cookie - - - - diff --git a/packages/RestSharp.105.2.3/readme.txt b/packages/RestSharp.105.2.3/readme.txt deleted file mode 100644 index 89a5bded1..000000000 --- a/packages/RestSharp.105.2.3/readme.txt +++ /dev/null @@ -1,20 +0,0 @@ -*** IMPORTANT CHANGE IN RESTSHARP VERSION 103 *** - -In 103.0, JSON.NET was removed as a dependency. - -If this is still installed in your project and no other libraries depend on -it you may remove it from your installed packages. - -There is one breaking change: the default Json*Serializer* is no longer -compatible with Json.NET. To use Json.NET for serialization, copy the code -from https://github.com/restsharp/RestSharp/blob/86b31f9adf049d7fb821de8279154f41a17b36f7/RestSharp/Serializers/JsonSerializer.cs -and register it with your client: - -var client = new RestClient(); -client.JsonSerializer = new YourCustomSerializer(); - -The default Json*Deserializer* is mostly compatible, but it does not support -all features which Json.NET has (like the ability to support a custom [JsonConverter] -by decorating a certain property with an attribute). If you need these features, you -must take care of the deserialization yourself to get it working. - diff --git a/packages/repositories.config b/packages/repositories.config deleted file mode 100644 index 2bfcd809d..000000000 --- a/packages/repositories.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file