diff --git a/README.md b/README.md index 70fb557..14f75a3 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,74 @@ -# worldpay-lib-dotnet +worldpay-lib-dotnet +=================== -This repository consists of four related projects: -* worldpay-lib-dotnet-3-5 and worldpay-lib-dotnet-2-0, the SDKs for .NET 3.5+ and .NET 2.0 -* worldpay-sample-dotnet-3-5 and worldpay-sample-dotnet-2-0, the sample applications for the SDKs +This repository consists of following related projects: +* worldpay-lib-dotnet-3-5 for .NET 3.5 and sample application worldpay-sample-dotnet-3-5 +* worldpay-lib-dotnet-4-0 for .NET 4.0 and sample application worldpay-sample-dotnet-4-0 +* worldpay-lib-dotnet-4-6 for .NET 4.6 and sample application worldpay-sample-dotnet-4-6 -Each of these is contained in a separate directory / VS solution. +Each is a VS solution you can open separately. -#### Issues -Please see our [support contact information]( https://developer.worldpay.com/jsonapi/faq/articles/how-can-i-contact-you-for-support) to raise an issue. +TLS v1.2 support +---------------- + +TLS version 1.0 and 1.1 are no longer supported by this SDK from 4th June, 2018. +Any customers continuing to use TLS 1.0 or 1.1 will be unable to transact. + +Please follow the instructions below to update your application to ensure you are using TLS 1.2. + +.NET 2.0 is no longer supported due to this change. Please update to .NET 3.5 or later to be compatible. + +To test your integration, we have created an endpoint and please use: ```https://api-test.worldpay.com/v1``` instead. + +### .NET 3.5 + +#### Step 1: Install Patch +.NET 3.5 did not initially support TLS 1.2. However, there has been a recent patch available which enables TLS 1.2 support. +Please ensure the appropriate patch below is installed in your application environment:
 + +| OS | Patch | +|---------------------------|-----------------------------------------------------| +| Win7 SP1/Win 2008 R2 SP1 | KB3154518 - Reliability Rollup HR-1605 – NDP 2.0 SP2| +| Win8 RTM/Win 2012 RTM | KB3154519 - Reliability Rollup HR-1605 – NDP 2.0 SP2| +| Win8.1RTM/Win 2012 R2 RTM | KB3154520 - Reliability Rollup HR-1605 – NDP 2.0 SP2| +| Windows 10 | KB3156421 - 1605 HotFix Rollup through Windows Update| + +#### 

Step 2: Replace DLL +You should replace your current ```Worldpay.Sdk.dll``` with the new version 1.2.0.1 for .NET 3.5. + +#### 

Step 3: Add line to code base +The following line should be added to your code. This line explicitly sets the program to use TLS1.2. + +```ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;``` -worldpay-lib-dotnet-3-5 & 2-0 +### .NET 4.0 + +#### Step 1: Ensure .NET 4.5 is installed +.NET 4.0 does not support TLS 1.2, but if you have .NET 4.5 (or above) installed on your system you can use TLS 1.2 even if the application framework your are using does not support it. +Please ensure you install .NET 4.5 or above.
 + +#### 

Step 2: Replace DLL +You should replace you current ```Worldpay.Sdk.dll``` with the new version 1.2.0.1 for .NET 4.0. + +#### 

Step 3: Add line to code base +The following line should be added to your code. This line explicitly sets the program to use TLS1.2. + +```ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;``` + +### .NET 4.6 and above + +#### Step 1: Replace DLL +You should replace your current ```Worldpay.Sdk.dll``` with the new version 1.2.0.1 for .NET 4.6. + +#### Step 2: Make TLS 1.2 default +.NET 4.6 and above supports TLS 1.2, but it is not a default protocol. You will need to add the following line to your code base to ensure the connection uses TLS 1.2. + +```ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12``` + +worldpay-lib-dotnet ------------------- -DotNet Library for Worldpay REST API (.NET 3.5+, .NET 2.0) +DotNet Library for Worldpay REST API (.NET 3.5+) ## Usage @@ -50,7 +106,7 @@ try { } ``` -worldpay-sample-dotnet-3-5 & 2-0 +worldpay-sample-dotnet ------------------- C# ASP .NET sample application which demonstrates integration with Worldpay API. @@ -58,7 +114,7 @@ C# ASP .NET sample application which demonstrates integration with Worldpay API. ### Prerequisites - A .NET-enabled development environment, such as Visual Studio or SharpDevelop. These below instructions assume you're using Visual Studio. -- .NET Framework 3.5 +- .NET Framework 3.5+ ### Instructions @@ -68,3 +124,7 @@ C# ASP .NET sample application which demonstrates integration with Worldpay API. - Also in Web.config, set OrderLog to a location on your server which has read/write access permissions for your web server. In IIS on Windows, this usually means granting access to IUSR and IIS_IUSRS via the Windows Explorer folder properties dialog. - Visual Studio users can now be able to run the application simply by opening the page 'CreateOrder.aspx' and clicking the 'run' button from the toolbar. - To test credit card transactions via the IDE, simply fill out the details on the page and submit. + +Issues +------ +Please see our [support contact information]( https://developer.worldpay.com/jsonapi/faq/articles/how-can-i-contact-you-for-support) to raise an issue. diff --git a/Release.24.1.2017.zip b/Release.24.1.2017.zip deleted file mode 100755 index cf65a66..0000000 Binary files a/Release.24.1.2017.zip and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.dll deleted file mode 100755 index c31f72f..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.pdb deleted file mode 100644 index f3af237..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.pdb and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.Test.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.Test.dll deleted file mode 100755 index d718044..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.Test.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.dll deleted file mode 100755 index d2e1164..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.pdb b/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.pdb deleted file mode 100755 index e6c02b0..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.pdb and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll deleted file mode 100644 index 1f798cc..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll deleted file mode 100644 index 92677e0..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll deleted file mode 100644 index ae86e28..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb deleted file mode 100644 index fac813c..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/Newtonsoft.Json.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/Newtonsoft.Json.dll deleted file mode 100755 index c31f72f..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/Newtonsoft.Json.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/Newtonsoft.Json.pdb deleted file mode 100755 index 80af873..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/Newtonsoft.Json.pdb and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/WorldPay.Sdk.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/WorldPay.Sdk.dll deleted file mode 100755 index d2e1164..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/WorldPay.Sdk.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/WorldPay.Sdk.pdb b/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/WorldPay.Sdk.pdb deleted file mode 100755 index e6c02b0..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/WorldPay.Sdk.pdb and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/Newtonsoft.Json.pdb deleted file mode 100755 index 2a04869..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/Newtonsoft.Json.pdb and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/WorldPay.Sdk.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/WorldPay.Sdk.dll deleted file mode 100755 index 1317955..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/WorldPay.Sdk.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/WorldPay.Sdk.pdb b/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/WorldPay.Sdk.pdb deleted file mode 100755 index 9b582ea..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/WorldPay.Sdk.pdb and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll b/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll deleted file mode 100644 index ae86e28..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll and /dev/null differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Worldpay.Sdk.pdb deleted file mode 100644 index fac813c..0000000 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Worldpay.Sdk.pdb and /dev/null differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/App.config b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/App.config index 1305bdd..636dde0 100644 --- a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/App.config +++ b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/App.config @@ -1,4 +1,4 @@ - + diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj index bfb5e2f..8608c32 100644 --- a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj +++ b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -26,6 +26,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -34,6 +35,7 @@ TRACE prompt 4 + false diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll index 11091a3..ae2ac38 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config index 1305bdd..636dde0 100644 --- a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config +++ b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config @@ -1,4 +1,4 @@ - + diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb index b48e087..4a2ee9e 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll index 53d675d..a86a71f 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb index dc53f44..ed5785c 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll index 92677e0..05be320 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config index 1305bdd..636dde0 100644 --- a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config +++ b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config @@ -1,4 +1,4 @@ - + diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb index a8a5320..0efe92e 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll index ae86e28..7443f53 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb index fac813c..6440d24 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/App.config b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/App.config index f9fb7e9..f32ab1f 100644 --- a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/App.config +++ b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/App.config @@ -1,12 +1,28 @@ - - - - - - - + + + + + + + + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Http.cs b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Http.cs index c0a9a23..21462a0 100644 --- a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Http.cs +++ b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Http.cs @@ -130,6 +130,8 @@ private HttpWebRequest CreateRequest(string api, RequestMethod method, object da request.Accept = ApplicationJson; request.Timeout = ConnectionTimeout; + request.Headers.Add("x-wp-client-user-agent", "NET-Client-3_5"); + switch (method) { case RequestMethod.Get: diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Json/EntryConvertcs.cs b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Json/EntryConvertcs.cs old mode 100755 new mode 100644 diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Properties/AssemblyInfo.cs b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Properties/AssemblyInfo.cs index ce853d0..b937a9f 100644 --- a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Properties/AssemblyInfo.cs +++ b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 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("1.2.0.0")] -[assembly: AssemblyFileVersion("1.2.0.0")] +[assembly: AssemblyVersion("1.2.0.1")] +[assembly: AssemblyFileVersion("1.2.0.1")] diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Worldpay.Sdk.csproj b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Worldpay.Sdk.csproj old mode 100755 new mode 100644 diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Worldpay.Sdk35.csproj b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Worldpay.Sdk35.csproj index 3588230..b19dbbd 100644 --- a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Worldpay.Sdk35.csproj +++ b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/Worldpay.Sdk35.csproj @@ -1,5 +1,5 @@  - + Debug @@ -41,6 +41,7 @@ + diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.dll b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.dll index 53d675d..7443f53 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.dll and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.dll differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config index f9fb7e9..f32ab1f 100644 --- a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config +++ b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config @@ -1,12 +1,28 @@ - - - - - - - + + + + + + + + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.pdb index dc53f44..6440d24 100644 Binary files a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.pdb and b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/bin/Worldpay.Sdk.pdb differ diff --git a/worldpay-lib-dotnet-3-5/Worldpay.Sdk/lib/Newtonsoft.Json.dll b/worldpay-lib-dotnet-3-5/Worldpay.Sdk/lib/Newtonsoft.Json.dll old mode 100755 new mode 100644 diff --git a/worldpay-sample-dotnet-2-0/.gitignore b/worldpay-lib-dotnet-4-0/.gitignore similarity index 100% rename from worldpay-sample-dotnet-2-0/.gitignore rename to worldpay-lib-dotnet-4-0/.gitignore diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/HtmlColorConverter.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/HtmlColorConverter.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/HtmlColorConverter.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/HtmlColorConverter.cs index 3027b12..71c09fa 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/HtmlColorConverter.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/HtmlColorConverter.cs @@ -1,71 +1,71 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; - -namespace Newtonsoft.Json.Converters -{ - /// - /// Converts a object to and from JSON. - /// - public class HtmlColorConverter : JsonConverter - { - /// - /// Writes the JSON representation of the object. - /// - /// The to write to. - /// The value. - public override void WriteJson(JsonWriter writer, object value) - { - writer.WriteValue(ColorTranslator.ToHtml((Color)value)); - } - - /// - /// Determines whether this instance can convert the specified value type. - /// - /// Type of the value. - /// - /// true if this instance can convert the specified value type; otherwise, false. - /// - public override bool CanConvert(Type valueType) - { - return typeof(Color).IsAssignableFrom(valueType); - } - - /// - /// Reads the JSON representation of the object. - /// - /// The to read from. - /// Type of the object. - /// The object value. - public override object ReadJson(JsonReader reader, Type objectType) - { - throw new NotImplementedException(); - } - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Drawing; + +namespace Newtonsoft.Json.Converters +{ + /// + /// Converts a object to and from JSON. + /// + public class HtmlColorConverter : JsonConverter + { + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public override void WriteJson(JsonWriter writer, object value) + { + writer.WriteValue(ColorTranslator.ToHtml((Color)value)); + } + + /// + /// Determines whether this instance can convert the specified value type. + /// + /// Type of the value. + /// + /// true if this instance can convert the specified value type; otherwise, false. + /// + public override bool CanConvert(Type valueType) + { + return typeof(Color).IsAssignableFrom(valueType); + } + + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public override object ReadJson(JsonReader reader, Type objectType) + { + throw new NotImplementedException(); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs index 9786612..dad4e0d 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs @@ -1,90 +1,90 @@ -using System; -using System.Globalization; -using Newtonsoft.Json.Utilities; - -namespace Newtonsoft.Json.Converters -{ - /// - /// Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). - /// - public class IsoDateTimeConverter : JsonConverter - { - private const string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK"; - - private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind; - - /// - /// Gets or sets the date time styles used when converting a date to and from JSON. - /// - /// The date time styles used when converting a date to and from JSON. - public DateTimeStyles DateTimeStyles - { - get { return _dateTimeStyles; } - set { _dateTimeStyles = value; } - } - - /// - /// Writes the JSON representation of the object. - /// - /// The to write to. - /// The value. - public override void WriteJson(JsonWriter writer, object value) - { - string text; - - if (value is DateTime) - { - DateTime dateTime = (DateTime)value; - - if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal - || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal) - dateTime = dateTime.ToUniversalTime(); - - text = dateTime.ToString(DateTimeFormat, CultureInfo.InvariantCulture); - } - else - { - DateTimeOffset dateTimeOffset = (DateTimeOffset)value; - if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal - || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal) - dateTimeOffset = dateTimeOffset.ToUniversalTime(); - - text = dateTimeOffset.ToString(DateTimeFormat, CultureInfo.InvariantCulture); - } - - writer.WriteValue(text); - } - - /// - /// Reads the JSON representation of the object. - /// - /// The to read from. - /// Type of the object. - /// The object value. - public override object ReadJson(JsonReader reader, Type objectType) - { - if (reader.TokenType != JsonToken.String) - throw new Exception("Unexpected token parsing date. Expected String, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); - - string dateText = reader.Value.ToString(); - - if (objectType == typeof(DateTimeOffset)) - return DateTimeOffset.Parse(dateText, CultureInfo.InvariantCulture, _dateTimeStyles); - - return DateTime.Parse(dateText, CultureInfo.InvariantCulture, _dateTimeStyles); - } - - /// - /// Determines whether this instance can convert the specified object type. - /// - /// Type of the object. - /// - /// true if this instance can convert the specified object type; otherwise, false. - /// - public override bool CanConvert(Type objectType) - { - return (typeof(DateTime).IsAssignableFrom(objectType) - || typeof(DateTimeOffset).IsAssignableFrom(objectType)); - } - } +using System; +using System.Globalization; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Converters +{ + /// + /// Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + /// + public class IsoDateTimeConverter : JsonConverter + { + private const string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK"; + + private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind; + + /// + /// Gets or sets the date time styles used when converting a date to and from JSON. + /// + /// The date time styles used when converting a date to and from JSON. + public DateTimeStyles DateTimeStyles + { + get { return _dateTimeStyles; } + set { _dateTimeStyles = value; } + } + + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public override void WriteJson(JsonWriter writer, object value) + { + string text; + + if (value is DateTime) + { + DateTime dateTime = (DateTime)value; + + if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal + || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal) + dateTime = dateTime.ToUniversalTime(); + + text = dateTime.ToString(DateTimeFormat, CultureInfo.InvariantCulture); + } + else + { + DateTimeOffset dateTimeOffset = (DateTimeOffset)value; + if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal + || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal) + dateTimeOffset = dateTimeOffset.ToUniversalTime(); + + text = dateTimeOffset.ToString(DateTimeFormat, CultureInfo.InvariantCulture); + } + + writer.WriteValue(text); + } + + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public override object ReadJson(JsonReader reader, Type objectType) + { + if (reader.TokenType != JsonToken.String) + throw new Exception("Unexpected token parsing date. Expected String, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); + + string dateText = reader.Value.ToString(); + + if (objectType == typeof(DateTimeOffset)) + return DateTimeOffset.Parse(dateText, CultureInfo.InvariantCulture, _dateTimeStyles); + + return DateTime.Parse(dateText, CultureInfo.InvariantCulture, _dateTimeStyles); + } + + /// + /// Determines whether this instance can convert the specified object type. + /// + /// Type of the object. + /// + /// true if this instance can convert the specified object type; otherwise, false. + /// + public override bool CanConvert(Type objectType) + { + return (typeof(DateTime).IsAssignableFrom(objectType) + || typeof(DateTimeOffset).IsAssignableFrom(objectType)); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs index 9887b79..5704d6a 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs @@ -1,83 +1,83 @@ -using System; -using System.Globalization; -using Newtonsoft.Json.Utilities; - -namespace Newtonsoft.Json.Converters -{ - /// - /// Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). - /// - public class JavaScriptDateTimeConverter : JsonConverter - { - /// - /// Writes the JSON representation of the object. - /// - /// The to write to. - /// The value. - public override void WriteJson(JsonWriter writer, object value) - { - long ticks; - - if (value is DateTime) - { - DateTime dateTime = (DateTime)value; - DateTime utcDateTime = dateTime.ToUniversalTime(); - ticks = JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(utcDateTime); - } - else - { - DateTimeOffset dateTimeOffset = (DateTimeOffset)value; - DateTimeOffset utcDateTimeOffset = dateTimeOffset.ToUniversalTime(); - ticks = JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(utcDateTimeOffset.UtcDateTime); - } - - writer.WriteStartConstructor("Date"); - writer.WriteValue(ticks); - writer.WriteEndConstructor(); - } - - /// - /// Reads the JSON representation of the object. - /// - /// The to read from. - /// Type of the object. - /// The object value. - public override object ReadJson(JsonReader reader, Type objectType) - { - if (reader.TokenType != JsonToken.StartConstructor || string.Compare(reader.Value.ToString(), "Date", StringComparison.Ordinal) != 0) - throw new Exception("Unexpected token or value when parsing date. Token: {0}, Value: {1}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType, reader.Value)); - - reader.Read(); - - if (reader.TokenType != JsonToken.Integer) - throw new Exception("Unexpected token parsing date. Expected Integer, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); - - long ticks = (long)reader.Value; - - DateTime d = JavaScriptConvert.ConvertJavaScriptTicksToDateTime(ticks); - - reader.Read(); - - if (reader.TokenType != JsonToken.EndConstructor) - throw new Exception("Unexpected token parsing date. Expected EndConstructor, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); - - if (objectType == typeof(DateTimeOffset)) - return new DateTimeOffset(d); - - return d; - } - - /// - /// Determines whether this instance can convert the specified object type. - /// - /// Type of the object. - /// - /// true if this instance can convert the specified object type; otherwise, false. - /// - public override bool CanConvert(Type objectType) - { - return (typeof(DateTime).IsAssignableFrom(objectType) - || typeof(DateTimeOffset).IsAssignableFrom(objectType)); - } - } +using System; +using System.Globalization; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Converters +{ + /// + /// Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + /// + public class JavaScriptDateTimeConverter : JsonConverter + { + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public override void WriteJson(JsonWriter writer, object value) + { + long ticks; + + if (value is DateTime) + { + DateTime dateTime = (DateTime)value; + DateTime utcDateTime = dateTime.ToUniversalTime(); + ticks = JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(utcDateTime); + } + else + { + DateTimeOffset dateTimeOffset = (DateTimeOffset)value; + DateTimeOffset utcDateTimeOffset = dateTimeOffset.ToUniversalTime(); + ticks = JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(utcDateTimeOffset.UtcDateTime); + } + + writer.WriteStartConstructor("Date"); + writer.WriteValue(ticks); + writer.WriteEndConstructor(); + } + + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public override object ReadJson(JsonReader reader, Type objectType) + { + if (reader.TokenType != JsonToken.StartConstructor || string.Compare(reader.Value.ToString(), "Date", StringComparison.Ordinal) != 0) + throw new Exception("Unexpected token or value when parsing date. Token: {0}, Value: {1}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType, reader.Value)); + + reader.Read(); + + if (reader.TokenType != JsonToken.Integer) + throw new Exception("Unexpected token parsing date. Expected Integer, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); + + long ticks = (long)reader.Value; + + DateTime d = JavaScriptConvert.ConvertJavaScriptTicksToDateTime(ticks); + + reader.Read(); + + if (reader.TokenType != JsonToken.EndConstructor) + throw new Exception("Unexpected token parsing date. Expected EndConstructor, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); + + if (objectType == typeof(DateTimeOffset)) + return new DateTimeOffset(d); + + return d; + } + + /// + /// Determines whether this instance can convert the specified object type. + /// + /// Type of the object. + /// + /// true if this instance can convert the specified object type; otherwise, false. + /// + public override bool CanConvert(Type objectType) + { + return (typeof(DateTime).IsAssignableFrom(objectType) + || typeof(DateTimeOffset).IsAssignableFrom(objectType)); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/JsonDateTimeSerializationMode.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/JsonDateTimeSerializationMode.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/JsonDateTimeSerializationMode.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/JsonDateTimeSerializationMode.cs index 25c72f9..ab53622 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/JsonDateTimeSerializationMode.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/JsonDateTimeSerializationMode.cs @@ -1,25 +1,25 @@ -namespace Newtonsoft.Json.Converters -{ - /// - /// Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. - /// - public enum JsonDateTimeSerializationMode - { - /// - /// The time represented is local time. - /// - Local, - /// - /// The time represented is UTC. - /// - Utc, - /// - /// The time represented is not specified as either local time or Coordinated Universal Time (UTC). - /// - Unspecified, - /// - /// Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. - /// - RoundtripKind - } +namespace Newtonsoft.Json.Converters +{ + /// + /// Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + /// + public enum JsonDateTimeSerializationMode + { + /// + /// The time represented is local time. + /// + Local, + /// + /// The time represented is UTC. + /// + Utc, + /// + /// The time represented is not specified as either local time or Coordinated Universal Time (UTC). + /// + Unspecified, + /// + /// Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + /// + RoundtripKind + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/XmlNodeConverter.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/XmlNodeConverter.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/XmlNodeConverter.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/XmlNodeConverter.cs index 2b52aea..79d8c56 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Converters/XmlNodeConverter.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Converters/XmlNodeConverter.cs @@ -1,552 +1,552 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Xml; -using Newtonsoft.Json.Utilities; - -namespace Newtonsoft.Json.Converters -{ - /// - /// Converts an to and from JSON. - /// - public class XmlNodeConverter : JsonConverter - { - private const string TextName = "#text"; - private const string CommentName = "#comment"; - private const string CDataName = "#cdata-section"; - private const string WhitespaceName = "#whitespace"; - private const string SignificantWhitespaceName = "#significant-whitespace"; - private const string DeclarationName = "?xml"; - private const string JsonNamespaceUri = "http://james.newtonking.com/projects/json"; - - #region Writing - /// - /// Writes the JSON representation of the object. - /// - /// The to write to. - /// The value. - public override void WriteJson(JsonWriter writer, object value) - { - XmlNode node = value as XmlNode; - - if (node == null) - throw new ArgumentException("Value must be an XmlNode", "value"); - - writer.WriteStartObject(); - SerializeNode(writer, node, true); - writer.WriteEndObject(); - } - - private string GetPropertyName(XmlNode node) - { - switch (node.NodeType) - { - case XmlNodeType.Attribute: - return "@" + node.Name; - case XmlNodeType.CDATA: - return CDataName; - case XmlNodeType.Comment: - return CommentName; - case XmlNodeType.Element: - return node.Name; - case XmlNodeType.ProcessingInstruction: - return "?" + node.Name; - case XmlNodeType.XmlDeclaration: - return DeclarationName; - case XmlNodeType.SignificantWhitespace: - return SignificantWhitespaceName; - case XmlNodeType.Text: - return TextName; - case XmlNodeType.Whitespace: - return WhitespaceName; - default: - throw new JsonSerializationException("Unexpected XmlNodeType when getting node name: " + node.NodeType); - } - } - - private void SerializeGroupedNodes(JsonWriter writer, XmlNode node) - { - // group nodes together by name - Dictionary> nodesGroupedByName = new Dictionary>(); - - for (int i = 0; i < node.ChildNodes.Count; i++) - { - XmlNode childNode = node.ChildNodes[i]; - string nodeName = GetPropertyName(childNode); - - List nodes; - if (!nodesGroupedByName.TryGetValue(nodeName, out nodes)) - { - nodes = new List(); - nodesGroupedByName.Add(nodeName, nodes); - } - - nodes.Add(childNode); - } - - // loop through grouped nodes. write single name instances as normal, - // write multiple names together in an array - foreach (KeyValuePair> nodeNameGroup in nodesGroupedByName) - { - List groupedNodes = nodeNameGroup.Value; - bool writeArray; - - if (groupedNodes.Count == 1) - { - XmlNode singleNode = groupedNodes[0]; - XmlAttribute jsonArrayAttribute = (singleNode.Attributes != null) ? singleNode.Attributes["Array", JsonNamespaceUri] : null; - if (jsonArrayAttribute != null) - writeArray = XmlConvert.ToBoolean(jsonArrayAttribute.Value); - else - writeArray = false; - } - else - { - writeArray = true; - } - - if (!writeArray) - { - SerializeNode(writer, groupedNodes[0], true); - } - else - { - string elementNames = nodeNameGroup.Key; - writer.WritePropertyName(nodeNameGroup.Key); - writer.WriteStartArray(); - - for (int i = 0; i < groupedNodes.Count; i++) - { - SerializeNode(writer, groupedNodes[i], false); - } - - writer.WriteEndArray(); - } - } - } - - private void SerializeNode(JsonWriter writer, XmlNode node, bool writePropertyName) - { - switch (node.NodeType) - { - case XmlNodeType.Document: - case XmlNodeType.DocumentFragment: - SerializeGroupedNodes(writer, node); - break; - case XmlNodeType.Element: - if (writePropertyName) - writer.WritePropertyName(node.Name); - - if (ValueAttributes(node.Attributes).Count() == 0 && node.ChildNodes.Count == 1 - && node.ChildNodes[0].NodeType == XmlNodeType.Text) - { - // write elements with a single text child as a name value pair - writer.WriteValue(node.ChildNodes[0].Value); - } - else if (node.ChildNodes.Count == 0 && CollectionUtils.IsNullOrEmpty(node.Attributes)) - { - // empty element - writer.WriteNull(); - } - else if (node.ChildNodes.OfType().Where(x => x.Name.StartsWith("-")).Count() > 1) - { - XmlElement constructorValueElement = node.ChildNodes.OfType().Where(x => x.Name.StartsWith("-")).First(); - string constructorName = constructorValueElement.Name.Substring(1); - - writer.WriteStartConstructor(constructorName); - - for (int i = 0; i < node.ChildNodes.Count; i++) - { - SerializeNode(writer, node.ChildNodes[i], false); - } - - writer.WriteEndConstructor(); - } - else - { - writer.WriteStartObject(); - - for (int i = 0; i < node.Attributes.Count; i++) - { - SerializeNode(writer, node.Attributes[i], true); - } - - SerializeGroupedNodes(writer, node); - - writer.WriteEndObject(); - } - - break; - case XmlNodeType.Comment: - if (writePropertyName) - writer.WriteComment(node.Value); - break; - case XmlNodeType.Attribute: - case XmlNodeType.Text: - case XmlNodeType.CDATA: - case XmlNodeType.ProcessingInstruction: - case XmlNodeType.Whitespace: - case XmlNodeType.SignificantWhitespace: - if (node.Prefix == "xmlns" && node.Value == JsonNamespaceUri) - break; - else if (node.NamespaceURI == JsonNamespaceUri) - break; - - if (writePropertyName) - writer.WritePropertyName(GetPropertyName(node)); - writer.WriteValue(node.Value); - break; - case XmlNodeType.XmlDeclaration: - XmlDeclaration declaration = (XmlDeclaration)node; - writer.WritePropertyName(GetPropertyName(node)); - writer.WriteStartObject(); - - if (!string.IsNullOrEmpty(declaration.Version)) - { - writer.WritePropertyName("@version"); - writer.WriteValue(declaration.Version); - } - if (!string.IsNullOrEmpty(declaration.Encoding)) - { - writer.WritePropertyName("@encoding"); - writer.WriteValue(declaration.Encoding); - } - if (!string.IsNullOrEmpty(declaration.Standalone)) - { - writer.WritePropertyName("@standalone"); - writer.WriteValue(declaration.Standalone); - } - - writer.WriteEndObject(); - break; - default: - throw new JsonSerializationException("Unexpected XmlNodeType when serializing nodes: " + node.NodeType); - } - } - #endregion - - #region Reading - /// - /// Reads the JSON representation of the object. - /// - /// The to read from. - /// Type of the object. - /// The object value. - public override object ReadJson(JsonReader reader, Type objectType) - { - // maybe have CanReader and a CanWrite methods so this sort of test wouldn't be necessary - if (objectType != typeof(XmlDocument)) - throw new JsonSerializationException("XmlNodeConverter only supports deserializing XmlDocuments"); - - XmlDocument document = new XmlDocument(); - XmlNamespaceManager manager = new XmlNamespaceManager(document.NameTable); - - if (reader.TokenType != JsonToken.StartObject) - throw new JsonSerializationException("XmlNodeConverter can only convert JSON that begins with an object."); - - reader.Read(); - - DeserializeNode(reader, document, manager, document); - - return document; - } - - private void DeserializeValue(JsonReader reader, XmlDocument document, XmlNamespaceManager manager, string propertyName, XmlNode currentNode) - { - switch (propertyName) - { - case TextName: - currentNode.AppendChild(document.CreateTextNode(reader.Value.ToString())); - break; - case CDataName: - currentNode.AppendChild(document.CreateCDataSection(reader.Value.ToString())); - break; - case WhitespaceName: - currentNode.AppendChild(document.CreateWhitespace(reader.Value.ToString())); - break; - case SignificantWhitespaceName: - currentNode.AppendChild(document.CreateSignificantWhitespace(reader.Value.ToString())); - break; - default: - // processing instructions and the xml declaration start with ? - if (!string.IsNullOrEmpty(propertyName) && propertyName[0] == '?') - { - if (propertyName == DeclarationName) - { - string version = null; - string encoding = null; - string standalone = null; - while (reader.Read() && reader.TokenType != JsonToken.EndObject) - { - switch (reader.Value.ToString()) - { - case "@version": - reader.Read(); - version = reader.Value.ToString(); - break; - case "@encoding": - reader.Read(); - encoding = reader.Value.ToString(); - break; - case "@standalone": - reader.Read(); - standalone = reader.Value.ToString(); - break; - default: - throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value); - } - } - - XmlDeclaration declaration = document.CreateXmlDeclaration(version, encoding, standalone); - currentNode.AppendChild(declaration); - } - else - { - XmlProcessingInstruction instruction = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString()); - currentNode.AppendChild(instruction); - } - } - else - { - // deserialize xml element - bool finishedAttributes = false; - bool finishedElement = false; - string elementPrefix = GetPrefix(propertyName); - Dictionary attributeNameValues = new Dictionary(); - - // a string token means the element only has a single text child - if (reader.TokenType != JsonToken.String - && reader.TokenType != JsonToken.Null - && reader.TokenType != JsonToken.Boolean - && reader.TokenType != JsonToken.Integer - && reader.TokenType != JsonToken.Float - && reader.TokenType != JsonToken.Date - && reader.TokenType != JsonToken.StartConstructor) - { - // read properties until first non-attribute is encountered - while (!finishedAttributes && !finishedElement && reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.PropertyName: - string attributeName = reader.Value.ToString(); - - if (attributeName[0] == '@') - { - attributeName = attributeName.Substring(1); - reader.Read(); - string attributeValue = reader.Value.ToString(); - attributeNameValues.Add(attributeName, attributeValue); - - string namespacePrefix; - - if (IsNamespaceAttribute(attributeName, out namespacePrefix)) - { - manager.AddNamespace(namespacePrefix, attributeValue); - } - } - else - { - finishedAttributes = true; - } - break; - case JsonToken.EndObject: - finishedElement = true; - break; - default: - throw new JsonSerializationException("Unexpected JsonToken: " + reader.TokenType); - } - } - } - - // have to wait until attributes have been parsed before creating element - // attributes may contain namespace info used by the element - XmlElement element = (!string.IsNullOrEmpty(elementPrefix)) - ? document.CreateElement(propertyName, manager.LookupNamespace(elementPrefix)) - : document.CreateElement(propertyName); - - currentNode.AppendChild(element); - - // add attributes to newly created element - foreach (KeyValuePair nameValue in attributeNameValues) - { - string attributePrefix = GetPrefix(nameValue.Key); - - XmlAttribute attribute = (!string.IsNullOrEmpty(attributePrefix)) - ? document.CreateAttribute(nameValue.Key, manager.LookupNamespace(attributePrefix)) - : document.CreateAttribute(nameValue.Key); - - attribute.Value = nameValue.Value; - - element.SetAttributeNode(attribute); - } - - if (reader.TokenType == JsonToken.String) - { - element.AppendChild(document.CreateTextNode(reader.Value.ToString())); - } - else if (reader.TokenType == JsonToken.Integer) - { - element.AppendChild(document.CreateTextNode(XmlConvert.ToString((long)reader.Value))); - } - else if (reader.TokenType == JsonToken.Float) - { - element.AppendChild(document.CreateTextNode(XmlConvert.ToString((double)reader.Value))); - } - else if (reader.TokenType == JsonToken.Boolean) - { - element.AppendChild(document.CreateTextNode(XmlConvert.ToString((bool)reader.Value))); - } - else if (reader.TokenType == JsonToken.Date) - { - DateTime d = (DateTime)reader.Value; - element.AppendChild(document.CreateTextNode(XmlConvert.ToString(d, DateTimeUtils.ToSerializationMode(d.Kind)))); - } - else if (reader.TokenType == JsonToken.Null) - { - // empty element. do nothing - } - else - { - // finished element will have no children to deserialize - if (!finishedElement) - { - manager.PushScope(); - - DeserializeNode(reader, document, manager, element); - - manager.PopScope(); - } - } - } - break; - } - } - - private void DeserializeNode(JsonReader reader, XmlDocument document, XmlNamespaceManager manager, XmlNode currentNode) - { - do - { - switch (reader.TokenType) - { - case JsonToken.PropertyName: - if (currentNode.NodeType == XmlNodeType.Document && document.DocumentElement != null) - throw new JsonSerializationException("JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document."); - - string propertyName = reader.Value.ToString(); - reader.Read(); - - if (reader.TokenType == JsonToken.StartArray) - { - while (reader.Read() && reader.TokenType != JsonToken.EndArray) - { - DeserializeValue(reader, document, manager, propertyName, currentNode); - } - } - else - { - DeserializeValue(reader, document, manager, propertyName, currentNode); - } - break; - case JsonToken.StartConstructor: - string constructorName = reader.Value.ToString(); - - while (reader.Read() && reader.TokenType != JsonToken.EndConstructor) - { - DeserializeValue(reader, document, manager, "-" + constructorName, currentNode); - } - break; - case JsonToken.EndObject: - case JsonToken.EndArray: - return; - default: - throw new JsonSerializationException("Unexpected JsonToken when deserializing node: " + reader.TokenType); - } - } while (reader.TokenType == JsonToken.PropertyName || reader.Read()); - // don't read if current token is a property. token was already read when parsing element attributes - } - - /// - /// Checks if the attributeName is a namespace attribute. - /// - /// Attribute name to test. - /// The attribute name prefix if it has one, otherwise an empty string. - /// True if attribute name is for a namespace attribute, otherwise false. - private bool IsNamespaceAttribute(string attributeName, out string prefix) - { - if (attributeName.StartsWith("xmlns", StringComparison.Ordinal)) - { - if (attributeName.Length == 5) - { - prefix = string.Empty; - return true; - } - else if (attributeName[5] == ':') - { - prefix = attributeName.Substring(6, attributeName.Length - 6); - return true; - } - } - prefix = null; - return false; - } - - private string GetPrefix(string qualifiedName) - { - int colonPosition = qualifiedName.IndexOf(':'); - - if ((colonPosition == -1 || colonPosition == 0) || (qualifiedName.Length - 1) == colonPosition) - return string.Empty; - else - return qualifiedName.Substring(0, colonPosition); - } - - private IEnumerable ValueAttributes(XmlAttributeCollection c) - { - return c.OfType().Where(a => a.NamespaceURI != JsonNamespaceUri); - } - - private IEnumerable ValueNodes(XmlNodeList c) - { - return c.OfType().Where(n => n.NamespaceURI != JsonNamespaceUri); - } - #endregion - - /// - /// Determines whether this instance can convert the specified value type. - /// - /// Type of the value. - /// - /// true if this instance can convert the specified value type; otherwise, false. - /// - public override bool CanConvert(Type valueType) - { - return typeof(XmlNode).IsAssignableFrom(valueType); - } - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Converters +{ + /// + /// Converts an to and from JSON. + /// + public class XmlNodeConverter : JsonConverter + { + private const string TextName = "#text"; + private const string CommentName = "#comment"; + private const string CDataName = "#cdata-section"; + private const string WhitespaceName = "#whitespace"; + private const string SignificantWhitespaceName = "#significant-whitespace"; + private const string DeclarationName = "?xml"; + private const string JsonNamespaceUri = "http://james.newtonking.com/projects/json"; + + #region Writing + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public override void WriteJson(JsonWriter writer, object value) + { + XmlNode node = value as XmlNode; + + if (node == null) + throw new ArgumentException("Value must be an XmlNode", "value"); + + writer.WriteStartObject(); + SerializeNode(writer, node, true); + writer.WriteEndObject(); + } + + private string GetPropertyName(XmlNode node) + { + switch (node.NodeType) + { + case XmlNodeType.Attribute: + return "@" + node.Name; + case XmlNodeType.CDATA: + return CDataName; + case XmlNodeType.Comment: + return CommentName; + case XmlNodeType.Element: + return node.Name; + case XmlNodeType.ProcessingInstruction: + return "?" + node.Name; + case XmlNodeType.XmlDeclaration: + return DeclarationName; + case XmlNodeType.SignificantWhitespace: + return SignificantWhitespaceName; + case XmlNodeType.Text: + return TextName; + case XmlNodeType.Whitespace: + return WhitespaceName; + default: + throw new JsonSerializationException("Unexpected XmlNodeType when getting node name: " + node.NodeType); + } + } + + private void SerializeGroupedNodes(JsonWriter writer, XmlNode node) + { + // group nodes together by name + Dictionary> nodesGroupedByName = new Dictionary>(); + + for (int i = 0; i < node.ChildNodes.Count; i++) + { + XmlNode childNode = node.ChildNodes[i]; + string nodeName = GetPropertyName(childNode); + + List nodes; + if (!nodesGroupedByName.TryGetValue(nodeName, out nodes)) + { + nodes = new List(); + nodesGroupedByName.Add(nodeName, nodes); + } + + nodes.Add(childNode); + } + + // loop through grouped nodes. write single name instances as normal, + // write multiple names together in an array + foreach (KeyValuePair> nodeNameGroup in nodesGroupedByName) + { + List groupedNodes = nodeNameGroup.Value; + bool writeArray; + + if (groupedNodes.Count == 1) + { + XmlNode singleNode = groupedNodes[0]; + XmlAttribute jsonArrayAttribute = (singleNode.Attributes != null) ? singleNode.Attributes["Array", JsonNamespaceUri] : null; + if (jsonArrayAttribute != null) + writeArray = XmlConvert.ToBoolean(jsonArrayAttribute.Value); + else + writeArray = false; + } + else + { + writeArray = true; + } + + if (!writeArray) + { + SerializeNode(writer, groupedNodes[0], true); + } + else + { + string elementNames = nodeNameGroup.Key; + writer.WritePropertyName(nodeNameGroup.Key); + writer.WriteStartArray(); + + for (int i = 0; i < groupedNodes.Count; i++) + { + SerializeNode(writer, groupedNodes[i], false); + } + + writer.WriteEndArray(); + } + } + } + + private void SerializeNode(JsonWriter writer, XmlNode node, bool writePropertyName) + { + switch (node.NodeType) + { + case XmlNodeType.Document: + case XmlNodeType.DocumentFragment: + SerializeGroupedNodes(writer, node); + break; + case XmlNodeType.Element: + if (writePropertyName) + writer.WritePropertyName(node.Name); + + if (ValueAttributes(node.Attributes).Count() == 0 && node.ChildNodes.Count == 1 + && node.ChildNodes[0].NodeType == XmlNodeType.Text) + { + // write elements with a single text child as a name value pair + writer.WriteValue(node.ChildNodes[0].Value); + } + else if (node.ChildNodes.Count == 0 && CollectionUtils.IsNullOrEmpty(node.Attributes)) + { + // empty element + writer.WriteNull(); + } + else if (node.ChildNodes.OfType().Where(x => x.Name.StartsWith("-")).Count() > 1) + { + XmlElement constructorValueElement = node.ChildNodes.OfType().Where(x => x.Name.StartsWith("-")).First(); + string constructorName = constructorValueElement.Name.Substring(1); + + writer.WriteStartConstructor(constructorName); + + for (int i = 0; i < node.ChildNodes.Count; i++) + { + SerializeNode(writer, node.ChildNodes[i], false); + } + + writer.WriteEndConstructor(); + } + else + { + writer.WriteStartObject(); + + for (int i = 0; i < node.Attributes.Count; i++) + { + SerializeNode(writer, node.Attributes[i], true); + } + + SerializeGroupedNodes(writer, node); + + writer.WriteEndObject(); + } + + break; + case XmlNodeType.Comment: + if (writePropertyName) + writer.WriteComment(node.Value); + break; + case XmlNodeType.Attribute: + case XmlNodeType.Text: + case XmlNodeType.CDATA: + case XmlNodeType.ProcessingInstruction: + case XmlNodeType.Whitespace: + case XmlNodeType.SignificantWhitespace: + if (node.Prefix == "xmlns" && node.Value == JsonNamespaceUri) + break; + else if (node.NamespaceURI == JsonNamespaceUri) + break; + + if (writePropertyName) + writer.WritePropertyName(GetPropertyName(node)); + writer.WriteValue(node.Value); + break; + case XmlNodeType.XmlDeclaration: + XmlDeclaration declaration = (XmlDeclaration)node; + writer.WritePropertyName(GetPropertyName(node)); + writer.WriteStartObject(); + + if (!string.IsNullOrEmpty(declaration.Version)) + { + writer.WritePropertyName("@version"); + writer.WriteValue(declaration.Version); + } + if (!string.IsNullOrEmpty(declaration.Encoding)) + { + writer.WritePropertyName("@encoding"); + writer.WriteValue(declaration.Encoding); + } + if (!string.IsNullOrEmpty(declaration.Standalone)) + { + writer.WritePropertyName("@standalone"); + writer.WriteValue(declaration.Standalone); + } + + writer.WriteEndObject(); + break; + default: + throw new JsonSerializationException("Unexpected XmlNodeType when serializing nodes: " + node.NodeType); + } + } + #endregion + + #region Reading + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public override object ReadJson(JsonReader reader, Type objectType) + { + // maybe have CanReader and a CanWrite methods so this sort of test wouldn't be necessary + if (objectType != typeof(XmlDocument)) + throw new JsonSerializationException("XmlNodeConverter only supports deserializing XmlDocuments"); + + XmlDocument document = new XmlDocument(); + XmlNamespaceManager manager = new XmlNamespaceManager(document.NameTable); + + if (reader.TokenType != JsonToken.StartObject) + throw new JsonSerializationException("XmlNodeConverter can only convert JSON that begins with an object."); + + reader.Read(); + + DeserializeNode(reader, document, manager, document); + + return document; + } + + private void DeserializeValue(JsonReader reader, XmlDocument document, XmlNamespaceManager manager, string propertyName, XmlNode currentNode) + { + switch (propertyName) + { + case TextName: + currentNode.AppendChild(document.CreateTextNode(reader.Value.ToString())); + break; + case CDataName: + currentNode.AppendChild(document.CreateCDataSection(reader.Value.ToString())); + break; + case WhitespaceName: + currentNode.AppendChild(document.CreateWhitespace(reader.Value.ToString())); + break; + case SignificantWhitespaceName: + currentNode.AppendChild(document.CreateSignificantWhitespace(reader.Value.ToString())); + break; + default: + // processing instructions and the xml declaration start with ? + if (!string.IsNullOrEmpty(propertyName) && propertyName[0] == '?') + { + if (propertyName == DeclarationName) + { + string version = null; + string encoding = null; + string standalone = null; + while (reader.Read() && reader.TokenType != JsonToken.EndObject) + { + switch (reader.Value.ToString()) + { + case "@version": + reader.Read(); + version = reader.Value.ToString(); + break; + case "@encoding": + reader.Read(); + encoding = reader.Value.ToString(); + break; + case "@standalone": + reader.Read(); + standalone = reader.Value.ToString(); + break; + default: + throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value); + } + } + + XmlDeclaration declaration = document.CreateXmlDeclaration(version, encoding, standalone); + currentNode.AppendChild(declaration); + } + else + { + XmlProcessingInstruction instruction = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString()); + currentNode.AppendChild(instruction); + } + } + else + { + // deserialize xml element + bool finishedAttributes = false; + bool finishedElement = false; + string elementPrefix = GetPrefix(propertyName); + Dictionary attributeNameValues = new Dictionary(); + + // a string token means the element only has a single text child + if (reader.TokenType != JsonToken.String + && reader.TokenType != JsonToken.Null + && reader.TokenType != JsonToken.Boolean + && reader.TokenType != JsonToken.Integer + && reader.TokenType != JsonToken.Float + && reader.TokenType != JsonToken.Date + && reader.TokenType != JsonToken.StartConstructor) + { + // read properties until first non-attribute is encountered + while (!finishedAttributes && !finishedElement && reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + string attributeName = reader.Value.ToString(); + + if (attributeName[0] == '@') + { + attributeName = attributeName.Substring(1); + reader.Read(); + string attributeValue = reader.Value.ToString(); + attributeNameValues.Add(attributeName, attributeValue); + + string namespacePrefix; + + if (IsNamespaceAttribute(attributeName, out namespacePrefix)) + { + manager.AddNamespace(namespacePrefix, attributeValue); + } + } + else + { + finishedAttributes = true; + } + break; + case JsonToken.EndObject: + finishedElement = true; + break; + default: + throw new JsonSerializationException("Unexpected JsonToken: " + reader.TokenType); + } + } + } + + // have to wait until attributes have been parsed before creating element + // attributes may contain namespace info used by the element + XmlElement element = (!string.IsNullOrEmpty(elementPrefix)) + ? document.CreateElement(propertyName, manager.LookupNamespace(elementPrefix)) + : document.CreateElement(propertyName); + + currentNode.AppendChild(element); + + // add attributes to newly created element + foreach (KeyValuePair nameValue in attributeNameValues) + { + string attributePrefix = GetPrefix(nameValue.Key); + + XmlAttribute attribute = (!string.IsNullOrEmpty(attributePrefix)) + ? document.CreateAttribute(nameValue.Key, manager.LookupNamespace(attributePrefix)) + : document.CreateAttribute(nameValue.Key); + + attribute.Value = nameValue.Value; + + element.SetAttributeNode(attribute); + } + + if (reader.TokenType == JsonToken.String) + { + element.AppendChild(document.CreateTextNode(reader.Value.ToString())); + } + else if (reader.TokenType == JsonToken.Integer) + { + element.AppendChild(document.CreateTextNode(XmlConvert.ToString((long)reader.Value))); + } + else if (reader.TokenType == JsonToken.Float) + { + element.AppendChild(document.CreateTextNode(XmlConvert.ToString((double)reader.Value))); + } + else if (reader.TokenType == JsonToken.Boolean) + { + element.AppendChild(document.CreateTextNode(XmlConvert.ToString((bool)reader.Value))); + } + else if (reader.TokenType == JsonToken.Date) + { + DateTime d = (DateTime)reader.Value; + element.AppendChild(document.CreateTextNode(XmlConvert.ToString(d, DateTimeUtils.ToSerializationMode(d.Kind)))); + } + else if (reader.TokenType == JsonToken.Null) + { + // empty element. do nothing + } + else + { + // finished element will have no children to deserialize + if (!finishedElement) + { + manager.PushScope(); + + DeserializeNode(reader, document, manager, element); + + manager.PopScope(); + } + } + } + break; + } + } + + private void DeserializeNode(JsonReader reader, XmlDocument document, XmlNamespaceManager manager, XmlNode currentNode) + { + do + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + if (currentNode.NodeType == XmlNodeType.Document && document.DocumentElement != null) + throw new JsonSerializationException("JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document."); + + string propertyName = reader.Value.ToString(); + reader.Read(); + + if (reader.TokenType == JsonToken.StartArray) + { + while (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + DeserializeValue(reader, document, manager, propertyName, currentNode); + } + } + else + { + DeserializeValue(reader, document, manager, propertyName, currentNode); + } + break; + case JsonToken.StartConstructor: + string constructorName = reader.Value.ToString(); + + while (reader.Read() && reader.TokenType != JsonToken.EndConstructor) + { + DeserializeValue(reader, document, manager, "-" + constructorName, currentNode); + } + break; + case JsonToken.EndObject: + case JsonToken.EndArray: + return; + default: + throw new JsonSerializationException("Unexpected JsonToken when deserializing node: " + reader.TokenType); + } + } while (reader.TokenType == JsonToken.PropertyName || reader.Read()); + // don't read if current token is a property. token was already read when parsing element attributes + } + + /// + /// Checks if the attributeName is a namespace attribute. + /// + /// Attribute name to test. + /// The attribute name prefix if it has one, otherwise an empty string. + /// True if attribute name is for a namespace attribute, otherwise false. + private bool IsNamespaceAttribute(string attributeName, out string prefix) + { + if (attributeName.StartsWith("xmlns", StringComparison.Ordinal)) + { + if (attributeName.Length == 5) + { + prefix = string.Empty; + return true; + } + else if (attributeName[5] == ':') + { + prefix = attributeName.Substring(6, attributeName.Length - 6); + return true; + } + } + prefix = null; + return false; + } + + private string GetPrefix(string qualifiedName) + { + int colonPosition = qualifiedName.IndexOf(':'); + + if ((colonPosition == -1 || colonPosition == 0) || (qualifiedName.Length - 1) == colonPosition) + return string.Empty; + else + return qualifiedName.Substring(0, colonPosition); + } + + private IEnumerable ValueAttributes(XmlAttributeCollection c) + { + return c.OfType().Where(a => a.NamespaceURI != JsonNamespaceUri); + } + + private IEnumerable ValueNodes(XmlNodeList c) + { + return c.OfType().Where(n => n.NamespaceURI != JsonNamespaceUri); + } + #endregion + + /// + /// Determines whether this instance can convert the specified value type. + /// + /// Type of the value. + /// + /// true if this instance can convert the specified value type; otherwise, false. + /// + public override bool CanConvert(Type valueType) + { + return typeof(XmlNode).IsAssignableFrom(valueType); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Identifier.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Identifier.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Identifier.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Identifier.cs index bccbe43..df4e28c 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Identifier.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Identifier.cs @@ -1,156 +1,156 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Web; -using System.Collections.Generic; -using System.Drawing; -using System.Web.UI.WebControls; -using System.ComponentModel; - -namespace Newtonsoft.Json -{ - /// - /// - /// - public class Identifier - { - private string _name; - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return _name; } - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - public Identifier(string name) - { - _name = name; - } - - private static bool IsAsciiLetter(char c) - { - return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// - /// true if the specified is equal to the current ; otherwise, false. - /// - /// The parameter is null. - public override bool Equals(object obj) - { - Identifier function = obj as Identifier; - - return Equals(function); - } - - /// - /// Equalses the specified function. - /// - /// The function. - /// - public bool Equals(Identifier function) - { - return (_name == function.Name); - } - - /// - /// Equalses the specified a. - /// - /// A. - /// The b. - /// - public static bool Equals(Identifier a, Identifier b) - { - if (a == b) - return true; - - if (a != null && b != null) - return a.Equals(b); - - return false; - } - - /// - /// Serves as a hash function for a particular type. - /// - /// - /// A hash code for the current . - /// - public override int GetHashCode() - { - return _name.GetHashCode(); - } - - /// - /// Returns a that represents the current . - /// - /// - /// A that represents the current . - /// - public override string ToString() - { - return _name; - } - - /// - /// Implements the operator ==. - /// - /// A. - /// The b. - /// The result of the operator. - public static bool operator ==(Identifier a, Identifier b) - { - return Identifier.Equals(a, b); - } - - /// - /// Implements the operator !=. - /// - /// A. - /// The b. - /// The result of the operator. - public static bool operator !=(Identifier a, Identifier b) - { - return !Identifier.Equals(a, b); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections; +using System.Globalization; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Web; +using System.Collections.Generic; +using System.Drawing; +using System.Web.UI.WebControls; +using System.ComponentModel; + +namespace Newtonsoft.Json +{ + /// + /// + /// + public class Identifier + { + private string _name; + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get { return _name; } + } + + /// + /// Initializes a new instance of the class. + /// + /// The name. + public Identifier(string name) + { + _name = name; + } + + private static bool IsAsciiLetter(char c) + { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); + } + + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// + /// true if the specified is equal to the current ; otherwise, false. + /// + /// The parameter is null. + public override bool Equals(object obj) + { + Identifier function = obj as Identifier; + + return Equals(function); + } + + /// + /// Equalses the specified function. + /// + /// The function. + /// + public bool Equals(Identifier function) + { + return (_name == function.Name); + } + + /// + /// Equalses the specified a. + /// + /// A. + /// The b. + /// + public static bool Equals(Identifier a, Identifier b) + { + if (a == b) + return true; + + if (a != null && b != null) + return a.Equals(b); + + return false; + } + + /// + /// Serves as a hash function for a particular type. + /// + /// + /// A hash code for the current . + /// + public override int GetHashCode() + { + return _name.GetHashCode(); + } + + /// + /// Returns a that represents the current . + /// + /// + /// A that represents the current . + /// + public override string ToString() + { + return _name; + } + + /// + /// Implements the operator ==. + /// + /// A. + /// The b. + /// The result of the operator. + public static bool operator ==(Identifier a, Identifier b) + { + return Identifier.Equals(a, b); + } + + /// + /// Implements the operator !=. + /// + /// A. + /// The b. + /// The result of the operator. + public static bool operator !=(Identifier a, Identifier b) + { + return !Identifier.Equals(a, b); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JavaScriptConvert.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JavaScriptConvert.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JavaScriptConvert.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JavaScriptConvert.cs index a20c4dc..8422469 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JavaScriptConvert.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JavaScriptConvert.cs @@ -1,542 +1,542 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using System.Web.UI.WebControls; -using System.Collections; -using System.IO; -using System.Globalization; -using System.Runtime.Serialization; -using System.Reflection; -using System.Data.SqlTypes; -using Newtonsoft.Json.Utilities; -using System.Xml; -using Newtonsoft.Json.Converters; - -namespace Newtonsoft.Json -{ - /// - /// Provides methods for converting between common language runtime types and JavaScript types. - /// - public static class JavaScriptConvert - { - /// - /// Represents JavaScript's boolean value true as a string. This field is read-only. - /// - public static readonly string True; - - /// - /// Represents JavaScript's boolean value false as a string. This field is read-only. - /// - public static readonly string False; - - /// - /// Represents JavaScript's null as a string. This field is read-only. - /// - public static readonly string Null; - - /// - /// Represents JavaScript's undefined as a string. This field is read-only. - /// - public static readonly string Undefined; - - /// - /// Represents JavaScript's positive infinity as a string. This field is read-only. - /// - public static readonly string PositiveInfinity; - - /// - /// Represents JavaScript's negative infinity as a string. This field is read-only. - /// - public static readonly string NegativeInfinity; - - /// - /// Represents JavaScript's NaN as a string. This field is read-only. - /// - public static readonly string NaN; - - internal static long InitialJavaScriptDateTicks; - internal static DateTime MinimumJavaScriptDate; - - static JavaScriptConvert() - { - True = "true"; - False = "false"; - Null = "null"; - Undefined = "undefined"; - PositiveInfinity = "Infinity"; - NegativeInfinity = "-Infinity"; - NaN = "NaN"; - - InitialJavaScriptDateTicks = (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).Ticks; - MinimumJavaScriptDate = new DateTime(100, 1, 1); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(DateTime value) - { - return ToStringInternal(new DateTimeOffset(value), value.Kind); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(DateTimeOffset value) - { - return ToStringInternal(value, DateTimeKind.Local); - } - - internal static string ToStringInternal(DateTimeOffset value, DateTimeKind kind) - { - long javaScriptTicks = ConvertDateTimeToJavaScriptTicks(value); - - string offset; - switch (kind) - { - case DateTimeKind.Local: - case DateTimeKind.Unspecified: - TimeSpan utcOffset = value.Offset; - offset = utcOffset.Hours.ToString("+00;-00", CultureInfo.InvariantCulture) + utcOffset.Minutes.ToString("00;00", CultureInfo.InvariantCulture); - break; - default: - offset = string.Empty; - break; - } - return @"""\/Date(" + javaScriptTicks.ToString(CultureInfo.InvariantCulture) + offset + @")\/"""; - } - - internal static long ConvertDateTimeToJavaScriptTicks(DateTimeOffset dateTime) - { - DateTimeOffset utcDateTime = dateTime.ToUniversalTime(); - - //if (utcDateTime < MinimumJavaScriptDate) - // utcDateTime = MinimumJavaScriptDate; - - long javaScriptTicks = (utcDateTime.Ticks - InitialJavaScriptDateTicks) / (long)10000; - - return javaScriptTicks; - } - - internal static DateTime ConvertJavaScriptTicksToDateTime(long javaScriptTicks) - { - DateTime dateTime = new DateTime((javaScriptTicks * 10000) + InitialJavaScriptDateTicks, DateTimeKind.Utc); - - return dateTime; - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(bool value) - { - return (value) ? True : False; - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(char value) - { - return ToString(char.ToString(value)); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(Enum value) - { - return Enum.Format(value.GetType(), value, "D"); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(int value) - { - return value.ToString(null, CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(short value) - { - return value.ToString(null, CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(ushort value) - { - return value.ToString(null, CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(uint value) - { - return value.ToString(null, CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(long value) - { - return value.ToString(null, CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(ulong value) - { - return value.ToString(null, CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(float value) - { - return value.ToString("R", CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(double value) - { - return value.ToString("R", CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(byte value) - { - return value.ToString(null, CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(sbyte value) - { - return value.ToString(null, CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(decimal value) - { - return value.ToString(null, CultureInfo.InvariantCulture); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(Guid value) - { - return '"' + value.ToString("D", CultureInfo.InvariantCulture) + '"'; - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(string value) - { - return ToString(value, '"'); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// The string delimiter character. - /// A Json string representation of the . - public static string ToString(string value, char delimter) - { - return JavaScriptUtils.ToEscapedJavaScriptString(value, delimter, true); - } - - /// - /// Converts the to it's JavaScript string representation. - /// - /// The value to convert. - /// A Json string representation of the . - public static string ToString(object value) - { - if (value == null) - { - return Null; - } - else if (value is IConvertible) - { - IConvertible convertible = value as IConvertible; - - switch (convertible.GetTypeCode()) - { - case TypeCode.String: - return ToString((string)convertible); - case TypeCode.Char: - return ToString((char)convertible); - case TypeCode.Boolean: - return ToString((bool)convertible); - case TypeCode.SByte: - return ToString((sbyte)convertible); - case TypeCode.Int16: - return ToString((short)convertible); - case TypeCode.UInt16: - return ToString((ushort)convertible); - case TypeCode.Int32: - return ToString((int)convertible); - case TypeCode.Byte: - return ToString((byte)convertible); - case TypeCode.UInt32: - return ToString((uint)convertible); - case TypeCode.Int64: - return ToString((long)convertible); - case TypeCode.UInt64: - return ToString((ulong)convertible); - case TypeCode.Single: - return ToString((float)convertible); - case TypeCode.Double: - return ToString((double)convertible); - case TypeCode.DateTime: - return ToString((DateTime)convertible); - case TypeCode.Decimal: - return ToString((decimal)convertible); - } - } - else if (value is DateTimeOffset) - { - return ToString((DateTimeOffset)value); - } - else if (value is Guid) - { - return ToString((Guid)value); - } - - throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType())); - } - - /// - /// Serializes the specified object to a JSON string. - /// - /// The object to serialize. - /// A JSON string representation of the object. - public static string SerializeObject(object value) - { - return SerializeObject(value, null); - } - - /// - /// Serializes the specified object to a JSON string using a collection of . - /// - /// The object to serialize. - /// A collection converters used while serializing. - /// A JSON string representation of the object. - public static string SerializeObject(object value, params JsonConverter[] converters) - { - StringWriter sw = new StringWriter(CultureInfo.InvariantCulture); - JsonSerializer jsonSerializer = new JsonSerializer(); - - if (!CollectionUtils.IsNullOrEmpty(converters)) - { - for (int i = 0; i < converters.Length; i++) - { - jsonSerializer.Converters.Add(converters[i]); - } - } - - using (JsonWriter jsonWriter = new JsonTextWriter(sw)) - { - //jsonWriter.Formatting = Formatting.Indented; - jsonSerializer.Serialize(jsonWriter, value); - } - - return sw.ToString(); - } - - /// - /// Deserializes the specified object to a Json object. - /// - /// The object to deserialize. - /// The deserialized object from the Json string. - public static object DeserializeObject(string value) - { - return DeserializeObject(value, null, null); - } - - /// - /// Deserializes the specified object to a Json object. - /// - /// The object to deserialize. - /// The of object being deserialized. - /// The deserialized object from the Json string. - public static object DeserializeObject(string value, Type type) - { - return DeserializeObject(value, type, null); - } - - /// - /// Deserializes the specified object to a Json object. - /// - /// The type of the object to deserialize. - /// The object to deserialize. - /// The deserialized object from the Json string. - public static T DeserializeObject(string value) - { - return DeserializeObject(value, null); - } - - /// - /// Deserializes the specified JSON to the given anonymous type. - /// - /// - /// The anonymous type to deserialize to. This can't be specified - /// traditionally and must be infered from the anonymous type passed - /// as a parameter. - /// - /// The object to deserialize. - /// The anonymous type object. - /// The deserialized anonymous type from the JSON string. - public static T DeserializeAnonymousType(string value, T anonymousTypeObject) - { - return DeserializeObject(value); - } - - /// - /// Deserializes the JSON string to the specified type. - /// - /// The type of the object to deserialize. - /// The object to deserialize. - /// Converters to use while deserializing. - /// The deserialized object from the JSON string. - public static T DeserializeObject(string value, params JsonConverter[] converters) - { - return (T)DeserializeObject(value, typeof(T), converters); - } - - /// - /// Deserializes the JSON string to the specified type. - /// - /// The object to deserialize. - /// The type of the object to deserialize. - /// Converters to use while deserializing. - /// The deserialized object from the JSON string. - public static object DeserializeObject(string value, Type type, params JsonConverter[] converters) - { - StringReader sr = new StringReader(value); - JsonSerializer jsonSerializer = new JsonSerializer(); - - if (!CollectionUtils.IsNullOrEmpty(converters)) - { - for (int i = 0; i < converters.Length; i++) - { - jsonSerializer.Converters.Add(converters[i]); - } - } - - object deserializedValue; - - using (JsonReader jsonReader = new JsonTextReader(sr)) - { - deserializedValue = jsonSerializer.Deserialize(jsonReader, type); - } - - return deserializedValue; - } - - /// - /// Serializes the XML node to a JSON string. - /// - /// The node to serialize. - /// A JSON string of the XmlNode. - public static string SerializeXmlNode(XmlNode node) - { - XmlNodeConverter converter = new XmlNodeConverter(); - - return SerializeObject(node, converter); - } - - /// - /// Deserializes the XmlNode from a JSON string. - /// - /// The JSON string. - /// The deserialized XmlNode - public static XmlNode DeserializeXmlNode(string value) - { - XmlNodeConverter converter = new XmlNodeConverter(); - - return (XmlDocument)DeserializeObject(value, typeof(XmlDocument), converter); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Drawing; +using System.Web.UI.WebControls; +using System.Collections; +using System.IO; +using System.Globalization; +using System.Runtime.Serialization; +using System.Reflection; +using System.Data.SqlTypes; +using Newtonsoft.Json.Utilities; +using System.Xml; +using Newtonsoft.Json.Converters; + +namespace Newtonsoft.Json +{ + /// + /// Provides methods for converting between common language runtime types and JavaScript types. + /// + public static class JavaScriptConvert + { + /// + /// Represents JavaScript's boolean value true as a string. This field is read-only. + /// + public static readonly string True; + + /// + /// Represents JavaScript's boolean value false as a string. This field is read-only. + /// + public static readonly string False; + + /// + /// Represents JavaScript's null as a string. This field is read-only. + /// + public static readonly string Null; + + /// + /// Represents JavaScript's undefined as a string. This field is read-only. + /// + public static readonly string Undefined; + + /// + /// Represents JavaScript's positive infinity as a string. This field is read-only. + /// + public static readonly string PositiveInfinity; + + /// + /// Represents JavaScript's negative infinity as a string. This field is read-only. + /// + public static readonly string NegativeInfinity; + + /// + /// Represents JavaScript's NaN as a string. This field is read-only. + /// + public static readonly string NaN; + + internal static long InitialJavaScriptDateTicks; + internal static DateTime MinimumJavaScriptDate; + + static JavaScriptConvert() + { + True = "true"; + False = "false"; + Null = "null"; + Undefined = "undefined"; + PositiveInfinity = "Infinity"; + NegativeInfinity = "-Infinity"; + NaN = "NaN"; + + InitialJavaScriptDateTicks = (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).Ticks; + MinimumJavaScriptDate = new DateTime(100, 1, 1); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(DateTime value) + { + return ToStringInternal(new DateTimeOffset(value), value.Kind); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(DateTimeOffset value) + { + return ToStringInternal(value, DateTimeKind.Local); + } + + internal static string ToStringInternal(DateTimeOffset value, DateTimeKind kind) + { + long javaScriptTicks = ConvertDateTimeToJavaScriptTicks(value); + + string offset; + switch (kind) + { + case DateTimeKind.Local: + case DateTimeKind.Unspecified: + TimeSpan utcOffset = value.Offset; + offset = utcOffset.Hours.ToString("+00;-00", CultureInfo.InvariantCulture) + utcOffset.Minutes.ToString("00;00", CultureInfo.InvariantCulture); + break; + default: + offset = string.Empty; + break; + } + return @"""\/Date(" + javaScriptTicks.ToString(CultureInfo.InvariantCulture) + offset + @")\/"""; + } + + internal static long ConvertDateTimeToJavaScriptTicks(DateTimeOffset dateTime) + { + DateTimeOffset utcDateTime = dateTime.ToUniversalTime(); + + //if (utcDateTime < MinimumJavaScriptDate) + // utcDateTime = MinimumJavaScriptDate; + + long javaScriptTicks = (utcDateTime.Ticks - InitialJavaScriptDateTicks) / (long)10000; + + return javaScriptTicks; + } + + internal static DateTime ConvertJavaScriptTicksToDateTime(long javaScriptTicks) + { + DateTime dateTime = new DateTime((javaScriptTicks * 10000) + InitialJavaScriptDateTicks, DateTimeKind.Utc); + + return dateTime; + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(bool value) + { + return (value) ? True : False; + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(char value) + { + return ToString(char.ToString(value)); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(Enum value) + { + return Enum.Format(value.GetType(), value, "D"); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(int value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(short value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(ushort value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(uint value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(long value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(ulong value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(float value) + { + return value.ToString("R", CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(double value) + { + return value.ToString("R", CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(byte value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(sbyte value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(decimal value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(Guid value) + { + return '"' + value.ToString("D", CultureInfo.InvariantCulture) + '"'; + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(string value) + { + return ToString(value, '"'); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// The string delimiter character. + /// A Json string representation of the . + public static string ToString(string value, char delimter) + { + return JavaScriptUtils.ToEscapedJavaScriptString(value, delimter, true); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(object value) + { + if (value == null) + { + return Null; + } + else if (value is IConvertible) + { + IConvertible convertible = value as IConvertible; + + switch (convertible.GetTypeCode()) + { + case TypeCode.String: + return ToString((string)convertible); + case TypeCode.Char: + return ToString((char)convertible); + case TypeCode.Boolean: + return ToString((bool)convertible); + case TypeCode.SByte: + return ToString((sbyte)convertible); + case TypeCode.Int16: + return ToString((short)convertible); + case TypeCode.UInt16: + return ToString((ushort)convertible); + case TypeCode.Int32: + return ToString((int)convertible); + case TypeCode.Byte: + return ToString((byte)convertible); + case TypeCode.UInt32: + return ToString((uint)convertible); + case TypeCode.Int64: + return ToString((long)convertible); + case TypeCode.UInt64: + return ToString((ulong)convertible); + case TypeCode.Single: + return ToString((float)convertible); + case TypeCode.Double: + return ToString((double)convertible); + case TypeCode.DateTime: + return ToString((DateTime)convertible); + case TypeCode.Decimal: + return ToString((decimal)convertible); + } + } + else if (value is DateTimeOffset) + { + return ToString((DateTimeOffset)value); + } + else if (value is Guid) + { + return ToString((Guid)value); + } + + throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType())); + } + + /// + /// Serializes the specified object to a JSON string. + /// + /// The object to serialize. + /// A JSON string representation of the object. + public static string SerializeObject(object value) + { + return SerializeObject(value, null); + } + + /// + /// Serializes the specified object to a JSON string using a collection of . + /// + /// The object to serialize. + /// A collection converters used while serializing. + /// A JSON string representation of the object. + public static string SerializeObject(object value, params JsonConverter[] converters) + { + StringWriter sw = new StringWriter(CultureInfo.InvariantCulture); + JsonSerializer jsonSerializer = new JsonSerializer(); + + if (!CollectionUtils.IsNullOrEmpty(converters)) + { + for (int i = 0; i < converters.Length; i++) + { + jsonSerializer.Converters.Add(converters[i]); + } + } + + using (JsonWriter jsonWriter = new JsonTextWriter(sw)) + { + //jsonWriter.Formatting = Formatting.Indented; + jsonSerializer.Serialize(jsonWriter, value); + } + + return sw.ToString(); + } + + /// + /// Deserializes the specified object to a Json object. + /// + /// The object to deserialize. + /// The deserialized object from the Json string. + public static object DeserializeObject(string value) + { + return DeserializeObject(value, null, null); + } + + /// + /// Deserializes the specified object to a Json object. + /// + /// The object to deserialize. + /// The of object being deserialized. + /// The deserialized object from the Json string. + public static object DeserializeObject(string value, Type type) + { + return DeserializeObject(value, type, null); + } + + /// + /// Deserializes the specified object to a Json object. + /// + /// The type of the object to deserialize. + /// The object to deserialize. + /// The deserialized object from the Json string. + public static T DeserializeObject(string value) + { + return DeserializeObject(value, null); + } + + /// + /// Deserializes the specified JSON to the given anonymous type. + /// + /// + /// The anonymous type to deserialize to. This can't be specified + /// traditionally and must be infered from the anonymous type passed + /// as a parameter. + /// + /// The object to deserialize. + /// The anonymous type object. + /// The deserialized anonymous type from the JSON string. + public static T DeserializeAnonymousType(string value, T anonymousTypeObject) + { + return DeserializeObject(value); + } + + /// + /// Deserializes the JSON string to the specified type. + /// + /// The type of the object to deserialize. + /// The object to deserialize. + /// Converters to use while deserializing. + /// The deserialized object from the JSON string. + public static T DeserializeObject(string value, params JsonConverter[] converters) + { + return (T)DeserializeObject(value, typeof(T), converters); + } + + /// + /// Deserializes the JSON string to the specified type. + /// + /// The object to deserialize. + /// The type of the object to deserialize. + /// Converters to use while deserializing. + /// The deserialized object from the JSON string. + public static object DeserializeObject(string value, Type type, params JsonConverter[] converters) + { + StringReader sr = new StringReader(value); + JsonSerializer jsonSerializer = new JsonSerializer(); + + if (!CollectionUtils.IsNullOrEmpty(converters)) + { + for (int i = 0; i < converters.Length; i++) + { + jsonSerializer.Converters.Add(converters[i]); + } + } + + object deserializedValue; + + using (JsonReader jsonReader = new JsonTextReader(sr)) + { + deserializedValue = jsonSerializer.Deserialize(jsonReader, type); + } + + return deserializedValue; + } + + /// + /// Serializes the XML node to a JSON string. + /// + /// The node to serialize. + /// A JSON string of the XmlNode. + public static string SerializeXmlNode(XmlNode node) + { + XmlNodeConverter converter = new XmlNodeConverter(); + + return SerializeObject(node, converter); + } + + /// + /// Deserializes the XmlNode from a JSON string. + /// + /// The JSON string. + /// The deserialized XmlNode + public static XmlNode DeserializeXmlNode(string value) + { + XmlNodeConverter converter = new XmlNodeConverter(); + + return (XmlDocument)DeserializeObject(value, typeof(XmlDocument), converter); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonConverter.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonConverter.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonConverter.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonConverter.cs index 1bc9f11..386c1b5 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonConverter.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonConverter.cs @@ -1,62 +1,62 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using Newtonsoft.Json.Utilities; - -namespace Newtonsoft.Json -{ - /// - /// Converts an object to and from JSON. - /// - public abstract class JsonConverter - { - /// - /// Writes the JSON representation of the object. - /// - /// The to write to. - /// The value. - public abstract void WriteJson(JsonWriter writer, object value); - - /// - /// Reads the JSON representation of the object. - /// - /// The to read from. - /// Type of the object. - /// The object value. - public abstract object ReadJson(JsonReader reader, Type objectType); - - /// - /// Determines whether this instance can convert the specified object type. - /// - /// Type of the object. - /// - /// true if this instance can convert the specified object type; otherwise, false. - /// - public abstract bool CanConvert(Type objectType); - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json +{ + /// + /// Converts an object to and from JSON. + /// + public abstract class JsonConverter + { + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public abstract void WriteJson(JsonWriter writer, object value); + + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public abstract object ReadJson(JsonReader reader, Type objectType); + + /// + /// Determines whether this instance can convert the specified object type. + /// + /// Type of the object. + /// + /// true if this instance can convert the specified object type; otherwise, false. + /// + public abstract bool CanConvert(Type objectType); + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonConverterCollection.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonConverterCollection.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonConverterCollection.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonConverterCollection.cs index a2a2bea..50f70c5 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonConverterCollection.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonConverterCollection.cs @@ -1,39 +1,39 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.Collections.ObjectModel; - -namespace Newtonsoft.Json -{ - /// - /// Represents a collection of . - /// - public class JsonConverterCollection : Collection - { - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections.ObjectModel; + +namespace Newtonsoft.Json +{ + /// + /// Represents a collection of . + /// + public class JsonConverterCollection : Collection + { + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonHandler.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonHandler.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonHandler.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonHandler.cs index ca2a93f..1f81131 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonHandler.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonHandler.cs @@ -1,63 +1,63 @@ -using System; -using System.Web; -using System.Web.Caching; -using System.Xml; -using System.Text; -using System.Security.Principal; - -namespace Newtonsoft.Json -{ - public abstract class JsonHandler : HandlerBase, IHttpHandler - { - public event EventHandler Error; - - protected abstract void WriteResult(JsonWriter writer); - - public static void JsonResponse(HttpResponse response, Action writeAction) - { - response.ClearHeaders(); - response.ClearContent(); - - JsonWriter writer = new JsonWriter(response.Output); - - writeAction(writer); - - writer.Flush(); - } - - protected virtual void OnError(EventArgs e) - { - if (Error != null) - { - Error(this, e); - } - } - - void IHttpHandler.ProcessRequest(HttpContext context) - { - if (context == null) - throw new ArgumentNullException("context"); - - Context = context; - - try - { - JsonHandler.JsonResponse(context.Response, new Action(WriteResult)); - } - catch (Exception exception) - { - context.AddError(exception); - OnError(EventArgs.Empty); - if (context.Error != null) - { - throw new HttpUnhandledException("blah", exception); - } - } - } - - bool IHttpHandler.IsReusable - { - get { return false; } - } - } +using System; +using System.Web; +using System.Web.Caching; +using System.Xml; +using System.Text; +using System.Security.Principal; + +namespace Newtonsoft.Json +{ + public abstract class JsonHandler : HandlerBase, IHttpHandler + { + public event EventHandler Error; + + protected abstract void WriteResult(JsonWriter writer); + + public static void JsonResponse(HttpResponse response, Action writeAction) + { + response.ClearHeaders(); + response.ClearContent(); + + JsonWriter writer = new JsonWriter(response.Output); + + writeAction(writer); + + writer.Flush(); + } + + protected virtual void OnError(EventArgs e) + { + if (Error != null) + { + Error(this, e); + } + } + + void IHttpHandler.ProcessRequest(HttpContext context) + { + if (context == null) + throw new ArgumentNullException("context"); + + Context = context; + + try + { + JsonHandler.JsonResponse(context.Response, new Action(WriteResult)); + } + catch (Exception exception) + { + context.AddError(exception); + OnError(EventArgs.Empty); + if (context.Error != null) + { + throw new HttpUnhandledException("blah", exception); + } + } + } + + bool IHttpHandler.IsReusable + { + get { return false; } + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonIgnoreAttribute.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonIgnoreAttribute.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonIgnoreAttribute.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonIgnoreAttribute.cs index f736c8c..e7511a0 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonIgnoreAttribute.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonIgnoreAttribute.cs @@ -1,39 +1,39 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Newtonsoft.Json -{ - /// - /// Instructs the not to serialize the public field or public read/write property value. - /// - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] - public sealed class JsonIgnoreAttribute : Attribute - { - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Instructs the not to serialize the public field or public read/write property value. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] + public sealed class JsonIgnoreAttribute : Attribute + { + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonObjectAttribute.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonObjectAttribute.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonObjectAttribute.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonObjectAttribute.cs index 659f67a..317e834 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonObjectAttribute.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonObjectAttribute.cs @@ -1,64 +1,64 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; - -namespace Newtonsoft.Json -{ - /// - /// Instructs the how to serialize the object. - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] - public sealed class JsonObjectAttribute : Attribute - { - private MemberSerialization _memberSerialization = MemberSerialization.OptOut; - - /// - /// Gets or sets the member serialization. - /// - /// The member serialization. - public MemberSerialization MemberSerialization - { - get { return _memberSerialization; } - set { _memberSerialization = value; } - } - - /// - /// Initializes a new instance of the class. - /// - public JsonObjectAttribute() - { - } - - /// - /// Initializes a new instance of the class with the specified member serialization. - /// - /// The member serialization. - public JsonObjectAttribute(MemberSerialization memberSerialization) - { - MemberSerialization = memberSerialization; - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; + +namespace Newtonsoft.Json +{ + /// + /// Instructs the how to serialize the object. + /// + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] + public sealed class JsonObjectAttribute : Attribute + { + private MemberSerialization _memberSerialization = MemberSerialization.OptOut; + + /// + /// Gets or sets the member serialization. + /// + /// The member serialization. + public MemberSerialization MemberSerialization + { + get { return _memberSerialization; } + set { _memberSerialization = value; } + } + + /// + /// Initializes a new instance of the class. + /// + public JsonObjectAttribute() + { + } + + /// + /// Initializes a new instance of the class with the specified member serialization. + /// + /// The member serialization. + public JsonObjectAttribute(MemberSerialization memberSerialization) + { + MemberSerialization = memberSerialization; + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonPropertyAttribute.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonPropertyAttribute.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonPropertyAttribute.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonPropertyAttribute.cs index e6049ea..f2161e8 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonPropertyAttribute.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonPropertyAttribute.cs @@ -1,39 +1,39 @@ -using System; - -namespace Newtonsoft.Json -{ - /// - /// Instructs the to always serialize the member with the specified name. - /// - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] - public sealed class JsonPropertyAttribute : Attribute - { - private string _propertyName; - - /// - /// Gets or sets the name of the property. - /// - /// The name of the property. - public string PropertyName - { - get { return _propertyName; } - set { _propertyName = value; } - } - - /// - /// Initializes a new instance of the class. - /// - public JsonPropertyAttribute() - { - } - - /// - /// Initializes a new instance of the class with the specified name. - /// - /// Name of the property. - public JsonPropertyAttribute(string propertyName) - { - _propertyName = propertyName; - } - } +using System; + +namespace Newtonsoft.Json +{ + /// + /// Instructs the to always serialize the member with the specified name. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] + public sealed class JsonPropertyAttribute : Attribute + { + private string _propertyName; + + /// + /// Gets or sets the name of the property. + /// + /// The name of the property. + public string PropertyName + { + get { return _propertyName; } + set { _propertyName = value; } + } + + /// + /// Initializes a new instance of the class. + /// + public JsonPropertyAttribute() + { + } + + /// + /// Initializes a new instance of the class with the specified name. + /// + /// Name of the property. + public JsonPropertyAttribute(string propertyName) + { + _propertyName = propertyName; + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonReader.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonReader.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonReader.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonReader.cs index f281454..72fe568 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonReader.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonReader.cs @@ -1,404 +1,404 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using System.Globalization; -using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Utilities; - -namespace Newtonsoft.Json -{ - /// - /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - /// - public abstract class JsonReader : IDisposable - { - /// - /// Specifies the state of the reader. - /// - protected enum State - { - /// - /// The Read method has not been called. - /// - Start, - /// - /// The end of the file has been reached successfully. - /// - Complete, - /// - /// Reader is at a property. - /// - Property, - /// - /// Reader is at the start of an object. - /// - ObjectStart, - /// - /// Reader is in an object. - /// - Object, - /// - /// Reader is at the start of an array. - /// - ArrayStart, - /// - /// Reader is in an array. - /// - Array, - /// - /// The Close method has been called. - /// - Closed, - /// - /// Reader has just read a value. - /// - PostValue, - /// - /// Reader is at the start of a constructor. - /// - ConstructorStart, - /// - /// Reader in a constructor. - /// - Constructor, - /// - /// An error occurred that prevents the read operation from continuing. - /// - Error, - /// - /// The end of the file has been reached successfully. - /// - Finished - } - - // current Token data - private JsonToken _token; - private object _value; - private Type _valueType; - private char _quoteChar; - private State _currentState; - - /// - /// Gets the current reader state. - /// - /// The current reader state. - protected State CurrentState - { - get { return _currentState; } - private set { _currentState = value; } - } - - private int _top; - - private List _stack; - - /// - /// Gets the quotation mark character used to enclose the value of a string. - /// - public char QuoteChar - { - get { return _quoteChar; } - protected set { _quoteChar = value; } - } - - /// - /// Gets the type of the current Json token. - /// - public JsonToken TokenType - { - get { return _token; } - } - - /// - /// Gets the text value of the current Json token. - /// - public object Value - { - get { return _value; } - } - - /// - /// Gets The Common Language Runtime (CLR) type for the current Json token. - /// - public Type ValueType - { - get { return _valueType; } - } - - /// - /// Gets the depth of the current token in the JSON document. - /// - /// The depth of the current token in the JSON document. - public int Depth - { - get - { - int depth = _top - 1; - if (IsStartToken(TokenType)) - return depth - 1; - else - return depth; - } - } - - /// - /// Initializes a new instance of the class with the specified . - /// - public JsonReader() - { - //_testBuffer = new StringBuilder(); - _currentState = State.Start; - _stack = new List(); - _top = 0; - Push(JsonTokenType.None); - } - - private void Push(JsonTokenType value) - { - _stack.Add(value); - _top++; - } - - private JsonTokenType Pop() - { - JsonTokenType value = Peek(); - _stack.RemoveAt(_stack.Count - 1); - _top--; - - return value; - } - - private JsonTokenType Peek() - { - return _stack[_top - 1]; - } - - /// - /// Reads the next Json token from the stream. - /// - /// true if the next token was read successfully; false if there are no more tokens to read. - public abstract bool Read(); - - /// - /// Skips the children of the current token. - /// - public void Skip() - { - if (IsStartToken(TokenType)) - { - int depth = Depth; - - while (Read() && (depth < Depth)) - { - } - } - } - - /// - /// Sets the current token. - /// - /// The new token. - protected void SetToken(JsonToken newToken) - { - SetToken(newToken, null); - } - - /// - /// Sets the current token and value. - /// - /// The new token. - /// The value. - protected virtual void SetToken(JsonToken newToken, object value) - { - _token = newToken; - - switch (newToken) - { - case JsonToken.StartObject: - _currentState = State.ObjectStart; - Push(JsonTokenType.Object); - break; - case JsonToken.StartArray: - _currentState = State.ArrayStart; - Push(JsonTokenType.Array); - break; - case JsonToken.StartConstructor: - _currentState = State.ConstructorStart; - Push(JsonTokenType.Constructor); - break; - case JsonToken.EndObject: - ValidateEnd(JsonToken.EndObject); - _currentState = State.PostValue; - break; - case JsonToken.EndArray: - ValidateEnd(JsonToken.EndArray); - _currentState = State.PostValue; - break; - case JsonToken.EndConstructor: - ValidateEnd(JsonToken.EndConstructor); - _currentState = State.PostValue; - break; - case JsonToken.PropertyName: - _currentState = State.Property; - Push(JsonTokenType.Property); - break; - case JsonToken.Undefined: - case JsonToken.Integer: - case JsonToken.Float: - case JsonToken.Boolean: - case JsonToken.Null: - case JsonToken.Date: - case JsonToken.String: - _currentState = State.PostValue; - break; - } - - JsonTokenType current = Peek(); - if (current == JsonTokenType.Property && _currentState == State.PostValue) - Pop(); - - if (value != null) - { - _value = value; - _valueType = value.GetType(); - } - else - { - _value = null; - _valueType = null; - } - } - - private void ValidateEnd(JsonToken endToken) - { - JsonTokenType currentObject = Pop(); - - if (GetTypeForCloseToken(endToken) != currentObject) - throw new JsonReaderException("JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, currentObject)); - } - - /// - /// Sets the state based on current token type. - /// - protected void SetStateBasedOnCurrent() - { - JsonTokenType currentObject = Peek(); - - switch (currentObject) - { - case JsonTokenType.Object: - _currentState = State.Object; - break; - case JsonTokenType.Array: - _currentState = State.Array; - break; - case JsonTokenType.Constructor: - _currentState = State.Constructor; - break; - case JsonTokenType.None: - _currentState = State.Finished; - break; - default: - throw new JsonReaderException("While setting the reader state back to current object an unexpected JsonType was encountered: " + currentObject); - } - } - - private bool IsStartToken(JsonToken token) - { - switch (token) - { - case JsonToken.StartObject: - case JsonToken.StartArray: - case JsonToken.StartConstructor: - case JsonToken.PropertyName: - return true; - case JsonToken.None: - case JsonToken.Comment: - case JsonToken.Integer: - case JsonToken.Float: - case JsonToken.String: - case JsonToken.Boolean: - case JsonToken.Null: - case JsonToken.Undefined: - case JsonToken.EndObject: - case JsonToken.EndArray: - case JsonToken.EndConstructor: - case JsonToken.Date: - return false; - default: - throw new ArgumentOutOfRangeException("token", token, "Unexpected JsonToken value."); - } - } - - private JsonTokenType GetTypeForCloseToken(JsonToken token) - { - switch (token) - { - case JsonToken.EndObject: - return JsonTokenType.Object; - case JsonToken.EndArray: - return JsonTokenType.Array; - case JsonToken.EndConstructor: - return JsonTokenType.Constructor; - default: - throw new JsonReaderException("Not a valid close JsonToken: " + token); - } - } - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - void IDisposable.Dispose() - { - Dispose(true); - } - - /// - /// Releases unmanaged and - optionally - managed resources - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool disposing) - { - if (_currentState != State.Closed && disposing) - Close(); - } - - /// - /// Changes the to Closed. - /// - public virtual void Close() - { - _currentState = State.Closed; - _token = JsonToken.None; - _value = null; - _valueType = null; - } - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using System.Globalization; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json +{ + /// + /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + /// + public abstract class JsonReader : IDisposable + { + /// + /// Specifies the state of the reader. + /// + protected enum State + { + /// + /// The Read method has not been called. + /// + Start, + /// + /// The end of the file has been reached successfully. + /// + Complete, + /// + /// Reader is at a property. + /// + Property, + /// + /// Reader is at the start of an object. + /// + ObjectStart, + /// + /// Reader is in an object. + /// + Object, + /// + /// Reader is at the start of an array. + /// + ArrayStart, + /// + /// Reader is in an array. + /// + Array, + /// + /// The Close method has been called. + /// + Closed, + /// + /// Reader has just read a value. + /// + PostValue, + /// + /// Reader is at the start of a constructor. + /// + ConstructorStart, + /// + /// Reader in a constructor. + /// + Constructor, + /// + /// An error occurred that prevents the read operation from continuing. + /// + Error, + /// + /// The end of the file has been reached successfully. + /// + Finished + } + + // current Token data + private JsonToken _token; + private object _value; + private Type _valueType; + private char _quoteChar; + private State _currentState; + + /// + /// Gets the current reader state. + /// + /// The current reader state. + protected State CurrentState + { + get { return _currentState; } + private set { _currentState = value; } + } + + private int _top; + + private List _stack; + + /// + /// Gets the quotation mark character used to enclose the value of a string. + /// + public char QuoteChar + { + get { return _quoteChar; } + protected set { _quoteChar = value; } + } + + /// + /// Gets the type of the current Json token. + /// + public JsonToken TokenType + { + get { return _token; } + } + + /// + /// Gets the text value of the current Json token. + /// + public object Value + { + get { return _value; } + } + + /// + /// Gets The Common Language Runtime (CLR) type for the current Json token. + /// + public Type ValueType + { + get { return _valueType; } + } + + /// + /// Gets the depth of the current token in the JSON document. + /// + /// The depth of the current token in the JSON document. + public int Depth + { + get + { + int depth = _top - 1; + if (IsStartToken(TokenType)) + return depth - 1; + else + return depth; + } + } + + /// + /// Initializes a new instance of the class with the specified . + /// + public JsonReader() + { + //_testBuffer = new StringBuilder(); + _currentState = State.Start; + _stack = new List(); + _top = 0; + Push(JsonTokenType.None); + } + + private void Push(JsonTokenType value) + { + _stack.Add(value); + _top++; + } + + private JsonTokenType Pop() + { + JsonTokenType value = Peek(); + _stack.RemoveAt(_stack.Count - 1); + _top--; + + return value; + } + + private JsonTokenType Peek() + { + return _stack[_top - 1]; + } + + /// + /// Reads the next Json token from the stream. + /// + /// true if the next token was read successfully; false if there are no more tokens to read. + public abstract bool Read(); + + /// + /// Skips the children of the current token. + /// + public void Skip() + { + if (IsStartToken(TokenType)) + { + int depth = Depth; + + while (Read() && (depth < Depth)) + { + } + } + } + + /// + /// Sets the current token. + /// + /// The new token. + protected void SetToken(JsonToken newToken) + { + SetToken(newToken, null); + } + + /// + /// Sets the current token and value. + /// + /// The new token. + /// The value. + protected virtual void SetToken(JsonToken newToken, object value) + { + _token = newToken; + + switch (newToken) + { + case JsonToken.StartObject: + _currentState = State.ObjectStart; + Push(JsonTokenType.Object); + break; + case JsonToken.StartArray: + _currentState = State.ArrayStart; + Push(JsonTokenType.Array); + break; + case JsonToken.StartConstructor: + _currentState = State.ConstructorStart; + Push(JsonTokenType.Constructor); + break; + case JsonToken.EndObject: + ValidateEnd(JsonToken.EndObject); + _currentState = State.PostValue; + break; + case JsonToken.EndArray: + ValidateEnd(JsonToken.EndArray); + _currentState = State.PostValue; + break; + case JsonToken.EndConstructor: + ValidateEnd(JsonToken.EndConstructor); + _currentState = State.PostValue; + break; + case JsonToken.PropertyName: + _currentState = State.Property; + Push(JsonTokenType.Property); + break; + case JsonToken.Undefined: + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.Boolean: + case JsonToken.Null: + case JsonToken.Date: + case JsonToken.String: + _currentState = State.PostValue; + break; + } + + JsonTokenType current = Peek(); + if (current == JsonTokenType.Property && _currentState == State.PostValue) + Pop(); + + if (value != null) + { + _value = value; + _valueType = value.GetType(); + } + else + { + _value = null; + _valueType = null; + } + } + + private void ValidateEnd(JsonToken endToken) + { + JsonTokenType currentObject = Pop(); + + if (GetTypeForCloseToken(endToken) != currentObject) + throw new JsonReaderException("JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, currentObject)); + } + + /// + /// Sets the state based on current token type. + /// + protected void SetStateBasedOnCurrent() + { + JsonTokenType currentObject = Peek(); + + switch (currentObject) + { + case JsonTokenType.Object: + _currentState = State.Object; + break; + case JsonTokenType.Array: + _currentState = State.Array; + break; + case JsonTokenType.Constructor: + _currentState = State.Constructor; + break; + case JsonTokenType.None: + _currentState = State.Finished; + break; + default: + throw new JsonReaderException("While setting the reader state back to current object an unexpected JsonType was encountered: " + currentObject); + } + } + + private bool IsStartToken(JsonToken token) + { + switch (token) + { + case JsonToken.StartObject: + case JsonToken.StartArray: + case JsonToken.StartConstructor: + case JsonToken.PropertyName: + return true; + case JsonToken.None: + case JsonToken.Comment: + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.String: + case JsonToken.Boolean: + case JsonToken.Null: + case JsonToken.Undefined: + case JsonToken.EndObject: + case JsonToken.EndArray: + case JsonToken.EndConstructor: + case JsonToken.Date: + return false; + default: + throw new ArgumentOutOfRangeException("token", token, "Unexpected JsonToken value."); + } + } + + private JsonTokenType GetTypeForCloseToken(JsonToken token) + { + switch (token) + { + case JsonToken.EndObject: + return JsonTokenType.Object; + case JsonToken.EndArray: + return JsonTokenType.Array; + case JsonToken.EndConstructor: + return JsonTokenType.Constructor; + default: + throw new JsonReaderException("Not a valid close JsonToken: " + token); + } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + void IDisposable.Dispose() + { + Dispose(true); + } + + /// + /// Releases unmanaged and - optionally - managed resources + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + if (_currentState != State.Closed && disposing) + Close(); + } + + /// + /// Changes the to Closed. + /// + public virtual void Close() + { + _currentState = State.Closed; + _token = JsonToken.None; + _value = null; + _valueType = null; + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonReaderException.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonReaderException.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonReaderException.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonReaderException.cs index 9940c67..711c450 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonReaderException.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonReaderException.cs @@ -1,65 +1,65 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Newtonsoft.Json -{ - /// - /// The exception thrown when an error occurs while reading Json text. - /// - public class JsonReaderException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public JsonReaderException() - { - } - - /// - /// Initializes a new instance of the class - /// with a specified error message. - /// - /// The error message that explains the reason for the exception. - public JsonReaderException(string message) - : base(message) - { - } - - /// - /// Initializes a new instance of the class - /// with a specified error message and a reference to the inner exception that is the cause of this exception. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - public JsonReaderException(string message, Exception innerException) - : base(message, innerException) - { - } - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// The exception thrown when an error occurs while reading Json text. + /// + public class JsonReaderException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public JsonReaderException() + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The error message that explains the reason for the exception. + public JsonReaderException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + public JsonReaderException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonSerializationException.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonSerializationException.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonSerializationException.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonSerializationException.cs index bec2635..758caa4 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonSerializationException.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonSerializationException.cs @@ -1,65 +1,65 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Newtonsoft.Json -{ - /// - /// The exception thrown when an error occurs during Json serialization or deserialization. - /// - public class JsonSerializationException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public JsonSerializationException() - { - } - - /// - /// Initializes a new instance of the class - /// with a specified error message. - /// - /// The error message that explains the reason for the exception. - public JsonSerializationException(string message) - : base(message) - { - } - - /// - /// Initializes a new instance of the class - /// with a specified error message and a reference to the inner exception that is the cause of this exception. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - public JsonSerializationException(string message, Exception innerException) - : base(message, innerException) - { - } - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// The exception thrown when an error occurs during Json serialization or deserialization. + /// + public class JsonSerializationException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public JsonSerializationException() + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The error message that explains the reason for the exception. + public JsonSerializationException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + public JsonSerializationException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonSerializer.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonSerializer.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonSerializer.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonSerializer.cs index 12afeae..a182701 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonSerializer.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonSerializer.cs @@ -1,830 +1,830 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Collections; -using System.Linq; -using System.Reflection; -using System.ComponentModel; -using Newtonsoft.Json.Utilities; -using System.Globalization; -using Newtonsoft.Json.Linq; -using System.Collections.ObjectModel; - -namespace Newtonsoft.Json -{ - /// - /// Serializes and deserializes objects into and from the Json format. - /// The enables you to control how objects are encoded into Json. - /// - public class JsonSerializer - { - private ReferenceLoopHandling _referenceLoopHandling; - private MissingMemberHandling _missingMemberHandling; - private ObjectCreationHandling _objectCreationHandling; - private NullValueHandling _nullValueHandling; - private int _level; - private JsonConverterCollection _converters; - private Dictionary _typeMemberMappings; - - /// - /// Get or set how reference loops (e.g. a class referencing itself) is handled. - /// - public ReferenceLoopHandling ReferenceLoopHandling - { - get { return _referenceLoopHandling; } - set - { - if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize) - throw new ArgumentOutOfRangeException("value"); - - _referenceLoopHandling = value; - } - } - - /// - /// Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. - /// - public MissingMemberHandling MissingMemberHandling - { - get { return _missingMemberHandling; } - set - { - if (value < MissingMemberHandling.Error || value > MissingMemberHandling.Ignore) - throw new ArgumentOutOfRangeException("value"); - - _missingMemberHandling = value; - } - } - - /// - /// Get or set how null values are handled during serialization and deserialization. - /// - public NullValueHandling NullValueHandling - { - get { return _nullValueHandling; } - set - { - if (value < NullValueHandling.Include || value > NullValueHandling.Ignore) - throw new ArgumentOutOfRangeException("value"); - - _nullValueHandling = value; - } - } - - /// - /// Gets or sets how objects are created during deserialization. - /// - /// The object creation handling. - public ObjectCreationHandling ObjectCreationHandling - { - get { return _objectCreationHandling; } - set - { - if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace) - throw new ArgumentOutOfRangeException("value"); - - _objectCreationHandling = value; - } - } - - /// - /// Gets a collection that will be used during serialization. - /// - /// Collection that will be used during serialization. - public JsonConverterCollection Converters - { - get - { - if (_converters == null) - _converters = new JsonConverterCollection(); - - return _converters; - } - } - - /// - /// Initializes a new instance of the class. - /// - public JsonSerializer() - { - _referenceLoopHandling = ReferenceLoopHandling.Error; - _missingMemberHandling = MissingMemberHandling.Error; - _nullValueHandling = NullValueHandling.Include; - _objectCreationHandling = ObjectCreationHandling.Auto; - } - - #region Deserialize - /// - /// Deserializes the Json structure contained by the specified . - /// - /// The that contains the Json structure to deserialize. - /// The being deserialized. - public object Deserialize(JsonReader reader) - { - return Deserialize(reader, null); - } - - /// - /// Deserializes the Json structure contained by the specified - /// into an instance of the specified type. - /// - /// The containing the object. - /// The of object being deserialized. - /// The instance of being deserialized. - public object Deserialize(JsonReader reader, Type objectType) - { - if (reader == null) - throw new ArgumentNullException("reader"); - - if (!reader.Read()) - return null; - - if (objectType != null) - return CreateObject(reader, objectType, null); - else - return CreateJToken(reader); - } - - /// - /// Deserializes the Json structure contained by the specified - /// into an instance of the specified type. - /// - /// The containing the object. - /// The of object being deserialized. - /// The instance of being deserialized. - public object Deserialize(StringReader reader, Type objectType) - { - return Deserialize(new JsonTextReader(reader), objectType); - } - - private JToken CreateJToken(JsonReader reader) - { - JToken token; - using (JsonTokenWriter writer = new JsonTokenWriter()) - { - writer.WriteToken(reader); - token = writer.Token; - } - - return token; - } - - private object CreateObject(JsonReader reader, Type objectType, object existingValue) - { - _level++; - - object value; - JsonConverter converter; - - if (HasMatchingConverter(objectType, out converter)) - { - return converter.ReadJson(reader, objectType); - } - else - { - switch (reader.TokenType) - { - // populate a typed object or generic dictionary/array - // depending upon whether an objectType was supplied - case JsonToken.StartObject: - if (objectType == null) - { - value = CreateJToken(reader); - } - else if (typeof(IDictionary).IsAssignableFrom(objectType) || ReflectionUtils.IsSubClass(objectType, typeof(IDictionary<,>))) - { - if (existingValue == null) - value = CreateAndPopulateDictionary(reader, objectType); - else - value = PopulateDictionary(CollectionUtils.CreateDictionaryWrapper(existingValue), reader); - } - else - { - if (existingValue == null) - value = CreateAndPopulateObject(reader, objectType); - else - value = PopulateObject(existingValue, reader, objectType); - } - break; - case JsonToken.StartArray: - if (objectType != null) - { - if (existingValue == null) - value = CreateAndPopulateList(reader, objectType); - else - value = PopulateList(CollectionUtils.CreateListWrapper(existingValue), ReflectionUtils.GetListItemType(objectType), reader); - } - else - { - value = CreateJToken(reader); - } - break; - case JsonToken.Integer: - case JsonToken.Float: - case JsonToken.String: - case JsonToken.Boolean: - case JsonToken.Date: - value = EnsureType(reader.Value, objectType); - break; - case JsonToken.StartConstructor: - case JsonToken.EndConstructor: - string constructorName = reader.Value.ToString(); - - value = constructorName; - break; - case JsonToken.Null: - case JsonToken.Undefined: - if (objectType == typeof(DBNull)) - value = DBNull.Value; - else - value = null; - break; - default: - throw new JsonSerializationException("Unexpected token while deserializing object: " + reader.TokenType); - } - } - - _level--; - - return value; - } - - private object EnsureType(object value, Type targetType) - { - // do something about null value when the targetType is a valuetype? - if (value == null) - return null; - - if (targetType == null) - return value; - - Type valueType = value.GetType(); - - // type of value and type of target don't match - // attempt to convert value's type to target's type - if (valueType != targetType) - { - TypeConverter targetConverter = TypeDescriptor.GetConverter(targetType); - - if (!targetConverter.CanConvertFrom(valueType)) - { - if (targetConverter.CanConvertFrom(typeof(string))) - { - string valueString = TypeDescriptor.GetConverter(value).ConvertToInvariantString(value); - - return targetConverter.ConvertFromInvariantString(valueString); - } - - if (targetType == typeof(DateTimeOffset) && value is DateTime) - return new DateTimeOffset((DateTime)value); - - if (!targetType.IsAssignableFrom(valueType)) - throw new InvalidOperationException("Cannot convert object of type '{0}' to type '{1}'".FormatWith(CultureInfo.InvariantCulture, value.GetType(), targetType)); - - return value; - } - - return targetConverter.ConvertFrom(null, CultureInfo.InvariantCulture, value); - } - else - { - return value; - } - } - - private MemberMappingCollection GetMemberMappings(Type objectType) - { - if (_typeMemberMappings == null) - _typeMemberMappings = new Dictionary(); - - MemberMappingCollection memberMappings; - - if (_typeMemberMappings.TryGetValue(objectType, out memberMappings)) - return memberMappings; - - memberMappings = CreateMemberMappings(objectType); - _typeMemberMappings[objectType] = memberMappings; - - return memberMappings; - } - - private MemberMappingCollection CreateMemberMappings(Type objectType) - { - MemberSerialization memberSerialization = GetObjectMemberSerialization(objectType); - - List members = GetSerializableMembers(objectType); - if (members == null) - throw new JsonSerializationException("Null collection of seralizable members returned."); - - MemberMappingCollection memberMappings = new MemberMappingCollection(); - - foreach (MemberInfo member in members) - { - JsonPropertyAttribute propertyAttribute = ReflectionUtils.GetAttribute(member, true); - bool hasIgnoreAttribute = member.IsDefined(typeof(JsonIgnoreAttribute), true); - - string mappedName = (propertyAttribute != null && propertyAttribute.PropertyName != null) - ? propertyAttribute.PropertyName - : member.Name; - - bool ignored = (hasIgnoreAttribute - || (memberSerialization == MemberSerialization.OptIn && propertyAttribute == null)); - - bool readable = ReflectionUtils.CanReadMemberValue(member); - bool writable = ReflectionUtils.CanSetMemberValue(member); - MemberMapping memberMapping = new MemberMapping(mappedName, member, ignored, readable, writable); - - memberMappings.AddMapping(memberMapping); - } - - return memberMappings; - } - - /// - /// Gets the serializable members for the given . - /// - /// The object to get seralizable members for. - /// Seralizable members for the given type. - protected virtual List GetSerializableMembers(Type objectType) - { - return ReflectionUtils.GetFieldsAndProperties(objectType, BindingFlags.Public | BindingFlags.Instance); - } - - private static MemberSerialization GetObjectMemberSerialization(Type objectType) - { - JsonObjectAttribute objectAttribute = ReflectionUtils.GetAttribute(objectType, true); - - if (objectAttribute == null) - return MemberSerialization.OptOut; - else - return objectAttribute.MemberSerialization; - } - - private void SetObjectMember(JsonReader reader, object target, Type targetType, string memberName) - { - if (!reader.Read()) - throw new JsonSerializationException("Unexpected end when setting {0}'s value.".FormatWith(CultureInfo.InvariantCulture, memberName)); - - MemberMappingCollection memberMappings = GetMemberMappings(targetType); - Type memberType; - object value; - - // test if a member with memberName exists on the type - // otherwise test if target is a dictionary and assign value with the key if it is - if (memberMappings.Contains(memberName)) - { - MemberMapping memberMapping = memberMappings[memberName]; - - if (memberMapping.Ignored) - { - reader.Skip(); - return; - } - - // get the member's underlying type - memberType = ReflectionUtils.GetMemberUnderlyingType(memberMapping.Member); - object currentValue = ReflectionUtils.GetMemberValue(memberMapping.Member, target); - - bool useExistingValue = (currentValue != null - && (_objectCreationHandling == ObjectCreationHandling.Auto || _objectCreationHandling == ObjectCreationHandling.Reuse) - && (reader.TokenType == JsonToken.StartArray || reader.TokenType == JsonToken.StartObject) - && (!memberType.IsArray && !ReflectionUtils.IsSubClass(memberType, typeof(ReadOnlyCollection<>)))); - - if (!memberMapping.Writable && !useExistingValue) - { - reader.Skip(); - return; - } - - value = CreateObject(reader, memberType, (useExistingValue) ? currentValue : null); - - if (_nullValueHandling == NullValueHandling.Ignore && value == null) - return; - - if (!useExistingValue) - ReflectionUtils.SetMemberValue(memberMapping.Member, target, value); - } - else - { - if (_missingMemberHandling == MissingMemberHandling.Error) - throw new JsonSerializationException("Could not find member '{0}' on object of type '{1}'".FormatWith(CultureInfo.InvariantCulture, memberName, targetType.GetType().Name)); - } - } - - private object CreateAndPopulateDictionary(JsonReader reader, Type objectType) - { - IWrappedDictionary dictionary = CollectionUtils.CreateDictionaryWrapper(Activator.CreateInstance(objectType)); - PopulateDictionary(dictionary, reader); - - return dictionary.UnderlyingDictionary; - } - - private IDictionary PopulateDictionary(IWrappedDictionary dictionary, JsonReader reader) - { - Type dictionaryType = dictionary.UnderlyingDictionary.GetType(); - Type dictionaryKeyType = ReflectionUtils.GetDictionaryKeyType(dictionaryType); - Type dictionaryValueType = ReflectionUtils.GetDictionaryValueType(dictionaryType); - - while (reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.PropertyName: - object keyValue = EnsureType(reader.Value, dictionaryKeyType); - reader.Read(); - - dictionary.Add(keyValue, CreateObject(reader, dictionaryValueType, null)); - break; - case JsonToken.EndObject: - return dictionary; - default: - throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType); - } - } - - throw new JsonSerializationException("Unexpected end when deserializing object."); - } - - private object CreateAndPopulateList(JsonReader reader, Type objectType) - { - return CollectionUtils.CreateAndPopulateList(objectType, l => PopulateList(l, ReflectionUtils.GetListItemType(objectType), reader)); - } - - private IList PopulateList(IList list, Type listItemType, JsonReader reader) - { - while (reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.EndArray: - return list; - case JsonToken.Comment: - break; - default: - object value = CreateObject(reader, listItemType, null); - - list.Add(value); - break; - } - } - - throw new JsonSerializationException("Unexpected end when deserializing array."); - } - - private object CreateAndPopulateObject(JsonReader reader, Type objectType) - { - object newObject; - - if (ReflectionUtils.HasDefaultConstructor(objectType)) - { - newObject = Activator.CreateInstance(objectType); - - PopulateObject(newObject, reader, objectType); - return newObject; - } - else - { - ConstructorInfo c = objectType.GetConstructors(BindingFlags.Public | BindingFlags.Instance).SingleOrDefault(); - - if (c == null) - throw new JsonSerializationException("Could not find a public constructor for type {0}.".FormatWith(CultureInfo.InvariantCulture, objectType)); - - IDictionary constructorParameters = c.GetParameters().ToDictionary(p => p, p => (object)null); - - bool exit = false; - while (!exit && reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.PropertyName: - string memberName = reader.Value.ToString(); - ParameterInfo matchingConstructorParameter = constructorParameters - .Where(kv => kv.Key.Name == memberName) - .Select(kv => kv.Key) - .SingleOrDefault(); - - if (!reader.Read()) - throw new JsonSerializationException("Unexpected end when setting {0}'s value.".FormatWith(CultureInfo.InvariantCulture, memberName)); - - if (matchingConstructorParameter != null) - constructorParameters[matchingConstructorParameter] = CreateObject(reader, matchingConstructorParameter.ParameterType, null); - - break; - case JsonToken.EndObject: - exit = true; - break; - default: - throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType); - } - } - - newObject = Activator.CreateInstance(objectType, constructorParameters.Values.ToArray()); - - return newObject; - } - } - - private object PopulateObject(object newObject, JsonReader reader, Type objectType) - { - while (reader.Read()) - { - switch (reader.TokenType) - { - case JsonToken.PropertyName: - string memberName = reader.Value.ToString(); - - SetObjectMember(reader, newObject, objectType, memberName); - break; - case JsonToken.EndObject: - return newObject; - default: - throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType); - } - } - - throw new JsonSerializationException("Unexpected end when deserializing object."); - } - #endregion - - #region Serialize - /// - /// Serializes the specified and writes the Json structure - /// to a Stream using the specified . - /// - /// The used to write the Json structure. - /// The to serialize. - public void Serialize(TextWriter textWriter, object value) - { - Serialize(new JsonTextWriter(textWriter), value); - } - - /// - /// Serializes the specified and writes the Json structure - /// to a Stream using the specified . - /// - /// The used to write the Json structure. - /// The to serialize. - public void Serialize(JsonWriter jsonWriter, object value) - { - if (jsonWriter == null) - throw new ArgumentNullException("jsonWriter"); - - if (value is JToken) - ((JToken)value).WriteTo(jsonWriter, (_converters != null) ? _converters.ToArray() : null); - else - SerializeValue(jsonWriter, value); - } - - - private void SerializeValue(JsonWriter writer, object value) - { - JsonConverter converter; - - if (value == null) - { - writer.WriteNull(); - } - else if (HasMatchingConverter(value.GetType(), out converter)) - { - converter.WriteJson(writer, value); - } - else if (value is IConvertible) - { - IConvertible convertible = value as IConvertible; - - switch (convertible.GetTypeCode()) - { - case TypeCode.String: - writer.WriteValue((string)convertible); - break; - case TypeCode.Char: - writer.WriteValue((char)convertible); - break; - case TypeCode.Boolean: - writer.WriteValue((bool)convertible); - break; - case TypeCode.SByte: - writer.WriteValue((sbyte)convertible); - break; - case TypeCode.Int16: - writer.WriteValue((short)convertible); - break; - case TypeCode.UInt16: - writer.WriteValue((ushort)convertible); - break; - case TypeCode.Int32: - writer.WriteValue((int)convertible); - break; - case TypeCode.Byte: - writer.WriteValue((byte)convertible); - break; - case TypeCode.UInt32: - writer.WriteValue((uint)convertible); - break; - case TypeCode.Int64: - writer.WriteValue((long)convertible); - break; - case TypeCode.UInt64: - writer.WriteValue((ulong)convertible); - break; - case TypeCode.Single: - writer.WriteValue((float)convertible); - break; - case TypeCode.Double: - writer.WriteValue((double)convertible); - break; - case TypeCode.DateTime: - writer.WriteValue((DateTime)convertible); - break; - case TypeCode.Decimal: - writer.WriteValue((decimal)convertible); - break; - case TypeCode.DBNull: - writer.WriteNull(); - break; - default: - SerializeObject(writer, value); - break; - } - } - else if (value is DateTimeOffset) - { - writer.WriteValue((DateTimeOffset)value); - } - else if (value is IList) - { - SerializeList(writer, (IList)value); - } - else if (value is IDictionary) - { - SerializeDictionary(writer, (IDictionary)value); - } - else if (value is ICollection) - { - SerializeCollection(writer, (ICollection)value); - } - else if (value is IEnumerable) - { - SerializeEnumerable(writer, (IEnumerable)value); - } - else if (value is Identifier) - { - writer.WriteRaw(value.ToString()); - } - else - { - SerializeObject(writer, value); - } - } - - private bool HasMatchingConverter(Type type, out JsonConverter matchingConverter) - { - return HasMatchingConverter(_converters, type, out matchingConverter); - } - - internal static bool HasMatchingConverter(IList converters, Type type, out JsonConverter matchingConverter) - { - if (converters != null) - { - for (int i = 0; i < converters.Count; i++) - { - JsonConverter converter = converters[i]; - - if (converter.CanConvert(type)) - { - matchingConverter = converter; - return true; - } - } - } - - matchingConverter = null; - return false; - } - - private void WriteMemberInfoProperty(JsonWriter writer, object value, MemberInfo member, string propertyName) - { - if (!ReflectionUtils.IsIndexedProperty(member)) - { - object memberValue = ReflectionUtils.GetMemberValue(member, value); - - if (_nullValueHandling == NullValueHandling.Ignore && memberValue == null) - return; - - if (writer.SerializeStack.IndexOf(memberValue) != -1) - { - switch (_referenceLoopHandling) - { - case ReferenceLoopHandling.Error: - throw new JsonSerializationException("Self referencing loop"); - case ReferenceLoopHandling.Ignore: - // return from method - return; - case ReferenceLoopHandling.Serialize: - // continue - break; - default: - throw new InvalidOperationException("Unexpected ReferenceLoopHandling value: '{0}'".FormatWith(CultureInfo.InvariantCulture, _referenceLoopHandling)); - } - } - - writer.WritePropertyName(propertyName ?? member.Name); - SerializeValue(writer, memberValue); - } - } - - private void SerializeObject(JsonWriter writer, object value) - { - Type objectType = value.GetType(); - - TypeConverter converter = TypeDescriptor.GetConverter(objectType); - - // use the objectType's TypeConverter if it has one and can convert to a string - if (converter != null && !(converter is ComponentConverter) && converter.GetType() != typeof(TypeConverter)) - { - if (converter.CanConvertTo(typeof(string))) - { - writer.WriteValue(converter.ConvertToInvariantString(value)); - return; - } - } - - writer.SerializeStack.Add(value); - - writer.WriteStartObject(); - - MemberMappingCollection memberMappings = GetMemberMappings(objectType); - - foreach (MemberMapping memberMapping in memberMappings) - { - if (!memberMapping.Ignored && memberMapping.Readable) - WriteMemberInfoProperty(writer, value, memberMapping.Member, memberMapping.MappingName); - } - - writer.WriteEndObject(); - - writer.SerializeStack.Remove(value); - } - - private void SerializeEnumerable(JsonWriter writer, IEnumerable values) - { - SerializeList(writer, values.Cast().ToList()); - } - - private void SerializeCollection(JsonWriter writer, ICollection values) - { - SerializeList(writer, values.Cast().ToList()); - } - - private void SerializeList(JsonWriter writer, IList values) - { - writer.WriteStartArray(); - - for (int i = 0; i < values.Count; i++) - { - SerializeValue(writer, values[i]); - } - - writer.WriteEndArray(); - } - - private void SerializeDictionary(JsonWriter writer, IDictionary values) - { - writer.WriteStartObject(); - - foreach (DictionaryEntry entry in values) - { - writer.WritePropertyName(entry.Key.ToString()); - SerializeValue(writer, entry.Value); - } - - writer.WriteEndObject(); - } - #endregion - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Collections; +using System.Linq; +using System.Reflection; +using System.ComponentModel; +using Newtonsoft.Json.Utilities; +using System.Globalization; +using Newtonsoft.Json.Linq; +using System.Collections.ObjectModel; + +namespace Newtonsoft.Json +{ + /// + /// Serializes and deserializes objects into and from the Json format. + /// The enables you to control how objects are encoded into Json. + /// + public class JsonSerializer + { + private ReferenceLoopHandling _referenceLoopHandling; + private MissingMemberHandling _missingMemberHandling; + private ObjectCreationHandling _objectCreationHandling; + private NullValueHandling _nullValueHandling; + private int _level; + private JsonConverterCollection _converters; + private Dictionary _typeMemberMappings; + + /// + /// Get or set how reference loops (e.g. a class referencing itself) is handled. + /// + public ReferenceLoopHandling ReferenceLoopHandling + { + get { return _referenceLoopHandling; } + set + { + if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize) + throw new ArgumentOutOfRangeException("value"); + + _referenceLoopHandling = value; + } + } + + /// + /// Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + /// + public MissingMemberHandling MissingMemberHandling + { + get { return _missingMemberHandling; } + set + { + if (value < MissingMemberHandling.Error || value > MissingMemberHandling.Ignore) + throw new ArgumentOutOfRangeException("value"); + + _missingMemberHandling = value; + } + } + + /// + /// Get or set how null values are handled during serialization and deserialization. + /// + public NullValueHandling NullValueHandling + { + get { return _nullValueHandling; } + set + { + if (value < NullValueHandling.Include || value > NullValueHandling.Ignore) + throw new ArgumentOutOfRangeException("value"); + + _nullValueHandling = value; + } + } + + /// + /// Gets or sets how objects are created during deserialization. + /// + /// The object creation handling. + public ObjectCreationHandling ObjectCreationHandling + { + get { return _objectCreationHandling; } + set + { + if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace) + throw new ArgumentOutOfRangeException("value"); + + _objectCreationHandling = value; + } + } + + /// + /// Gets a collection that will be used during serialization. + /// + /// Collection that will be used during serialization. + public JsonConverterCollection Converters + { + get + { + if (_converters == null) + _converters = new JsonConverterCollection(); + + return _converters; + } + } + + /// + /// Initializes a new instance of the class. + /// + public JsonSerializer() + { + _referenceLoopHandling = ReferenceLoopHandling.Error; + _missingMemberHandling = MissingMemberHandling.Error; + _nullValueHandling = NullValueHandling.Include; + _objectCreationHandling = ObjectCreationHandling.Auto; + } + + #region Deserialize + /// + /// Deserializes the Json structure contained by the specified . + /// + /// The that contains the Json structure to deserialize. + /// The being deserialized. + public object Deserialize(JsonReader reader) + { + return Deserialize(reader, null); + } + + /// + /// Deserializes the Json structure contained by the specified + /// into an instance of the specified type. + /// + /// The containing the object. + /// The of object being deserialized. + /// The instance of being deserialized. + public object Deserialize(JsonReader reader, Type objectType) + { + if (reader == null) + throw new ArgumentNullException("reader"); + + if (!reader.Read()) + return null; + + if (objectType != null) + return CreateObject(reader, objectType, null); + else + return CreateJToken(reader); + } + + /// + /// Deserializes the Json structure contained by the specified + /// into an instance of the specified type. + /// + /// The containing the object. + /// The of object being deserialized. + /// The instance of being deserialized. + public object Deserialize(StringReader reader, Type objectType) + { + return Deserialize(new JsonTextReader(reader), objectType); + } + + private JToken CreateJToken(JsonReader reader) + { + JToken token; + using (JsonTokenWriter writer = new JsonTokenWriter()) + { + writer.WriteToken(reader); + token = writer.Token; + } + + return token; + } + + private object CreateObject(JsonReader reader, Type objectType, object existingValue) + { + _level++; + + object value; + JsonConverter converter; + + if (HasMatchingConverter(objectType, out converter)) + { + return converter.ReadJson(reader, objectType); + } + else + { + switch (reader.TokenType) + { + // populate a typed object or generic dictionary/array + // depending upon whether an objectType was supplied + case JsonToken.StartObject: + if (objectType == null) + { + value = CreateJToken(reader); + } + else if (typeof(IDictionary).IsAssignableFrom(objectType) || ReflectionUtils.IsSubClass(objectType, typeof(IDictionary<,>))) + { + if (existingValue == null) + value = CreateAndPopulateDictionary(reader, objectType); + else + value = PopulateDictionary(CollectionUtils.CreateDictionaryWrapper(existingValue), reader); + } + else + { + if (existingValue == null) + value = CreateAndPopulateObject(reader, objectType); + else + value = PopulateObject(existingValue, reader, objectType); + } + break; + case JsonToken.StartArray: + if (objectType != null) + { + if (existingValue == null) + value = CreateAndPopulateList(reader, objectType); + else + value = PopulateList(CollectionUtils.CreateListWrapper(existingValue), ReflectionUtils.GetListItemType(objectType), reader); + } + else + { + value = CreateJToken(reader); + } + break; + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.String: + case JsonToken.Boolean: + case JsonToken.Date: + value = EnsureType(reader.Value, objectType); + break; + case JsonToken.StartConstructor: + case JsonToken.EndConstructor: + string constructorName = reader.Value.ToString(); + + value = constructorName; + break; + case JsonToken.Null: + case JsonToken.Undefined: + if (objectType == typeof(DBNull)) + value = DBNull.Value; + else + value = null; + break; + default: + throw new JsonSerializationException("Unexpected token while deserializing object: " + reader.TokenType); + } + } + + _level--; + + return value; + } + + private object EnsureType(object value, Type targetType) + { + // do something about null value when the targetType is a valuetype? + if (value == null) + return null; + + if (targetType == null) + return value; + + Type valueType = value.GetType(); + + // type of value and type of target don't match + // attempt to convert value's type to target's type + if (valueType != targetType) + { + TypeConverter targetConverter = TypeDescriptor.GetConverter(targetType); + + if (!targetConverter.CanConvertFrom(valueType)) + { + if (targetConverter.CanConvertFrom(typeof(string))) + { + string valueString = TypeDescriptor.GetConverter(value).ConvertToInvariantString(value); + + return targetConverter.ConvertFromInvariantString(valueString); + } + + if (targetType == typeof(DateTimeOffset) && value is DateTime) + return new DateTimeOffset((DateTime)value); + + if (!targetType.IsAssignableFrom(valueType)) + throw new InvalidOperationException("Cannot convert object of type '{0}' to type '{1}'".FormatWith(CultureInfo.InvariantCulture, value.GetType(), targetType)); + + return value; + } + + return targetConverter.ConvertFrom(null, CultureInfo.InvariantCulture, value); + } + else + { + return value; + } + } + + private MemberMappingCollection GetMemberMappings(Type objectType) + { + if (_typeMemberMappings == null) + _typeMemberMappings = new Dictionary(); + + MemberMappingCollection memberMappings; + + if (_typeMemberMappings.TryGetValue(objectType, out memberMappings)) + return memberMappings; + + memberMappings = CreateMemberMappings(objectType); + _typeMemberMappings[objectType] = memberMappings; + + return memberMappings; + } + + private MemberMappingCollection CreateMemberMappings(Type objectType) + { + MemberSerialization memberSerialization = GetObjectMemberSerialization(objectType); + + List members = GetSerializableMembers(objectType); + if (members == null) + throw new JsonSerializationException("Null collection of seralizable members returned."); + + MemberMappingCollection memberMappings = new MemberMappingCollection(); + + foreach (MemberInfo member in members) + { + JsonPropertyAttribute propertyAttribute = ReflectionUtils.GetAttribute(member, true); + bool hasIgnoreAttribute = member.IsDefined(typeof(JsonIgnoreAttribute), true); + + string mappedName = (propertyAttribute != null && propertyAttribute.PropertyName != null) + ? propertyAttribute.PropertyName + : member.Name; + + bool ignored = (hasIgnoreAttribute + || (memberSerialization == MemberSerialization.OptIn && propertyAttribute == null)); + + bool readable = ReflectionUtils.CanReadMemberValue(member); + bool writable = ReflectionUtils.CanSetMemberValue(member); + MemberMapping memberMapping = new MemberMapping(mappedName, member, ignored, readable, writable); + + memberMappings.AddMapping(memberMapping); + } + + return memberMappings; + } + + /// + /// Gets the serializable members for the given . + /// + /// The object to get seralizable members for. + /// Seralizable members for the given type. + protected virtual List GetSerializableMembers(Type objectType) + { + return ReflectionUtils.GetFieldsAndProperties(objectType, BindingFlags.Public | BindingFlags.Instance); + } + + private static MemberSerialization GetObjectMemberSerialization(Type objectType) + { + JsonObjectAttribute objectAttribute = ReflectionUtils.GetAttribute(objectType, true); + + if (objectAttribute == null) + return MemberSerialization.OptOut; + else + return objectAttribute.MemberSerialization; + } + + private void SetObjectMember(JsonReader reader, object target, Type targetType, string memberName) + { + if (!reader.Read()) + throw new JsonSerializationException("Unexpected end when setting {0}'s value.".FormatWith(CultureInfo.InvariantCulture, memberName)); + + MemberMappingCollection memberMappings = GetMemberMappings(targetType); + Type memberType; + object value; + + // test if a member with memberName exists on the type + // otherwise test if target is a dictionary and assign value with the key if it is + if (memberMappings.Contains(memberName)) + { + MemberMapping memberMapping = memberMappings[memberName]; + + if (memberMapping.Ignored) + { + reader.Skip(); + return; + } + + // get the member's underlying type + memberType = ReflectionUtils.GetMemberUnderlyingType(memberMapping.Member); + object currentValue = ReflectionUtils.GetMemberValue(memberMapping.Member, target); + + bool useExistingValue = (currentValue != null + && (_objectCreationHandling == ObjectCreationHandling.Auto || _objectCreationHandling == ObjectCreationHandling.Reuse) + && (reader.TokenType == JsonToken.StartArray || reader.TokenType == JsonToken.StartObject) + && (!memberType.IsArray && !ReflectionUtils.IsSubClass(memberType, typeof(ReadOnlyCollection<>)))); + + if (!memberMapping.Writable && !useExistingValue) + { + reader.Skip(); + return; + } + + value = CreateObject(reader, memberType, (useExistingValue) ? currentValue : null); + + if (_nullValueHandling == NullValueHandling.Ignore && value == null) + return; + + if (!useExistingValue) + ReflectionUtils.SetMemberValue(memberMapping.Member, target, value); + } + else + { + if (_missingMemberHandling == MissingMemberHandling.Error) + throw new JsonSerializationException("Could not find member '{0}' on object of type '{1}'".FormatWith(CultureInfo.InvariantCulture, memberName, targetType.GetType().Name)); + } + } + + private object CreateAndPopulateDictionary(JsonReader reader, Type objectType) + { + IWrappedDictionary dictionary = CollectionUtils.CreateDictionaryWrapper(Activator.CreateInstance(objectType)); + PopulateDictionary(dictionary, reader); + + return dictionary.UnderlyingDictionary; + } + + private IDictionary PopulateDictionary(IWrappedDictionary dictionary, JsonReader reader) + { + Type dictionaryType = dictionary.UnderlyingDictionary.GetType(); + Type dictionaryKeyType = ReflectionUtils.GetDictionaryKeyType(dictionaryType); + Type dictionaryValueType = ReflectionUtils.GetDictionaryValueType(dictionaryType); + + while (reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + object keyValue = EnsureType(reader.Value, dictionaryKeyType); + reader.Read(); + + dictionary.Add(keyValue, CreateObject(reader, dictionaryValueType, null)); + break; + case JsonToken.EndObject: + return dictionary; + default: + throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType); + } + } + + throw new JsonSerializationException("Unexpected end when deserializing object."); + } + + private object CreateAndPopulateList(JsonReader reader, Type objectType) + { + return CollectionUtils.CreateAndPopulateList(objectType, l => PopulateList(l, ReflectionUtils.GetListItemType(objectType), reader)); + } + + private IList PopulateList(IList list, Type listItemType, JsonReader reader) + { + while (reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.EndArray: + return list; + case JsonToken.Comment: + break; + default: + object value = CreateObject(reader, listItemType, null); + + list.Add(value); + break; + } + } + + throw new JsonSerializationException("Unexpected end when deserializing array."); + } + + private object CreateAndPopulateObject(JsonReader reader, Type objectType) + { + object newObject; + + if (ReflectionUtils.HasDefaultConstructor(objectType)) + { + newObject = Activator.CreateInstance(objectType); + + PopulateObject(newObject, reader, objectType); + return newObject; + } + else + { + ConstructorInfo c = objectType.GetConstructors(BindingFlags.Public | BindingFlags.Instance).SingleOrDefault(); + + if (c == null) + throw new JsonSerializationException("Could not find a public constructor for type {0}.".FormatWith(CultureInfo.InvariantCulture, objectType)); + + IDictionary constructorParameters = c.GetParameters().ToDictionary(p => p, p => (object)null); + + bool exit = false; + while (!exit && reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + string memberName = reader.Value.ToString(); + ParameterInfo matchingConstructorParameter = constructorParameters + .Where(kv => kv.Key.Name == memberName) + .Select(kv => kv.Key) + .SingleOrDefault(); + + if (!reader.Read()) + throw new JsonSerializationException("Unexpected end when setting {0}'s value.".FormatWith(CultureInfo.InvariantCulture, memberName)); + + if (matchingConstructorParameter != null) + constructorParameters[matchingConstructorParameter] = CreateObject(reader, matchingConstructorParameter.ParameterType, null); + + break; + case JsonToken.EndObject: + exit = true; + break; + default: + throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType); + } + } + + newObject = Activator.CreateInstance(objectType, constructorParameters.Values.ToArray()); + + return newObject; + } + } + + private object PopulateObject(object newObject, JsonReader reader, Type objectType) + { + while (reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + string memberName = reader.Value.ToString(); + + SetObjectMember(reader, newObject, objectType, memberName); + break; + case JsonToken.EndObject: + return newObject; + default: + throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType); + } + } + + throw new JsonSerializationException("Unexpected end when deserializing object."); + } + #endregion + + #region Serialize + /// + /// Serializes the specified and writes the Json structure + /// to a Stream using the specified . + /// + /// The used to write the Json structure. + /// The to serialize. + public void Serialize(TextWriter textWriter, object value) + { + Serialize(new JsonTextWriter(textWriter), value); + } + + /// + /// Serializes the specified and writes the Json structure + /// to a Stream using the specified . + /// + /// The used to write the Json structure. + /// The to serialize. + public void Serialize(JsonWriter jsonWriter, object value) + { + if (jsonWriter == null) + throw new ArgumentNullException("jsonWriter"); + + if (value is JToken) + ((JToken)value).WriteTo(jsonWriter, (_converters != null) ? _converters.ToArray() : null); + else + SerializeValue(jsonWriter, value); + } + + + private void SerializeValue(JsonWriter writer, object value) + { + JsonConverter converter; + + if (value == null) + { + writer.WriteNull(); + } + else if (HasMatchingConverter(value.GetType(), out converter)) + { + converter.WriteJson(writer, value); + } + else if (value is IConvertible) + { + IConvertible convertible = value as IConvertible; + + switch (convertible.GetTypeCode()) + { + case TypeCode.String: + writer.WriteValue((string)convertible); + break; + case TypeCode.Char: + writer.WriteValue((char)convertible); + break; + case TypeCode.Boolean: + writer.WriteValue((bool)convertible); + break; + case TypeCode.SByte: + writer.WriteValue((sbyte)convertible); + break; + case TypeCode.Int16: + writer.WriteValue((short)convertible); + break; + case TypeCode.UInt16: + writer.WriteValue((ushort)convertible); + break; + case TypeCode.Int32: + writer.WriteValue((int)convertible); + break; + case TypeCode.Byte: + writer.WriteValue((byte)convertible); + break; + case TypeCode.UInt32: + writer.WriteValue((uint)convertible); + break; + case TypeCode.Int64: + writer.WriteValue((long)convertible); + break; + case TypeCode.UInt64: + writer.WriteValue((ulong)convertible); + break; + case TypeCode.Single: + writer.WriteValue((float)convertible); + break; + case TypeCode.Double: + writer.WriteValue((double)convertible); + break; + case TypeCode.DateTime: + writer.WriteValue((DateTime)convertible); + break; + case TypeCode.Decimal: + writer.WriteValue((decimal)convertible); + break; + case TypeCode.DBNull: + writer.WriteNull(); + break; + default: + SerializeObject(writer, value); + break; + } + } + else if (value is DateTimeOffset) + { + writer.WriteValue((DateTimeOffset)value); + } + else if (value is IList) + { + SerializeList(writer, (IList)value); + } + else if (value is IDictionary) + { + SerializeDictionary(writer, (IDictionary)value); + } + else if (value is ICollection) + { + SerializeCollection(writer, (ICollection)value); + } + else if (value is IEnumerable) + { + SerializeEnumerable(writer, (IEnumerable)value); + } + else if (value is Identifier) + { + writer.WriteRaw(value.ToString()); + } + else + { + SerializeObject(writer, value); + } + } + + private bool HasMatchingConverter(Type type, out JsonConverter matchingConverter) + { + return HasMatchingConverter(_converters, type, out matchingConverter); + } + + internal static bool HasMatchingConverter(IList converters, Type type, out JsonConverter matchingConverter) + { + if (converters != null) + { + for (int i = 0; i < converters.Count; i++) + { + JsonConverter converter = converters[i]; + + if (converter.CanConvert(type)) + { + matchingConverter = converter; + return true; + } + } + } + + matchingConverter = null; + return false; + } + + private void WriteMemberInfoProperty(JsonWriter writer, object value, MemberInfo member, string propertyName) + { + if (!ReflectionUtils.IsIndexedProperty(member)) + { + object memberValue = ReflectionUtils.GetMemberValue(member, value); + + if (_nullValueHandling == NullValueHandling.Ignore && memberValue == null) + return; + + if (writer.SerializeStack.IndexOf(memberValue) != -1) + { + switch (_referenceLoopHandling) + { + case ReferenceLoopHandling.Error: + throw new JsonSerializationException("Self referencing loop"); + case ReferenceLoopHandling.Ignore: + // return from method + return; + case ReferenceLoopHandling.Serialize: + // continue + break; + default: + throw new InvalidOperationException("Unexpected ReferenceLoopHandling value: '{0}'".FormatWith(CultureInfo.InvariantCulture, _referenceLoopHandling)); + } + } + + writer.WritePropertyName(propertyName ?? member.Name); + SerializeValue(writer, memberValue); + } + } + + private void SerializeObject(JsonWriter writer, object value) + { + Type objectType = value.GetType(); + + TypeConverter converter = TypeDescriptor.GetConverter(objectType); + + // use the objectType's TypeConverter if it has one and can convert to a string + if (converter != null && !(converter is ComponentConverter) && converter.GetType() != typeof(TypeConverter)) + { + if (converter.CanConvertTo(typeof(string))) + { + writer.WriteValue(converter.ConvertToInvariantString(value)); + return; + } + } + + writer.SerializeStack.Add(value); + + writer.WriteStartObject(); + + MemberMappingCollection memberMappings = GetMemberMappings(objectType); + + foreach (MemberMapping memberMapping in memberMappings) + { + if (!memberMapping.Ignored && memberMapping.Readable) + WriteMemberInfoProperty(writer, value, memberMapping.Member, memberMapping.MappingName); + } + + writer.WriteEndObject(); + + writer.SerializeStack.Remove(value); + } + + private void SerializeEnumerable(JsonWriter writer, IEnumerable values) + { + SerializeList(writer, values.Cast().ToList()); + } + + private void SerializeCollection(JsonWriter writer, ICollection values) + { + SerializeList(writer, values.Cast().ToList()); + } + + private void SerializeList(JsonWriter writer, IList values) + { + writer.WriteStartArray(); + + for (int i = 0; i < values.Count; i++) + { + SerializeValue(writer, values[i]); + } + + writer.WriteEndArray(); + } + + private void SerializeDictionary(JsonWriter writer, IDictionary values) + { + writer.WriteStartObject(); + + foreach (DictionaryEntry entry in values) + { + writer.WritePropertyName(entry.Key.ToString()); + SerializeValue(writer, entry.Value); + } + + writer.WriteEndObject(); + } + #endregion + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonTextReader.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonTextReader.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonTextReader.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonTextReader.cs index 02330d6..638e2da 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonTextReader.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonTextReader.cs @@ -1,811 +1,811 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using System.Globalization; - -namespace Newtonsoft.Json -{ - /// - /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - /// - public class JsonTextReader : JsonReader - { - private TextReader _reader; - private char _currentChar; - - // current Token data - private StringBuffer _buffer; - - /// - /// Initializes a new instance of the class with the specified . - /// - /// The TextReader containing the XML data to read. - public JsonTextReader(TextReader reader) - { - if (reader == null) - throw new ArgumentNullException("reader"); - - _reader = reader; - _buffer = new StringBuffer(4096); - } - - private void ParseString(char quote) - { - bool stringTerminated = false; - bool hexNumber = false; - int hexCount = 0; - - while (!stringTerminated && MoveNext()) - { - if (hexNumber) - hexCount++; - - switch (_currentChar) - { - case '\\': - if (MoveNext()) - { - switch (_currentChar) - { - case 'b': - _buffer.Append('\b'); - break; - case 't': - _buffer.Append('\t'); - break; - case 'n': - _buffer.Append('\n'); - break; - case 'f': - _buffer.Append('\f'); - break; - case 'r': - _buffer.Append('\r'); - break; - case 'u': - // note the start of a hex character - hexNumber = true; - break; - default: - _buffer.Append(_currentChar); - break; - } - } - else - { - throw new JsonReaderException("Unterminated string. Expected delimiter: " + quote); - } - break; - case '"': - case '\'': - if (_currentChar == quote) - stringTerminated = true; - else - goto default; - break; - default: - _buffer.Append(_currentChar); - break; - } - - if (hexCount == 4) - { - // remove hex characters from buffer, convert to char and then add - string hexString = _buffer.ToString(_buffer.Position - 4, 4); - char hexChar = Convert.ToChar(int.Parse(hexString, NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo)); - - _buffer.Position = _buffer.Position - 4; - _buffer.Append(hexChar); - - hexNumber = false; - hexCount = 0; - } - } - - if (!stringTerminated) - throw new JsonReaderException("Unterminated string. Expected delimiter: " + quote); - - ClearCurrentChar(); - string text = _buffer.ToString(); - _buffer.Position = 0; - - if (text.StartsWith("/Date(", StringComparison.Ordinal) && text.EndsWith(")/", StringComparison.Ordinal)) - { - ParseDate(text); - } - else - { - SetToken(JsonToken.String, text); - QuoteChar = quote; - } - } - - /// - /// Sets the current token and value. - /// - /// The new token. - /// The value. - protected override void SetToken(JsonToken newToken, object value) - { - base.SetToken(newToken, value); - - switch (newToken) - { - case JsonToken.StartObject: - ClearCurrentChar(); - break; - case JsonToken.StartArray: - ClearCurrentChar(); - break; - case JsonToken.StartConstructor: - ClearCurrentChar(); - break; - case JsonToken.EndObject: - ClearCurrentChar(); - break; - case JsonToken.EndArray: - ClearCurrentChar(); - break; - case JsonToken.EndConstructor: - ClearCurrentChar(); - break; - case JsonToken.PropertyName: - ClearCurrentChar(); - break; - } - } - - private void ParseDate(string text) - { - string value = text.Substring(6, text.Length - 8); - DateTimeKind kind = DateTimeKind.Utc; - - int index = value.IndexOf('+', 1); - - if (index == -1) - index = value.IndexOf('-', 1); - - if (index != -1) - { - kind = DateTimeKind.Local; - value = value.Substring(0, index); - } - - long javaScriptTicks = long.Parse(value, CultureInfo.InvariantCulture); - DateTime utcDateTime = JavaScriptConvert.ConvertJavaScriptTicksToDateTime(javaScriptTicks); - DateTime dateTime; - - switch (kind) - { - case DateTimeKind.Unspecified: - dateTime = DateTime.SpecifyKind(utcDateTime.ToLocalTime(), DateTimeKind.Unspecified); - break; - case DateTimeKind.Local: - dateTime = utcDateTime.ToLocalTime(); - break; - default: - dateTime = utcDateTime; - break; - } - - SetToken(JsonToken.Date, dateTime); - } - - private bool MoveNext() - { - int value = _reader.Read(); - - if (value != -1) - { - _currentChar = (char)value; - //_testBuffer.Append(_currentChar); - return true; - } - else - { - return false; - } - } - - private bool HasNext() - { - return (_reader.Peek() != -1); - } - - private char PeekNext() - { - return (char)_reader.Peek(); - } - - private void ClearCurrentChar() - { - _currentChar = '\0'; - } - - private bool MoveTo(char value) - { - while (MoveNext()) - { - if (_currentChar == value) - return true; - } - return false; - } - - /// - /// Reads the next Json token from the stream. - /// - /// - /// true if the next token was read successfully; false if there are no more tokens to read. - /// - public override bool Read() - { - while (true) - { - if (_currentChar == '\0') - { - if (!MoveNext()) - return false; - } - - switch (CurrentState) - { - case State.Start: - case State.Property: - case State.Array: - case State.ArrayStart: - case State.Constructor: - case State.ConstructorStart: - return ParseValue(); - case State.Complete: - break; - case State.Object: - case State.ObjectStart: - return ParseObject(); - case State.PostValue: - // returns true if it hits - // end of object or array - if (ParsePostValue()) - return true; - break; - case State.Closed: - break; - case State.Error: - break; - default: - throw new JsonReaderException("Unexpected state: " + CurrentState); - } - } - } - - private bool ParsePostValue() - { - do - { - switch (_currentChar) - { - case '}': - SetToken(JsonToken.EndObject); - ClearCurrentChar(); - return true; - case ']': - SetToken(JsonToken.EndArray); - ClearCurrentChar(); - return true; - case ')': - SetToken(JsonToken.EndConstructor); - ClearCurrentChar(); - return true; - case '/': - ParseComment(); - return true; - case ',': - // finished paring - SetStateBasedOnCurrent(); - ClearCurrentChar(); - return false; - default: - if (char.IsWhiteSpace(_currentChar)) - { - // eat whitespace - ClearCurrentChar(); - } - else - { - throw new JsonReaderException("After parsing a value an unexpected character was encoutered: " + _currentChar); - } - break; - } - } while (MoveNext()); - - return false; - } - - private bool ParseObject() - { - do - { - switch (_currentChar) - { - case '}': - SetToken(JsonToken.EndObject); - return true; - case '/': - ParseComment(); - return true; - case ',': - SetToken(JsonToken.Undefined); - return true; - default: - if (char.IsWhiteSpace(_currentChar)) - { - // eat - } - else - { - return ParseProperty(); - } - break; - } - } while (MoveNext()); - - return false; - } - - private bool ParseProperty() - { - if (ValidIdentifierChar(_currentChar)) - { - ParseUnquotedProperty(); - } - else if (_currentChar == '"' || _currentChar == '\'') - { - ParseQuotedProperty(_currentChar); - } - else - { - throw new JsonReaderException("Invalid property identifier character: " + _currentChar); - } - - // finished property. move to colon - if (_currentChar != ':') - { - MoveTo(':'); - } - - SetToken(JsonToken.PropertyName, _buffer.ToString()); - _buffer.Position = 0; - - return true; - } - - private void ParseQuotedProperty(char quoteChar) - { - // parse property name until quoted char is hit - while (MoveNext()) - { - if (_currentChar == quoteChar) - { - return; - } - else - { - _buffer.Append(_currentChar); - } - } - - throw new JsonReaderException("Unclosed quoted property. Expected: " + quoteChar); - } - - private bool ValidIdentifierChar(char value) - { - return (char.IsLetterOrDigit(_currentChar) || _currentChar == '_' || _currentChar == '$'); - } - - private void ParseUnquotedProperty() - { - // parse unquoted property name until whitespace or colon - _buffer.Append(_currentChar); - - while (MoveNext()) - { - if (char.IsWhiteSpace(_currentChar) || _currentChar == ':') - { - break; - } - else if (ValidIdentifierChar(_currentChar)) - { - _buffer.Append(_currentChar); - } - else - { - throw new JsonReaderException("Invalid JavaScript property identifier character: " + _currentChar); - } - } - } - - private bool ParseValue() - { - do - { - switch (_currentChar) - { - case '"': - case '\'': - ParseString(_currentChar); - return true; - case 't': - ParseTrue(); - return true; - case 'f': - ParseFalse(); - return true; - case 'n': - if (HasNext()) - { - char next = PeekNext(); - - if (next == 'u') - ParseNull(); - else if (next == 'e') - ParseConstructor(); - else - throw new JsonReaderException("Unexpected character encountered while parsing value: " + _currentChar); - } - else - { - throw new JsonReaderException("Unexpected end"); - } - return true; - case 'N': - ParseNumberNaN(); - return true; - case 'I': - ParseNumberPositiveInfinity(); - return true; - case '-': - if (PeekNext() == 'I') - ParseNumberNegativeInfinity(); - else - ParseNumber(); - return true; - case '/': - ParseComment(); - return true; - case 'u': - ParseUndefined(); - return true; - case '{': - SetToken(JsonToken.StartObject); - return true; - case '[': - SetToken(JsonToken.StartArray); - return true; - case '}': - SetToken(JsonToken.EndObject); - return true; - case ']': - SetToken(JsonToken.EndArray); - return true; - case ',': - SetToken(JsonToken.Undefined); - //ClearCurrentChar(); - return true; - case ')': - SetToken(JsonToken.EndConstructor); - return true; - default: - if (char.IsWhiteSpace(_currentChar)) - { - // eat - } - else if (char.IsNumber(_currentChar) || _currentChar == '-' || _currentChar == '.') - { - ParseNumber(); - return true; - } - else - { - throw new JsonReaderException("Unexpected character encountered while parsing value: " + _currentChar); - } - break; - } - } while (MoveNext()); - - return false; - } - - private bool EatWhitespace(bool oneOrMore) - { - bool whitespace = false; - while (char.IsWhiteSpace(_currentChar)) - { - whitespace = true; - MoveNext(); - } - - return (!oneOrMore || whitespace); - } - - private void ParseConstructor() - { - if (MatchValue("new", true)) - { - if (EatWhitespace(true)) - { - while (char.IsLetter(_currentChar)) - { - _buffer.Append(_currentChar); - MoveNext(); - } - - EatWhitespace(false); - - if (_currentChar != '(') - throw new JsonReaderException("Unexpected character while parsing constructor: " + _currentChar); - - string constructorName = _buffer.ToString(); - _buffer.Position = 0; - - SetToken(JsonToken.StartConstructor, constructorName); - } - } - } - - private void ParseNumber() - { - // parse until seperator character or end - bool end = false; - do - { - if (CurrentIsSeperator()) - end = true; - else - _buffer.Append(_currentChar); - - } while (!end && MoveNext()); - - string number = _buffer.ToString(); - object numberValue; - JsonToken numberType; - - if (number.IndexOf(".", StringComparison.OrdinalIgnoreCase) == -1 - && number.IndexOf("e", StringComparison.OrdinalIgnoreCase) == -1) - { - numberValue = Convert.ToInt64(_buffer.ToString(), CultureInfo.InvariantCulture); - numberType = JsonToken.Integer; - } - else - { - numberValue = Convert.ToDouble(_buffer.ToString(), CultureInfo.InvariantCulture); - numberType = JsonToken.Float; - } - - _buffer.Position = 0; - - SetToken(numberType, numberValue); - } - - private void ParseComment() - { - // should have already parsed / character before reaching this method - - MoveNext(); - - if (_currentChar == '*') - { - while (MoveNext()) - { - if (_currentChar == '*') - { - if (MoveNext()) - { - if (_currentChar == '/') - { - break; - } - else - { - _buffer.Append('*'); - _buffer.Append(_currentChar); - } - } - } - else - { - _buffer.Append(_currentChar); - } - } - } - else - { - throw new JsonReaderException("Error parsing comment. Expected: *"); - } - - SetToken(JsonToken.Comment, _buffer.ToString()); - - _buffer.Position = 0; - - ClearCurrentChar(); - } - - private bool MatchValue(string value) - { - int i = 0; - do - { - if (_currentChar != value[i]) - { - break; - } - i++; - } - while (i < value.Length && MoveNext()); - - return (i == value.Length); - } - - private bool MatchValue(string value, bool noTrailingNonSeperatorCharacters) - { - // will match value and then move to the next character, checking that it is a seperator character - bool match = MatchValue(value); - - if (!noTrailingNonSeperatorCharacters) - return match; - else - return (match && (!MoveNext() || CurrentIsSeperator())); - } - - private bool CurrentIsSeperator() - { - switch (_currentChar) - { - case '}': - case ']': - case ',': - return true; - case '/': - // check next character to see if start of a comment - return (HasNext() && PeekNext() == '*'); - case ')': - if (CurrentState == State.Constructor || CurrentState == State.ConstructorStart) - return true; - break; - default: - if (char.IsWhiteSpace(_currentChar)) - return true; - break; - } - - return false; - } - - private void ParseTrue() - { - // check characters equal 'true' - // and that it is followed by either a seperator character - // or the text ends - if (MatchValue(JavaScriptConvert.True, true)) - { - SetToken(JsonToken.Boolean, true); - } - else - { - throw new JsonReaderException("Error parsing boolean value."); - } - } - - private void ParseNull() - { - if (MatchValue(JavaScriptConvert.Null, true)) - { - SetToken(JsonToken.Null); - } - else - { - throw new JsonReaderException("Error parsing null value."); - } - } - - private void ParseUndefined() - { - if (MatchValue(JavaScriptConvert.Undefined, true)) - { - SetToken(JsonToken.Undefined); - } - else - { - throw new JsonReaderException("Error parsing undefined value."); - } - } - - private void ParseFalse() - { - if (MatchValue(JavaScriptConvert.False, true)) - { - SetToken(JsonToken.Boolean, false); - } - else - { - throw new JsonReaderException("Error parsing boolean value."); - } - } - - private void ParseNumberNegativeInfinity() - { - if (MatchValue(JavaScriptConvert.NegativeInfinity, true)) - { - SetToken(JsonToken.Float, double.NegativeInfinity); - } - else - { - throw new JsonReaderException("Error parsing negative infinity value."); - } - } - - private void ParseNumberPositiveInfinity() - { - if (MatchValue(JavaScriptConvert.PositiveInfinity, true)) - { - SetToken(JsonToken.Float, double.PositiveInfinity); - } - else - { - throw new JsonReaderException("Error parsing positive infinity value."); - } - } - - private void ParseNumberNaN() - { - if (MatchValue(JavaScriptConvert.NaN, true)) - { - SetToken(JsonToken.Float, double.NaN); - } - else - { - throw new JsonReaderException("Error parsing NaN value."); - } - } - - /// - /// Changes the to Closed. - /// - public override void Close() - { - base.Close(); - - if (_reader != null) - _reader.Close(); - - if (_buffer != null) - _buffer.Clear(); - } - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using System.Globalization; + +namespace Newtonsoft.Json +{ + /// + /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + /// + public class JsonTextReader : JsonReader + { + private TextReader _reader; + private char _currentChar; + + // current Token data + private StringBuffer _buffer; + + /// + /// Initializes a new instance of the class with the specified . + /// + /// The TextReader containing the XML data to read. + public JsonTextReader(TextReader reader) + { + if (reader == null) + throw new ArgumentNullException("reader"); + + _reader = reader; + _buffer = new StringBuffer(4096); + } + + private void ParseString(char quote) + { + bool stringTerminated = false; + bool hexNumber = false; + int hexCount = 0; + + while (!stringTerminated && MoveNext()) + { + if (hexNumber) + hexCount++; + + switch (_currentChar) + { + case '\\': + if (MoveNext()) + { + switch (_currentChar) + { + case 'b': + _buffer.Append('\b'); + break; + case 't': + _buffer.Append('\t'); + break; + case 'n': + _buffer.Append('\n'); + break; + case 'f': + _buffer.Append('\f'); + break; + case 'r': + _buffer.Append('\r'); + break; + case 'u': + // note the start of a hex character + hexNumber = true; + break; + default: + _buffer.Append(_currentChar); + break; + } + } + else + { + throw new JsonReaderException("Unterminated string. Expected delimiter: " + quote); + } + break; + case '"': + case '\'': + if (_currentChar == quote) + stringTerminated = true; + else + goto default; + break; + default: + _buffer.Append(_currentChar); + break; + } + + if (hexCount == 4) + { + // remove hex characters from buffer, convert to char and then add + string hexString = _buffer.ToString(_buffer.Position - 4, 4); + char hexChar = Convert.ToChar(int.Parse(hexString, NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo)); + + _buffer.Position = _buffer.Position - 4; + _buffer.Append(hexChar); + + hexNumber = false; + hexCount = 0; + } + } + + if (!stringTerminated) + throw new JsonReaderException("Unterminated string. Expected delimiter: " + quote); + + ClearCurrentChar(); + string text = _buffer.ToString(); + _buffer.Position = 0; + + if (text.StartsWith("/Date(", StringComparison.Ordinal) && text.EndsWith(")/", StringComparison.Ordinal)) + { + ParseDate(text); + } + else + { + SetToken(JsonToken.String, text); + QuoteChar = quote; + } + } + + /// + /// Sets the current token and value. + /// + /// The new token. + /// The value. + protected override void SetToken(JsonToken newToken, object value) + { + base.SetToken(newToken, value); + + switch (newToken) + { + case JsonToken.StartObject: + ClearCurrentChar(); + break; + case JsonToken.StartArray: + ClearCurrentChar(); + break; + case JsonToken.StartConstructor: + ClearCurrentChar(); + break; + case JsonToken.EndObject: + ClearCurrentChar(); + break; + case JsonToken.EndArray: + ClearCurrentChar(); + break; + case JsonToken.EndConstructor: + ClearCurrentChar(); + break; + case JsonToken.PropertyName: + ClearCurrentChar(); + break; + } + } + + private void ParseDate(string text) + { + string value = text.Substring(6, text.Length - 8); + DateTimeKind kind = DateTimeKind.Utc; + + int index = value.IndexOf('+', 1); + + if (index == -1) + index = value.IndexOf('-', 1); + + if (index != -1) + { + kind = DateTimeKind.Local; + value = value.Substring(0, index); + } + + long javaScriptTicks = long.Parse(value, CultureInfo.InvariantCulture); + DateTime utcDateTime = JavaScriptConvert.ConvertJavaScriptTicksToDateTime(javaScriptTicks); + DateTime dateTime; + + switch (kind) + { + case DateTimeKind.Unspecified: + dateTime = DateTime.SpecifyKind(utcDateTime.ToLocalTime(), DateTimeKind.Unspecified); + break; + case DateTimeKind.Local: + dateTime = utcDateTime.ToLocalTime(); + break; + default: + dateTime = utcDateTime; + break; + } + + SetToken(JsonToken.Date, dateTime); + } + + private bool MoveNext() + { + int value = _reader.Read(); + + if (value != -1) + { + _currentChar = (char)value; + //_testBuffer.Append(_currentChar); + return true; + } + else + { + return false; + } + } + + private bool HasNext() + { + return (_reader.Peek() != -1); + } + + private char PeekNext() + { + return (char)_reader.Peek(); + } + + private void ClearCurrentChar() + { + _currentChar = '\0'; + } + + private bool MoveTo(char value) + { + while (MoveNext()) + { + if (_currentChar == value) + return true; + } + return false; + } + + /// + /// Reads the next Json token from the stream. + /// + /// + /// true if the next token was read successfully; false if there are no more tokens to read. + /// + public override bool Read() + { + while (true) + { + if (_currentChar == '\0') + { + if (!MoveNext()) + return false; + } + + switch (CurrentState) + { + case State.Start: + case State.Property: + case State.Array: + case State.ArrayStart: + case State.Constructor: + case State.ConstructorStart: + return ParseValue(); + case State.Complete: + break; + case State.Object: + case State.ObjectStart: + return ParseObject(); + case State.PostValue: + // returns true if it hits + // end of object or array + if (ParsePostValue()) + return true; + break; + case State.Closed: + break; + case State.Error: + break; + default: + throw new JsonReaderException("Unexpected state: " + CurrentState); + } + } + } + + private bool ParsePostValue() + { + do + { + switch (_currentChar) + { + case '}': + SetToken(JsonToken.EndObject); + ClearCurrentChar(); + return true; + case ']': + SetToken(JsonToken.EndArray); + ClearCurrentChar(); + return true; + case ')': + SetToken(JsonToken.EndConstructor); + ClearCurrentChar(); + return true; + case '/': + ParseComment(); + return true; + case ',': + // finished paring + SetStateBasedOnCurrent(); + ClearCurrentChar(); + return false; + default: + if (char.IsWhiteSpace(_currentChar)) + { + // eat whitespace + ClearCurrentChar(); + } + else + { + throw new JsonReaderException("After parsing a value an unexpected character was encoutered: " + _currentChar); + } + break; + } + } while (MoveNext()); + + return false; + } + + private bool ParseObject() + { + do + { + switch (_currentChar) + { + case '}': + SetToken(JsonToken.EndObject); + return true; + case '/': + ParseComment(); + return true; + case ',': + SetToken(JsonToken.Undefined); + return true; + default: + if (char.IsWhiteSpace(_currentChar)) + { + // eat + } + else + { + return ParseProperty(); + } + break; + } + } while (MoveNext()); + + return false; + } + + private bool ParseProperty() + { + if (ValidIdentifierChar(_currentChar)) + { + ParseUnquotedProperty(); + } + else if (_currentChar == '"' || _currentChar == '\'') + { + ParseQuotedProperty(_currentChar); + } + else + { + throw new JsonReaderException("Invalid property identifier character: " + _currentChar); + } + + // finished property. move to colon + if (_currentChar != ':') + { + MoveTo(':'); + } + + SetToken(JsonToken.PropertyName, _buffer.ToString()); + _buffer.Position = 0; + + return true; + } + + private void ParseQuotedProperty(char quoteChar) + { + // parse property name until quoted char is hit + while (MoveNext()) + { + if (_currentChar == quoteChar) + { + return; + } + else + { + _buffer.Append(_currentChar); + } + } + + throw new JsonReaderException("Unclosed quoted property. Expected: " + quoteChar); + } + + private bool ValidIdentifierChar(char value) + { + return (char.IsLetterOrDigit(_currentChar) || _currentChar == '_' || _currentChar == '$'); + } + + private void ParseUnquotedProperty() + { + // parse unquoted property name until whitespace or colon + _buffer.Append(_currentChar); + + while (MoveNext()) + { + if (char.IsWhiteSpace(_currentChar) || _currentChar == ':') + { + break; + } + else if (ValidIdentifierChar(_currentChar)) + { + _buffer.Append(_currentChar); + } + else + { + throw new JsonReaderException("Invalid JavaScript property identifier character: " + _currentChar); + } + } + } + + private bool ParseValue() + { + do + { + switch (_currentChar) + { + case '"': + case '\'': + ParseString(_currentChar); + return true; + case 't': + ParseTrue(); + return true; + case 'f': + ParseFalse(); + return true; + case 'n': + if (HasNext()) + { + char next = PeekNext(); + + if (next == 'u') + ParseNull(); + else if (next == 'e') + ParseConstructor(); + else + throw new JsonReaderException("Unexpected character encountered while parsing value: " + _currentChar); + } + else + { + throw new JsonReaderException("Unexpected end"); + } + return true; + case 'N': + ParseNumberNaN(); + return true; + case 'I': + ParseNumberPositiveInfinity(); + return true; + case '-': + if (PeekNext() == 'I') + ParseNumberNegativeInfinity(); + else + ParseNumber(); + return true; + case '/': + ParseComment(); + return true; + case 'u': + ParseUndefined(); + return true; + case '{': + SetToken(JsonToken.StartObject); + return true; + case '[': + SetToken(JsonToken.StartArray); + return true; + case '}': + SetToken(JsonToken.EndObject); + return true; + case ']': + SetToken(JsonToken.EndArray); + return true; + case ',': + SetToken(JsonToken.Undefined); + //ClearCurrentChar(); + return true; + case ')': + SetToken(JsonToken.EndConstructor); + return true; + default: + if (char.IsWhiteSpace(_currentChar)) + { + // eat + } + else if (char.IsNumber(_currentChar) || _currentChar == '-' || _currentChar == '.') + { + ParseNumber(); + return true; + } + else + { + throw new JsonReaderException("Unexpected character encountered while parsing value: " + _currentChar); + } + break; + } + } while (MoveNext()); + + return false; + } + + private bool EatWhitespace(bool oneOrMore) + { + bool whitespace = false; + while (char.IsWhiteSpace(_currentChar)) + { + whitespace = true; + MoveNext(); + } + + return (!oneOrMore || whitespace); + } + + private void ParseConstructor() + { + if (MatchValue("new", true)) + { + if (EatWhitespace(true)) + { + while (char.IsLetter(_currentChar)) + { + _buffer.Append(_currentChar); + MoveNext(); + } + + EatWhitespace(false); + + if (_currentChar != '(') + throw new JsonReaderException("Unexpected character while parsing constructor: " + _currentChar); + + string constructorName = _buffer.ToString(); + _buffer.Position = 0; + + SetToken(JsonToken.StartConstructor, constructorName); + } + } + } + + private void ParseNumber() + { + // parse until seperator character or end + bool end = false; + do + { + if (CurrentIsSeperator()) + end = true; + else + _buffer.Append(_currentChar); + + } while (!end && MoveNext()); + + string number = _buffer.ToString(); + object numberValue; + JsonToken numberType; + + if (number.IndexOf(".", StringComparison.OrdinalIgnoreCase) == -1 + && number.IndexOf("e", StringComparison.OrdinalIgnoreCase) == -1) + { + numberValue = Convert.ToInt64(_buffer.ToString(), CultureInfo.InvariantCulture); + numberType = JsonToken.Integer; + } + else + { + numberValue = Convert.ToDouble(_buffer.ToString(), CultureInfo.InvariantCulture); + numberType = JsonToken.Float; + } + + _buffer.Position = 0; + + SetToken(numberType, numberValue); + } + + private void ParseComment() + { + // should have already parsed / character before reaching this method + + MoveNext(); + + if (_currentChar == '*') + { + while (MoveNext()) + { + if (_currentChar == '*') + { + if (MoveNext()) + { + if (_currentChar == '/') + { + break; + } + else + { + _buffer.Append('*'); + _buffer.Append(_currentChar); + } + } + } + else + { + _buffer.Append(_currentChar); + } + } + } + else + { + throw new JsonReaderException("Error parsing comment. Expected: *"); + } + + SetToken(JsonToken.Comment, _buffer.ToString()); + + _buffer.Position = 0; + + ClearCurrentChar(); + } + + private bool MatchValue(string value) + { + int i = 0; + do + { + if (_currentChar != value[i]) + { + break; + } + i++; + } + while (i < value.Length && MoveNext()); + + return (i == value.Length); + } + + private bool MatchValue(string value, bool noTrailingNonSeperatorCharacters) + { + // will match value and then move to the next character, checking that it is a seperator character + bool match = MatchValue(value); + + if (!noTrailingNonSeperatorCharacters) + return match; + else + return (match && (!MoveNext() || CurrentIsSeperator())); + } + + private bool CurrentIsSeperator() + { + switch (_currentChar) + { + case '}': + case ']': + case ',': + return true; + case '/': + // check next character to see if start of a comment + return (HasNext() && PeekNext() == '*'); + case ')': + if (CurrentState == State.Constructor || CurrentState == State.ConstructorStart) + return true; + break; + default: + if (char.IsWhiteSpace(_currentChar)) + return true; + break; + } + + return false; + } + + private void ParseTrue() + { + // check characters equal 'true' + // and that it is followed by either a seperator character + // or the text ends + if (MatchValue(JavaScriptConvert.True, true)) + { + SetToken(JsonToken.Boolean, true); + } + else + { + throw new JsonReaderException("Error parsing boolean value."); + } + } + + private void ParseNull() + { + if (MatchValue(JavaScriptConvert.Null, true)) + { + SetToken(JsonToken.Null); + } + else + { + throw new JsonReaderException("Error parsing null value."); + } + } + + private void ParseUndefined() + { + if (MatchValue(JavaScriptConvert.Undefined, true)) + { + SetToken(JsonToken.Undefined); + } + else + { + throw new JsonReaderException("Error parsing undefined value."); + } + } + + private void ParseFalse() + { + if (MatchValue(JavaScriptConvert.False, true)) + { + SetToken(JsonToken.Boolean, false); + } + else + { + throw new JsonReaderException("Error parsing boolean value."); + } + } + + private void ParseNumberNegativeInfinity() + { + if (MatchValue(JavaScriptConvert.NegativeInfinity, true)) + { + SetToken(JsonToken.Float, double.NegativeInfinity); + } + else + { + throw new JsonReaderException("Error parsing negative infinity value."); + } + } + + private void ParseNumberPositiveInfinity() + { + if (MatchValue(JavaScriptConvert.PositiveInfinity, true)) + { + SetToken(JsonToken.Float, double.PositiveInfinity); + } + else + { + throw new JsonReaderException("Error parsing positive infinity value."); + } + } + + private void ParseNumberNaN() + { + if (MatchValue(JavaScriptConvert.NaN, true)) + { + SetToken(JsonToken.Float, double.NaN); + } + else + { + throw new JsonReaderException("Error parsing NaN value."); + } + } + + /// + /// Changes the to Closed. + /// + public override void Close() + { + base.Close(); + + if (_reader != null) + _reader.Close(); + + if (_buffer != null) + _buffer.Clear(); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonTextWriter.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonTextWriter.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonTextWriter.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonTextWriter.cs index 3a26116..f15b329 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonTextWriter.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonTextWriter.cs @@ -1,458 +1,458 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using Newtonsoft.Json.Utilities; - -namespace Newtonsoft.Json -{ - /// - /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - /// - public class JsonTextWriter : JsonWriter - { - private TextWriter _writer; - private char _indentChar; - private int _indentation; - private char _quoteChar; - private bool _quoteName; - - /// - /// Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. - /// - public int Indentation - { - get { return _indentation; } - set - { - if (value < 0) - throw new ArgumentException("Indentation value must be greater than 0."); - - _indentation = value; - } - } - - /// - /// Gets or sets which character to use to quote attribute values. - /// - public char QuoteChar - { - get { return _quoteChar; } - set - { - if (value != '"' && value != '\'') - throw new ArgumentException(@"Invalid JavaScript string quote character. Valid quote characters are ' and ""."); - - _quoteChar = value; - } - } - - /// - /// Gets or sets which character to use for indenting when is set to Formatting.Indented. - /// - public char IndentChar - { - get { return _indentChar; } - set { _indentChar = value; } - } - - /// - /// Gets or sets a value indicating whether object names will be surrounded with quotes. - /// - public bool QuoteName - { - get { return _quoteName; } - set { _quoteName = value; } - } - - /// - /// Creates an instance of the JsonWriter class using the specified . - /// - /// The TextWriter to write to. - public JsonTextWriter(TextWriter textWriter) - { - if (textWriter == null) - throw new ArgumentNullException("textWriter"); - - _writer = textWriter; - _quoteChar = '"'; - _quoteName = true; - _indentChar = ' '; - _indentation = 2; - } - - /// - /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - /// - public override void Flush() - { - _writer.Flush(); - } - - /// - /// Closes this stream and the underlying stream. - /// - public override void Close() - { - base.Close(); - - _writer.Close(); - } - - /// - /// Writes the beginning of a Json object. - /// - public override void WriteStartObject() - { - base.WriteStartObject(); - - _writer.Write("{"); - } - - /// - /// Writes the beginning of a Json array. - /// - public override void WriteStartArray() - { - base.WriteStartArray(); - - _writer.Write("["); - } - - /// - /// Writes the start of a constructor with the given name. - /// - /// The name of the constructor. - public override void WriteStartConstructor(string name) - { - base.WriteStartConstructor(name); - - _writer.Write("new "); - _writer.Write(name); - _writer.Write("("); - } - - /// - /// Writes the specified end token. - /// - /// The end token to write. - protected override void WriteEnd(JsonToken token) - { - switch (token) - { - case JsonToken.EndObject: - _writer.Write("}"); - break; - case JsonToken.EndArray: - _writer.Write("]"); - break; - case JsonToken.EndConstructor: - _writer.Write(")"); - break; - default: - throw new JsonWriterException("Invalid JsonToken: " + token); - } - } - - /// - /// Writes the property name of a name/value pair on a Json object. - /// - /// The name of the property. - public override void WritePropertyName(string name) - { - base.WritePropertyName(name); - - if (_quoteName) - _writer.Write(_quoteChar); - - _writer.Write(name); - - if (_quoteName) - _writer.Write(_quoteChar); - - _writer.Write(':'); - } - - /// - /// Writes indent characters. - /// - protected override void WriteIndent() - { - if (Formatting == Formatting.Indented) - { - _writer.Write(Environment.NewLine); - // for each level of object... - for (int i = 0; i < Top; i++) - { - // ...write the indent char the specified number of times - for (int j = 0; j < _indentation; j++) - { - _writer.Write(_indentChar); - } - } - } - } - - /// - /// Writes the JSON value delimiter. - /// - protected override void WriteValueDelimiter() - { - _writer.Write(','); - } - - /// - /// Writes an indent space. - /// - protected override void WriteIndentSpace() - { - _writer.Write(' '); - } - - private void WriteValueInternal(string value, JsonToken token) - { - _writer.Write(value); - } - - #region WriteValue methods - /// - /// Writes a null value. - /// - public override void WriteNull() - { - base.WriteNull(); - WriteValueInternal(JavaScriptConvert.Null, JsonToken.Null); - } - - /// - /// Writes an undefined value. - /// - public override void WriteUndefined() - { - base.WriteUndefined(); - WriteValueInternal(JavaScriptConvert.Undefined, JsonToken.Undefined); - } - - /// - /// Writes raw JavaScript manually. - /// - /// The raw JavaScript to write. - public override void WriteRaw(string javaScript) - { - base.WriteRaw(javaScript); - // hack. some 'raw' or 'other' token perhaps? - WriteValueInternal(javaScript, JsonToken.Undefined); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(string value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value, _quoteChar), JsonToken.String); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(int value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(uint value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(long value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(ulong value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(float value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(double value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(bool value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Boolean); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(short value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(ushort value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(char value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(byte value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(sbyte value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(decimal value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(DateTime value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Date); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(DateTimeOffset value) - { - base.WriteValue(value); - WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Date); - } - #endregion - - /// - /// Writes out a comment /*...*/ containing the specified text. - /// - /// Text to place inside the comment. - public override void WriteComment(string text) - { - base.WriteComment(text); - - _writer.Write("/*"); - _writer.Write(text); - _writer.Write("*/"); - } - - /// - /// Writes out the given white space. - /// - /// The string of white space characters. - public override void WriteWhitespace(string ws) - { - base.WriteWhitespace(ws); - - _writer.Write(ws); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json +{ + /// + /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + /// + public class JsonTextWriter : JsonWriter + { + private TextWriter _writer; + private char _indentChar; + private int _indentation; + private char _quoteChar; + private bool _quoteName; + + /// + /// Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + /// + public int Indentation + { + get { return _indentation; } + set + { + if (value < 0) + throw new ArgumentException("Indentation value must be greater than 0."); + + _indentation = value; + } + } + + /// + /// Gets or sets which character to use to quote attribute values. + /// + public char QuoteChar + { + get { return _quoteChar; } + set + { + if (value != '"' && value != '\'') + throw new ArgumentException(@"Invalid JavaScript string quote character. Valid quote characters are ' and ""."); + + _quoteChar = value; + } + } + + /// + /// Gets or sets which character to use for indenting when is set to Formatting.Indented. + /// + public char IndentChar + { + get { return _indentChar; } + set { _indentChar = value; } + } + + /// + /// Gets or sets a value indicating whether object names will be surrounded with quotes. + /// + public bool QuoteName + { + get { return _quoteName; } + set { _quoteName = value; } + } + + /// + /// Creates an instance of the JsonWriter class using the specified . + /// + /// The TextWriter to write to. + public JsonTextWriter(TextWriter textWriter) + { + if (textWriter == null) + throw new ArgumentNullException("textWriter"); + + _writer = textWriter; + _quoteChar = '"'; + _quoteName = true; + _indentChar = ' '; + _indentation = 2; + } + + /// + /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + /// + public override void Flush() + { + _writer.Flush(); + } + + /// + /// Closes this stream and the underlying stream. + /// + public override void Close() + { + base.Close(); + + _writer.Close(); + } + + /// + /// Writes the beginning of a Json object. + /// + public override void WriteStartObject() + { + base.WriteStartObject(); + + _writer.Write("{"); + } + + /// + /// Writes the beginning of a Json array. + /// + public override void WriteStartArray() + { + base.WriteStartArray(); + + _writer.Write("["); + } + + /// + /// Writes the start of a constructor with the given name. + /// + /// The name of the constructor. + public override void WriteStartConstructor(string name) + { + base.WriteStartConstructor(name); + + _writer.Write("new "); + _writer.Write(name); + _writer.Write("("); + } + + /// + /// Writes the specified end token. + /// + /// The end token to write. + protected override void WriteEnd(JsonToken token) + { + switch (token) + { + case JsonToken.EndObject: + _writer.Write("}"); + break; + case JsonToken.EndArray: + _writer.Write("]"); + break; + case JsonToken.EndConstructor: + _writer.Write(")"); + break; + default: + throw new JsonWriterException("Invalid JsonToken: " + token); + } + } + + /// + /// Writes the property name of a name/value pair on a Json object. + /// + /// The name of the property. + public override void WritePropertyName(string name) + { + base.WritePropertyName(name); + + if (_quoteName) + _writer.Write(_quoteChar); + + _writer.Write(name); + + if (_quoteName) + _writer.Write(_quoteChar); + + _writer.Write(':'); + } + + /// + /// Writes indent characters. + /// + protected override void WriteIndent() + { + if (Formatting == Formatting.Indented) + { + _writer.Write(Environment.NewLine); + // for each level of object... + for (int i = 0; i < Top; i++) + { + // ...write the indent char the specified number of times + for (int j = 0; j < _indentation; j++) + { + _writer.Write(_indentChar); + } + } + } + } + + /// + /// Writes the JSON value delimiter. + /// + protected override void WriteValueDelimiter() + { + _writer.Write(','); + } + + /// + /// Writes an indent space. + /// + protected override void WriteIndentSpace() + { + _writer.Write(' '); + } + + private void WriteValueInternal(string value, JsonToken token) + { + _writer.Write(value); + } + + #region WriteValue methods + /// + /// Writes a null value. + /// + public override void WriteNull() + { + base.WriteNull(); + WriteValueInternal(JavaScriptConvert.Null, JsonToken.Null); + } + + /// + /// Writes an undefined value. + /// + public override void WriteUndefined() + { + base.WriteUndefined(); + WriteValueInternal(JavaScriptConvert.Undefined, JsonToken.Undefined); + } + + /// + /// Writes raw JavaScript manually. + /// + /// The raw JavaScript to write. + public override void WriteRaw(string javaScript) + { + base.WriteRaw(javaScript); + // hack. some 'raw' or 'other' token perhaps? + WriteValueInternal(javaScript, JsonToken.Undefined); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(string value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value, _quoteChar), JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(int value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(uint value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(long value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(ulong value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(float value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(double value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(bool value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Boolean); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(short value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(ushort value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(char value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(byte value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(sbyte value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(decimal value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(DateTime value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Date); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(DateTimeOffset value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Date); + } + #endregion + + /// + /// Writes out a comment /*...*/ containing the specified text. + /// + /// Text to place inside the comment. + public override void WriteComment(string text) + { + base.WriteComment(text); + + _writer.Write("/*"); + _writer.Write(text); + _writer.Write("*/"); + } + + /// + /// Writes out the given white space. + /// + /// The string of white space characters. + public override void WriteWhitespace(string ws) + { + base.WriteWhitespace(ws); + + _writer.Write(ws); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonToken.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonToken.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonToken.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonToken.cs index fc27644..8d58c9f 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonToken.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonToken.cs @@ -1,102 +1,102 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Newtonsoft.Json -{ - /// - /// Specifies the type of Json token. - /// - public enum JsonToken - { - /// - /// This is returned by the if a method has not been called. - /// - None, - /// - /// An object start token. - /// - StartObject, - /// - /// An array start token. - /// - StartArray, - /// - /// An object property name. - /// - StartConstructor, - /// - /// A constructor end token. - /// - PropertyName, - /// - /// A comment. - /// - Comment, - /// - /// An interger. - /// - Integer, - /// - /// A float. - /// - Float, - /// - /// A string. - /// - String, - /// - /// A boolean. - /// - Boolean, - /// - /// A null token. - /// - Null, - /// - /// An undefined token. - /// - Undefined, - /// - /// An object end token. - /// - EndObject, - /// - /// An array end token. - /// - EndArray, - /// - /// A constructor start token. - /// - EndConstructor, - /// - /// A Date. - /// - Date - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Specifies the type of Json token. + /// + public enum JsonToken + { + /// + /// This is returned by the if a method has not been called. + /// + None, + /// + /// An object start token. + /// + StartObject, + /// + /// An array start token. + /// + StartArray, + /// + /// An object property name. + /// + StartConstructor, + /// + /// A constructor end token. + /// + PropertyName, + /// + /// A comment. + /// + Comment, + /// + /// An interger. + /// + Integer, + /// + /// A float. + /// + Float, + /// + /// A string. + /// + String, + /// + /// A boolean. + /// + Boolean, + /// + /// A null token. + /// + Null, + /// + /// An undefined token. + /// + Undefined, + /// + /// An object end token. + /// + EndObject, + /// + /// An array end token. + /// + EndArray, + /// + /// A constructor start token. + /// + EndConstructor, + /// + /// A Date. + /// + Date + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonWriter.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonWriter.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonWriter.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonWriter.cs index 53ca752..615fc46 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonWriter.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonWriter.cs @@ -1,772 +1,772 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Xml; -using Newtonsoft.Json.Utilities; -using Newtonsoft.Json.Linq; -using System.Globalization; - -namespace Newtonsoft.Json -{ - /// - /// Specifies the state of the . - /// - public enum WriteState - { - /// - /// An exception has been thrown, which has left the in an invalid state. - /// You may call the method to put the in the Closed state. - /// Any other method calls results in an being thrown. - /// - Error, - /// - /// The method has been called. - /// - Closed, - /// - /// An object is being written. - /// - Object, - /// - /// A array is being written. - /// - Array, - /// - /// A constructor is being written. - /// - Constructor, - /// - /// A property is being written. - /// - Property, - /// - /// A write method has not been called. - /// - Start - } - - /// - /// Specifies formatting options for the . - /// - public enum Formatting - { - /// - /// No special formatting is applied. This is the default. - /// - None, - /// - /// Causes child objects to be indented according to the and settings. - /// - Indented - } - - /// - /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - /// - public abstract class JsonWriter : IDisposable - { - private enum State - { - Start, - Property, - ObjectStart, - Object, - ArrayStart, - Array, - ConstructorStart, - Constructor, - Closed, - Error - } - - // array that gives a new state based on the current state an the token being written - private static readonly State[,] stateArray = { -// Start PropertyName ObjectStart Object ArrayStart Array ConstructorStart Constructor Closed Error -// -/* None */{ State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error }, -/* StartObject */{ State.ObjectStart, State.ObjectStart, State.Error, State.Error, State.ObjectStart, State.ObjectStart, State.ObjectStart, State.ObjectStart, State.Error, State.Error }, -/* StartArray */{ State.ArrayStart, State.ArrayStart, State.Error, State.Error, State.ArrayStart, State.ArrayStart, State.ArrayStart, State.ArrayStart, State.Error, State.Error }, -/* StartConstructor */{ State.ConstructorStart, State.ConstructorStart, State.Error, State.Error, State.ConstructorStart, State.ConstructorStart, State.ConstructorStart, State.ConstructorStart, State.Error, State.Error }, -/* StartProperty */{ State.Property, State.Error, State.Property, State.Property, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error }, -/* Comment */{ State.Start, State.Property, State.ObjectStart, State.Object, State.ArrayStart, State.Array, State.Constructor, State.Constructor, State.Error, State.Error }, -/* Value */{ State.Start, State.Object, State.Error, State.Error, State.Array, State.Array, State.Constructor, State.Constructor, State.Error, State.Error }, - }; - - private int _top; - - private List _stack; - private List _serializeStack; - private State _currentState; - private Formatting _formatting; - - internal List SerializeStack - { - get - { - if (_serializeStack == null) - _serializeStack = new List(); - - return _serializeStack; - } - } - - /// - /// Gets the top. - /// - /// The top. - protected int Top - { - get { return _top; } - } - - /// - /// Gets the state of the writer. - /// - public WriteState WriteState - { - get - { - switch (_currentState) - { - case State.Error: - return WriteState.Error; - case State.Closed: - return WriteState.Closed; - case State.Object: - case State.ObjectStart: - return WriteState.Object; - case State.Array: - case State.ArrayStart: - return WriteState.Array; - case State.Constructor: - case State.ConstructorStart: - return WriteState.Constructor; - case State.Property: - return WriteState.Property; - case State.Start: - return WriteState.Start; - default: - throw new JsonWriterException("Invalid state: " + _currentState); - } - } - } - - /// - /// Indicates how the output is formatted. - /// - public Formatting Formatting - { - get { return _formatting; } - set { _formatting = value; } - } - - /// - /// Creates an instance of the JsonWriter class. - /// - public JsonWriter() - { - _stack = new List(1); - _stack.Add(JsonTokenType.None); - _currentState = State.Start; - _formatting = Formatting.None; - } - - private void Push(JsonTokenType value) - { - _top++; - if (_stack.Count <= _top) - _stack.Add(value); - else - _stack[_top] = value; - } - - private JsonTokenType Pop() - { - JsonTokenType value = Peek(); - _top--; - - return value; - } - - private JsonTokenType Peek() - { - return _stack[_top]; - } - - /// - /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - /// - public abstract void Flush(); - - /// - /// Closes this stream and the underlying stream. - /// - public virtual void Close() - { - AutoCompleteAll(); - } - - /// - /// Writes the beginning of a Json object. - /// - public virtual void WriteStartObject() - { - AutoComplete(JsonToken.StartObject); - Push(JsonTokenType.Object); - } - - /// - /// Writes the end of a Json object. - /// - public void WriteEndObject() - { - AutoCompleteClose(JsonToken.EndObject); - } - - /// - /// Writes the beginning of a Json array. - /// - public virtual void WriteStartArray() - { - AutoComplete(JsonToken.StartArray); - Push(JsonTokenType.Array); - } - - /// - /// Writes the end of an array. - /// - public void WriteEndArray() - { - AutoCompleteClose(JsonToken.EndArray); - } - - /// - /// Writes the start of a constructor with the given name. - /// - /// The name of the constructor. - public virtual void WriteStartConstructor(string name) - { - AutoComplete(JsonToken.StartConstructor); - Push(JsonTokenType.Constructor); - } - - /// - /// Writes the end constructor. - /// - public void WriteEndConstructor() - { - AutoCompleteClose(JsonToken.EndConstructor); - } - - /// - /// Writes the property name of a name/value pair on a Json object. - /// - /// The name of the property. - public virtual void WritePropertyName(string name) - { - AutoComplete(JsonToken.PropertyName); - } - - /// - /// Writes the end of the current Json object or array. - /// - public void WriteEnd() - { - WriteEnd(Peek()); - } - - /// - /// Writes the current token. - /// - /// The to read the token from. - public void WriteToken(JsonReader reader) - { - ValidationUtils.ArgumentNotNull(reader, "reader"); - - int currentDepth = (reader.TokenType == JsonToken.None) ? -1 : reader.Depth; - - do - { - switch (reader.TokenType) - { - case JsonToken.None: - // read to next - break; - case JsonToken.StartObject: - WriteStartObject(); - break; - case JsonToken.StartArray: - WriteStartArray(); - break; - case JsonToken.StartConstructor: - WriteStartConstructor(reader.Value.ToString()); - break; - case JsonToken.PropertyName: - WritePropertyName(reader.Value.ToString()); - break; - case JsonToken.Comment: - WriteComment(reader.Value.ToString()); - break; - case JsonToken.Integer: - WriteValue((long)reader.Value); - break; - case JsonToken.Float: - WriteValue((double)reader.Value); - break; - case JsonToken.String: - WriteValue(reader.Value.ToString()); - break; - case JsonToken.Boolean: - WriteValue((bool)reader.Value); - break; - case JsonToken.Null: - WriteNull(); - break; - case JsonToken.Undefined: - WriteUndefined(); - break; - case JsonToken.EndObject: - WriteEndObject(); - break; - case JsonToken.EndArray: - WriteEndArray(); - break; - case JsonToken.EndConstructor: - WriteEndConstructor(); - break; - case JsonToken.Date: - WriteValue((DateTime)reader.Value); - break; - default: - throw new ArgumentOutOfRangeException("TokenType", reader.TokenType, "Unexpected token type."); - } - } - while (reader.Read() && (currentDepth - 1 < reader.Depth || (currentDepth == reader.Depth && !IsEndToken(reader.TokenType)))); - } - - private bool IsEndToken(JsonToken token) - { - switch (token) - { - case JsonToken.EndObject: - case JsonToken.EndArray: - case JsonToken.EndConstructor: - return true; - default: - return false; - } - } - - private void WriteEnd(JsonTokenType type) - { - switch (type) - { - case JsonTokenType.Object: - WriteEndObject(); - break; - case JsonTokenType.Array: - WriteEndArray(); - break; - case JsonTokenType.Constructor: - WriteEndConstructor(); - break; - default: - throw new JsonWriterException("Unexpected type when writing end: " + type); - } - } - - private void AutoCompleteAll() - { - while (_top > 0) - { - WriteEnd(); - } - } - - private JsonTokenType GetTypeForCloseToken(JsonToken token) - { - switch (token) - { - case JsonToken.EndObject: - return JsonTokenType.Object; - case JsonToken.EndArray: - return JsonTokenType.Array; - case JsonToken.EndConstructor: - return JsonTokenType.Constructor; - default: - throw new JsonWriterException("No type for token: " + token); - } - } - - private JsonToken GetCloseTokenForType(JsonTokenType type) - { - switch (type) - { - case JsonTokenType.Object: - return JsonToken.EndObject; - case JsonTokenType.Array: - return JsonToken.EndArray; - case JsonTokenType.Constructor: - return JsonToken.EndConstructor; - default: - throw new JsonWriterException("No close token for type: " + type); - } - } - - private void AutoCompleteClose(JsonToken tokenBeingClosed) - { - // write closing symbol and calculate new state - - int levelsToComplete = 0; - - for (int i = 0; i < _top; i++) - { - int currentLevel = _top - i; - - if (_stack[currentLevel] == GetTypeForCloseToken(tokenBeingClosed)) - { - levelsToComplete = i + 1; - break; - } - } - - if (levelsToComplete == 0) - throw new JsonWriterException("No token to close."); - - for (int i = 0; i < levelsToComplete; i++) - { - JsonToken token = GetCloseTokenForType(Pop()); - - if (_currentState != State.ObjectStart && _currentState != State.ArrayStart) - WriteIndent(); - - WriteEnd(token); - } - - JsonTokenType currentLevelType = Peek(); - - switch (currentLevelType) - { - case JsonTokenType.Object: - _currentState = State.Object; - break; - case JsonTokenType.Array: - _currentState = State.Array; - break; - case JsonTokenType.None: - _currentState = State.Start; - break; - default: - throw new JsonWriterException("Unknown JsonType: " + currentLevelType); - } - } - - /// - /// Writes the specified end token. - /// - /// The end token to write. - protected virtual void WriteEnd(JsonToken token) - { - } - - /// - /// Writes indent characters. - /// - protected virtual void WriteIndent() - { - } - - /// - /// Writes the JSON value delimiter. - /// - protected virtual void WriteValueDelimiter() - { - } - - /// - /// Writes an indent space. - /// - protected virtual void WriteIndentSpace() - { - } - - private void AutoComplete(JsonToken tokenBeingWritten) - { - int token; - - switch (tokenBeingWritten) - { - default: - token = (int)tokenBeingWritten; - break; - case JsonToken.Integer: - case JsonToken.Float: - case JsonToken.String: - case JsonToken.Boolean: - case JsonToken.Null: - case JsonToken.Undefined: - case JsonToken.Date: - // a value is being written - token = 6; - break; - } - - // gets new state based on the current state and what is being written - State newState = stateArray[token, (int)_currentState]; - - if (newState == State.Error) - throw new JsonWriterException("Token {0} in state {1} would result in an invalid JavaScript object.".FormatWith(CultureInfo.InvariantCulture, tokenBeingWritten.ToString(), _currentState.ToString())); - - if ((_currentState == State.Object || _currentState == State.Array || _currentState == State.Constructor) && tokenBeingWritten != JsonToken.Comment) - { - WriteValueDelimiter(); - } - else if (_currentState == State.Property) - { - if (_formatting == Formatting.Indented) - WriteIndentSpace(); - } - - // don't indent a property when it is the first token to be written (i.e. at the start) - if ((tokenBeingWritten == JsonToken.PropertyName && WriteState != WriteState.Start) || - WriteState == WriteState.Array || WriteState == WriteState.Constructor) - { - WriteIndent(); - } - - _currentState = newState; - } - - #region WriteValue methods - /// - /// Writes a null value. - /// - public virtual void WriteNull() - { - AutoComplete(JsonToken.Null); - } - - /// - /// Writes an undefined value. - /// - public virtual void WriteUndefined() - { - AutoComplete(JsonToken.Undefined); - } - - /// - /// Writes raw JavaScript manually. - /// - /// The raw JavaScript to write. - public virtual void WriteRaw(string javaScript) - { - // hack. some 'raw' or 'other' token perhaps? - AutoComplete(JsonToken.Undefined); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(string value) - { - AutoComplete(JsonToken.String); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(int value) - { - AutoComplete(JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(uint value) - { - AutoComplete(JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(long value) - { - AutoComplete(JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(ulong value) - { - AutoComplete(JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(float value) - { - AutoComplete(JsonToken.Float); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(double value) - { - AutoComplete(JsonToken.Float); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(bool value) - { - AutoComplete(JsonToken.Boolean); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(short value) - { - AutoComplete(JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(ushort value) - { - AutoComplete(JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(char value) - { - AutoComplete(JsonToken.String); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(byte value) - { - AutoComplete(JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(sbyte value) - { - AutoComplete(JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(decimal value) - { - AutoComplete(JsonToken.Float); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(DateTime value) - { - AutoComplete(JsonToken.Date); - } - - /// - /// Writes a value. - /// - /// The value to write. - public virtual void WriteValue(DateTimeOffset value) - { - AutoComplete(JsonToken.Date); - } - #endregion - - /// - /// Writes out a comment /*...*/ containing the specified text. - /// - /// Text to place inside the comment. - public virtual void WriteComment(string text) - { - AutoComplete(JsonToken.Comment); - } - - /// - /// Writes out the given white space. - /// - /// The string of white space characters. - public virtual void WriteWhitespace(string ws) - { - if (ws != null) - { - if (!StringUtils.IsWhiteSpace(ws)) - throw new JsonWriterException("Only white space characters should be used."); - } - } - - - void IDisposable.Dispose() - { - Dispose(true); - } - - private void Dispose(bool disposing) - { - if (WriteState != WriteState.Closed) - Close(); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using Newtonsoft.Json.Utilities; +using Newtonsoft.Json.Linq; +using System.Globalization; + +namespace Newtonsoft.Json +{ + /// + /// Specifies the state of the . + /// + public enum WriteState + { + /// + /// An exception has been thrown, which has left the in an invalid state. + /// You may call the method to put the in the Closed state. + /// Any other method calls results in an being thrown. + /// + Error, + /// + /// The method has been called. + /// + Closed, + /// + /// An object is being written. + /// + Object, + /// + /// A array is being written. + /// + Array, + /// + /// A constructor is being written. + /// + Constructor, + /// + /// A property is being written. + /// + Property, + /// + /// A write method has not been called. + /// + Start + } + + /// + /// Specifies formatting options for the . + /// + public enum Formatting + { + /// + /// No special formatting is applied. This is the default. + /// + None, + /// + /// Causes child objects to be indented according to the and settings. + /// + Indented + } + + /// + /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + /// + public abstract class JsonWriter : IDisposable + { + private enum State + { + Start, + Property, + ObjectStart, + Object, + ArrayStart, + Array, + ConstructorStart, + Constructor, + Closed, + Error + } + + // array that gives a new state based on the current state an the token being written + private static readonly State[,] stateArray = { +// Start PropertyName ObjectStart Object ArrayStart Array ConstructorStart Constructor Closed Error +// +/* None */{ State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error }, +/* StartObject */{ State.ObjectStart, State.ObjectStart, State.Error, State.Error, State.ObjectStart, State.ObjectStart, State.ObjectStart, State.ObjectStart, State.Error, State.Error }, +/* StartArray */{ State.ArrayStart, State.ArrayStart, State.Error, State.Error, State.ArrayStart, State.ArrayStart, State.ArrayStart, State.ArrayStart, State.Error, State.Error }, +/* StartConstructor */{ State.ConstructorStart, State.ConstructorStart, State.Error, State.Error, State.ConstructorStart, State.ConstructorStart, State.ConstructorStart, State.ConstructorStart, State.Error, State.Error }, +/* StartProperty */{ State.Property, State.Error, State.Property, State.Property, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error }, +/* Comment */{ State.Start, State.Property, State.ObjectStart, State.Object, State.ArrayStart, State.Array, State.Constructor, State.Constructor, State.Error, State.Error }, +/* Value */{ State.Start, State.Object, State.Error, State.Error, State.Array, State.Array, State.Constructor, State.Constructor, State.Error, State.Error }, + }; + + private int _top; + + private List _stack; + private List _serializeStack; + private State _currentState; + private Formatting _formatting; + + internal List SerializeStack + { + get + { + if (_serializeStack == null) + _serializeStack = new List(); + + return _serializeStack; + } + } + + /// + /// Gets the top. + /// + /// The top. + protected int Top + { + get { return _top; } + } + + /// + /// Gets the state of the writer. + /// + public WriteState WriteState + { + get + { + switch (_currentState) + { + case State.Error: + return WriteState.Error; + case State.Closed: + return WriteState.Closed; + case State.Object: + case State.ObjectStart: + return WriteState.Object; + case State.Array: + case State.ArrayStart: + return WriteState.Array; + case State.Constructor: + case State.ConstructorStart: + return WriteState.Constructor; + case State.Property: + return WriteState.Property; + case State.Start: + return WriteState.Start; + default: + throw new JsonWriterException("Invalid state: " + _currentState); + } + } + } + + /// + /// Indicates how the output is formatted. + /// + public Formatting Formatting + { + get { return _formatting; } + set { _formatting = value; } + } + + /// + /// Creates an instance of the JsonWriter class. + /// + public JsonWriter() + { + _stack = new List(1); + _stack.Add(JsonTokenType.None); + _currentState = State.Start; + _formatting = Formatting.None; + } + + private void Push(JsonTokenType value) + { + _top++; + if (_stack.Count <= _top) + _stack.Add(value); + else + _stack[_top] = value; + } + + private JsonTokenType Pop() + { + JsonTokenType value = Peek(); + _top--; + + return value; + } + + private JsonTokenType Peek() + { + return _stack[_top]; + } + + /// + /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + /// + public abstract void Flush(); + + /// + /// Closes this stream and the underlying stream. + /// + public virtual void Close() + { + AutoCompleteAll(); + } + + /// + /// Writes the beginning of a Json object. + /// + public virtual void WriteStartObject() + { + AutoComplete(JsonToken.StartObject); + Push(JsonTokenType.Object); + } + + /// + /// Writes the end of a Json object. + /// + public void WriteEndObject() + { + AutoCompleteClose(JsonToken.EndObject); + } + + /// + /// Writes the beginning of a Json array. + /// + public virtual void WriteStartArray() + { + AutoComplete(JsonToken.StartArray); + Push(JsonTokenType.Array); + } + + /// + /// Writes the end of an array. + /// + public void WriteEndArray() + { + AutoCompleteClose(JsonToken.EndArray); + } + + /// + /// Writes the start of a constructor with the given name. + /// + /// The name of the constructor. + public virtual void WriteStartConstructor(string name) + { + AutoComplete(JsonToken.StartConstructor); + Push(JsonTokenType.Constructor); + } + + /// + /// Writes the end constructor. + /// + public void WriteEndConstructor() + { + AutoCompleteClose(JsonToken.EndConstructor); + } + + /// + /// Writes the property name of a name/value pair on a Json object. + /// + /// The name of the property. + public virtual void WritePropertyName(string name) + { + AutoComplete(JsonToken.PropertyName); + } + + /// + /// Writes the end of the current Json object or array. + /// + public void WriteEnd() + { + WriteEnd(Peek()); + } + + /// + /// Writes the current token. + /// + /// The to read the token from. + public void WriteToken(JsonReader reader) + { + ValidationUtils.ArgumentNotNull(reader, "reader"); + + int currentDepth = (reader.TokenType == JsonToken.None) ? -1 : reader.Depth; + + do + { + switch (reader.TokenType) + { + case JsonToken.None: + // read to next + break; + case JsonToken.StartObject: + WriteStartObject(); + break; + case JsonToken.StartArray: + WriteStartArray(); + break; + case JsonToken.StartConstructor: + WriteStartConstructor(reader.Value.ToString()); + break; + case JsonToken.PropertyName: + WritePropertyName(reader.Value.ToString()); + break; + case JsonToken.Comment: + WriteComment(reader.Value.ToString()); + break; + case JsonToken.Integer: + WriteValue((long)reader.Value); + break; + case JsonToken.Float: + WriteValue((double)reader.Value); + break; + case JsonToken.String: + WriteValue(reader.Value.ToString()); + break; + case JsonToken.Boolean: + WriteValue((bool)reader.Value); + break; + case JsonToken.Null: + WriteNull(); + break; + case JsonToken.Undefined: + WriteUndefined(); + break; + case JsonToken.EndObject: + WriteEndObject(); + break; + case JsonToken.EndArray: + WriteEndArray(); + break; + case JsonToken.EndConstructor: + WriteEndConstructor(); + break; + case JsonToken.Date: + WriteValue((DateTime)reader.Value); + break; + default: + throw new ArgumentOutOfRangeException("TokenType", reader.TokenType, "Unexpected token type."); + } + } + while (reader.Read() && (currentDepth - 1 < reader.Depth || (currentDepth == reader.Depth && !IsEndToken(reader.TokenType)))); + } + + private bool IsEndToken(JsonToken token) + { + switch (token) + { + case JsonToken.EndObject: + case JsonToken.EndArray: + case JsonToken.EndConstructor: + return true; + default: + return false; + } + } + + private void WriteEnd(JsonTokenType type) + { + switch (type) + { + case JsonTokenType.Object: + WriteEndObject(); + break; + case JsonTokenType.Array: + WriteEndArray(); + break; + case JsonTokenType.Constructor: + WriteEndConstructor(); + break; + default: + throw new JsonWriterException("Unexpected type when writing end: " + type); + } + } + + private void AutoCompleteAll() + { + while (_top > 0) + { + WriteEnd(); + } + } + + private JsonTokenType GetTypeForCloseToken(JsonToken token) + { + switch (token) + { + case JsonToken.EndObject: + return JsonTokenType.Object; + case JsonToken.EndArray: + return JsonTokenType.Array; + case JsonToken.EndConstructor: + return JsonTokenType.Constructor; + default: + throw new JsonWriterException("No type for token: " + token); + } + } + + private JsonToken GetCloseTokenForType(JsonTokenType type) + { + switch (type) + { + case JsonTokenType.Object: + return JsonToken.EndObject; + case JsonTokenType.Array: + return JsonToken.EndArray; + case JsonTokenType.Constructor: + return JsonToken.EndConstructor; + default: + throw new JsonWriterException("No close token for type: " + type); + } + } + + private void AutoCompleteClose(JsonToken tokenBeingClosed) + { + // write closing symbol and calculate new state + + int levelsToComplete = 0; + + for (int i = 0; i < _top; i++) + { + int currentLevel = _top - i; + + if (_stack[currentLevel] == GetTypeForCloseToken(tokenBeingClosed)) + { + levelsToComplete = i + 1; + break; + } + } + + if (levelsToComplete == 0) + throw new JsonWriterException("No token to close."); + + for (int i = 0; i < levelsToComplete; i++) + { + JsonToken token = GetCloseTokenForType(Pop()); + + if (_currentState != State.ObjectStart && _currentState != State.ArrayStart) + WriteIndent(); + + WriteEnd(token); + } + + JsonTokenType currentLevelType = Peek(); + + switch (currentLevelType) + { + case JsonTokenType.Object: + _currentState = State.Object; + break; + case JsonTokenType.Array: + _currentState = State.Array; + break; + case JsonTokenType.None: + _currentState = State.Start; + break; + default: + throw new JsonWriterException("Unknown JsonType: " + currentLevelType); + } + } + + /// + /// Writes the specified end token. + /// + /// The end token to write. + protected virtual void WriteEnd(JsonToken token) + { + } + + /// + /// Writes indent characters. + /// + protected virtual void WriteIndent() + { + } + + /// + /// Writes the JSON value delimiter. + /// + protected virtual void WriteValueDelimiter() + { + } + + /// + /// Writes an indent space. + /// + protected virtual void WriteIndentSpace() + { + } + + private void AutoComplete(JsonToken tokenBeingWritten) + { + int token; + + switch (tokenBeingWritten) + { + default: + token = (int)tokenBeingWritten; + break; + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.String: + case JsonToken.Boolean: + case JsonToken.Null: + case JsonToken.Undefined: + case JsonToken.Date: + // a value is being written + token = 6; + break; + } + + // gets new state based on the current state and what is being written + State newState = stateArray[token, (int)_currentState]; + + if (newState == State.Error) + throw new JsonWriterException("Token {0} in state {1} would result in an invalid JavaScript object.".FormatWith(CultureInfo.InvariantCulture, tokenBeingWritten.ToString(), _currentState.ToString())); + + if ((_currentState == State.Object || _currentState == State.Array || _currentState == State.Constructor) && tokenBeingWritten != JsonToken.Comment) + { + WriteValueDelimiter(); + } + else if (_currentState == State.Property) + { + if (_formatting == Formatting.Indented) + WriteIndentSpace(); + } + + // don't indent a property when it is the first token to be written (i.e. at the start) + if ((tokenBeingWritten == JsonToken.PropertyName && WriteState != WriteState.Start) || + WriteState == WriteState.Array || WriteState == WriteState.Constructor) + { + WriteIndent(); + } + + _currentState = newState; + } + + #region WriteValue methods + /// + /// Writes a null value. + /// + public virtual void WriteNull() + { + AutoComplete(JsonToken.Null); + } + + /// + /// Writes an undefined value. + /// + public virtual void WriteUndefined() + { + AutoComplete(JsonToken.Undefined); + } + + /// + /// Writes raw JavaScript manually. + /// + /// The raw JavaScript to write. + public virtual void WriteRaw(string javaScript) + { + // hack. some 'raw' or 'other' token perhaps? + AutoComplete(JsonToken.Undefined); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(string value) + { + AutoComplete(JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(int value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(uint value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(long value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(ulong value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(float value) + { + AutoComplete(JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(double value) + { + AutoComplete(JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(bool value) + { + AutoComplete(JsonToken.Boolean); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(short value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(ushort value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(char value) + { + AutoComplete(JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(byte value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(sbyte value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(decimal value) + { + AutoComplete(JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(DateTime value) + { + AutoComplete(JsonToken.Date); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(DateTimeOffset value) + { + AutoComplete(JsonToken.Date); + } + #endregion + + /// + /// Writes out a comment /*...*/ containing the specified text. + /// + /// Text to place inside the comment. + public virtual void WriteComment(string text) + { + AutoComplete(JsonToken.Comment); + } + + /// + /// Writes out the given white space. + /// + /// The string of white space characters. + public virtual void WriteWhitespace(string ws) + { + if (ws != null) + { + if (!StringUtils.IsWhiteSpace(ws)) + throw new JsonWriterException("Only white space characters should be used."); + } + } + + + void IDisposable.Dispose() + { + Dispose(true); + } + + private void Dispose(bool disposing) + { + if (WriteState != WriteState.Closed) + Close(); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonWriterException.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonWriterException.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonWriterException.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonWriterException.cs index bc43cd3..a906f2c 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/JsonWriterException.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/JsonWriterException.cs @@ -1,65 +1,65 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Newtonsoft.Json -{ - /// - /// The exception thrown when an error occurs while reading Json text. - /// - public class JsonWriterException : Exception - { - /// - /// Initializes a new instance of the class. - /// - public JsonWriterException() - { - } - - /// - /// Initializes a new instance of the class - /// with a specified error message. - /// - /// The error message that explains the reason for the exception. - public JsonWriterException(string message) - : base(message) - { - } - - /// - /// Initializes a new instance of the class - /// with a specified error message and a reference to the inner exception that is the cause of this exception. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - public JsonWriterException(string message, Exception innerException) - : base(message, innerException) - { - } - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// The exception thrown when an error occurs while reading Json text. + /// + public class JsonWriterException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public JsonWriterException() + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The error message that explains the reason for the exception. + public JsonWriterException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + public JsonWriterException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/Extensions.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/Extensions.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/Extensions.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/Extensions.cs index eb86990..f632404 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/Extensions.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/Extensions.cs @@ -1,251 +1,251 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json.Utilities; -using System.Globalization; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Contains the LINQ to JSON extension methods. - /// - public static class Extensions - { - /// - /// Returns a collection of tokens that contains the ancestors of every token in the source collection. - /// - /// The type of the objects in source, constrained to . - /// An of that contains the source collection. - /// An of that contains the ancestors of every node in the source collection. - public static IEnumerable Ancestors(this IEnumerable source) where T : JToken - { - ValidationUtils.ArgumentNotNull(source, "source"); - - return source.SelectMany(j => j.Ancestors()); - } - - //TODO - //public static IEnumerable AncestorsAndSelf(this IEnumerable source) where T : JObject - //{ - // ValidationUtils.ArgumentNotNull(source, "source"); - - // return source.SelectMany(j => j.AncestorsAndSelf()); - //} - - /// - /// Returns a collection of tokens that contains the descendants of every token in the source collection. - /// - /// The type of the objects in source, constrained to . - /// An of that contains the source collection. - /// An of that contains the descendants of every node in the source collection. - public static IEnumerable Descendants(this IEnumerable source) where T : JContainer - { - ValidationUtils.ArgumentNotNull(source, "source"); - - return source.SelectMany(j => j.Descendants()); - } - - //TODO - //public static IEnumerable DescendantsAndSelf(this IEnumerable source) where T : JContainer - //{ - // ValidationUtils.ArgumentNotNull(source, "source"); - - // return source.SelectMany(j => j.DescendantsAndSelf()); - //} - - /// - /// Returns a collection of child properties of every object in the source collection. - /// - /// An of that contains the source collection. - /// An of that contains the properties of every object in the source collection. - public static IEnumerable Properties(this IEnumerable source) - { - ValidationUtils.ArgumentNotNull(source, "source"); - - return source.SelectMany(d => d.Properties()); - } - - /// - /// Returns a collection of child values of every object in the source collection with the given key. - /// - /// An of that contains the source collection. - /// The token key. - /// An of that contains the values of every node in the source collection with the given key. - public static IEnumerable Values(this IEnumerable source, object key) - { - return Values(source, key); - } - - /// - /// Returns a collection of child values of every object in the source collection. - /// - /// An of that contains the source collection. - /// An of that contains the values of every node in the source collection. - public static IEnumerable Values(this IEnumerable source) - { - return Values(source, null); - } - - /// - /// Returns a collection of converted child values of every object in the source collection with the given key. - /// - /// The type to convert the values to. - /// An of that contains the source collection. - /// The token key. - /// An that contains the converted values of every node in the source collection with the given key. - public static IEnumerable Values(this IEnumerable source, object key) - { - return Values(source, key); - } - - /// - /// Returns a collection of converted child values of every object in the source collection. - /// - /// The type to convert the values to. - /// An of that contains the source collection. - /// An that contains the converted values of every node in the source collection. - public static IEnumerable Values(this IEnumerable source) - { - return Values(source, null); - } - - //public static IEnumerable Values(this IEnumerable source, object key) - //{ - // return Values(source, null); - //} - - internal static IEnumerable Values(this IEnumerable source, object key) where T : JToken - { - ValidationUtils.ArgumentNotNull(source, "source"); - - foreach (JToken token in source) - { - if (key == null) - { - foreach (JToken t in token.Children()) - { - yield return t.Convert(); ; - } - } - else - { - JToken value = token[key]; - if (value != null) - yield return value.Convert(); - } - } - - yield break; - - //IEnumerable allChildren = source.SelectMany(d => d.Children()); - //IEnumerable childrenValues = (key != null) ? allChildren.Select(p => p[key]) : allChildren.SelectMany(p => p.Children()); - - //List s = childrenValues.Convert().ToList(); - //return childrenValues.Convert(); - - // return source.SelectMany(d => d.Properties()) - //.Where(p => string.Compare(p.Name, name, StringComparison.Ordinal) == 0) - //.Select(p => p.Value) - //.Convert(); - } - - //TODO - //public static IEnumerable InDocumentOrder(this IEnumerable source) where T : JObject; - - //public static IEnumerable Children(this IEnumerable source) where T : JToken - //{ - // ValidationUtils.ArgumentNotNull(source, "source"); - - // return source.SelectMany(c => c.Children()); - //} - - /// - /// Returns a collection of child tokens of every array in the source collection. - /// - /// An of that contains the source collection. - /// An of that contains the values of every node in the source collection. - public static IEnumerable Children(this IEnumerable source) - { - return Children(source); - } - - /// - /// Returns a collection of converted child tokens of every array in the source collection. - /// - /// An of that contains the source collection. - /// An of that contains the converted values of every node in the source collection. - public static IEnumerable Children(this IEnumerable source) - { - ValidationUtils.ArgumentNotNull(source, "source"); - - return source.SelectMany(c => c.Children()).Convert(); - } - - internal static IEnumerable Convert(this IEnumerable source) where T : JToken - { - ValidationUtils.ArgumentNotNull(source, "source"); - - bool cast = typeof(JToken).IsAssignableFrom(typeof(U)); - - foreach (JToken token in source) - { - yield return Convert(token, cast); - } - } - - internal static U Convert(this T token) where T : JToken - { - bool cast = typeof(JToken).IsAssignableFrom(typeof(U)); - - return Convert(token, cast); - } - - internal static U Convert(this T token, bool cast) where T : JToken - { - if (cast) - { - // HACK - return (U)(object)token; - } - else - { - if (token == null) - return default(U); - - JValue value = token as JValue; - if (value == null) - throw new InvalidCastException("Cannot cast {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, token.GetType(), typeof(T))); - - return (U)System.Convert.ChangeType(value.Value, typeof(U), CultureInfo.InvariantCulture); - } - } - - //TODO - //public static void Remove(this IEnumerable source) where T : JContainer; - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Contains the LINQ to JSON extension methods. + /// + public static class Extensions + { + /// + /// Returns a collection of tokens that contains the ancestors of every token in the source collection. + /// + /// The type of the objects in source, constrained to . + /// An of that contains the source collection. + /// An of that contains the ancestors of every node in the source collection. + public static IEnumerable Ancestors(this IEnumerable source) where T : JToken + { + ValidationUtils.ArgumentNotNull(source, "source"); + + return source.SelectMany(j => j.Ancestors()); + } + + //TODO + //public static IEnumerable AncestorsAndSelf(this IEnumerable source) where T : JObject + //{ + // ValidationUtils.ArgumentNotNull(source, "source"); + + // return source.SelectMany(j => j.AncestorsAndSelf()); + //} + + /// + /// Returns a collection of tokens that contains the descendants of every token in the source collection. + /// + /// The type of the objects in source, constrained to . + /// An of that contains the source collection. + /// An of that contains the descendants of every node in the source collection. + public static IEnumerable Descendants(this IEnumerable source) where T : JContainer + { + ValidationUtils.ArgumentNotNull(source, "source"); + + return source.SelectMany(j => j.Descendants()); + } + + //TODO + //public static IEnumerable DescendantsAndSelf(this IEnumerable source) where T : JContainer + //{ + // ValidationUtils.ArgumentNotNull(source, "source"); + + // return source.SelectMany(j => j.DescendantsAndSelf()); + //} + + /// + /// Returns a collection of child properties of every object in the source collection. + /// + /// An of that contains the source collection. + /// An of that contains the properties of every object in the source collection. + public static IEnumerable Properties(this IEnumerable source) + { + ValidationUtils.ArgumentNotNull(source, "source"); + + return source.SelectMany(d => d.Properties()); + } + + /// + /// Returns a collection of child values of every object in the source collection with the given key. + /// + /// An of that contains the source collection. + /// The token key. + /// An of that contains the values of every node in the source collection with the given key. + public static IEnumerable Values(this IEnumerable source, object key) + { + return Values(source, key); + } + + /// + /// Returns a collection of child values of every object in the source collection. + /// + /// An of that contains the source collection. + /// An of that contains the values of every node in the source collection. + public static IEnumerable Values(this IEnumerable source) + { + return Values(source, null); + } + + /// + /// Returns a collection of converted child values of every object in the source collection with the given key. + /// + /// The type to convert the values to. + /// An of that contains the source collection. + /// The token key. + /// An that contains the converted values of every node in the source collection with the given key. + public static IEnumerable Values(this IEnumerable source, object key) + { + return Values(source, key); + } + + /// + /// Returns a collection of converted child values of every object in the source collection. + /// + /// The type to convert the values to. + /// An of that contains the source collection. + /// An that contains the converted values of every node in the source collection. + public static IEnumerable Values(this IEnumerable source) + { + return Values(source, null); + } + + //public static IEnumerable Values(this IEnumerable source, object key) + //{ + // return Values(source, null); + //} + + internal static IEnumerable Values(this IEnumerable source, object key) where T : JToken + { + ValidationUtils.ArgumentNotNull(source, "source"); + + foreach (JToken token in source) + { + if (key == null) + { + foreach (JToken t in token.Children()) + { + yield return t.Convert(); ; + } + } + else + { + JToken value = token[key]; + if (value != null) + yield return value.Convert(); + } + } + + yield break; + + //IEnumerable allChildren = source.SelectMany(d => d.Children()); + //IEnumerable childrenValues = (key != null) ? allChildren.Select(p => p[key]) : allChildren.SelectMany(p => p.Children()); + + //List s = childrenValues.Convert().ToList(); + //return childrenValues.Convert(); + + // return source.SelectMany(d => d.Properties()) + //.Where(p => string.Compare(p.Name, name, StringComparison.Ordinal) == 0) + //.Select(p => p.Value) + //.Convert(); + } + + //TODO + //public static IEnumerable InDocumentOrder(this IEnumerable source) where T : JObject; + + //public static IEnumerable Children(this IEnumerable source) where T : JToken + //{ + // ValidationUtils.ArgumentNotNull(source, "source"); + + // return source.SelectMany(c => c.Children()); + //} + + /// + /// Returns a collection of child tokens of every array in the source collection. + /// + /// An of that contains the source collection. + /// An of that contains the values of every node in the source collection. + public static IEnumerable Children(this IEnumerable source) + { + return Children(source); + } + + /// + /// Returns a collection of converted child tokens of every array in the source collection. + /// + /// An of that contains the source collection. + /// An of that contains the converted values of every node in the source collection. + public static IEnumerable Children(this IEnumerable source) + { + ValidationUtils.ArgumentNotNull(source, "source"); + + return source.SelectMany(c => c.Children()).Convert(); + } + + internal static IEnumerable Convert(this IEnumerable source) where T : JToken + { + ValidationUtils.ArgumentNotNull(source, "source"); + + bool cast = typeof(JToken).IsAssignableFrom(typeof(U)); + + foreach (JToken token in source) + { + yield return Convert(token, cast); + } + } + + internal static U Convert(this T token) where T : JToken + { + bool cast = typeof(JToken).IsAssignableFrom(typeof(U)); + + return Convert(token, cast); + } + + internal static U Convert(this T token, bool cast) where T : JToken + { + if (cast) + { + // HACK + return (U)(object)token; + } + else + { + if (token == null) + return default(U); + + JValue value = token as JValue; + if (value == null) + throw new InvalidCastException("Cannot cast {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, token.GetType(), typeof(T))); + + return (U)System.Convert.ChangeType(value.Value, typeof(U), CultureInfo.InvariantCulture); + } + } + + //TODO + //public static void Remove(this IEnumerable source) where T : JContainer; + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JArray.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JArray.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JArray.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JArray.cs index 93264b4..4daaab8 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JArray.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JArray.cs @@ -1,199 +1,199 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Linq; -using Newtonsoft.Json.Utilities; -using System.IO; -using System.Globalization; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents a JSON array. - /// - public class JArray : JContainer - { - /// - /// Gets the node type for this . - /// - /// The type. - public override JsonTokenType Type - { - get { return JsonTokenType.Array; } - } - - /// - /// Initializes a new instance of the class. - /// - public JArray() - { - } - - /// - /// Initializes a new instance of the class from another object. - /// - /// A object to copy from. - public JArray(JArray other) - : base(other) - { - } - - /// - /// Initializes a new instance of the class with the specified content. - /// - /// The contents of the array. - public JArray(params object[] content) - : this((object)content) - { - } - - /// - /// Initializes a new instance of the class with the specified content. - /// - /// The contents of the array. - public JArray(object content) - { - Add(content); - } - - internal override bool DeepEquals(JToken node) - { - JArray t = node as JArray; - return (t != null && ContentsEqual(t)); - } - - internal override JToken CloneNode() - { - return new JArray(this); - } - - /// - /// Returns a count of this token's child tokens. - /// - /// A count of this token's child tokens. - public int Count() - { - return Children().Count(); - } - - /// - /// Loads an from a . - /// - /// A that will be read for the content of the . - /// A that contains the XML that was read from the specified . - public static JArray Load(JsonReader reader) - { - if (reader.TokenType == JsonToken.None) - { - if (!reader.Read()) - throw new Exception("Error reading JArray from JsonReader."); - } - if (reader.TokenType != JsonToken.StartArray) - { - throw new Exception("Current JsonReader item is not an object."); - } - else - { - if (!reader.Read()) - throw new Exception("Error reading JArray from JsonReader."); - } - - JArray a = new JArray(); - a.ReadContentFrom(reader); - - return a; - } - - /// - /// Load a from a string that contains JSON. - /// - /// A that contains JSON. - /// A populated from the string that contains JSON. - public static JArray Parse(string json) - { - JsonReader jsonReader = new JsonTextReader(new StringReader(json)); - - return Load(jsonReader); - } - - internal override void ValidateObject(JToken o, JToken previous) - { - ValidationUtils.ArgumentNotNull(o, "o"); - - if (o.Type == JsonTokenType.Property) - throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); - } - - /// - /// Creates a from an object. - /// - /// The object that will be used to create . - /// A with the values of the specified object - public static JArray FromObject(object o) - { - JToken token = FromObjectInternal(o); - - if (token.Type != JsonTokenType.Array) - throw new ArgumentException("Object serialized to {0}. JArray instance expected.".FormatWith(CultureInfo.InvariantCulture, token.Type)); - - return (JArray)token; - } - - /// - /// Writes this token to a . - /// - /// A into which this method will write. - /// A collection of which will be used when writing the token. - public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) - { - writer.WriteStartArray(); - - foreach (JToken token in Children()) - { - token.WriteTo(writer, converters); - } - - writer.WriteEndArray(); - } - - /// - /// Gets the with the specified key. - /// - /// The with the specified key. - public override JToken this[object key] - { - get - { - ValidationUtils.ArgumentNotNull(key, "o"); - - if (!(key is int)) - throw new ArgumentException("Accessed JArray values with invalid key value: {0}. Array position index expected.".FormatWith(CultureInfo.InvariantCulture, MiscellaneousUtils.ToString(key))); - - return GetIndex(this, (int)key); - } - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.IO; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a JSON array. + /// + public class JArray : JContainer + { + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + get { return JsonTokenType.Array; } + } + + /// + /// Initializes a new instance of the class. + /// + public JArray() + { + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JArray(JArray other) + : base(other) + { + } + + /// + /// Initializes a new instance of the class with the specified content. + /// + /// The contents of the array. + public JArray(params object[] content) + : this((object)content) + { + } + + /// + /// Initializes a new instance of the class with the specified content. + /// + /// The contents of the array. + public JArray(object content) + { + Add(content); + } + + internal override bool DeepEquals(JToken node) + { + JArray t = node as JArray; + return (t != null && ContentsEqual(t)); + } + + internal override JToken CloneNode() + { + return new JArray(this); + } + + /// + /// Returns a count of this token's child tokens. + /// + /// A count of this token's child tokens. + public int Count() + { + return Children().Count(); + } + + /// + /// Loads an from a . + /// + /// A that will be read for the content of the . + /// A that contains the XML that was read from the specified . + public static JArray Load(JsonReader reader) + { + if (reader.TokenType == JsonToken.None) + { + if (!reader.Read()) + throw new Exception("Error reading JArray from JsonReader."); + } + if (reader.TokenType != JsonToken.StartArray) + { + throw new Exception("Current JsonReader item is not an object."); + } + else + { + if (!reader.Read()) + throw new Exception("Error reading JArray from JsonReader."); + } + + JArray a = new JArray(); + a.ReadContentFrom(reader); + + return a; + } + + /// + /// Load a from a string that contains JSON. + /// + /// A that contains JSON. + /// A populated from the string that contains JSON. + public static JArray Parse(string json) + { + JsonReader jsonReader = new JsonTextReader(new StringReader(json)); + + return Load(jsonReader); + } + + internal override void ValidateObject(JToken o, JToken previous) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type == JsonTokenType.Property) + throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); + } + + /// + /// Creates a from an object. + /// + /// The object that will be used to create . + /// A with the values of the specified object + public static JArray FromObject(object o) + { + JToken token = FromObjectInternal(o); + + if (token.Type != JsonTokenType.Array) + throw new ArgumentException("Object serialized to {0}. JArray instance expected.".FormatWith(CultureInfo.InvariantCulture, token.Type)); + + return (JArray)token; + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + writer.WriteStartArray(); + + foreach (JToken token in Children()) + { + token.WriteTo(writer, converters); + } + + writer.WriteEndArray(); + } + + /// + /// Gets the with the specified key. + /// + /// The with the specified key. + public override JToken this[object key] + { + get + { + ValidationUtils.ArgumentNotNull(key, "o"); + + if (!(key is int)) + throw new ArgumentException("Accessed JArray values with invalid key value: {0}. Array position index expected.".FormatWith(CultureInfo.InvariantCulture, MiscellaneousUtils.ToString(key))); + + return GetIndex(this, (int)key); + } + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JConstructor.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JConstructor.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JConstructor.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JConstructor.cs index 631ba27..cbbcaff 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JConstructor.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JConstructor.cs @@ -1,161 +1,161 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using Newtonsoft.Json.Utilities; -using System.Globalization; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents a JSON constructor. - /// - public class JConstructor : JContainer - { - private string _name; - - /// - /// Gets or sets the name of this constructor. - /// - /// The constructor name. - public string Name - { - get { return _name; } - set { _name = value; } - } - - /// - /// Gets the node type for this . - /// - /// The type. - public override JsonTokenType Type - { - get { return JsonTokenType.Constructor; } - } - - /// - /// Initializes a new instance of the class. - /// - public JConstructor() - { - } - - /// - /// Initializes a new instance of the class from another object. - /// - /// A object to copy from. - public JConstructor(JConstructor other) - : base(other) - { - _name = other.Name; - } - - /// - /// Initializes a new instance of the class with the specified name and content. - /// - /// The constructor name. - /// The contents of the constructor. - public JConstructor(string name, params object[] content) - : this(name, (object)content) - { - } - - /// - /// Initializes a new instance of the class with the specified name and content. - /// - /// The constructor name. - /// The contents of the constructor. - public JConstructor(string name, object content) - : this(name) - { - Add(content); - } - - /// - /// Initializes a new instance of the class with the specified name. - /// - /// The constructor name. - public JConstructor(string name) - { - _name = name; - } - - internal override bool DeepEquals(JToken node) - { - JConstructor c = node as JConstructor; - return (c != null && _name == c.Name && ContentsEqual(c)); - } - - internal override JToken CloneNode() - { - return new JConstructor(this); - } - - internal override void ValidateObject(JToken o, JToken previous) - { - ValidationUtils.ArgumentNotNull(o, "o"); - - switch (o.Type) - { - case JsonTokenType.Property: - throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); - } - } - - /// - /// Writes this token to a . - /// - /// A into which this method will write. - /// A collection of which will be used when writing the token. - public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) - { - writer.WriteStartConstructor(_name); - - foreach (JToken token in Children()) - { - token.WriteTo(writer, converters); - } - - writer.WriteEndConstructor(); - } - - /// - /// Gets the with the specified key. - /// - /// The with the specified key. - public override JToken this[object key] - { - get - { - ValidationUtils.ArgumentNotNull(key, "o"); - - if (!(key is int)) - throw new ArgumentException("Accessed JConstructor values with invalid key value: {0}. Argument position index expected.".FormatWith(CultureInfo.InvariantCulture, MiscellaneousUtils.ToString(key))); - - return GetIndex(this, (int)key); - } - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a JSON constructor. + /// + public class JConstructor : JContainer + { + private string _name; + + /// + /// Gets or sets the name of this constructor. + /// + /// The constructor name. + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + get { return JsonTokenType.Constructor; } + } + + /// + /// Initializes a new instance of the class. + /// + public JConstructor() + { + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JConstructor(JConstructor other) + : base(other) + { + _name = other.Name; + } + + /// + /// Initializes a new instance of the class with the specified name and content. + /// + /// The constructor name. + /// The contents of the constructor. + public JConstructor(string name, params object[] content) + : this(name, (object)content) + { + } + + /// + /// Initializes a new instance of the class with the specified name and content. + /// + /// The constructor name. + /// The contents of the constructor. + public JConstructor(string name, object content) + : this(name) + { + Add(content); + } + + /// + /// Initializes a new instance of the class with the specified name. + /// + /// The constructor name. + public JConstructor(string name) + { + _name = name; + } + + internal override bool DeepEquals(JToken node) + { + JConstructor c = node as JConstructor; + return (c != null && _name == c.Name && ContentsEqual(c)); + } + + internal override JToken CloneNode() + { + return new JConstructor(this); + } + + internal override void ValidateObject(JToken o, JToken previous) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + switch (o.Type) + { + case JsonTokenType.Property: + throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); + } + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + writer.WriteStartConstructor(_name); + + foreach (JToken token in Children()) + { + token.WriteTo(writer, converters); + } + + writer.WriteEndConstructor(); + } + + /// + /// Gets the with the specified key. + /// + /// The with the specified key. + public override JToken this[object key] + { + get + { + ValidationUtils.ArgumentNotNull(key, "o"); + + if (!(key is int)) + throw new ArgumentException("Accessed JConstructor values with invalid key value: {0}. Argument position index expected.".FormatWith(CultureInfo.InvariantCulture, MiscellaneousUtils.ToString(key))); + + return GetIndex(this, (int)key); + } + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JContainer.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JContainer.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JContainer.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JContainer.cs index 38f93d9..e23a668 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JContainer.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JContainer.cs @@ -1,463 +1,463 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json.Utilities; -using System.Collections; -using System.Diagnostics; -using System.Globalization; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents a token that can contain other tokens. - /// - public abstract class JContainer : JToken - { - private JToken _content; - - internal JToken Content - { - get { return _content; } - set { _content = value; } - } - - internal JContainer() - { - } - - internal JContainer(JContainer other) - { - ValidationUtils.ArgumentNotNull(other, "c"); - - JToken content = other.Last; - if (content != null) - { - do - { - content = content._next; - Add(content.CloneNode()); - } - while (content != other.Last); - } - } - - /// - /// Gets a value indicating whether this token has childen tokens. - /// - /// - /// true if this token has child values; otherwise, false. - /// - public override bool HasValues - { - get { return (_content != null); } - } - - internal bool ContentsEqual(JContainer container) - { - JToken t1 = First; - JToken t2 = container.First; - - if (t1 == t2) - return true; - - do - { - if (t1 == null && t2 == null) - return true; - - if (t1 != null && t2 != null && t1.DeepEquals(t2)) - { - t1 = (t1 != Last) ? t1.Next : null; - t2 = (t2 != container.Last) ? t2.Next : null; - } - else - { - return false; - } - } - while (true); - } - - /// - /// Get the first child token of this token. - /// - /// - /// A containing the first child token of the . - /// - public override JToken First - { - get - { - if (Last == null) - return null; - - return Last._next; - } - } - - /// - /// Get the last child token of this token. - /// - /// - /// A containing the last child token of the . - /// - public override JToken Last - { - [DebuggerStepThrough] - get { return _content; } - } - - /// - /// Returns a collection of the child tokens of this token, in document order. - /// - /// - /// An of containing the child tokens of this , in document order. - /// - public override JEnumerable Children() - { - return new JEnumerable(ChildrenInternal()); - } - - private IEnumerable ChildrenInternal() - { - JToken first = First; - JToken current = first; - if (current == null) - yield break; - - do - { - yield return current; - } - while (current != null - && ((current = current.Next) != null)); - } - - /// - /// Returns a collection of the child values of this token, in document order. - /// - /// - /// - /// A containing the child values of this , in document order. - /// - public override IEnumerable Values() - { - return Children().Convert(); - } - - /// - /// Returns a collection of the descendant tokens for this token in document order. - /// - /// An containing the descendant tokens of the . - public IEnumerable Descendants() - { - foreach (JToken o in Children()) - { - yield return o; - JContainer c = o as JContainer; - if (c != null) - { - foreach (JToken d in c.Descendants()) - { - yield return d; - } - } - } - } - - internal static JToken FromObjectInternal(object o) - { - ValidationUtils.ArgumentNotNull(o, "o"); - - JsonSerializer jsonSerializer = new JsonSerializer(); - - JToken token; - using (JsonTokenWriter jsonWriter = new JsonTokenWriter()) - { - jsonSerializer.Serialize(jsonWriter, o); - token = jsonWriter.Token; - } - - return token; - } - - internal static JToken GetIndex(JContainer c, object o) - { - return c.Children().ElementAt((int)o); - } - - internal bool IsMultiContent(object content) - { - return (content is IEnumerable && !(content is string)); - } - - internal void AddInternal(bool isLast, JToken previous, object content) - { - if (IsMultiContent(content)) - { - IEnumerable enumerable = content as IEnumerable; - - JToken multiPrevious = previous; - foreach (object c in enumerable) - { - AddInternal(isLast, multiPrevious, c); - multiPrevious = (previous != null) ? previous._next : Last; - } - } - else - { - JToken o = CreateFromContent(content); - - ValidateToken(o); - - if (o.Parent != null) - { - o = o.CloneNode(); - } - else - { - JContainer parent = this; - while (parent.Parent != null) - { - parent = parent.Parent; - } - if (o == parent) - { - o = o.CloneNode(); - } - } - - JToken next = (previous != null) ? previous._next : o; - - o.Parent = this; - o.Next = next; - - if (previous != null) - previous.Next = o; - - if (isLast) - _content = o; - } - } - - internal virtual void ValidateToken(JToken o) - { - ValidationUtils.ArgumentNotNull(o, "o"); - - if (o.Type == JsonTokenType.Property) - throw new Exception("Can not add {0} to {1}".FormatWith(CultureInfo.InvariantCulture, o.GetType(), GetType())); - } - - /// - /// Adds the specified content as children of this . - /// - /// The content to be added. - public virtual void Add(object content) - { - AddInternal(true, Last, content); - } - - /// - /// Adds the specified content as the first children of this . - /// - /// The content to be added. - public void AddFirst(object content) - { - AddInternal(false, Last, content); - } - - internal JToken CreateFromContent(object content) - { - if (content is JToken) - return (JToken)content; - else - return new JValue(content); - } - - /// - /// Creates an that can be used to add tokens to the . - /// - /// An that is ready to have content written to it. - public JsonWriter CreateWriter() - { - return new JsonTokenWriter(this); - } - - /// - /// Replaces the children nodes of this token with the specified content. - /// - /// The content. - public void ReplaceAll(object content) - { - RemoveAll(); - Add(content); - } - - /// - /// Removes the child nodes from this token. - /// - public void RemoveAll() - { - while (_content != null) - { - JToken o = _content; - - JToken next = o._next; - if (o != _content || next != o._next) - throw new InvalidOperationException("This operation was corrupted by external code."); - - if (next != o) - o._next = next._next; - else - _content = null; - - next.Parent = null; - next._next = null; - } - } - - internal void Remove(JToken o) - { - if (o.Parent != this) - throw new InvalidOperationException("This operation was corrupted by external code."); - - JToken content = _content; - - while (content._next != o) - { - content = content._next; - } - if (content == o) - { - // token is containers last child - _content = null; - } - else - { - if (_content == o) - { - _content = content; - } - content._next = o._next; - } - o.Parent = null; - o.Next = null; - } - - internal abstract void ValidateObject(JToken o, JToken previous); - - internal void AddObjectSkipNotify(JToken o) - { - ValidateObject(o, this); - - Add(o); - } - - internal void ReadContentFrom(JsonReader r) - { - ValidationUtils.ArgumentNotNull(r, "r"); - - JContainer parent = this; - - do - { - if (parent is JProperty) - { - if (((JProperty)parent).Value != null) - parent = parent.Parent; - } - - switch (r.TokenType) - { - case JsonToken.None: - // new reader. move to actual content - break; - case JsonToken.StartArray: - JArray a = new JArray(); - parent.AddObjectSkipNotify(a); - parent = a; - break; - - case JsonToken.EndArray: - if (parent == this) - return; - - parent = parent.Parent; - break; - case JsonToken.StartObject: - JObject o = new JObject(); - parent.AddObjectSkipNotify(o); - parent = o; - break; - case JsonToken.EndObject: - if (parent == this) - return; - - parent = parent.Parent; - break; - case JsonToken.StartConstructor: - JConstructor constructor = new JConstructor(); - constructor.Name = r.Value.ToString(); - parent.AddObjectSkipNotify(constructor); - parent = constructor; - break; - case JsonToken.EndConstructor: - if (parent == this) - return; - - parent = parent.Parent; - break; - case JsonToken.String: - case JsonToken.Integer: - case JsonToken.Float: - case JsonToken.Date: - case JsonToken.Boolean: - parent.AddObjectSkipNotify(new JValue(r.Value)); - break; - case JsonToken.Comment: - parent.AddObjectSkipNotify(JValue.CreateComment(r.Value.ToString())); - break; - case JsonToken.Null: - parent.AddObjectSkipNotify(new JValue(null, JsonTokenType.Null)); - break; - case JsonToken.Undefined: - parent.AddObjectSkipNotify(new JValue(null, JsonTokenType.Undefined)); - break; - case JsonToken.PropertyName: - JProperty property = new JProperty(r.Value.ToString()); - parent.AddObjectSkipNotify(property); - parent = property; - break; - default: - throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, r.TokenType)); - } - } - while (r.Read()); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Collections; +using System.Diagnostics; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a token that can contain other tokens. + /// + public abstract class JContainer : JToken + { + private JToken _content; + + internal JToken Content + { + get { return _content; } + set { _content = value; } + } + + internal JContainer() + { + } + + internal JContainer(JContainer other) + { + ValidationUtils.ArgumentNotNull(other, "c"); + + JToken content = other.Last; + if (content != null) + { + do + { + content = content._next; + Add(content.CloneNode()); + } + while (content != other.Last); + } + } + + /// + /// Gets a value indicating whether this token has childen tokens. + /// + /// + /// true if this token has child values; otherwise, false. + /// + public override bool HasValues + { + get { return (_content != null); } + } + + internal bool ContentsEqual(JContainer container) + { + JToken t1 = First; + JToken t2 = container.First; + + if (t1 == t2) + return true; + + do + { + if (t1 == null && t2 == null) + return true; + + if (t1 != null && t2 != null && t1.DeepEquals(t2)) + { + t1 = (t1 != Last) ? t1.Next : null; + t2 = (t2 != container.Last) ? t2.Next : null; + } + else + { + return false; + } + } + while (true); + } + + /// + /// Get the first child token of this token. + /// + /// + /// A containing the first child token of the . + /// + public override JToken First + { + get + { + if (Last == null) + return null; + + return Last._next; + } + } + + /// + /// Get the last child token of this token. + /// + /// + /// A containing the last child token of the . + /// + public override JToken Last + { + [DebuggerStepThrough] + get { return _content; } + } + + /// + /// Returns a collection of the child tokens of this token, in document order. + /// + /// + /// An of containing the child tokens of this , in document order. + /// + public override JEnumerable Children() + { + return new JEnumerable(ChildrenInternal()); + } + + private IEnumerable ChildrenInternal() + { + JToken first = First; + JToken current = first; + if (current == null) + yield break; + + do + { + yield return current; + } + while (current != null + && ((current = current.Next) != null)); + } + + /// + /// Returns a collection of the child values of this token, in document order. + /// + /// + /// + /// A containing the child values of this , in document order. + /// + public override IEnumerable Values() + { + return Children().Convert(); + } + + /// + /// Returns a collection of the descendant tokens for this token in document order. + /// + /// An containing the descendant tokens of the . + public IEnumerable Descendants() + { + foreach (JToken o in Children()) + { + yield return o; + JContainer c = o as JContainer; + if (c != null) + { + foreach (JToken d in c.Descendants()) + { + yield return d; + } + } + } + } + + internal static JToken FromObjectInternal(object o) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + JsonSerializer jsonSerializer = new JsonSerializer(); + + JToken token; + using (JsonTokenWriter jsonWriter = new JsonTokenWriter()) + { + jsonSerializer.Serialize(jsonWriter, o); + token = jsonWriter.Token; + } + + return token; + } + + internal static JToken GetIndex(JContainer c, object o) + { + return c.Children().ElementAt((int)o); + } + + internal bool IsMultiContent(object content) + { + return (content is IEnumerable && !(content is string)); + } + + internal void AddInternal(bool isLast, JToken previous, object content) + { + if (IsMultiContent(content)) + { + IEnumerable enumerable = content as IEnumerable; + + JToken multiPrevious = previous; + foreach (object c in enumerable) + { + AddInternal(isLast, multiPrevious, c); + multiPrevious = (previous != null) ? previous._next : Last; + } + } + else + { + JToken o = CreateFromContent(content); + + ValidateToken(o); + + if (o.Parent != null) + { + o = o.CloneNode(); + } + else + { + JContainer parent = this; + while (parent.Parent != null) + { + parent = parent.Parent; + } + if (o == parent) + { + o = o.CloneNode(); + } + } + + JToken next = (previous != null) ? previous._next : o; + + o.Parent = this; + o.Next = next; + + if (previous != null) + previous.Next = o; + + if (isLast) + _content = o; + } + } + + internal virtual void ValidateToken(JToken o) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type == JsonTokenType.Property) + throw new Exception("Can not add {0} to {1}".FormatWith(CultureInfo.InvariantCulture, o.GetType(), GetType())); + } + + /// + /// Adds the specified content as children of this . + /// + /// The content to be added. + public virtual void Add(object content) + { + AddInternal(true, Last, content); + } + + /// + /// Adds the specified content as the first children of this . + /// + /// The content to be added. + public void AddFirst(object content) + { + AddInternal(false, Last, content); + } + + internal JToken CreateFromContent(object content) + { + if (content is JToken) + return (JToken)content; + else + return new JValue(content); + } + + /// + /// Creates an that can be used to add tokens to the . + /// + /// An that is ready to have content written to it. + public JsonWriter CreateWriter() + { + return new JsonTokenWriter(this); + } + + /// + /// Replaces the children nodes of this token with the specified content. + /// + /// The content. + public void ReplaceAll(object content) + { + RemoveAll(); + Add(content); + } + + /// + /// Removes the child nodes from this token. + /// + public void RemoveAll() + { + while (_content != null) + { + JToken o = _content; + + JToken next = o._next; + if (o != _content || next != o._next) + throw new InvalidOperationException("This operation was corrupted by external code."); + + if (next != o) + o._next = next._next; + else + _content = null; + + next.Parent = null; + next._next = null; + } + } + + internal void Remove(JToken o) + { + if (o.Parent != this) + throw new InvalidOperationException("This operation was corrupted by external code."); + + JToken content = _content; + + while (content._next != o) + { + content = content._next; + } + if (content == o) + { + // token is containers last child + _content = null; + } + else + { + if (_content == o) + { + _content = content; + } + content._next = o._next; + } + o.Parent = null; + o.Next = null; + } + + internal abstract void ValidateObject(JToken o, JToken previous); + + internal void AddObjectSkipNotify(JToken o) + { + ValidateObject(o, this); + + Add(o); + } + + internal void ReadContentFrom(JsonReader r) + { + ValidationUtils.ArgumentNotNull(r, "r"); + + JContainer parent = this; + + do + { + if (parent is JProperty) + { + if (((JProperty)parent).Value != null) + parent = parent.Parent; + } + + switch (r.TokenType) + { + case JsonToken.None: + // new reader. move to actual content + break; + case JsonToken.StartArray: + JArray a = new JArray(); + parent.AddObjectSkipNotify(a); + parent = a; + break; + + case JsonToken.EndArray: + if (parent == this) + return; + + parent = parent.Parent; + break; + case JsonToken.StartObject: + JObject o = new JObject(); + parent.AddObjectSkipNotify(o); + parent = o; + break; + case JsonToken.EndObject: + if (parent == this) + return; + + parent = parent.Parent; + break; + case JsonToken.StartConstructor: + JConstructor constructor = new JConstructor(); + constructor.Name = r.Value.ToString(); + parent.AddObjectSkipNotify(constructor); + parent = constructor; + break; + case JsonToken.EndConstructor: + if (parent == this) + return; + + parent = parent.Parent; + break; + case JsonToken.String: + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.Date: + case JsonToken.Boolean: + parent.AddObjectSkipNotify(new JValue(r.Value)); + break; + case JsonToken.Comment: + parent.AddObjectSkipNotify(JValue.CreateComment(r.Value.ToString())); + break; + case JsonToken.Null: + parent.AddObjectSkipNotify(new JValue(null, JsonTokenType.Null)); + break; + case JsonToken.Undefined: + parent.AddObjectSkipNotify(new JValue(null, JsonTokenType.Undefined)); + break; + case JsonToken.PropertyName: + JProperty property = new JProperty(r.Value.ToString()); + parent.AddObjectSkipNotify(property); + parent = property; + break; + default: + throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, r.TokenType)); + } + } + while (r.Read()); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JEnumerable.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JEnumerable.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JEnumerable.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JEnumerable.cs index 3ddde0a..87cd9c8 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JEnumerable.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JEnumerable.cs @@ -1,63 +1,63 @@ -using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json.Utilities; -using System.Collections; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents a collection of objects. - /// - /// The type of token - public struct JEnumerable : IEnumerable where T : JToken - { - /// - /// An empty collection of objects. - /// - public static readonly JEnumerable Empty = new JEnumerable(Enumerable.Empty()); - - private IEnumerable _enumerable; - - /// - /// Initializes a new instance of the struct. - /// - /// The enumerable. - public JEnumerable(IEnumerable enumerable) - { - ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); - - _enumerable = enumerable; - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// - /// A that can be used to iterate through the collection. - /// - public IEnumerator GetEnumerator() - { - return _enumerable.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through a collection. - /// - /// - /// An object that can be used to iterate through the collection. - /// - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - /// - /// Gets the with the specified key. - /// - /// - public IEnumerable this[object key] - { - get { return Extensions.Values(_enumerable, key); } - } - } -} +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Collections; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a collection of objects. + /// + /// The type of token + public struct JEnumerable : IEnumerable where T : JToken + { + /// + /// An empty collection of objects. + /// + public static readonly JEnumerable Empty = new JEnumerable(Enumerable.Empty()); + + private IEnumerable _enumerable; + + /// + /// Initializes a new instance of the struct. + /// + /// The enumerable. + public JEnumerable(IEnumerable enumerable) + { + ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); + + _enumerable = enumerable; + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// A that can be used to iterate through the collection. + /// + public IEnumerator GetEnumerator() + { + return _enumerable.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through a collection. + /// + /// + /// An object that can be used to iterate through the collection. + /// + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// + /// Gets the with the specified key. + /// + /// + public IEnumerable this[object key] + { + get { return Extensions.Values(_enumerable, key); } + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JObject.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JObject.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JObject.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JObject.cs index 76ec61b..b17709c 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JObject.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JObject.cs @@ -1,234 +1,234 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Newtonsoft.Json.Utilities; -using System.Globalization; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents a JSON object. - /// - public class JObject : JContainer - { - /// - /// Initializes a new instance of the class. - /// - public JObject() - { - } - - /// - /// Initializes a new instance of the class from another object. - /// - /// A object to copy from. - public JObject(JObject other) - : base(other) - { - } - - /// - /// Initializes a new instance of the class with the specified content. - /// - /// The contents of the object. - public JObject(params object[] content) - : this((object)content) - { - } - - /// - /// Initializes a new instance of the class with the specified content. - /// - /// The contents of the object. - public JObject(object content) - { - Add(content); - } - - internal override bool DeepEquals(JToken node) - { - JObject t = node as JObject; - return (t != null && ContentsEqual(t)); - } - - internal override void ValidateToken(JToken o) - { - ValidationUtils.ArgumentNotNull(o, "o"); - - if (o.Type != JsonTokenType.Property) - throw new Exception("Can not add {0} to {1}".FormatWith(CultureInfo.InvariantCulture, o.GetType(), GetType())); - } - - internal override JToken CloneNode() - { - return new JObject(this); - } - - /// - /// Gets the node type for this . - /// - /// The type. - public override JsonTokenType Type - { - get { return JsonTokenType.Object; } - } - - /// - /// Gets an of this object's properties. - /// - /// An of this object's properties. - public IEnumerable Properties() - { - return Children().Cast(); - } - - /// - /// Gets a the specified name. - /// - /// The property name. - /// A with the specified name or null. - public JProperty Property(string name) - { - return Properties() - .Where(p => string.Compare(p.Name, name, StringComparison.Ordinal) == 0) - .SingleOrDefault(); - } - - /// - /// Gets an of this object's property values. - /// - /// An of this object's property values. - public JEnumerable PropertyValues() - { - return new JEnumerable(Properties().Select(p => p.Value)); - } - - /// - /// Gets the with the specified key. - /// - /// The with the specified key. - public override JToken this[object key] - { - get - { - ValidationUtils.ArgumentNotNull(key, "o"); - - string propertyName = key as string; - if (propertyName == null) - throw new ArgumentException("Accessed JObject values with invalid key value: {0}. Object property name expected.".FormatWith(CultureInfo.InvariantCulture, MiscellaneousUtils.ToString(key))); - - JProperty property = Property(propertyName); - - return (property != null) ? property.Value : null; - } - } - - /// - /// Loads an from a . - /// - /// A that will be read for the content of the . - /// A that contains the XML that was read from the specified . - public static JObject Load(JsonReader reader) - { - ValidationUtils.ArgumentNotNull(reader, "reader"); - - if (reader.TokenType == JsonToken.None) - { - if (!reader.Read()) - throw new Exception("Error reading JObject from JsonReader."); - } - if (reader.TokenType != JsonToken.StartObject) - { - throw new Exception("Current JsonReader item is not an object."); - } - else - { - if (!reader.Read()) - throw new Exception("Error reading JObject from JsonReader."); - } - - JObject o = new JObject(); - o.ReadContentFrom(reader); - - return o; - } - - /// - /// Load a from a string that contains JSON. - /// - /// A that contains JSON. - /// A populated from the string that contains JSON. - public static JObject Parse(string json) - { - JsonReader jsonReader = new JsonTextReader(new StringReader(json)); - - return Load(jsonReader); - } - - /// - /// Creates a from an object. - /// - /// The object that will be used to create . - /// A with the values of the specified object - public static JObject FromObject(object o) - { - JToken token = FromObjectInternal(o); - - if (token.Type != JsonTokenType.Object) - throw new ArgumentException("Object serialized to {0}. JObject instance expected.".FormatWith(CultureInfo.InvariantCulture, token.Type)); - - return (JObject)token; - } - - internal override void ValidateObject(JToken o, JToken previous) - { - ValidationUtils.ArgumentNotNull(o, "o"); - - if (o.Type != JsonTokenType.Property) - throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); - } - - /// - /// Writes this token to a . - /// - /// A into which this method will write. - /// A collection of which will be used when writing the token. - public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) - { - writer.WriteStartObject(); - - foreach (JProperty property in Properties()) - { - property.WriteTo(writer, converters); - } - - writer.WriteEndObject(); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a JSON object. + /// + public class JObject : JContainer + { + /// + /// Initializes a new instance of the class. + /// + public JObject() + { + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JObject(JObject other) + : base(other) + { + } + + /// + /// Initializes a new instance of the class with the specified content. + /// + /// The contents of the object. + public JObject(params object[] content) + : this((object)content) + { + } + + /// + /// Initializes a new instance of the class with the specified content. + /// + /// The contents of the object. + public JObject(object content) + { + Add(content); + } + + internal override bool DeepEquals(JToken node) + { + JObject t = node as JObject; + return (t != null && ContentsEqual(t)); + } + + internal override void ValidateToken(JToken o) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type != JsonTokenType.Property) + throw new Exception("Can not add {0} to {1}".FormatWith(CultureInfo.InvariantCulture, o.GetType(), GetType())); + } + + internal override JToken CloneNode() + { + return new JObject(this); + } + + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + get { return JsonTokenType.Object; } + } + + /// + /// Gets an of this object's properties. + /// + /// An of this object's properties. + public IEnumerable Properties() + { + return Children().Cast(); + } + + /// + /// Gets a the specified name. + /// + /// The property name. + /// A with the specified name or null. + public JProperty Property(string name) + { + return Properties() + .Where(p => string.Compare(p.Name, name, StringComparison.Ordinal) == 0) + .SingleOrDefault(); + } + + /// + /// Gets an of this object's property values. + /// + /// An of this object's property values. + public JEnumerable PropertyValues() + { + return new JEnumerable(Properties().Select(p => p.Value)); + } + + /// + /// Gets the with the specified key. + /// + /// The with the specified key. + public override JToken this[object key] + { + get + { + ValidationUtils.ArgumentNotNull(key, "o"); + + string propertyName = key as string; + if (propertyName == null) + throw new ArgumentException("Accessed JObject values with invalid key value: {0}. Object property name expected.".FormatWith(CultureInfo.InvariantCulture, MiscellaneousUtils.ToString(key))); + + JProperty property = Property(propertyName); + + return (property != null) ? property.Value : null; + } + } + + /// + /// Loads an from a . + /// + /// A that will be read for the content of the . + /// A that contains the XML that was read from the specified . + public static JObject Load(JsonReader reader) + { + ValidationUtils.ArgumentNotNull(reader, "reader"); + + if (reader.TokenType == JsonToken.None) + { + if (!reader.Read()) + throw new Exception("Error reading JObject from JsonReader."); + } + if (reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Current JsonReader item is not an object."); + } + else + { + if (!reader.Read()) + throw new Exception("Error reading JObject from JsonReader."); + } + + JObject o = new JObject(); + o.ReadContentFrom(reader); + + return o; + } + + /// + /// Load a from a string that contains JSON. + /// + /// A that contains JSON. + /// A populated from the string that contains JSON. + public static JObject Parse(string json) + { + JsonReader jsonReader = new JsonTextReader(new StringReader(json)); + + return Load(jsonReader); + } + + /// + /// Creates a from an object. + /// + /// The object that will be used to create . + /// A with the values of the specified object + public static JObject FromObject(object o) + { + JToken token = FromObjectInternal(o); + + if (token.Type != JsonTokenType.Object) + throw new ArgumentException("Object serialized to {0}. JObject instance expected.".FormatWith(CultureInfo.InvariantCulture, token.Type)); + + return (JObject)token; + } + + internal override void ValidateObject(JToken o, JToken previous) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type != JsonTokenType.Property) + throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + writer.WriteStartObject(); + + foreach (JProperty property in Properties()) + { + property.WriteTo(writer, converters); + } + + writer.WriteEndObject(); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JProperty.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JProperty.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JProperty.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JProperty.cs index 3d8514b..29061aa 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JProperty.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JProperty.cs @@ -1,150 +1,150 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using Newtonsoft.Json.Utilities; -using System.Diagnostics; -using System.Globalization; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents a JSON property. - /// - public class JProperty : JContainer - { - private readonly string _name; - - /// - /// Gets the property name. - /// - /// The property name. - public string Name - { - [DebuggerStepThrough] - get { return _name; } - } - - /// - /// Gets or sets the property value. - /// - /// The property value. - public JToken Value - { - [DebuggerStepThrough] - get { return Last; } - set { ReplaceAll(value); } - } - - /// - /// Initializes a new instance of the class from another object. - /// - /// A object to copy from. - public JProperty(JProperty other) - : base(other) - { - _name = other.Name; - } - - internal override bool DeepEquals(JToken node) - { - JProperty t = node as JProperty; - return (t != null && _name == t.Name && ContentsEqual(t)); - } - - internal override JToken CloneNode() - { - return new JProperty(this); - } - - /// - /// Gets the node type for this . - /// - /// The type. - public override JsonTokenType Type - { - [DebuggerStepThrough] - get { return JsonTokenType.Property; } - } - - /// - /// Initializes a new instance of the class. - /// - /// The property name. - public JProperty(string name) - { - ValidationUtils.ArgumentNotNull(name, "name"); - - _name = name; - } - - /// - /// Initializes a new instance of the class. - /// - /// The property name. - /// The property value. - public JProperty(string name, object value) - { - ValidationUtils.ArgumentNotNullOrEmpty(name, "name"); - - _name = name; - Value = CreateFromContent(value); - } - - internal override void ValidateObject(JToken o, JToken previous) - { - ValidationUtils.ArgumentNotNull(o, "o"); - - if (o.Type == JsonTokenType.Property) - throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); - } - - /// - /// Writes this token to a . - /// - /// A into which this method will write. - /// A collection of which will be used when writing the token. - public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) - { - writer.WritePropertyName(_name); - Value.WriteTo(writer, converters); - } - - //public static explicit operator JValue(JProperty property) - //{ - // if (property == null) - // return null; - - // JToken value = property.Value; - // if (value == null) - // return null; - - // if (!(value is JValue)) - // throw new Exception("Could not cast {0} to JValue".FormatWith(CultureInfo.InvariantCulture, value.GetType())); - - // return (JValue)value; - //} - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using Newtonsoft.Json.Utilities; +using System.Diagnostics; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a JSON property. + /// + public class JProperty : JContainer + { + private readonly string _name; + + /// + /// Gets the property name. + /// + /// The property name. + public string Name + { + [DebuggerStepThrough] + get { return _name; } + } + + /// + /// Gets or sets the property value. + /// + /// The property value. + public JToken Value + { + [DebuggerStepThrough] + get { return Last; } + set { ReplaceAll(value); } + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JProperty(JProperty other) + : base(other) + { + _name = other.Name; + } + + internal override bool DeepEquals(JToken node) + { + JProperty t = node as JProperty; + return (t != null && _name == t.Name && ContentsEqual(t)); + } + + internal override JToken CloneNode() + { + return new JProperty(this); + } + + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + [DebuggerStepThrough] + get { return JsonTokenType.Property; } + } + + /// + /// Initializes a new instance of the class. + /// + /// The property name. + public JProperty(string name) + { + ValidationUtils.ArgumentNotNull(name, "name"); + + _name = name; + } + + /// + /// Initializes a new instance of the class. + /// + /// The property name. + /// The property value. + public JProperty(string name, object value) + { + ValidationUtils.ArgumentNotNullOrEmpty(name, "name"); + + _name = name; + Value = CreateFromContent(value); + } + + internal override void ValidateObject(JToken o, JToken previous) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type == JsonTokenType.Property) + throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + writer.WritePropertyName(_name); + Value.WriteTo(writer, converters); + } + + //public static explicit operator JValue(JProperty property) + //{ + // if (property == null) + // return null; + + // JToken value = property.Value; + // if (value == null) + // return null; + + // if (!(value is JValue)) + // throw new Exception("Could not cast {0} to JValue".FormatWith(CultureInfo.InvariantCulture, value.GetType())); + + // return (JValue)value; + //} + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JToken.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JToken.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JToken.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JToken.cs index ab9a810..f0944a1 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JToken.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JToken.cs @@ -1,697 +1,697 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Newtonsoft.Json.Utilities; -using System.Diagnostics; -using System.Globalization; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents an abstract JSON token. - /// - public abstract class JToken - { - private JContainer _parent; - internal JToken _next; - - /// - /// Gets or sets the parent. - /// - /// The parent. - public JContainer Parent - { - [DebuggerStepThrough] - get { return _parent; } - internal set { _parent = value; } - } - - /// - /// Gets the root of this . - /// - /// The root of this . - public JToken Root - { - get - { - JContainer parent = Parent; - if (parent == null) - return this; - - while (parent.Parent != null) - { - parent = parent.Parent; - } - - return parent; - } - } - - internal abstract JToken CloneNode(); - internal abstract bool DeepEquals(JToken node); - - /// - /// Gets the node type for this . - /// - /// The type. - public abstract JsonTokenType Type { get; } - - /// - /// Gets a value indicating whether this token has childen tokens. - /// - /// - /// true if this token has child values; otherwise, false. - /// - public abstract bool HasValues { get; } - - /// - /// Compares the values of two tokens, including the values of all descendant tokens. - /// - /// The first to compare. - /// The second to compare. - /// true if the tokens are equal; otherwise false. - public static bool DeepEquals(JToken t1, JToken t2) - { - return (t1 == t2 || (t1 != null && t2 != null && t1.DeepEquals(t2))); - } - - /// - /// Gets the next sibling token of this node. - /// - /// The that contains the next sibling token. - public JToken Next - { - get - { - if (_parent != null && _next != _parent.First) - return _next; - - return null; - } - internal set { _next = value; } - } - - /// - /// Gets the previous sibling token of this node. - /// - /// The that contains the previous sibling token. - public JToken Previous - { - get - { - if (_parent == null) - return null; - - JToken parentNext = ((JToken)_parent.Content)._next; - JToken parentNextBefore = null; - while (parentNext != this) - { - parentNextBefore = parentNext; - parentNext = parentNext.Next; - } - return parentNextBefore; - } - } - - internal JToken() - { - } - - /// - /// Returns a collection of the ancestor tokens of this token. - /// - /// A collection of the ancestor tokens of this token. - public IEnumerable Ancestors() - { - for (JToken parent = Parent; parent != null; parent = parent.Parent) - { - yield return parent; - } - } - - /// - /// Returns a collection of the sibling tokens after this token, in document order. - /// - /// A collection of the sibling tokens after this tokens, in document order. - public IEnumerable AfterSelf() - { - if (Parent == null) - yield break; - - for (JToken o = Next; o != null; o = o.Next) - yield return o; - } - - /// - /// Returns a collection of the sibling tokens before this token, in document order. - /// - /// A collection of the sibling tokens before this token, in document order. - public IEnumerable BeforeSelf() - { - for (JToken o = Parent.First; o != this; o = o.Next) - yield return o; - } - - /// - /// Gets the with the specified key. - /// - /// The with the specified key. - public virtual JToken this[object key] - { - get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); } - } - - /// - /// Gets the with the specified key converted to the specified type. - /// - /// The type to convert the token to. - /// The token key. - /// The converted token value. - public virtual T Value(object key) - { - JToken token = this[key]; - - return Extensions.Convert(token); - } - - /// - /// Get the first child token of this token. - /// - /// A containing the first child token of the . - public virtual JToken First - { - get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); } - } - - /// - /// Get the last child token of this token. - /// - /// A containing the last child token of the . - public virtual JToken Last - { - get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); } - } - - /// - /// Returns a collection of the child tokens of this token, in document order. - /// - /// An of containing the child tokens of this , in document order. - public virtual JEnumerable Children() - { - throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); - } - - /// - /// Returns a collection of the child tokens of this token, in document order. - /// - /// A containing the child tokens of this , in document order. - public JEnumerable Children() where T : JToken - { - return new JEnumerable(Children().OfType()); - } - - /// - /// Returns a collection of the child values of this token, in document order. - /// - /// A containing the child values of this , in document order. - public virtual IEnumerable Values() - { - throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); - } - - /// - /// Removes this token from its parent. - /// - public void Remove() - { - if (_parent == null) - throw new InvalidOperationException("The parent is missing."); - - _parent.Remove(this); - } - - /// - /// Replaces this token with the specified token. - /// - /// The value. - public void Replace(JToken value) - { - if (_parent == null) - throw new InvalidOperationException("The parent is missing."); - - JContainer parent = _parent; - - JToken previous = this; - while (previous._next != this) - { - previous = previous._next; - } - if (previous == this) - previous = null; - - bool isLast = (this == _parent.Last); - - Remove(); - parent.AddInternal(isLast, previous, value); - } - - /// - /// Writes this token to a . - /// - /// A into which this method will write. - /// A collection of which will be used when writing the token. - public abstract void WriteTo(JsonWriter writer, params JsonConverter[] converters); - - /// - /// Returns the indented JSON for this token. - /// - /// - /// A containing the indented JSON. - /// - public override string ToString() - { - return ToString(null); - } - - /// - /// Returns the indented JSON for this token using any given converters. - /// - /// A collection of which will be used when writing the token. - /// - private string ToString(params JsonConverter[] converters) - { - using (StringWriter sw = new StringWriter(CultureInfo.InvariantCulture)) - { - JsonTextWriter jw = new JsonTextWriter(sw); - jw.Formatting = Formatting.Indented; - - WriteTo(jw); - - return sw.ToString(); - } - } - - private static JValue EnsureValue(JToken value) - { - if (value == null) - throw new ArgumentNullException("value"); - - if (value is JProperty) - value = ((JProperty)value).Value; - - JValue v = value as JValue; - - return v; - } - - private static bool IsNullable(JToken o) - { - return (o.Type == JsonTokenType.Undefined || o.Type == JsonTokenType.Null); - } - - private static bool ValidateFloat(JToken o, bool nullable) - { - return (o.Type == JsonTokenType.Float || o.Type == JsonTokenType.Integer || (nullable && IsNullable(o))); - } - - private static bool ValidateInteger(JToken o, bool nullable) - { - return (o.Type == JsonTokenType.Integer || (nullable && IsNullable(o))); - } - - private static bool ValidateDate(JToken o, bool nullable) - { - return (o.Type == JsonTokenType.Date || (nullable && IsNullable(o))); - } - - private static bool ValidateBoolean(JToken o, bool nullable) - { - return (o.Type == JsonTokenType.Boolean || (nullable && IsNullable(o))); - } - - private static bool ValidateString(JToken o) - { - return (o.Type == JsonTokenType.String || IsNullable(o)); - } - - private static string GetType(JToken t) - { - return (t != null) ? t.Type.ToString() : "{null}"; - } - - #region Cast operators - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator bool(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateBoolean(v, false)) - throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (bool)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator DateTimeOffset(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateDate(v, false)) - throw new ArgumentException("Can not convert {0} to DateTimeOffset.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (DateTimeOffset)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator bool?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateBoolean(v, true)) - throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (bool?)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator long(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateInteger(v, false)) - throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (long)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator DateTime?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateDate(v, true)) - throw new ArgumentException("Can not convert {0} to DateTime.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (DateTime?)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator DateTimeOffset?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateDate(v, true)) - throw new ArgumentException("Can not convert {0} to DateTimeOffset.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (DateTimeOffset?)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator decimal?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateFloat(v, true)) - throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (decimal?)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator double?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateFloat(v, true)) - throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (double?)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator int(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateInteger(v, false)) - throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return Convert.ToInt32(v.Value, CultureInfo.InvariantCulture); - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator int?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateInteger(v, true)) - throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (v.Value != null) ? (int?)Convert.ToInt32(v.Value, CultureInfo.InvariantCulture) : null; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator DateTime(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateDate(v, false)) - throw new ArgumentException("Can not convert {0} to DateTime.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (DateTime)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator long?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateInteger(v, true)) - throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (long?)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator float?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateFloat(v, true)) - throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (float?)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator decimal(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateFloat(v, false)) - throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (decimal)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator uint?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateInteger(v, true)) - throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (uint?)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator ulong?(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateInteger(v, true)) - throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (ulong?)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator double(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateFloat(v, false)) - throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (double)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator float(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateFloat(v, false)) - throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return Convert.ToSingle(v.Value, CultureInfo.InvariantCulture); - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator string(JToken value) - { - if (value == null) - return null; - - JValue v = EnsureValue(value); - if (v == null || !ValidateString(v)) - throw new ArgumentException("Can not convert {0} to String.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return (string)v.Value; - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator uint(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateInteger(v, false)) - throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return Convert.ToUInt32(v.Value, CultureInfo.InvariantCulture); - } - - /// - /// Performs an explicit conversion from to . - /// - /// The value. - /// The result of the conversion. - public static explicit operator ulong(JToken value) - { - JValue v = EnsureValue(value); - if (v == null || !ValidateInteger(v, false)) - throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); - - return Convert.ToUInt64(v.Value, CultureInfo.InvariantCulture); - } - #endregion - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Diagnostics; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents an abstract JSON token. + /// + public abstract class JToken + { + private JContainer _parent; + internal JToken _next; + + /// + /// Gets or sets the parent. + /// + /// The parent. + public JContainer Parent + { + [DebuggerStepThrough] + get { return _parent; } + internal set { _parent = value; } + } + + /// + /// Gets the root of this . + /// + /// The root of this . + public JToken Root + { + get + { + JContainer parent = Parent; + if (parent == null) + return this; + + while (parent.Parent != null) + { + parent = parent.Parent; + } + + return parent; + } + } + + internal abstract JToken CloneNode(); + internal abstract bool DeepEquals(JToken node); + + /// + /// Gets the node type for this . + /// + /// The type. + public abstract JsonTokenType Type { get; } + + /// + /// Gets a value indicating whether this token has childen tokens. + /// + /// + /// true if this token has child values; otherwise, false. + /// + public abstract bool HasValues { get; } + + /// + /// Compares the values of two tokens, including the values of all descendant tokens. + /// + /// The first to compare. + /// The second to compare. + /// true if the tokens are equal; otherwise false. + public static bool DeepEquals(JToken t1, JToken t2) + { + return (t1 == t2 || (t1 != null && t2 != null && t1.DeepEquals(t2))); + } + + /// + /// Gets the next sibling token of this node. + /// + /// The that contains the next sibling token. + public JToken Next + { + get + { + if (_parent != null && _next != _parent.First) + return _next; + + return null; + } + internal set { _next = value; } + } + + /// + /// Gets the previous sibling token of this node. + /// + /// The that contains the previous sibling token. + public JToken Previous + { + get + { + if (_parent == null) + return null; + + JToken parentNext = ((JToken)_parent.Content)._next; + JToken parentNextBefore = null; + while (parentNext != this) + { + parentNextBefore = parentNext; + parentNext = parentNext.Next; + } + return parentNextBefore; + } + } + + internal JToken() + { + } + + /// + /// Returns a collection of the ancestor tokens of this token. + /// + /// A collection of the ancestor tokens of this token. + public IEnumerable Ancestors() + { + for (JToken parent = Parent; parent != null; parent = parent.Parent) + { + yield return parent; + } + } + + /// + /// Returns a collection of the sibling tokens after this token, in document order. + /// + /// A collection of the sibling tokens after this tokens, in document order. + public IEnumerable AfterSelf() + { + if (Parent == null) + yield break; + + for (JToken o = Next; o != null; o = o.Next) + yield return o; + } + + /// + /// Returns a collection of the sibling tokens before this token, in document order. + /// + /// A collection of the sibling tokens before this token, in document order. + public IEnumerable BeforeSelf() + { + for (JToken o = Parent.First; o != this; o = o.Next) + yield return o; + } + + /// + /// Gets the with the specified key. + /// + /// The with the specified key. + public virtual JToken this[object key] + { + get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); } + } + + /// + /// Gets the with the specified key converted to the specified type. + /// + /// The type to convert the token to. + /// The token key. + /// The converted token value. + public virtual T Value(object key) + { + JToken token = this[key]; + + return Extensions.Convert(token); + } + + /// + /// Get the first child token of this token. + /// + /// A containing the first child token of the . + public virtual JToken First + { + get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); } + } + + /// + /// Get the last child token of this token. + /// + /// A containing the last child token of the . + public virtual JToken Last + { + get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); } + } + + /// + /// Returns a collection of the child tokens of this token, in document order. + /// + /// An of containing the child tokens of this , in document order. + public virtual JEnumerable Children() + { + throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); + } + + /// + /// Returns a collection of the child tokens of this token, in document order. + /// + /// A containing the child tokens of this , in document order. + public JEnumerable Children() where T : JToken + { + return new JEnumerable(Children().OfType()); + } + + /// + /// Returns a collection of the child values of this token, in document order. + /// + /// A containing the child values of this , in document order. + public virtual IEnumerable Values() + { + throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); + } + + /// + /// Removes this token from its parent. + /// + public void Remove() + { + if (_parent == null) + throw new InvalidOperationException("The parent is missing."); + + _parent.Remove(this); + } + + /// + /// Replaces this token with the specified token. + /// + /// The value. + public void Replace(JToken value) + { + if (_parent == null) + throw new InvalidOperationException("The parent is missing."); + + JContainer parent = _parent; + + JToken previous = this; + while (previous._next != this) + { + previous = previous._next; + } + if (previous == this) + previous = null; + + bool isLast = (this == _parent.Last); + + Remove(); + parent.AddInternal(isLast, previous, value); + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public abstract void WriteTo(JsonWriter writer, params JsonConverter[] converters); + + /// + /// Returns the indented JSON for this token. + /// + /// + /// A containing the indented JSON. + /// + public override string ToString() + { + return ToString(null); + } + + /// + /// Returns the indented JSON for this token using any given converters. + /// + /// A collection of which will be used when writing the token. + /// + private string ToString(params JsonConverter[] converters) + { + using (StringWriter sw = new StringWriter(CultureInfo.InvariantCulture)) + { + JsonTextWriter jw = new JsonTextWriter(sw); + jw.Formatting = Formatting.Indented; + + WriteTo(jw); + + return sw.ToString(); + } + } + + private static JValue EnsureValue(JToken value) + { + if (value == null) + throw new ArgumentNullException("value"); + + if (value is JProperty) + value = ((JProperty)value).Value; + + JValue v = value as JValue; + + return v; + } + + private static bool IsNullable(JToken o) + { + return (o.Type == JsonTokenType.Undefined || o.Type == JsonTokenType.Null); + } + + private static bool ValidateFloat(JToken o, bool nullable) + { + return (o.Type == JsonTokenType.Float || o.Type == JsonTokenType.Integer || (nullable && IsNullable(o))); + } + + private static bool ValidateInteger(JToken o, bool nullable) + { + return (o.Type == JsonTokenType.Integer || (nullable && IsNullable(o))); + } + + private static bool ValidateDate(JToken o, bool nullable) + { + return (o.Type == JsonTokenType.Date || (nullable && IsNullable(o))); + } + + private static bool ValidateBoolean(JToken o, bool nullable) + { + return (o.Type == JsonTokenType.Boolean || (nullable && IsNullable(o))); + } + + private static bool ValidateString(JToken o) + { + return (o.Type == JsonTokenType.String || IsNullable(o)); + } + + private static string GetType(JToken t) + { + return (t != null) ? t.Type.ToString() : "{null}"; + } + + #region Cast operators + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator bool(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateBoolean(v, false)) + throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (bool)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator DateTimeOffset(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateDate(v, false)) + throw new ArgumentException("Can not convert {0} to DateTimeOffset.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (DateTimeOffset)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator bool?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateBoolean(v, true)) + throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (bool?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator long(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, false)) + throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (long)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator DateTime?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateDate(v, true)) + throw new ArgumentException("Can not convert {0} to DateTime.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (DateTime?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator DateTimeOffset?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateDate(v, true)) + throw new ArgumentException("Can not convert {0} to DateTimeOffset.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (DateTimeOffset?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator decimal?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, true)) + throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (decimal?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator double?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, true)) + throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (double?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator int(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, false)) + throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return Convert.ToInt32(v.Value, CultureInfo.InvariantCulture); + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator int?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, true)) + throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (v.Value != null) ? (int?)Convert.ToInt32(v.Value, CultureInfo.InvariantCulture) : null; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator DateTime(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateDate(v, false)) + throw new ArgumentException("Can not convert {0} to DateTime.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (DateTime)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator long?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, true)) + throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (long?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator float?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, true)) + throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (float?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator decimal(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, false)) + throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (decimal)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator uint?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, true)) + throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (uint?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator ulong?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, true)) + throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (ulong?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator double(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, false)) + throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (double)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator float(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, false)) + throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return Convert.ToSingle(v.Value, CultureInfo.InvariantCulture); + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator string(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateString(v)) + throw new ArgumentException("Can not convert {0} to String.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (string)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator uint(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, false)) + throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return Convert.ToUInt32(v.Value, CultureInfo.InvariantCulture); + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator ulong(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, false)) + throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return Convert.ToUInt64(v.Value, CultureInfo.InvariantCulture); + } + #endregion + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JValue.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JValue.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JValue.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JValue.cs index c3f1a00..7f205d8 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JValue.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JValue.cs @@ -1,291 +1,291 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using Newtonsoft.Json.Utilities; -using System.Globalization; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents a value in JSON (string, integer, date, etc). - /// - public class JValue : JToken - { - private JsonTokenType _valueType; - private object _value; - - internal JValue(object value, JsonTokenType type) - { - _value = value; - _valueType = type; - } - - /// - /// Initializes a new instance of the class from another object. - /// - /// A object to copy from. - public JValue(JValue other) - : this(other.Value, other.Type) - { - } - - /// - /// Initializes a new instance of the class with the given value. - /// - /// The value. - public JValue(long value) - : this(value, JsonTokenType.Integer) - { - } - - /// - /// Initializes a new instance of the class with the given value. - /// - /// The value. - public JValue(ulong value) - : this(value, JsonTokenType.Integer) - { - } - - /// - /// Initializes a new instance of the class with the given value. - /// - /// The value. - public JValue(double value) - : this(value, JsonTokenType.Float) - { - } - - /// - /// Initializes a new instance of the class with the given value. - /// - /// The value. - public JValue(DateTime value) - : this(value, JsonTokenType.Date) - { - } - - /// - /// Initializes a new instance of the class with the given value. - /// - /// The value. - public JValue(bool value) - : this(value, JsonTokenType.Boolean) - { - } - - /// - /// Initializes a new instance of the class with the given value. - /// - /// The value. - public JValue(string value) - : this(value, JsonTokenType.String) - { - } - - /// - /// Initializes a new instance of the class with the given value. - /// - /// The value. - public JValue(object value) - : this(value, GetValueType(null, value)) - { - } - - internal override bool DeepEquals(JToken node) - { - JValue other = node as JValue; - if (other == null) - return false; - - return (this == other || (_valueType == other.Type && Compare(_value, other.Value))); - } - - /// - /// Gets a value indicating whether this token has childen tokens. - /// - /// - /// true if this token has child values; otherwise, false. - /// - public override bool HasValues - { - get { return false; } - } - - private bool Compare(object objA, object objB) - { - if (objA == null && objB == null) - return true; - - switch (_valueType) - { - case JsonTokenType.Integer: - if (objA is ulong || objB is ulong) - return Convert.ToDecimal(objA, CultureInfo.InvariantCulture).Equals(Convert.ToDecimal(objB, CultureInfo.InvariantCulture)); - else - return Convert.ToInt64(objA, CultureInfo.InvariantCulture).Equals(Convert.ToInt64(objB, CultureInfo.InvariantCulture)); - case JsonTokenType.Float: - return Convert.ToDouble(objA, CultureInfo.InvariantCulture).Equals(Convert.ToDouble(objB, CultureInfo.InvariantCulture)); - case JsonTokenType.Comment: - case JsonTokenType.String: - case JsonTokenType.Boolean: - return objA.Equals(objB); - case JsonTokenType.Date: - return objA.Equals(objB); - default: - throw new ArgumentOutOfRangeException("valueType", _valueType, "Unexpected value type: {0}".FormatWith(CultureInfo.InvariantCulture, _valueType)); - } - } - - internal override JToken CloneNode() - { - return new JValue(this); - } - - /// - /// Creates a comment with the given value. - /// - /// The value. - /// A comment with the given value. - public static JValue CreateComment(string value) - { - return new JValue(value, JsonTokenType.Comment); - } - - /// - /// Creates a string with the given value. - /// - /// The value. - /// A string with the given value. - public static JValue CreateString(string value) - { - return new JValue(value, JsonTokenType.String); - } - - private static JsonTokenType GetValueType(JsonTokenType? current, object value) - { - if (value == null) - return JsonTokenType.Null; - else if (value is string) - return (current == JsonTokenType.Comment) ? JsonTokenType.Comment : JsonTokenType.String; - else if (value is long || value is int || value is short || value is sbyte - || value is ulong || value is uint || value is ushort || value is byte) - return JsonTokenType.Integer; - else if (value is double || value is float || value is decimal) - return JsonTokenType.Float; - else if (value is DateTime || value is DateTimeOffset) - return JsonTokenType.Date; - else if (value is bool) - return JsonTokenType.Boolean; - - throw new ArgumentException("Could not determin JSON object type for type {0}.".FormatWith(CultureInfo.InvariantCulture, value.GetType())); - } - - /// - /// Gets the node type for this . - /// - /// The type. - public override JsonTokenType Type - { - get { return _valueType; } - } - - /// - /// Gets or sets the underlying token value. - /// - /// The underlying token value. - public object Value - { - get { return _value; } - set - { - Type currentType = (_value != null) ? _value.GetType() : null; - Type newType = (value != null) ? value.GetType() : null; - - if (currentType != newType) - _valueType = GetValueType(_valueType, value); - - _value = value; - } - } - - private static void WriteConvertableValue(JsonWriter writer, IList converters, Action _defaultWrite, object value) - { - JsonConverter matchingConverter; - - JsonSerializer.HasMatchingConverter(converters, value.GetType(), out matchingConverter); - if (matchingConverter != null) - matchingConverter.WriteJson(writer, value); - else - _defaultWrite(value); - } - - /// - /// Writes this token to a . - /// - /// A into which this method will write. - /// A collection of which will be used when writing the token. - public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) - { - switch (_valueType) - { - case JsonTokenType.Comment: - writer.WriteComment(_value.ToString()); - break; - case JsonTokenType.Integer: - WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToInt64(v, CultureInfo.InvariantCulture)), _value); - break; - case JsonTokenType.Float: - WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToDouble(v, CultureInfo.InvariantCulture)), _value); - break; - case JsonTokenType.String: - WriteConvertableValue(writer, converters, v => writer.WriteValue(v.ToString()), _value); - break; - case JsonTokenType.Boolean: - WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToBoolean(v, CultureInfo.InvariantCulture)), _value); - break; - case JsonTokenType.Date: - WriteConvertableValue(writer, converters, v => - { - if (v is DateTimeOffset) - writer.WriteValue((DateTimeOffset)v); - else - writer.WriteValue(Convert.ToDateTime(v, CultureInfo.InvariantCulture)); - }, _value); - break; - case JsonTokenType.Null: - writer.WriteNull(); - break; - case JsonTokenType.Undefined: - writer.WriteUndefined(); - break; - default: - throw new ArgumentOutOfRangeException("TokenType", _valueType, "Unexpected token type."); - } - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a value in JSON (string, integer, date, etc). + /// + public class JValue : JToken + { + private JsonTokenType _valueType; + private object _value; + + internal JValue(object value, JsonTokenType type) + { + _value = value; + _valueType = type; + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JValue(JValue other) + : this(other.Value, other.Type) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(long value) + : this(value, JsonTokenType.Integer) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(ulong value) + : this(value, JsonTokenType.Integer) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(double value) + : this(value, JsonTokenType.Float) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(DateTime value) + : this(value, JsonTokenType.Date) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(bool value) + : this(value, JsonTokenType.Boolean) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(string value) + : this(value, JsonTokenType.String) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(object value) + : this(value, GetValueType(null, value)) + { + } + + internal override bool DeepEquals(JToken node) + { + JValue other = node as JValue; + if (other == null) + return false; + + return (this == other || (_valueType == other.Type && Compare(_value, other.Value))); + } + + /// + /// Gets a value indicating whether this token has childen tokens. + /// + /// + /// true if this token has child values; otherwise, false. + /// + public override bool HasValues + { + get { return false; } + } + + private bool Compare(object objA, object objB) + { + if (objA == null && objB == null) + return true; + + switch (_valueType) + { + case JsonTokenType.Integer: + if (objA is ulong || objB is ulong) + return Convert.ToDecimal(objA, CultureInfo.InvariantCulture).Equals(Convert.ToDecimal(objB, CultureInfo.InvariantCulture)); + else + return Convert.ToInt64(objA, CultureInfo.InvariantCulture).Equals(Convert.ToInt64(objB, CultureInfo.InvariantCulture)); + case JsonTokenType.Float: + return Convert.ToDouble(objA, CultureInfo.InvariantCulture).Equals(Convert.ToDouble(objB, CultureInfo.InvariantCulture)); + case JsonTokenType.Comment: + case JsonTokenType.String: + case JsonTokenType.Boolean: + return objA.Equals(objB); + case JsonTokenType.Date: + return objA.Equals(objB); + default: + throw new ArgumentOutOfRangeException("valueType", _valueType, "Unexpected value type: {0}".FormatWith(CultureInfo.InvariantCulture, _valueType)); + } + } + + internal override JToken CloneNode() + { + return new JValue(this); + } + + /// + /// Creates a comment with the given value. + /// + /// The value. + /// A comment with the given value. + public static JValue CreateComment(string value) + { + return new JValue(value, JsonTokenType.Comment); + } + + /// + /// Creates a string with the given value. + /// + /// The value. + /// A string with the given value. + public static JValue CreateString(string value) + { + return new JValue(value, JsonTokenType.String); + } + + private static JsonTokenType GetValueType(JsonTokenType? current, object value) + { + if (value == null) + return JsonTokenType.Null; + else if (value is string) + return (current == JsonTokenType.Comment) ? JsonTokenType.Comment : JsonTokenType.String; + else if (value is long || value is int || value is short || value is sbyte + || value is ulong || value is uint || value is ushort || value is byte) + return JsonTokenType.Integer; + else if (value is double || value is float || value is decimal) + return JsonTokenType.Float; + else if (value is DateTime || value is DateTimeOffset) + return JsonTokenType.Date; + else if (value is bool) + return JsonTokenType.Boolean; + + throw new ArgumentException("Could not determin JSON object type for type {0}.".FormatWith(CultureInfo.InvariantCulture, value.GetType())); + } + + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + get { return _valueType; } + } + + /// + /// Gets or sets the underlying token value. + /// + /// The underlying token value. + public object Value + { + get { return _value; } + set + { + Type currentType = (_value != null) ? _value.GetType() : null; + Type newType = (value != null) ? value.GetType() : null; + + if (currentType != newType) + _valueType = GetValueType(_valueType, value); + + _value = value; + } + } + + private static void WriteConvertableValue(JsonWriter writer, IList converters, Action _defaultWrite, object value) + { + JsonConverter matchingConverter; + + JsonSerializer.HasMatchingConverter(converters, value.GetType(), out matchingConverter); + if (matchingConverter != null) + matchingConverter.WriteJson(writer, value); + else + _defaultWrite(value); + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + switch (_valueType) + { + case JsonTokenType.Comment: + writer.WriteComment(_value.ToString()); + break; + case JsonTokenType.Integer: + WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToInt64(v, CultureInfo.InvariantCulture)), _value); + break; + case JsonTokenType.Float: + WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToDouble(v, CultureInfo.InvariantCulture)), _value); + break; + case JsonTokenType.String: + WriteConvertableValue(writer, converters, v => writer.WriteValue(v.ToString()), _value); + break; + case JsonTokenType.Boolean: + WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToBoolean(v, CultureInfo.InvariantCulture)), _value); + break; + case JsonTokenType.Date: + WriteConvertableValue(writer, converters, v => + { + if (v is DateTimeOffset) + writer.WriteValue((DateTimeOffset)v); + else + writer.WriteValue(Convert.ToDateTime(v, CultureInfo.InvariantCulture)); + }, _value); + break; + case JsonTokenType.Null: + writer.WriteNull(); + break; + case JsonTokenType.Undefined: + writer.WriteUndefined(); + break; + default: + throw new ArgumentOutOfRangeException("TokenType", _valueType, "Unexpected token type."); + } + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JsonTokenReader.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JsonTokenReader.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JsonTokenReader.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JsonTokenReader.cs index 93b99ef..42f0696 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JsonTokenReader.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JsonTokenReader.cs @@ -1,169 +1,169 @@ -using System; -using Newtonsoft.Json.Utilities; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - /// - public class JsonTokenReader : JsonReader - { - private JToken _root; - private JToken _parent; - private JToken _current; - - /// - /// Initializes a new instance of the class. - /// - /// The token to read from. - public JsonTokenReader(JToken token) - { - ValidationUtils.ArgumentNotNull(token, "token"); - - _root = token; - _current = token; - } - - /// - /// Reads the next Json token from the stream. - /// - /// - /// true if the next token was read successfully; false if there are no more tokens to read. - /// - public override bool Read() - { - if (CurrentState != State.Start) - { - JContainer container = _current as JContainer; - if (container != null && _parent != container) - return ReadInto(container); - else - return ReadOver(_current); - } - - SetToken(_current); - return true; - } - - private bool ReadOver(JToken t) - { - if (t == _root) - return ReadToEnd(); - - JToken next = t.Next; - if ((next == null || next == t) || t == t.Parent.Last) - { - if (t.Parent == null) - return ReadToEnd(); - - return SetEnd(t.Parent); - } - else - { - _current = next; - SetToken(_current); - return true; - } - } - - private bool ReadToEnd() - { - //CurrentState = State.Finished; - return false; - } - - private JsonToken? GetEndToken(JContainer c) - { - switch (c.Type) - { - case JsonTokenType.Object: - return JsonToken.EndObject; - case JsonTokenType.Array: - return JsonToken.EndArray; - case JsonTokenType.Constructor: - return JsonToken.EndConstructor; - case JsonTokenType.Property: - return null; - default: - throw new ArgumentOutOfRangeException("Type", c.Type, "Unexpected JContainer type."); - } - } - - private bool ReadInto(JContainer c) - { - JToken firstChild = c.First; - if (firstChild == null) - { - return SetEnd(c); - } - else - { - SetToken(firstChild); - _current = firstChild; - _parent = c; - return true; - } - } - - private bool SetEnd(JContainer c) - { - JsonToken? endToken = GetEndToken(c); - if (endToken != null) - { - SetToken(endToken.Value); - _current = c; - _parent = c; - return true; - } - else - { - return ReadOver(c); - } - } - - private void SetToken(JToken token) - { - switch (token.Type) - { - case JsonTokenType.Object: - SetToken(JsonToken.StartObject); - break; - case JsonTokenType.Array: - SetToken(JsonToken.StartArray); - break; - case JsonTokenType.Constructor: - SetToken(JsonToken.StartConstructor); - break; - case JsonTokenType.Property: - SetToken(JsonToken.PropertyName, ((JProperty)token).Name); - break; - case JsonTokenType.Comment: - SetToken(JsonToken.Comment, ((JValue)token).Value); - break; - case JsonTokenType.Integer: - SetToken(JsonToken.Integer, ((JValue)token).Value); - break; - case JsonTokenType.Float: - SetToken(JsonToken.Float, ((JValue)token).Value); - break; - case JsonTokenType.String: - SetToken(JsonToken.String, ((JValue)token).Value); - break; - case JsonTokenType.Boolean: - SetToken(JsonToken.Boolean, ((JValue)token).Value); - break; - case JsonTokenType.Null: - SetToken(JsonToken.Null, ((JValue)token).Value); - break; - case JsonTokenType.Undefined: - SetToken(JsonToken.Undefined, ((JValue)token).Value); - break; - case JsonTokenType.Date: - SetToken(JsonToken.Date, ((JValue)token).Value); - break; - default: - throw new ArgumentOutOfRangeException("Type", token.Type, "Unexpected JsonTokenType."); - } - } - } -} +using System; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + /// + public class JsonTokenReader : JsonReader + { + private JToken _root; + private JToken _parent; + private JToken _current; + + /// + /// Initializes a new instance of the class. + /// + /// The token to read from. + public JsonTokenReader(JToken token) + { + ValidationUtils.ArgumentNotNull(token, "token"); + + _root = token; + _current = token; + } + + /// + /// Reads the next Json token from the stream. + /// + /// + /// true if the next token was read successfully; false if there are no more tokens to read. + /// + public override bool Read() + { + if (CurrentState != State.Start) + { + JContainer container = _current as JContainer; + if (container != null && _parent != container) + return ReadInto(container); + else + return ReadOver(_current); + } + + SetToken(_current); + return true; + } + + private bool ReadOver(JToken t) + { + if (t == _root) + return ReadToEnd(); + + JToken next = t.Next; + if ((next == null || next == t) || t == t.Parent.Last) + { + if (t.Parent == null) + return ReadToEnd(); + + return SetEnd(t.Parent); + } + else + { + _current = next; + SetToken(_current); + return true; + } + } + + private bool ReadToEnd() + { + //CurrentState = State.Finished; + return false; + } + + private JsonToken? GetEndToken(JContainer c) + { + switch (c.Type) + { + case JsonTokenType.Object: + return JsonToken.EndObject; + case JsonTokenType.Array: + return JsonToken.EndArray; + case JsonTokenType.Constructor: + return JsonToken.EndConstructor; + case JsonTokenType.Property: + return null; + default: + throw new ArgumentOutOfRangeException("Type", c.Type, "Unexpected JContainer type."); + } + } + + private bool ReadInto(JContainer c) + { + JToken firstChild = c.First; + if (firstChild == null) + { + return SetEnd(c); + } + else + { + SetToken(firstChild); + _current = firstChild; + _parent = c; + return true; + } + } + + private bool SetEnd(JContainer c) + { + JsonToken? endToken = GetEndToken(c); + if (endToken != null) + { + SetToken(endToken.Value); + _current = c; + _parent = c; + return true; + } + else + { + return ReadOver(c); + } + } + + private void SetToken(JToken token) + { + switch (token.Type) + { + case JsonTokenType.Object: + SetToken(JsonToken.StartObject); + break; + case JsonTokenType.Array: + SetToken(JsonToken.StartArray); + break; + case JsonTokenType.Constructor: + SetToken(JsonToken.StartConstructor); + break; + case JsonTokenType.Property: + SetToken(JsonToken.PropertyName, ((JProperty)token).Name); + break; + case JsonTokenType.Comment: + SetToken(JsonToken.Comment, ((JValue)token).Value); + break; + case JsonTokenType.Integer: + SetToken(JsonToken.Integer, ((JValue)token).Value); + break; + case JsonTokenType.Float: + SetToken(JsonToken.Float, ((JValue)token).Value); + break; + case JsonTokenType.String: + SetToken(JsonToken.String, ((JValue)token).Value); + break; + case JsonTokenType.Boolean: + SetToken(JsonToken.Boolean, ((JValue)token).Value); + break; + case JsonTokenType.Null: + SetToken(JsonToken.Null, ((JValue)token).Value); + break; + case JsonTokenType.Undefined: + SetToken(JsonToken.Undefined, ((JValue)token).Value); + break; + case JsonTokenType.Date: + SetToken(JsonToken.Date, ((JValue)token).Value); + break; + default: + throw new ArgumentOutOfRangeException("Type", token.Type, "Unexpected JsonTokenType."); + } + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JsonTokenType.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JsonTokenType.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JsonTokenType.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JsonTokenType.cs index 56d37b6..0c4ad85 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JsonTokenType.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JsonTokenType.cs @@ -1,86 +1,86 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -namespace Newtonsoft.Json.Linq -{ - /// - /// Specifies the type of token. - /// - public enum JsonTokenType - { - /// - /// No token type has been set. - /// - None, - /// - /// A JSON object. - /// - Object, - /// - /// A JSON array. - /// - Array, - /// - /// A JSON constructor. - /// - Constructor, - /// - /// A JSON object property. - /// - Property, - /// - /// A comment. - /// - Comment, - /// - /// An integer value. - /// - Integer, - /// - /// A float value. - /// - Float, - /// - /// A string value. - /// - String, - /// - /// A boolean value. - /// - Boolean, - /// - /// A null value. - /// - Null, - /// - /// An undefined value. - /// - Undefined, - /// - /// A date value. - /// - Date - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +namespace Newtonsoft.Json.Linq +{ + /// + /// Specifies the type of token. + /// + public enum JsonTokenType + { + /// + /// No token type has been set. + /// + None, + /// + /// A JSON object. + /// + Object, + /// + /// A JSON array. + /// + Array, + /// + /// A JSON constructor. + /// + Constructor, + /// + /// A JSON object property. + /// + Property, + /// + /// A comment. + /// + Comment, + /// + /// An integer value. + /// + Integer, + /// + /// A float value. + /// + Float, + /// + /// A string value. + /// + String, + /// + /// A boolean value. + /// + Boolean, + /// + /// A null value. + /// + Null, + /// + /// An undefined value. + /// + Undefined, + /// + /// A date value. + /// + Date + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JsonTokenWriter.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JsonTokenWriter.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JsonTokenWriter.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JsonTokenWriter.cs index c1d6a8d..5c72c1d 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Linq/JsonTokenWriter.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Linq/JsonTokenWriter.cs @@ -1,325 +1,325 @@ -using System; -using Newtonsoft.Json.Utilities; - -namespace Newtonsoft.Json.Linq -{ - /// - /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - /// - public class JsonTokenWriter : JsonWriter - { - private JContainer _token; - private JContainer _parent; - - /// - /// Gets the token being writen. - /// - /// The token being writen. - public JContainer Token - { - get { return _token; } - } - - /// - /// Initializes a new instance of the class writing to the given . - /// - /// The container being written to. - public JsonTokenWriter(JContainer container) - { - ValidationUtils.ArgumentNotNull(container, "container"); - - _token = container; - _parent = container; - } - - /// - /// Initializes a new instance of the class. - /// - public JsonTokenWriter() - { - } - - /// - /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - /// - public override void Flush() - { - } - - /// - /// Closes this stream and the underlying stream. - /// - public override void Close() - { - base.Close(); - } - - /// - /// Writes the beginning of a Json object. - /// - public override void WriteStartObject() - { - base.WriteStartObject(); - - AddParent(new JObject()); - } - - private void AddParent(JContainer container) - { - if (_parent == null) - _token = container; - else - _parent.Add(container); - - _parent = container; - } - - private void RemoveParent() - { - _parent = _parent.Parent; - - if (_parent != null && _parent.Type == JsonTokenType.Property) - _parent = _parent.Parent; - } - - /// - /// Writes the beginning of a Json array. - /// - public override void WriteStartArray() - { - base.WriteStartArray(); - - AddParent(new JArray()); - } - - /// - /// Writes the start of a constructor with the given name. - /// - /// The name of the constructor. - public override void WriteStartConstructor(string name) - { - base.WriteStartConstructor(name); - - AddParent(new JConstructor()); - } - - /// - /// Writes the end. - /// - /// The token. - protected override void WriteEnd(JsonToken token) - { - RemoveParent(); - } - - /// - /// Writes the property name of a name/value pair on a Json object. - /// - /// The name of the property. - public override void WritePropertyName(string name) - { - base.WritePropertyName(name); - - AddParent(new JProperty(name)); - } - - private void AddValue(object value, JsonToken token) - { - _parent.Add(new JValue(value)); - - if (_parent.Type == JsonTokenType.Property) - _parent = _parent.Parent; - } - - #region WriteValue methods - /// - /// Writes a null value. - /// - public override void WriteNull() - { - base.WriteNull(); - AddValue(null, JsonToken.Null); - } - - /// - /// Writes an undefined value. - /// - public override void WriteUndefined() - { - base.WriteUndefined(); - AddValue(null, JsonToken.Undefined); - } - - /// - /// Writes raw JavaScript manually. - /// - /// The raw JavaScript to write. - public override void WriteRaw(string javaScript) - { - base.WriteRaw(javaScript); - // hack. some 'raw' or 'other' token perhaps? - AddValue(javaScript, JsonToken.Undefined); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(string value) - { - base.WriteValue(value); - AddValue(value ?? string.Empty, JsonToken.String); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(int value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(uint value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(long value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(ulong value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(float value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Float); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(double value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Float); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(bool value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Boolean); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(short value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(ushort value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(char value) - { - base.WriteValue(value); - AddValue(value.ToString(), JsonToken.String); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(byte value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(sbyte value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Integer); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(decimal value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Float); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(DateTime value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Date); - } - - /// - /// Writes a value. - /// - /// The value to write. - public override void WriteValue(DateTimeOffset value) - { - base.WriteValue(value); - AddValue(value, JsonToken.Date); - } - #endregion - } -} +using System; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + /// + public class JsonTokenWriter : JsonWriter + { + private JContainer _token; + private JContainer _parent; + + /// + /// Gets the token being writen. + /// + /// The token being writen. + public JContainer Token + { + get { return _token; } + } + + /// + /// Initializes a new instance of the class writing to the given . + /// + /// The container being written to. + public JsonTokenWriter(JContainer container) + { + ValidationUtils.ArgumentNotNull(container, "container"); + + _token = container; + _parent = container; + } + + /// + /// Initializes a new instance of the class. + /// + public JsonTokenWriter() + { + } + + /// + /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + /// + public override void Flush() + { + } + + /// + /// Closes this stream and the underlying stream. + /// + public override void Close() + { + base.Close(); + } + + /// + /// Writes the beginning of a Json object. + /// + public override void WriteStartObject() + { + base.WriteStartObject(); + + AddParent(new JObject()); + } + + private void AddParent(JContainer container) + { + if (_parent == null) + _token = container; + else + _parent.Add(container); + + _parent = container; + } + + private void RemoveParent() + { + _parent = _parent.Parent; + + if (_parent != null && _parent.Type == JsonTokenType.Property) + _parent = _parent.Parent; + } + + /// + /// Writes the beginning of a Json array. + /// + public override void WriteStartArray() + { + base.WriteStartArray(); + + AddParent(new JArray()); + } + + /// + /// Writes the start of a constructor with the given name. + /// + /// The name of the constructor. + public override void WriteStartConstructor(string name) + { + base.WriteStartConstructor(name); + + AddParent(new JConstructor()); + } + + /// + /// Writes the end. + /// + /// The token. + protected override void WriteEnd(JsonToken token) + { + RemoveParent(); + } + + /// + /// Writes the property name of a name/value pair on a Json object. + /// + /// The name of the property. + public override void WritePropertyName(string name) + { + base.WritePropertyName(name); + + AddParent(new JProperty(name)); + } + + private void AddValue(object value, JsonToken token) + { + _parent.Add(new JValue(value)); + + if (_parent.Type == JsonTokenType.Property) + _parent = _parent.Parent; + } + + #region WriteValue methods + /// + /// Writes a null value. + /// + public override void WriteNull() + { + base.WriteNull(); + AddValue(null, JsonToken.Null); + } + + /// + /// Writes an undefined value. + /// + public override void WriteUndefined() + { + base.WriteUndefined(); + AddValue(null, JsonToken.Undefined); + } + + /// + /// Writes raw JavaScript manually. + /// + /// The raw JavaScript to write. + public override void WriteRaw(string javaScript) + { + base.WriteRaw(javaScript); + // hack. some 'raw' or 'other' token perhaps? + AddValue(javaScript, JsonToken.Undefined); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(string value) + { + base.WriteValue(value); + AddValue(value ?? string.Empty, JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(int value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(uint value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(long value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(ulong value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(float value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(double value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(bool value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Boolean); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(short value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(ushort value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(char value) + { + base.WriteValue(value); + AddValue(value.ToString(), JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(byte value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(sbyte value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(decimal value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(DateTime value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Date); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(DateTimeOffset value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Date); + } + #endregion + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/LinqBridge.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/LinqBridge.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/LinqBridge.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/LinqBridge.cs index f06a904..944ce70 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/LinqBridge.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/LinqBridge.cs @@ -1,3099 +1,3099 @@ -#region License, Terms and Author(s) -// -// LINQBridge -// Copyright (c) 2007 Atif Aziz, Joseph Albahari. All rights reserved. -// -// Author(s): -// -// Atif Aziz, http://www.raboof.com -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the New BSD License, a copy of which should have -// been delivered along with this distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -#endregion - -// $Id: Enumerable.cs c08984d432b1 2012/04/17 16:05:19 azizatif $ - -namespace System.Linq -{ - #region Imports - - using System; - using System.Collections; - using System.Collections.Generic; - using System.Diagnostics; - using LinqBridge; - - #endregion - - /// - /// Provides a set of static (Shared in Visual Basic) methods for - /// querying objects that implement . - /// - - static partial class Enumerable - { - /// - /// Returns the input typed as . - /// - - public static IEnumerable AsEnumerable(this IEnumerable source) - { - return source; - } - - /// - /// Returns an empty that has the - /// specified type argument. - /// - - public static IEnumerable Empty() - { - return Sequence.Empty; - } - - /// - /// Converts the elements of an to the - /// specified type. - /// - - public static IEnumerable Cast( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return CastYield(source); - } - - private static IEnumerable CastYield( - IEnumerable source) - { - foreach (var item in source) - yield return (TResult) item; - } - - /// - /// Filters the elements of an based on a specified type. - /// - - public static IEnumerable OfType( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return OfTypeYield(source); - } - - private static IEnumerable OfTypeYield( - IEnumerable source) - { - foreach (var item in source) - if (item is TResult) - yield return (TResult) item; - } - - /// - /// Generates a sequence of integral numbers within a specified range. - /// - /// The value of the first integer in the sequence. - /// The number of sequential integers to generate. - - public static IEnumerable Range(int start, int count) - { - if (count < 0) - throw new ArgumentOutOfRangeException("count", count, null); - - var end = (long) start + count; - if (end - 1 >= int.MaxValue) - throw new ArgumentOutOfRangeException("count", count, null); - - return RangeYield(start, end); - } - - private static IEnumerable RangeYield(int start, long end) - { - for (var i = start; i < end; i++) - yield return i; - } - - /// - /// Generates a sequence that contains one repeated value. - /// - - public static IEnumerable Repeat(TResult element, int count) - { - if (count < 0) throw new ArgumentOutOfRangeException("count", count, null); - - return RepeatYield(element, count); - } - - private static IEnumerable RepeatYield(TResult element, int count) - { - for (var i = 0; i < count; i++) - yield return element; - } - - /// - /// Filters a sequence of values based on a predicate. - /// - - public static IEnumerable Where( - this IEnumerable source, - Func predicate) - { - if (predicate == null) throw new ArgumentNullException("predicate"); - - return source.Where((item, i) => predicate(item)); - } - - /// - /// Filters a sequence of values based on a predicate. - /// Each element's index is used in the logic of the predicate function. - /// - - public static IEnumerable Where( - this IEnumerable source, - Func predicate) - { - if (source == null) throw new ArgumentNullException("source"); - if (predicate == null) throw new ArgumentNullException("predicate"); - - return WhereYield(source, predicate); - } - - private static IEnumerable WhereYield( - IEnumerable source, - Func predicate) - { - var i = 0; - foreach (var item in source) - if (predicate(item, i++)) - yield return item; - } - - /// - /// Projects each element of a sequence into a new form. - /// - - public static IEnumerable Select( - this IEnumerable source, - Func selector) - { - if (selector == null) throw new ArgumentNullException("selector"); - - return source.Select((item, i) => selector(item)); - } - - /// - /// Projects each element of a sequence into a new form by - /// incorporating the element's index. - /// - - public static IEnumerable Select( - this IEnumerable source, - Func selector) - { - if (source == null) throw new ArgumentNullException("source"); - if (selector == null) throw new ArgumentNullException("selector"); - - return SelectYield(source, selector); - } - - private static IEnumerable SelectYield( - IEnumerable source, - Func selector) - { - var i = 0; - foreach (var item in source) - yield return selector(item, i++); - } - - /// - /// Projects each element of a sequence to an - /// and flattens the resulting sequences into one sequence. - /// - - public static IEnumerable SelectMany( - this IEnumerable source, - Func> selector) - { - if (selector == null) throw new ArgumentNullException("selector"); - - return source.SelectMany((item, i) => selector(item)); - } - - /// - /// Projects each element of a sequence to an , - /// and flattens the resulting sequences into one sequence. The - /// index of each source element is used in the projected form of - /// that element. - /// - - public static IEnumerable SelectMany( - this IEnumerable source, - Func> selector) - { - if (selector == null) throw new ArgumentNullException("selector"); - - return source.SelectMany(selector, (item, subitem) => subitem); - } - - /// - /// Projects each element of a sequence to an , - /// flattens the resulting sequences into one sequence, and invokes - /// a result selector function on each element therein. - /// - - public static IEnumerable SelectMany( - this IEnumerable source, - Func> collectionSelector, - Func resultSelector) - { - if (collectionSelector == null) throw new ArgumentNullException("collectionSelector"); - - return source.SelectMany((item, i) => collectionSelector(item), resultSelector); - } - - /// - /// Projects each element of a sequence to an , - /// flattens the resulting sequences into one sequence, and invokes - /// a result selector function on each element therein. The index of - /// each source element is used in the intermediate projected form - /// of that element. - /// - - public static IEnumerable SelectMany( - this IEnumerable source, - Func> collectionSelector, - Func resultSelector) - { - if (source == null) throw new ArgumentNullException("source"); - if (collectionSelector == null) throw new ArgumentNullException("collectionSelector"); - if (resultSelector == null) throw new ArgumentNullException("resultSelector"); - - return SelectManyYield(source, collectionSelector, resultSelector); - } - - private static IEnumerable SelectManyYield( - this IEnumerable source, - Func> collectionSelector, - Func resultSelector) - { - var i = 0; - foreach (var item in source) - foreach (var subitem in collectionSelector(item, i++)) - yield return resultSelector(item, subitem); - } - - /// - /// Returns elements from a sequence as long as a specified condition is true. - /// - - public static IEnumerable TakeWhile( - this IEnumerable source, - Func predicate) - { - if (predicate == null) throw new ArgumentNullException("predicate"); - - return source.TakeWhile((item, i) => predicate(item)); - } - - /// - /// Returns elements from a sequence as long as a specified condition is true. - /// The element's index is used in the logic of the predicate function. - /// - - public static IEnumerable TakeWhile( - this IEnumerable source, - Func predicate) - { - if (source == null) throw new ArgumentNullException("source"); - if (predicate == null) throw new ArgumentNullException("predicate"); - - return TakeWhileYield(source, predicate); - } - - private static IEnumerable TakeWhileYield( - this IEnumerable source, - Func predicate) - { - var i = 0; - foreach (var item in source) - if (predicate(item, i++)) - yield return item; - else - break; - } - - /// - /// Returns a specified number of contiguous elements from the start - /// of a sequence. - /// - - public static IEnumerable Take( - this IEnumerable source, - int count) - { - return source.TakeWhile((item, i) => i < count); - } - - private static class Futures - { - public static readonly Func Default = () => default(T); - public static readonly Func Undefined = () => { throw new InvalidOperationException(); }; - } - - /// - /// Base implementation of First operator. - /// - - private static TSource FirstImpl( - this IEnumerable source, - Func empty) - { - if (source == null) throw new ArgumentNullException("source"); - Debug.Assert(empty != null); - - var list = source as IList; // optimized case for lists - if (list != null) - return list.Count > 0 ? list[0] : empty(); - - using (var e = source.GetEnumerator()) // fallback for enumeration - return e.MoveNext() ? e.Current : empty(); - } - - /// - /// Returns the first element of a sequence. - /// - - public static TSource First( - this IEnumerable source) - { - return source.FirstImpl(Futures.Undefined); - } - - /// - /// Returns the first element in a sequence that satisfies a specified condition. - /// - - public static TSource First( - this IEnumerable source, - Func predicate) - { - return First(source.Where(predicate)); - } - - /// - /// Returns the first element of a sequence, or a default value if - /// the sequence contains no elements. - /// - - public static TSource FirstOrDefault( - this IEnumerable source) - { - return source.FirstImpl(Futures.Default); - } - - /// - /// Returns the first element of the sequence that satisfies a - /// condition or a default value if no such element is found. - /// - - public static TSource FirstOrDefault( - this IEnumerable source, - Func predicate) - { - return FirstOrDefault(source.Where(predicate)); - } - - /// - /// Base implementation of Last operator. - /// - - private static TSource LastImpl( - this IEnumerable source, - Func empty) - { - if (source == null) throw new ArgumentNullException("source"); - - var list = source as IList; // optimized case for lists - if (list != null) - return list.Count > 0 ? list[list.Count - 1] : empty(); - - using (var e = source.GetEnumerator()) - { - if (!e.MoveNext()) - return empty(); - - var last = e.Current; - while (e.MoveNext()) - last = e.Current; - - return last; - } - } - - /// - /// Returns the last element of a sequence. - /// - public static TSource Last( - this IEnumerable source) - { - return source.LastImpl(Futures.Undefined); - } - - /// - /// Returns the last element of a sequence that satisfies a - /// specified condition. - /// - - public static TSource Last( - this IEnumerable source, - Func predicate) - { - return Last(source.Where(predicate)); - } - - /// - /// Returns the last element of a sequence, or a default value if - /// the sequence contains no elements. - /// - - public static TSource LastOrDefault( - this IEnumerable source) - { - return source.LastImpl(Futures.Default); - } - - /// - /// Returns the last element of a sequence that satisfies a - /// condition or a default value if no such element is found. - /// - - public static TSource LastOrDefault( - this IEnumerable source, - Func predicate) - { - return LastOrDefault(source.Where(predicate)); - } - - /// - /// Base implementation of Single operator. - /// - - private static TSource SingleImpl( - this IEnumerable source, - Func empty) - { - if (source == null) throw new ArgumentNullException("source"); - - using (var e = source.GetEnumerator()) - { - if (e.MoveNext()) - { - var single = e.Current; - if (!e.MoveNext()) - return single; - - throw new InvalidOperationException(); - } - - return empty(); - } - } - - /// - /// Returns the only element of a sequence, and throws an exception - /// if there is not exactly one element in the sequence. - /// - - public static TSource Single( - this IEnumerable source) - { - return source.SingleImpl(Futures.Undefined); - } - - /// - /// Returns the only element of a sequence that satisfies a - /// specified condition, and throws an exception if more than one - /// such element exists. - /// - - public static TSource Single( - this IEnumerable source, - Func predicate) - { - return Single(source.Where(predicate)); - } - - /// - /// Returns the only element of a sequence, or a default value if - /// the sequence is empty; this method throws an exception if there - /// is more than one element in the sequence. - /// - - public static TSource SingleOrDefault( - this IEnumerable source) - { - return source.SingleImpl(Futures.Default); - } - - /// - /// Returns the only element of a sequence that satisfies a - /// specified condition or a default value if no such element - /// exists; this method throws an exception if more than one element - /// satisfies the condition. - /// - - public static TSource SingleOrDefault( - this IEnumerable source, - Func predicate) - { - return SingleOrDefault(source.Where(predicate)); - } - - /// - /// Returns the element at a specified index in a sequence. - /// - - public static TSource ElementAt( - this IEnumerable source, - int index) - { - if (source == null) throw new ArgumentNullException("source"); - - if (index < 0) - throw new ArgumentOutOfRangeException("index", index, null); - - var list = source as IList; - if (list != null) - return list[index]; - - try - { - return source.SkipWhile((item, i) => i < index).First(); - } - catch (InvalidOperationException) // if thrown by First - { - throw new ArgumentOutOfRangeException("index", index, null); - } - } - - /// - /// Returns the element at a specified index in a sequence or a - /// default value if the index is out of range. - /// - - public static TSource ElementAtOrDefault( - this IEnumerable source, - int index) - { - if (source == null) throw new ArgumentNullException("source"); - - if (index < 0) - return default(TSource); - - var list = source as IList; - if (list != null) - return index < list.Count ? list[index] : default(TSource); - - return source.SkipWhile((item, i) => i < index).FirstOrDefault(); - } - - /// - /// Inverts the order of the elements in a sequence. - /// - - public static IEnumerable Reverse( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return ReverseYield(source); - } - - private static IEnumerable ReverseYield(IEnumerable source) - { - var stack = new Stack(); - foreach (var item in source) - stack.Push(item); - - foreach (var item in stack) - yield return item; - } - - /// - /// Bypasses elements in a sequence as long as a specified condition - /// is true and then returns the remaining elements. - /// - - public static IEnumerable SkipWhile( - this IEnumerable source, - Func predicate) - { - if (predicate == null) throw new ArgumentNullException("predicate"); - - return source.SkipWhile((item, i) => predicate(item)); - } - - /// - /// Bypasses elements in a sequence as long as a specified condition - /// is true and then returns the remaining elements. The element's - /// index is used in the logic of the predicate function. - /// - - public static IEnumerable SkipWhile( - this IEnumerable source, - Func predicate) - { - if (source == null) throw new ArgumentNullException("source"); - if (predicate == null) throw new ArgumentNullException("predicate"); - - return SkipWhileYield(source, predicate); - } - - private static IEnumerable SkipWhileYield( - IEnumerable source, - Func predicate) - { - using (var e = source.GetEnumerator()) - { - for (var i = 0; ; i++) - { - if (!e.MoveNext()) - yield break; - - if (!predicate(e.Current, i)) - break; - } - - do { yield return e.Current; } while (e.MoveNext()); - } - } - - /// - /// Bypasses a specified number of elements in a sequence and then - /// returns the remaining elements. - /// - - public static IEnumerable Skip( - this IEnumerable source, - int count) - { - return source.SkipWhile((item, i) => i < count); - } - - /// - /// Returns the number of elements in a sequence. - /// - - public static int Count( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - var collection = source as ICollection; - return collection != null - ? collection.Count - : source.Aggregate(0, (count, item) => checked(count + 1)); - } - - /// - /// Returns a number that represents how many elements in the - /// specified sequence satisfy a condition. - /// - - public static int Count( - this IEnumerable source, - Func predicate) - { - return Count(source.Where(predicate)); - } - - /// - /// Returns an that represents the total number - /// of elements in a sequence. - /// - - public static long LongCount( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - var array = source as Array; - return array != null - ? array.LongLength - : source.Aggregate(0L, (count, item) => count + 1); - } - - /// - /// Returns an that represents how many elements - /// in a sequence satisfy a condition. - /// - - public static long LongCount( - this IEnumerable source, - Func predicate) - { - return LongCount(source.Where(predicate)); - } - - /// - /// Concatenates two sequences. - /// - - public static IEnumerable Concat( - this IEnumerable first, - IEnumerable second) - { - if (first == null) throw new ArgumentNullException("first"); - if (second == null) throw new ArgumentNullException("second"); - - return ConcatYield(first, second); - } - - private static IEnumerable ConcatYield( - IEnumerable first, - IEnumerable second) - { - foreach (var item in first) - yield return item; - - foreach (var item in second) - yield return item; - } - - /// - /// Creates a from an . - /// - - public static List ToList( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return new List(source); - } - - /// - /// Creates an array from an . - /// - - public static TSource[] ToArray( - this IEnumerable source) - { - return source.ToList().ToArray(); - } - - /// - /// Returns distinct elements from a sequence by using the default - /// equality comparer to compare values. - /// - - public static IEnumerable Distinct( - this IEnumerable source) - { - return Distinct(source, /* comparer */ null); - } - - /// - /// Returns distinct elements from a sequence by using a specified - /// to compare values. - /// - - public static IEnumerable Distinct( - this IEnumerable source, - IEqualityComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - - return DistinctYield(source, comparer); - } - - private static IEnumerable DistinctYield( - IEnumerable source, - IEqualityComparer comparer) - { - var set = new Dictionary(comparer); - var gotNull = false; - - foreach (var item in source) - { - if (item == null) - { - if (gotNull) - continue; - gotNull = true; - } - else - { - if (set.ContainsKey(item)) - continue; - set.Add(item, null); - } - - yield return item; - } - } - - /// - /// Creates a from an - /// according to a specified key - /// selector function. - /// - - public static ILookup ToLookup( - this IEnumerable source, - Func keySelector) - { - return ToLookup(source, keySelector, e => e, /* comparer */ null); - } - - /// - /// Creates a from an - /// according to a specified key - /// selector function and a key comparer. - /// - - public static ILookup ToLookup( - this IEnumerable source, - Func keySelector, - IEqualityComparer comparer) - { - return ToLookup(source, keySelector, e => e, comparer); - } - - /// - /// Creates a from an - /// according to specified key - /// and element selector functions. - /// - - public static ILookup ToLookup( - this IEnumerable source, - Func keySelector, - Func elementSelector) - { - return ToLookup(source, keySelector, elementSelector, /* comparer */ null); - } - - /// - /// Creates a from an - /// according to a specified key - /// selector function, a comparer and an element selector function. - /// - - public static ILookup ToLookup( - this IEnumerable source, - Func keySelector, - Func elementSelector, - IEqualityComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - if (keySelector == null) throw new ArgumentNullException("keySelector"); - if (elementSelector == null) throw new ArgumentNullException("elementSelector"); - - var lookup = new Lookup(comparer); - - foreach (var item in source) - { - var key = keySelector(item); - - var grouping = (Grouping) lookup.Find(key); - if (grouping == null) - { - grouping = new Grouping(key); - lookup.Add(grouping); - } - - grouping.Add(elementSelector(item)); - } - - return lookup; - } - - /// - /// Groups the elements of a sequence according to a specified key - /// selector function. - /// - - public static IEnumerable> GroupBy( - this IEnumerable source, - Func keySelector) - { - return GroupBy(source, keySelector, /* comparer */ null); - } - - /// - /// Groups the elements of a sequence according to a specified key - /// selector function and compares the keys by using a specified - /// comparer. - /// - - public static IEnumerable> GroupBy( - this IEnumerable source, - Func keySelector, - IEqualityComparer comparer) - { - return GroupBy(source, keySelector, e => e, comparer); - } - - /// - /// Groups the elements of a sequence according to a specified key - /// selector function and projects the elements for each group by - /// using a specified function. - /// - - public static IEnumerable> GroupBy( - this IEnumerable source, - Func keySelector, - Func elementSelector) - { - return GroupBy(source, keySelector, elementSelector, /* comparer */ null); - } - - /// - /// Groups the elements of a sequence according to a specified key - /// selector function and creates a result value from each group and - /// its key. - /// - - public static IEnumerable> GroupBy( - this IEnumerable source, - Func keySelector, - Func elementSelector, - IEqualityComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - if (keySelector == null) throw new ArgumentNullException("keySelector"); - if (elementSelector == null) throw new ArgumentNullException("elementSelector"); - - return ToLookup(source, keySelector, elementSelector, comparer); - } - - /// - /// Groups the elements of a sequence according to a key selector - /// function. The keys are compared by using a comparer and each - /// group's elements are projected by using a specified function. - /// - - public static IEnumerable GroupBy( - this IEnumerable source, - Func keySelector, - Func, TResult> resultSelector) - { - return GroupBy(source, keySelector, resultSelector, /* comparer */ null); - } - - /// - /// Groups the elements of a sequence according to a specified key - /// selector function and creates a result value from each group and - /// its key. The elements of each group are projected by using a - /// specified function. - /// - - public static IEnumerable GroupBy( - this IEnumerable source, - Func keySelector, - Func, TResult> resultSelector, - IEqualityComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - if (keySelector == null) throw new ArgumentNullException("keySelector"); - if (resultSelector == null) throw new ArgumentNullException("resultSelector"); - - return ToLookup(source, keySelector, comparer).Select(g => resultSelector(g.Key, g)); - } - - /// - /// Groups the elements of a sequence according to a specified key - /// selector function and creates a result value from each group and - /// its key. The keys are compared by using a specified comparer. - /// - - public static IEnumerable GroupBy( - this IEnumerable source, - Func keySelector, - Func elementSelector, - Func, TResult> resultSelector) - { - return GroupBy(source, keySelector, elementSelector, resultSelector, /* comparer */ null); - } - - /// - /// Groups the elements of a sequence according to a specified key - /// selector function and creates a result value from each group and - /// its key. Key values are compared by using a specified comparer, - /// and the elements of each group are projected by using a - /// specified function. - /// - - public static IEnumerable GroupBy( - this IEnumerable source, - Func keySelector, - Func elementSelector, - Func, TResult> resultSelector, - IEqualityComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - if (keySelector == null) throw new ArgumentNullException("keySelector"); - if (elementSelector == null) throw new ArgumentNullException("elementSelector"); - if (resultSelector == null) throw new ArgumentNullException("resultSelector"); - - return ToLookup(source, keySelector, elementSelector, comparer) - .Select(g => resultSelector(g.Key, g)); - } - - /// - /// Applies an accumulator function over a sequence. - /// - - public static TSource Aggregate( - this IEnumerable source, - Func func) - { - if (source == null) throw new ArgumentNullException("source"); - if (func == null) throw new ArgumentNullException("func"); - - using (var e = source.GetEnumerator()) - { - if (!e.MoveNext()) - throw new InvalidOperationException(); - - return e.Renumerable().Skip(1).Aggregate(e.Current, func); - } - } - - /// - /// Applies an accumulator function over a sequence. The specified - /// seed value is used as the initial accumulator value. - /// - - public static TAccumulate Aggregate( - this IEnumerable source, - TAccumulate seed, - Func func) - { - return Aggregate(source, seed, func, r => r); - } - - /// - /// Applies an accumulator function over a sequence. The specified - /// seed value is used as the initial accumulator value, and the - /// specified function is used to select the result value. - /// - - public static TResult Aggregate( - this IEnumerable source, - TAccumulate seed, - Func func, - Func resultSelector) - { - if (source == null) throw new ArgumentNullException("source"); - if (func == null) throw new ArgumentNullException("func"); - if (resultSelector == null) throw new ArgumentNullException("resultSelector"); - - var result = seed; - - foreach (var item in source) - result = func(result, item); - - return resultSelector(result); - } - - /// - /// Produces the set union of two sequences by using the default - /// equality comparer. - /// - - public static IEnumerable Union( - this IEnumerable first, - IEnumerable second) - { - return Union(first, second, /* comparer */ null); - } - - /// - /// Produces the set union of two sequences by using a specified - /// . - /// - - public static IEnumerable Union( - this IEnumerable first, - IEnumerable second, - IEqualityComparer comparer) - { - return first.Concat(second).Distinct(comparer); - } - - /// - /// Returns the elements of the specified sequence or the type - /// parameter's default value in a singleton collection if the - /// sequence is empty. - /// - - public static IEnumerable DefaultIfEmpty( - this IEnumerable source) - { - return source.DefaultIfEmpty(default(TSource)); - } - - /// - /// Returns the elements of the specified sequence or the specified - /// value in a singleton collection if the sequence is empty. - /// - - public static IEnumerable DefaultIfEmpty( - this IEnumerable source, - TSource defaultValue) - { - if (source == null) throw new ArgumentNullException("source"); - - return DefaultIfEmptyYield(source, defaultValue); - } - - private static IEnumerable DefaultIfEmptyYield( - IEnumerable source, - TSource defaultValue) - { - using (var e = source.GetEnumerator()) - { - if (!e.MoveNext()) - yield return defaultValue; - else - do { yield return e.Current; } while (e.MoveNext()); - } - } - - /// - /// Determines whether all elements of a sequence satisfy a condition. - /// - - public static bool All( - this IEnumerable source, - Func predicate) - { - if (source == null) throw new ArgumentNullException("source"); - if (predicate == null) throw new ArgumentNullException("predicate"); - - foreach (var item in source) - if (!predicate(item)) - return false; - - return true; - } - - /// - /// Determines whether a sequence contains any elements. - /// - - public static bool Any( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - using (var e = source.GetEnumerator()) - return e.MoveNext(); - } - - /// - /// Determines whether any element of a sequence satisfies a - /// condition. - /// - - public static bool Any( - this IEnumerable source, - Func predicate) - { - return source.Where(predicate).Any(); - } - - /// - /// Determines whether a sequence contains a specified element by - /// using the default equality comparer. - /// - - public static bool Contains( - this IEnumerable source, - TSource value) - { - return source.Contains(value, /* comparer */ null); - } - - /// - /// Determines whether a sequence contains a specified element by - /// using a specified . - /// - - public static bool Contains( - this IEnumerable source, - TSource value, - IEqualityComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - - if (comparer == null) - { - var collection = source as ICollection; - if (collection != null) - return collection.Contains(value); - } - - comparer = comparer ?? EqualityComparer.Default; - return source.Any(item => comparer.Equals(item, value)); - } - - /// - /// Determines whether two sequences are equal by comparing the - /// elements by using the default equality comparer for their type. - /// - - public static bool SequenceEqual( - this IEnumerable first, - IEnumerable second) - { - return first.SequenceEqual(second, /* comparer */ null); - } - - /// - /// Determines whether two sequences are equal by comparing their - /// elements by using a specified . - /// - - public static bool SequenceEqual( - this IEnumerable first, - IEnumerable second, - IEqualityComparer comparer) - { - if (first == null) throw new ArgumentNullException("frist"); - if (second == null) throw new ArgumentNullException("second"); - - comparer = comparer ?? EqualityComparer.Default; - - using (IEnumerator lhs = first.GetEnumerator(), - rhs = second.GetEnumerator()) - { - do - { - if (!lhs.MoveNext()) - return !rhs.MoveNext(); - - if (!rhs.MoveNext()) - return false; - } - while (comparer.Equals(lhs.Current, rhs.Current)); - } - - return false; - } - - /// - /// Base implementation for Min/Max operator. - /// - - private static TSource MinMaxImpl( - this IEnumerable source, - Func lesser) - { - if (source == null) throw new ArgumentNullException("source"); - Debug.Assert(lesser != null); - - if (typeof(TSource).IsClass) // ReSharper disable CompareNonConstrainedGenericWithNull - source = source.Where(e => e != null).DefaultIfEmpty(); // ReSharper restore CompareNonConstrainedGenericWithNull - - return source.Aggregate((a, item) => lesser(a, item) ? a : item); - } - - /// - /// Base implementation for Min/Max operator for nullable types. - /// - - private static TSource? MinMaxImpl( - this IEnumerable source, - TSource? seed, Func lesser) where TSource : struct - { - if (source == null) throw new ArgumentNullException("source"); - Debug.Assert(lesser != null); - - return source.Aggregate(seed, (a, item) => lesser(a, item) ? a : item); - // == MinMaxImpl(Repeat(null, 1).Concat(source), lesser); - } - - /// - /// Returns the minimum value in a generic sequence. - /// - - public static TSource Min( - this IEnumerable source) - { - var comparer = Comparer.Default; - return source.MinMaxImpl((x, y) => comparer.Compare(x, y) < 0); - } - - /// - /// Invokes a transform function on each element of a generic - /// sequence and returns the minimum resulting value. - /// - - public static TResult Min( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Min(); - } - - /// - /// Returns the maximum value in a generic sequence. - /// - - public static TSource Max( - this IEnumerable source) - { - var comparer = Comparer.Default; - return source.MinMaxImpl((x, y) => comparer.Compare(x, y) > 0); - } - - /// - /// Invokes a transform function on each element of a generic - /// sequence and returns the maximum resulting value. - /// - - public static TResult Max( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Max(); - } - - /// - /// Makes an enumerator seen as enumerable once more. - /// - /// - /// The supplied enumerator must have been started. The first element - /// returned is the element the enumerator was on when passed in. - /// DO NOT use this method if the caller must be a generator. It is - /// mostly safe among aggregate operations. - /// - - private static IEnumerable Renumerable(this IEnumerator e) - { - Debug.Assert(e != null); - - do { yield return e.Current; } while (e.MoveNext()); - } - - /// - /// Sorts the elements of a sequence in ascending order according to a key. - /// - - public static IOrderedEnumerable OrderBy( - this IEnumerable source, - Func keySelector) - { - return source.OrderBy(keySelector, /* comparer */ null); - } - - /// - /// Sorts the elements of a sequence in ascending order by using a - /// specified comparer. - /// - - public static IOrderedEnumerable OrderBy( - this IEnumerable source, - Func keySelector, - IComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - if (keySelector == null) throw new ArgumentNullException("keySelector"); - - return new OrderedEnumerable(source, keySelector, comparer, /* descending */ false); - } - - /// - /// Sorts the elements of a sequence in descending order according to a key. - /// - - public static IOrderedEnumerable OrderByDescending( - this IEnumerable source, - Func keySelector) - { - return source.OrderByDescending(keySelector, /* comparer */ null); - } - - /// - /// Sorts the elements of a sequence in descending order by using a - /// specified comparer. - /// - - public static IOrderedEnumerable OrderByDescending( - this IEnumerable source, - Func keySelector, - IComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - if (source == null) throw new ArgumentNullException("keySelector"); - - return new OrderedEnumerable(source, keySelector, comparer, /* descending */ true); - } - - /// - /// Performs a subsequent ordering of the elements in a sequence in - /// ascending order according to a key. - /// - - public static IOrderedEnumerable ThenBy( - this IOrderedEnumerable source, - Func keySelector) - { - return source.ThenBy(keySelector, /* comparer */ null); - } - - /// - /// Performs a subsequent ordering of the elements in a sequence in - /// ascending order by using a specified comparer. - /// - - public static IOrderedEnumerable ThenBy( - this IOrderedEnumerable source, - Func keySelector, - IComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - - return source.CreateOrderedEnumerable(keySelector, comparer, /* descending */ false); - } - - /// - /// Performs a subsequent ordering of the elements in a sequence in - /// descending order, according to a key. - /// - - public static IOrderedEnumerable ThenByDescending( - this IOrderedEnumerable source, - Func keySelector) - { - return source.ThenByDescending(keySelector, /* comparer */ null); - } - - /// - /// Performs a subsequent ordering of the elements in a sequence in - /// descending order by using a specified comparer. - /// - - public static IOrderedEnumerable ThenByDescending( - this IOrderedEnumerable source, - Func keySelector, - IComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - - return source.CreateOrderedEnumerable(keySelector, comparer, /* descending */ true); - } - - /// - /// Base implementation for Intersect and Except operators. - /// - - private static IEnumerable IntersectExceptImpl( - this IEnumerable first, - IEnumerable second, - IEqualityComparer comparer, - bool flag) - { - if (first == null) throw new ArgumentNullException("first"); - if (second == null) throw new ArgumentNullException("second"); - - var keys = new List>(); - var flags = new Dictionary, bool>(new KeyComparer(comparer)); - - foreach (var item in from item in first - select new Key(item) into item - where !flags.ContainsKey(item) - select item) - { - flags.Add(item, !flag); - keys.Add(item); - } - - foreach (var item in from item in second - select new Key(item) into item - where flags.ContainsKey(item) - select item) - { - flags[item] = flag; - } - - // - // As per docs, "the marked elements are yielded in the order in - // which they were collected. - // - - return from item in keys where flags[item] select item.Value; - } - - /// - /// Produces the set intersection of two sequences by using the - /// default equality comparer to compare values. - /// - - public static IEnumerable Intersect( - this IEnumerable first, - IEnumerable second) - { - return first.Intersect(second, /* comparer */ null); - } - - /// - /// Produces the set intersection of two sequences by using the - /// specified to compare values. - /// - - public static IEnumerable Intersect( - this IEnumerable first, - IEnumerable second, - IEqualityComparer comparer) - { - return IntersectExceptImpl(first, second, comparer, /* flag */ true); - } - - /// - /// Produces the set difference of two sequences by using the - /// default equality comparer to compare values. - /// - - public static IEnumerable Except( - this IEnumerable first, - IEnumerable second) - { - return first.Except(second, /* comparer */ null); - } - - /// - /// Produces the set difference of two sequences by using the - /// specified to compare values. - /// - - public static IEnumerable Except( - this IEnumerable first, - IEnumerable second, - IEqualityComparer comparer) - { - return IntersectExceptImpl(first, second, comparer, /* flag */ false); - } - - /// - /// Creates a from an - /// according to a specified key - /// selector function. - /// - - public static Dictionary ToDictionary( - this IEnumerable source, - Func keySelector) - { - return source.ToDictionary(keySelector, /* comparer */ null); - } - - /// - /// Creates a from an - /// according to a specified key - /// selector function and key comparer. - /// - - public static Dictionary ToDictionary( - this IEnumerable source, - Func keySelector, - IEqualityComparer comparer) - { - return source.ToDictionary(keySelector, e => e, comparer); - } - - /// - /// Creates a from an - /// according to specified key - /// selector and element selector functions. - /// - - public static Dictionary ToDictionary( - this IEnumerable source, - Func keySelector, - Func elementSelector) - { - return source.ToDictionary(keySelector, elementSelector, /* comparer */ null); - } - - /// - /// Creates a from an - /// according to a specified key - /// selector function, a comparer, and an element selector function. - /// - - public static Dictionary ToDictionary( - this IEnumerable source, - Func keySelector, - Func elementSelector, - IEqualityComparer comparer) - { - if (source == null) throw new ArgumentNullException("source"); - if (keySelector == null) throw new ArgumentNullException("keySelector"); - if (elementSelector == null) throw new ArgumentNullException("elementSelector"); - - var dict = new Dictionary(comparer); - - foreach (var item in source) - { - // - // ToDictionary is meant to throw ArgumentNullException if - // keySelector produces a key that is null and - // Argument exception if keySelector produces duplicate keys - // for two elements. Incidentally, the doucmentation for - // IDictionary.Add says that the Add method - // throws the same exceptions under the same circumstances - // so we don't need to do any additional checking or work - // here and let the Add implementation do all the heavy - // lifting. - // - - dict.Add(keySelector(item), elementSelector(item)); - } - - return dict; - } - - /// - /// Correlates the elements of two sequences based on matching keys. - /// The default equality comparer is used to compare keys. - /// - - public static IEnumerable Join( - this IEnumerable outer, - IEnumerable inner, - Func outerKeySelector, - Func innerKeySelector, - Func resultSelector) - { - return outer.Join(inner, outerKeySelector, innerKeySelector, resultSelector, /* comparer */ null); - } - - /// - /// Correlates the elements of two sequences based on matching keys. - /// The default equality comparer is used to compare keys. A - /// specified is used to compare keys. - /// - - public static IEnumerable Join( - this IEnumerable outer, - IEnumerable inner, - Func outerKeySelector, - Func innerKeySelector, - Func resultSelector, - IEqualityComparer comparer) - { - if (outer == null) throw new ArgumentNullException("outer"); - if (inner == null) throw new ArgumentNullException("inner"); - if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); - if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); - if (resultSelector == null) throw new ArgumentNullException("resultSelector"); - - var lookup = inner.ToLookup(innerKeySelector, comparer); - - return - from o in outer - from i in lookup[outerKeySelector(o)] - select resultSelector(o, i); - } - - /// - /// Correlates the elements of two sequences based on equality of - /// keys and groups the results. The default equality comparer is - /// used to compare keys. - /// - - public static IEnumerable GroupJoin( - this IEnumerable outer, - IEnumerable inner, - Func outerKeySelector, - Func innerKeySelector, - Func, TResult> resultSelector) - { - return outer.GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, /* comparer */ null); - } - - /// - /// Correlates the elements of two sequences based on equality of - /// keys and groups the results. The default equality comparer is - /// used to compare keys. A specified - /// is used to compare keys. - /// - - public static IEnumerable GroupJoin( - this IEnumerable outer, - IEnumerable inner, - Func outerKeySelector, - Func innerKeySelector, - Func, TResult> resultSelector, - IEqualityComparer comparer) - { - if (outer == null) throw new ArgumentNullException("outer"); - if (inner == null) throw new ArgumentNullException("inner"); - if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); - if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); - if (resultSelector == null) throw new ArgumentNullException("resultSelector"); - - var lookup = inner.ToLookup(innerKeySelector, comparer); - return outer.Select(o => resultSelector(o, lookup[outerKeySelector(o)])); - } - - private static class Sequence - { - public static readonly IEnumerable Empty = new T[0]; - } - - private sealed class Grouping : List, IGrouping - { - internal Grouping(K key) - { - Key = key; - } - - public K Key { get; private set; } - } - } -} - -// $Id: Enumerable.g.tt 71137f497bf2 2012/04/16 20:01:27 azizatif $ - -namespace System.Linq -{ - #region Imports - - using System; - using System.Collections.Generic; - - #endregion - - // This partial implementation was template-generated: - // Mon, 16 Apr 2012 20:05:53 GMT - - partial class Enumerable - { - /// - /// Computes the sum of a sequence of nullable values. - /// - - public static int Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - int sum = 0; - foreach (var num in source) - sum = checked(sum + num); - - return sum; - } - - /// - /// Computes the sum of a sequence of nullable - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static int Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of nullable values. - /// - - public static double Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - long sum = 0; - long count = 0; - - foreach (var num in source) - checked - { - sum += (int) num; - count++; - } - - if (count == 0) - throw new InvalidOperationException(); - - return (double) sum / count; - } - - /// - /// Computes the average of a sequence of nullable values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static double Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - - /// - /// Computes the sum of a sequence of values. - /// - - public static int? Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - int sum = 0; - foreach (var num in source) - sum = checked(sum + (num ?? 0)); - - return sum; - } - - /// - /// Computes the sum of a sequence of - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static int? Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of values. - /// - - public static double? Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - long sum = 0; - long count = 0; - - foreach (var num in source.Where(n => n != null)) - checked - { - sum += (int) num; - count++; - } - - if (count == 0) - return null; - - return (double?) sum / count; - } - - /// - /// Computes the average of a sequence of values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static double? Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - /// - /// Returns the minimum value in a sequence of nullable - /// values. - /// - - public static int? Min( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the minimum nullable value. - /// - - public static int? Min( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Min(); - } - - /// - /// Returns the maximum value in a sequence of nullable - /// values. - /// - - public static int? Max( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), - null, (max, x) => x == null || (max != null && x.Value < max.Value)); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the maximum nullable value. - /// - - public static int? Max( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Max(); - } - - /// - /// Computes the sum of a sequence of nullable values. - /// - - public static long Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - long sum = 0; - foreach (var num in source) - sum = checked(sum + num); - - return sum; - } - - /// - /// Computes the sum of a sequence of nullable - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static long Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of nullable values. - /// - - public static double Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - long sum = 0; - long count = 0; - - foreach (var num in source) - checked - { - sum += (long) num; - count++; - } - - if (count == 0) - throw new InvalidOperationException(); - - return (double) sum / count; - } - - /// - /// Computes the average of a sequence of nullable values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static double Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - - /// - /// Computes the sum of a sequence of values. - /// - - public static long? Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - long sum = 0; - foreach (var num in source) - sum = checked(sum + (num ?? 0)); - - return sum; - } - - /// - /// Computes the sum of a sequence of - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static long? Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of values. - /// - - public static double? Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - long sum = 0; - long count = 0; - - foreach (var num in source.Where(n => n != null)) - checked - { - sum += (long) num; - count++; - } - - if (count == 0) - return null; - - return (double?) sum / count; - } - - /// - /// Computes the average of a sequence of values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static double? Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - /// - /// Returns the minimum value in a sequence of nullable - /// values. - /// - - public static long? Min( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the minimum nullable value. - /// - - public static long? Min( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Min(); - } - - /// - /// Returns the maximum value in a sequence of nullable - /// values. - /// - - public static long? Max( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), - null, (max, x) => x == null || (max != null && x.Value < max.Value)); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the maximum nullable value. - /// - - public static long? Max( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Max(); - } - - /// - /// Computes the sum of a sequence of nullable values. - /// - - public static float Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - float sum = 0; - foreach (var num in source) - sum = checked(sum + num); - - return sum; - } - - /// - /// Computes the sum of a sequence of nullable - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static float Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of nullable values. - /// - - public static float Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - float sum = 0; - long count = 0; - - foreach (var num in source) - checked - { - sum += (float) num; - count++; - } - - if (count == 0) - throw new InvalidOperationException(); - - return (float) sum / count; - } - - /// - /// Computes the average of a sequence of nullable values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static float Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - - /// - /// Computes the sum of a sequence of values. - /// - - public static float? Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - float sum = 0; - foreach (var num in source) - sum = checked(sum + (num ?? 0)); - - return sum; - } - - /// - /// Computes the sum of a sequence of - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static float? Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of values. - /// - - public static float? Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - float sum = 0; - long count = 0; - - foreach (var num in source.Where(n => n != null)) - checked - { - sum += (float) num; - count++; - } - - if (count == 0) - return null; - - return (float?) sum / count; - } - - /// - /// Computes the average of a sequence of values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static float? Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - /// - /// Returns the minimum value in a sequence of nullable - /// values. - /// - - public static float? Min( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the minimum nullable value. - /// - - public static float? Min( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Min(); - } - - /// - /// Returns the maximum value in a sequence of nullable - /// values. - /// - - public static float? Max( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), - null, (max, x) => x == null || (max != null && x.Value < max.Value)); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the maximum nullable value. - /// - - public static float? Max( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Max(); - } - - /// - /// Computes the sum of a sequence of nullable values. - /// - - public static double Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - double sum = 0; - foreach (var num in source) - sum = checked(sum + num); - - return sum; - } - - /// - /// Computes the sum of a sequence of nullable - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static double Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of nullable values. - /// - - public static double Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - double sum = 0; - long count = 0; - - foreach (var num in source) - checked - { - sum += (double) num; - count++; - } - - if (count == 0) - throw new InvalidOperationException(); - - return (double) sum / count; - } - - /// - /// Computes the average of a sequence of nullable values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static double Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - - /// - /// Computes the sum of a sequence of values. - /// - - public static double? Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - double sum = 0; - foreach (var num in source) - sum = checked(sum + (num ?? 0)); - - return sum; - } - - /// - /// Computes the sum of a sequence of - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static double? Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of values. - /// - - public static double? Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - double sum = 0; - long count = 0; - - foreach (var num in source.Where(n => n != null)) - checked - { - sum += (double) num; - count++; - } - - if (count == 0) - return null; - - return (double?) sum / count; - } - - /// - /// Computes the average of a sequence of values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static double? Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - /// - /// Returns the minimum value in a sequence of nullable - /// values. - /// - - public static double? Min( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the minimum nullable value. - /// - - public static double? Min( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Min(); - } - - /// - /// Returns the maximum value in a sequence of nullable - /// values. - /// - - public static double? Max( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), - null, (max, x) => x == null || (max != null && x.Value < max.Value)); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the maximum nullable value. - /// - - public static double? Max( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Max(); - } - - /// - /// Computes the sum of a sequence of nullable values. - /// - - public static decimal Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - decimal sum = 0; - foreach (var num in source) - sum = checked(sum + num); - - return sum; - } - - /// - /// Computes the sum of a sequence of nullable - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static decimal Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of nullable values. - /// - - public static decimal Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - decimal sum = 0; - long count = 0; - - foreach (var num in source) - checked - { - sum += (decimal) num; - count++; - } - - if (count == 0) - throw new InvalidOperationException(); - - return (decimal) sum / count; - } - - /// - /// Computes the average of a sequence of nullable values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static decimal Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - - /// - /// Computes the sum of a sequence of values. - /// - - public static decimal? Sum( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - decimal sum = 0; - foreach (var num in source) - sum = checked(sum + (num ?? 0)); - - return sum; - } - - /// - /// Computes the sum of a sequence of - /// values that are obtained by invoking a transform function on - /// each element of the input sequence. - /// - - public static decimal? Sum( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Sum(); - } - - /// - /// Computes the average of a sequence of values. - /// - - public static decimal? Average( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - decimal sum = 0; - long count = 0; - - foreach (var num in source.Where(n => n != null)) - checked - { - sum += (decimal) num; - count++; - } - - if (count == 0) - return null; - - return (decimal?) sum / count; - } - - /// - /// Computes the average of a sequence of values - /// that are obtained by invoking a transform function on each - /// element of the input sequence. - /// - - public static decimal? Average( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Average(); - } - - /// - /// Returns the minimum value in a sequence of nullable - /// values. - /// - - public static decimal? Min( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the minimum nullable value. - /// - - public static decimal? Min( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Min(); - } - - /// - /// Returns the maximum value in a sequence of nullable - /// values. - /// - - public static decimal? Max( - this IEnumerable source) - { - if (source == null) throw new ArgumentNullException("source"); - - return MinMaxImpl(source.Where(x => x != null), - null, (max, x) => x == null || (max != null && x.Value < max.Value)); - } - - /// - /// Invokes a transform function on each element of a sequence and - /// returns the maximum nullable value. - /// - - public static decimal? Max( - this IEnumerable source, - Func selector) - { - return source.Select(selector).Max(); - } - } -} - -// $Id: ExtensionAttribute.cs 898b3d493ed6 2012/04/17 20:09:57 azizatif $ - -namespace System.Runtime.CompilerServices -{ - /// - /// This attribute allows us to define extension methods without - /// requiring .NET Framework 3.5. For more information, see the section, - /// Extension Methods in .NET Framework 2.0 Apps, - /// of Basic Instincts: Extension Methods - /// column in MSDN Magazine, - /// issue Nov 2007. - /// - - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] - sealed partial class ExtensionAttribute : Attribute { } -} - -// $Id: Func.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ - -namespace System -{ -#if LINQBRIDGE_LIB - public delegate TResult Func(); - public delegate TResult Func(T a); - public delegate TResult Func(T1 arg1, T2 arg2); - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3); - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4); -#else - delegate TResult Func(); - delegate TResult Func(T a); - delegate TResult Func(T1 arg1, T2 arg2); - delegate TResult Func(T1 arg1, T2 arg2, T3 arg3); - delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4); -#endif -} - -// $Id: IGrouping.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ - -namespace System.Linq -{ - #region Imports - - using System.Collections.Generic; - - #endregion - - /// - /// Represents a collection of objects that have a common key. - /// - - partial interface IGrouping : IEnumerable - { - /// - /// Gets the key of the . - /// - - TKey Key { get; } - } -} - -// $Id: ILookup.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ - -namespace System.Linq -{ - using System.Collections.Generic; - - /// - /// Defines an indexer, size property, and Boolean search method for - /// data structures that map keys to - /// sequences of values. - /// - - partial interface ILookup : IEnumerable> - { - bool Contains(TKey key); - int Count { get; } - IEnumerable this[TKey key] { get; } - } -} - -// $Id: Internal.cs 1567e00f1a20 2012/04/17 16:09:51 azizatif $ - -namespace LinqBridge -{ - #region Imports - - using System; - using System.Collections.Generic; - - #endregion - - /// - /// This type is not intended to be used directly from user code. - /// It may be removed or changed in a future version without notice. - /// - - sealed class DelegatingComparer : IComparer - { - private readonly Func _comparer; - - public DelegatingComparer(Func comparer) - { - if (comparer == null) throw new ArgumentNullException("comparer"); - _comparer = comparer; - } - - public int Compare(T x, T y) { return _comparer(x, y); } - } - - /// - /// This type is not intended to be used directly from user code. - /// It may be removed or changed in a future version without notice. - /// - - struct Key - { - public Key(T value) : this() { Value = value; } - public T Value { get; private set; } - } - - /// - /// This type is not intended to be used directly from user code. - /// It may be removed or changed in a future version without notice. - /// - - sealed class KeyComparer : IEqualityComparer> - { - private readonly IEqualityComparer _innerComparer; - - public KeyComparer(IEqualityComparer innerComparer) - { - _innerComparer = innerComparer ?? EqualityComparer.Default; - } - - public bool Equals(Key x, Key y) - { - return _innerComparer.Equals(x.Value, y.Value); - } - - public int GetHashCode(Key obj) - { - return obj.Value == null ? 0 : _innerComparer.GetHashCode(obj.Value); - } - } -} - -// $Id: IOrderedEnumerable.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ - -namespace System.Linq -{ - using System.Collections.Generic; - - /// - /// Represents a sorted sequence. - /// - - partial interface IOrderedEnumerable : IEnumerable - { - /// - /// Performs a subsequent ordering on the elements of an - /// according to a key. - /// - - IOrderedEnumerable CreateOrderedEnumerable( - Func keySelector, IComparer comparer, bool descending); - } -} - -// $Id: Lookup.cs c08984d432b1 2012/04/17 16:05:19 azizatif $ - -namespace System.Linq -{ - #region Imports - - using System; - using System.Collections; - using System.Collections.Generic; - using IEnumerable=System.Collections.IEnumerable; - using LinqBridge; - - #endregion - - /// - /// Represents a collection of keys each mapped to one or more values. - /// - - internal sealed class Lookup : ILookup - { - private readonly Dictionary, IGrouping> _map; - private readonly List> _orderedKeys; // remember order of insertion - - internal Lookup(IEqualityComparer comparer) - { - _map = new Dictionary, IGrouping>(new KeyComparer(comparer)); - _orderedKeys = new List>(); - } - - internal void Add(IGrouping item) - { - var key = new Key(item.Key); - _map.Add(key, item); - _orderedKeys.Add(key); - } - - internal IEnumerable Find(TKey key) - { - IGrouping grouping; - return _map.TryGetValue(new Key(key), out grouping) ? grouping : null; - } - - /// - /// Gets the number of key/value collection pairs in the . - /// - - public int Count - { - get { return _map.Count; } - } - - /// - /// Gets the collection of values indexed by the specified key. - /// - - public IEnumerable this[TKey key] - { - get - { - IGrouping result; - return _map.TryGetValue(new Key(key), out result) ? result : Enumerable.Empty(); - } - } - - /// - /// Determines whether a specified key is in the . - /// - - public bool Contains(TKey key) - { - return _map.ContainsKey(new Key(key)); - } - - /// - /// Applies a transform function to each key and its associated - /// values and returns the results. - /// - - public IEnumerable ApplyResultSelector( - Func, TResult> resultSelector) - { - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - foreach (var pair in _map) - yield return resultSelector(pair.Key.Value, pair.Value); - } - - /// - /// Returns a generic enumerator that iterates through the . - /// - - public IEnumerator> GetEnumerator() - { - foreach (var key in _orderedKeys) - yield return _map[key]; - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} - -// $Id: OrderedEnumerable.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ - -namespace LinqBridge -{ - #region Imports - - using System; - using System.Collections; - using System.Collections.Generic; - using System.Diagnostics; - using System.Linq; - - #endregion - - internal sealed class OrderedEnumerable : IOrderedEnumerable - { - private readonly IEnumerable _source; - private readonly Func, IComparer> _comparerComposer; - - public OrderedEnumerable(IEnumerable source, - Func keySelector, IComparer comparer, bool descending) : - this(source, (_, next) => next, keySelector, comparer, descending) {} - - private OrderedEnumerable(IEnumerable source, - Func, IComparer> parent, - Func keySelector, IComparer comparer, bool descending) - { - if (source == null) throw new ArgumentNullException("source"); - if (keySelector == null) throw new ArgumentNullException("keySelector"); - Debug.Assert(parent != null); - - _source = source; - - comparer = comparer ?? Comparer.Default; - var direction = descending ? -1 : 1; - - _comparerComposer = (items, next) => - { - Debug.Assert(items != null); - Debug.Assert(next != null); - - var keys = new K[items.Length]; - for (var i = 0; i < items.Length; i++) - keys[i] = keySelector(items[i]); - - return parent(items, new DelegatingComparer((i, j) => - { - var result = direction * comparer.Compare(keys[i], keys[j]); - return result != 0 ? result : next.Compare(i, j); - })); - }; - } - - public IOrderedEnumerable CreateOrderedEnumerable( - Func keySelector, IComparer comparer, bool descending) - { - return new OrderedEnumerable(_source, _comparerComposer, keySelector, comparer, descending); - } - - public IEnumerator GetEnumerator() - { - // - // Sort using Array.Sort but docs say that it performs an - // unstable sort. LINQ, on the other hand, says OrderBy performs - // a stable sort. Use the item position then as a tie - // breaker when all keys compare equal, thus making the sort - // stable. - // - - var items = _source.ToArray(); - var positionComparer = new DelegatingComparer((i, j) => i.CompareTo(j)); - var comparer = _comparerComposer(items, positionComparer); - var keys = new int[items.Length]; - for (var i = 0; i < keys.Length; i++) - keys[i] = i; - Array.Sort(keys, items, comparer); - return ((IEnumerable) items).GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} - -// $Id: Action.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ - -namespace System -{ -#if LINQBRIDGE_LIB - public delegate void Action(); - public delegate void Action(T1 arg1, T2 arg2); - public delegate void Action(T1 arg1, T2 arg2, T3 arg3); - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4); -#else - delegate void Action(); - delegate void Action(T1 arg1, T2 arg2); - delegate void Action(T1 arg1, T2 arg2, T3 arg3); - delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4); -#endif +#region License, Terms and Author(s) +// +// LINQBridge +// Copyright (c) 2007 Atif Aziz, Joseph Albahari. All rights reserved. +// +// Author(s): +// +// Atif Aziz, http://www.raboof.com +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the New BSD License, a copy of which should have +// been delivered along with this distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +#endregion + +// $Id: Enumerable.cs c08984d432b1 2012/04/17 16:05:19 azizatif $ + +namespace System.Linq +{ + #region Imports + + using System; + using System.Collections; + using System.Collections.Generic; + using System.Diagnostics; + using LinqBridge; + + #endregion + + /// + /// Provides a set of static (Shared in Visual Basic) methods for + /// querying objects that implement . + /// + + static partial class Enumerable + { + /// + /// Returns the input typed as . + /// + + public static IEnumerable AsEnumerable(this IEnumerable source) + { + return source; + } + + /// + /// Returns an empty that has the + /// specified type argument. + /// + + public static IEnumerable Empty() + { + return Sequence.Empty; + } + + /// + /// Converts the elements of an to the + /// specified type. + /// + + public static IEnumerable Cast( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return CastYield(source); + } + + private static IEnumerable CastYield( + IEnumerable source) + { + foreach (var item in source) + yield return (TResult) item; + } + + /// + /// Filters the elements of an based on a specified type. + /// + + public static IEnumerable OfType( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return OfTypeYield(source); + } + + private static IEnumerable OfTypeYield( + IEnumerable source) + { + foreach (var item in source) + if (item is TResult) + yield return (TResult) item; + } + + /// + /// Generates a sequence of integral numbers within a specified range. + /// + /// The value of the first integer in the sequence. + /// The number of sequential integers to generate. + + public static IEnumerable Range(int start, int count) + { + if (count < 0) + throw new ArgumentOutOfRangeException("count", count, null); + + var end = (long) start + count; + if (end - 1 >= int.MaxValue) + throw new ArgumentOutOfRangeException("count", count, null); + + return RangeYield(start, end); + } + + private static IEnumerable RangeYield(int start, long end) + { + for (var i = start; i < end; i++) + yield return i; + } + + /// + /// Generates a sequence that contains one repeated value. + /// + + public static IEnumerable Repeat(TResult element, int count) + { + if (count < 0) throw new ArgumentOutOfRangeException("count", count, null); + + return RepeatYield(element, count); + } + + private static IEnumerable RepeatYield(TResult element, int count) + { + for (var i = 0; i < count; i++) + yield return element; + } + + /// + /// Filters a sequence of values based on a predicate. + /// + + public static IEnumerable Where( + this IEnumerable source, + Func predicate) + { + if (predicate == null) throw new ArgumentNullException("predicate"); + + return source.Where((item, i) => predicate(item)); + } + + /// + /// Filters a sequence of values based on a predicate. + /// Each element's index is used in the logic of the predicate function. + /// + + public static IEnumerable Where( + this IEnumerable source, + Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + return WhereYield(source, predicate); + } + + private static IEnumerable WhereYield( + IEnumerable source, + Func predicate) + { + var i = 0; + foreach (var item in source) + if (predicate(item, i++)) + yield return item; + } + + /// + /// Projects each element of a sequence into a new form. + /// + + public static IEnumerable Select( + this IEnumerable source, + Func selector) + { + if (selector == null) throw new ArgumentNullException("selector"); + + return source.Select((item, i) => selector(item)); + } + + /// + /// Projects each element of a sequence into a new form by + /// incorporating the element's index. + /// + + public static IEnumerable Select( + this IEnumerable source, + Func selector) + { + if (source == null) throw new ArgumentNullException("source"); + if (selector == null) throw new ArgumentNullException("selector"); + + return SelectYield(source, selector); + } + + private static IEnumerable SelectYield( + IEnumerable source, + Func selector) + { + var i = 0; + foreach (var item in source) + yield return selector(item, i++); + } + + /// + /// Projects each element of a sequence to an + /// and flattens the resulting sequences into one sequence. + /// + + public static IEnumerable SelectMany( + this IEnumerable source, + Func> selector) + { + if (selector == null) throw new ArgumentNullException("selector"); + + return source.SelectMany((item, i) => selector(item)); + } + + /// + /// Projects each element of a sequence to an , + /// and flattens the resulting sequences into one sequence. The + /// index of each source element is used in the projected form of + /// that element. + /// + + public static IEnumerable SelectMany( + this IEnumerable source, + Func> selector) + { + if (selector == null) throw new ArgumentNullException("selector"); + + return source.SelectMany(selector, (item, subitem) => subitem); + } + + /// + /// Projects each element of a sequence to an , + /// flattens the resulting sequences into one sequence, and invokes + /// a result selector function on each element therein. + /// + + public static IEnumerable SelectMany( + this IEnumerable source, + Func> collectionSelector, + Func resultSelector) + { + if (collectionSelector == null) throw new ArgumentNullException("collectionSelector"); + + return source.SelectMany((item, i) => collectionSelector(item), resultSelector); + } + + /// + /// Projects each element of a sequence to an , + /// flattens the resulting sequences into one sequence, and invokes + /// a result selector function on each element therein. The index of + /// each source element is used in the intermediate projected form + /// of that element. + /// + + public static IEnumerable SelectMany( + this IEnumerable source, + Func> collectionSelector, + Func resultSelector) + { + if (source == null) throw new ArgumentNullException("source"); + if (collectionSelector == null) throw new ArgumentNullException("collectionSelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + return SelectManyYield(source, collectionSelector, resultSelector); + } + + private static IEnumerable SelectManyYield( + this IEnumerable source, + Func> collectionSelector, + Func resultSelector) + { + var i = 0; + foreach (var item in source) + foreach (var subitem in collectionSelector(item, i++)) + yield return resultSelector(item, subitem); + } + + /// + /// Returns elements from a sequence as long as a specified condition is true. + /// + + public static IEnumerable TakeWhile( + this IEnumerable source, + Func predicate) + { + if (predicate == null) throw new ArgumentNullException("predicate"); + + return source.TakeWhile((item, i) => predicate(item)); + } + + /// + /// Returns elements from a sequence as long as a specified condition is true. + /// The element's index is used in the logic of the predicate function. + /// + + public static IEnumerable TakeWhile( + this IEnumerable source, + Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + return TakeWhileYield(source, predicate); + } + + private static IEnumerable TakeWhileYield( + this IEnumerable source, + Func predicate) + { + var i = 0; + foreach (var item in source) + if (predicate(item, i++)) + yield return item; + else + break; + } + + /// + /// Returns a specified number of contiguous elements from the start + /// of a sequence. + /// + + public static IEnumerable Take( + this IEnumerable source, + int count) + { + return source.TakeWhile((item, i) => i < count); + } + + private static class Futures + { + public static readonly Func Default = () => default(T); + public static readonly Func Undefined = () => { throw new InvalidOperationException(); }; + } + + /// + /// Base implementation of First operator. + /// + + private static TSource FirstImpl( + this IEnumerable source, + Func empty) + { + if (source == null) throw new ArgumentNullException("source"); + Debug.Assert(empty != null); + + var list = source as IList; // optimized case for lists + if (list != null) + return list.Count > 0 ? list[0] : empty(); + + using (var e = source.GetEnumerator()) // fallback for enumeration + return e.MoveNext() ? e.Current : empty(); + } + + /// + /// Returns the first element of a sequence. + /// + + public static TSource First( + this IEnumerable source) + { + return source.FirstImpl(Futures.Undefined); + } + + /// + /// Returns the first element in a sequence that satisfies a specified condition. + /// + + public static TSource First( + this IEnumerable source, + Func predicate) + { + return First(source.Where(predicate)); + } + + /// + /// Returns the first element of a sequence, or a default value if + /// the sequence contains no elements. + /// + + public static TSource FirstOrDefault( + this IEnumerable source) + { + return source.FirstImpl(Futures.Default); + } + + /// + /// Returns the first element of the sequence that satisfies a + /// condition or a default value if no such element is found. + /// + + public static TSource FirstOrDefault( + this IEnumerable source, + Func predicate) + { + return FirstOrDefault(source.Where(predicate)); + } + + /// + /// Base implementation of Last operator. + /// + + private static TSource LastImpl( + this IEnumerable source, + Func empty) + { + if (source == null) throw new ArgumentNullException("source"); + + var list = source as IList; // optimized case for lists + if (list != null) + return list.Count > 0 ? list[list.Count - 1] : empty(); + + using (var e = source.GetEnumerator()) + { + if (!e.MoveNext()) + return empty(); + + var last = e.Current; + while (e.MoveNext()) + last = e.Current; + + return last; + } + } + + /// + /// Returns the last element of a sequence. + /// + public static TSource Last( + this IEnumerable source) + { + return source.LastImpl(Futures.Undefined); + } + + /// + /// Returns the last element of a sequence that satisfies a + /// specified condition. + /// + + public static TSource Last( + this IEnumerable source, + Func predicate) + { + return Last(source.Where(predicate)); + } + + /// + /// Returns the last element of a sequence, or a default value if + /// the sequence contains no elements. + /// + + public static TSource LastOrDefault( + this IEnumerable source) + { + return source.LastImpl(Futures.Default); + } + + /// + /// Returns the last element of a sequence that satisfies a + /// condition or a default value if no such element is found. + /// + + public static TSource LastOrDefault( + this IEnumerable source, + Func predicate) + { + return LastOrDefault(source.Where(predicate)); + } + + /// + /// Base implementation of Single operator. + /// + + private static TSource SingleImpl( + this IEnumerable source, + Func empty) + { + if (source == null) throw new ArgumentNullException("source"); + + using (var e = source.GetEnumerator()) + { + if (e.MoveNext()) + { + var single = e.Current; + if (!e.MoveNext()) + return single; + + throw new InvalidOperationException(); + } + + return empty(); + } + } + + /// + /// Returns the only element of a sequence, and throws an exception + /// if there is not exactly one element in the sequence. + /// + + public static TSource Single( + this IEnumerable source) + { + return source.SingleImpl(Futures.Undefined); + } + + /// + /// Returns the only element of a sequence that satisfies a + /// specified condition, and throws an exception if more than one + /// such element exists. + /// + + public static TSource Single( + this IEnumerable source, + Func predicate) + { + return Single(source.Where(predicate)); + } + + /// + /// Returns the only element of a sequence, or a default value if + /// the sequence is empty; this method throws an exception if there + /// is more than one element in the sequence. + /// + + public static TSource SingleOrDefault( + this IEnumerable source) + { + return source.SingleImpl(Futures.Default); + } + + /// + /// Returns the only element of a sequence that satisfies a + /// specified condition or a default value if no such element + /// exists; this method throws an exception if more than one element + /// satisfies the condition. + /// + + public static TSource SingleOrDefault( + this IEnumerable source, + Func predicate) + { + return SingleOrDefault(source.Where(predicate)); + } + + /// + /// Returns the element at a specified index in a sequence. + /// + + public static TSource ElementAt( + this IEnumerable source, + int index) + { + if (source == null) throw new ArgumentNullException("source"); + + if (index < 0) + throw new ArgumentOutOfRangeException("index", index, null); + + var list = source as IList; + if (list != null) + return list[index]; + + try + { + return source.SkipWhile((item, i) => i < index).First(); + } + catch (InvalidOperationException) // if thrown by First + { + throw new ArgumentOutOfRangeException("index", index, null); + } + } + + /// + /// Returns the element at a specified index in a sequence or a + /// default value if the index is out of range. + /// + + public static TSource ElementAtOrDefault( + this IEnumerable source, + int index) + { + if (source == null) throw new ArgumentNullException("source"); + + if (index < 0) + return default(TSource); + + var list = source as IList; + if (list != null) + return index < list.Count ? list[index] : default(TSource); + + return source.SkipWhile((item, i) => i < index).FirstOrDefault(); + } + + /// + /// Inverts the order of the elements in a sequence. + /// + + public static IEnumerable Reverse( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return ReverseYield(source); + } + + private static IEnumerable ReverseYield(IEnumerable source) + { + var stack = new Stack(); + foreach (var item in source) + stack.Push(item); + + foreach (var item in stack) + yield return item; + } + + /// + /// Bypasses elements in a sequence as long as a specified condition + /// is true and then returns the remaining elements. + /// + + public static IEnumerable SkipWhile( + this IEnumerable source, + Func predicate) + { + if (predicate == null) throw new ArgumentNullException("predicate"); + + return source.SkipWhile((item, i) => predicate(item)); + } + + /// + /// Bypasses elements in a sequence as long as a specified condition + /// is true and then returns the remaining elements. The element's + /// index is used in the logic of the predicate function. + /// + + public static IEnumerable SkipWhile( + this IEnumerable source, + Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + return SkipWhileYield(source, predicate); + } + + private static IEnumerable SkipWhileYield( + IEnumerable source, + Func predicate) + { + using (var e = source.GetEnumerator()) + { + for (var i = 0; ; i++) + { + if (!e.MoveNext()) + yield break; + + if (!predicate(e.Current, i)) + break; + } + + do { yield return e.Current; } while (e.MoveNext()); + } + } + + /// + /// Bypasses a specified number of elements in a sequence and then + /// returns the remaining elements. + /// + + public static IEnumerable Skip( + this IEnumerable source, + int count) + { + return source.SkipWhile((item, i) => i < count); + } + + /// + /// Returns the number of elements in a sequence. + /// + + public static int Count( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + var collection = source as ICollection; + return collection != null + ? collection.Count + : source.Aggregate(0, (count, item) => checked(count + 1)); + } + + /// + /// Returns a number that represents how many elements in the + /// specified sequence satisfy a condition. + /// + + public static int Count( + this IEnumerable source, + Func predicate) + { + return Count(source.Where(predicate)); + } + + /// + /// Returns an that represents the total number + /// of elements in a sequence. + /// + + public static long LongCount( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + var array = source as Array; + return array != null + ? array.LongLength + : source.Aggregate(0L, (count, item) => count + 1); + } + + /// + /// Returns an that represents how many elements + /// in a sequence satisfy a condition. + /// + + public static long LongCount( + this IEnumerable source, + Func predicate) + { + return LongCount(source.Where(predicate)); + } + + /// + /// Concatenates two sequences. + /// + + public static IEnumerable Concat( + this IEnumerable first, + IEnumerable second) + { + if (first == null) throw new ArgumentNullException("first"); + if (second == null) throw new ArgumentNullException("second"); + + return ConcatYield(first, second); + } + + private static IEnumerable ConcatYield( + IEnumerable first, + IEnumerable second) + { + foreach (var item in first) + yield return item; + + foreach (var item in second) + yield return item; + } + + /// + /// Creates a from an . + /// + + public static List ToList( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return new List(source); + } + + /// + /// Creates an array from an . + /// + + public static TSource[] ToArray( + this IEnumerable source) + { + return source.ToList().ToArray(); + } + + /// + /// Returns distinct elements from a sequence by using the default + /// equality comparer to compare values. + /// + + public static IEnumerable Distinct( + this IEnumerable source) + { + return Distinct(source, /* comparer */ null); + } + + /// + /// Returns distinct elements from a sequence by using a specified + /// to compare values. + /// + + public static IEnumerable Distinct( + this IEnumerable source, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + return DistinctYield(source, comparer); + } + + private static IEnumerable DistinctYield( + IEnumerable source, + IEqualityComparer comparer) + { + var set = new Dictionary(comparer); + var gotNull = false; + + foreach (var item in source) + { + if (item == null) + { + if (gotNull) + continue; + gotNull = true; + } + else + { + if (set.ContainsKey(item)) + continue; + set.Add(item, null); + } + + yield return item; + } + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function. + /// + + public static ILookup ToLookup( + this IEnumerable source, + Func keySelector) + { + return ToLookup(source, keySelector, e => e, /* comparer */ null); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function and a key comparer. + /// + + public static ILookup ToLookup( + this IEnumerable source, + Func keySelector, + IEqualityComparer comparer) + { + return ToLookup(source, keySelector, e => e, comparer); + } + + /// + /// Creates a from an + /// according to specified key + /// and element selector functions. + /// + + public static ILookup ToLookup( + this IEnumerable source, + Func keySelector, + Func elementSelector) + { + return ToLookup(source, keySelector, elementSelector, /* comparer */ null); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function, a comparer and an element selector function. + /// + + public static ILookup ToLookup( + this IEnumerable source, + Func keySelector, + Func elementSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (elementSelector == null) throw new ArgumentNullException("elementSelector"); + + var lookup = new Lookup(comparer); + + foreach (var item in source) + { + var key = keySelector(item); + + var grouping = (Grouping) lookup.Find(key); + if (grouping == null) + { + grouping = new Grouping(key); + lookup.Add(grouping); + } + + grouping.Add(elementSelector(item)); + } + + return lookup; + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function. + /// + + public static IEnumerable> GroupBy( + this IEnumerable source, + Func keySelector) + { + return GroupBy(source, keySelector, /* comparer */ null); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and compares the keys by using a specified + /// comparer. + /// + + public static IEnumerable> GroupBy( + this IEnumerable source, + Func keySelector, + IEqualityComparer comparer) + { + return GroupBy(source, keySelector, e => e, comparer); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and projects the elements for each group by + /// using a specified function. + /// + + public static IEnumerable> GroupBy( + this IEnumerable source, + Func keySelector, + Func elementSelector) + { + return GroupBy(source, keySelector, elementSelector, /* comparer */ null); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and creates a result value from each group and + /// its key. + /// + + public static IEnumerable> GroupBy( + this IEnumerable source, + Func keySelector, + Func elementSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (elementSelector == null) throw new ArgumentNullException("elementSelector"); + + return ToLookup(source, keySelector, elementSelector, comparer); + } + + /// + /// Groups the elements of a sequence according to a key selector + /// function. The keys are compared by using a comparer and each + /// group's elements are projected by using a specified function. + /// + + public static IEnumerable GroupBy( + this IEnumerable source, + Func keySelector, + Func, TResult> resultSelector) + { + return GroupBy(source, keySelector, resultSelector, /* comparer */ null); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and creates a result value from each group and + /// its key. The elements of each group are projected by using a + /// specified function. + /// + + public static IEnumerable GroupBy( + this IEnumerable source, + Func keySelector, + Func, TResult> resultSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + return ToLookup(source, keySelector, comparer).Select(g => resultSelector(g.Key, g)); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and creates a result value from each group and + /// its key. The keys are compared by using a specified comparer. + /// + + public static IEnumerable GroupBy( + this IEnumerable source, + Func keySelector, + Func elementSelector, + Func, TResult> resultSelector) + { + return GroupBy(source, keySelector, elementSelector, resultSelector, /* comparer */ null); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and creates a result value from each group and + /// its key. Key values are compared by using a specified comparer, + /// and the elements of each group are projected by using a + /// specified function. + /// + + public static IEnumerable GroupBy( + this IEnumerable source, + Func keySelector, + Func elementSelector, + Func, TResult> resultSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (elementSelector == null) throw new ArgumentNullException("elementSelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + return ToLookup(source, keySelector, elementSelector, comparer) + .Select(g => resultSelector(g.Key, g)); + } + + /// + /// Applies an accumulator function over a sequence. + /// + + public static TSource Aggregate( + this IEnumerable source, + Func func) + { + if (source == null) throw new ArgumentNullException("source"); + if (func == null) throw new ArgumentNullException("func"); + + using (var e = source.GetEnumerator()) + { + if (!e.MoveNext()) + throw new InvalidOperationException(); + + return e.Renumerable().Skip(1).Aggregate(e.Current, func); + } + } + + /// + /// Applies an accumulator function over a sequence. The specified + /// seed value is used as the initial accumulator value. + /// + + public static TAccumulate Aggregate( + this IEnumerable source, + TAccumulate seed, + Func func) + { + return Aggregate(source, seed, func, r => r); + } + + /// + /// Applies an accumulator function over a sequence. The specified + /// seed value is used as the initial accumulator value, and the + /// specified function is used to select the result value. + /// + + public static TResult Aggregate( + this IEnumerable source, + TAccumulate seed, + Func func, + Func resultSelector) + { + if (source == null) throw new ArgumentNullException("source"); + if (func == null) throw new ArgumentNullException("func"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + var result = seed; + + foreach (var item in source) + result = func(result, item); + + return resultSelector(result); + } + + /// + /// Produces the set union of two sequences by using the default + /// equality comparer. + /// + + public static IEnumerable Union( + this IEnumerable first, + IEnumerable second) + { + return Union(first, second, /* comparer */ null); + } + + /// + /// Produces the set union of two sequences by using a specified + /// . + /// + + public static IEnumerable Union( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer) + { + return first.Concat(second).Distinct(comparer); + } + + /// + /// Returns the elements of the specified sequence or the type + /// parameter's default value in a singleton collection if the + /// sequence is empty. + /// + + public static IEnumerable DefaultIfEmpty( + this IEnumerable source) + { + return source.DefaultIfEmpty(default(TSource)); + } + + /// + /// Returns the elements of the specified sequence or the specified + /// value in a singleton collection if the sequence is empty. + /// + + public static IEnumerable DefaultIfEmpty( + this IEnumerable source, + TSource defaultValue) + { + if (source == null) throw new ArgumentNullException("source"); + + return DefaultIfEmptyYield(source, defaultValue); + } + + private static IEnumerable DefaultIfEmptyYield( + IEnumerable source, + TSource defaultValue) + { + using (var e = source.GetEnumerator()) + { + if (!e.MoveNext()) + yield return defaultValue; + else + do { yield return e.Current; } while (e.MoveNext()); + } + } + + /// + /// Determines whether all elements of a sequence satisfy a condition. + /// + + public static bool All( + this IEnumerable source, + Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + foreach (var item in source) + if (!predicate(item)) + return false; + + return true; + } + + /// + /// Determines whether a sequence contains any elements. + /// + + public static bool Any( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + using (var e = source.GetEnumerator()) + return e.MoveNext(); + } + + /// + /// Determines whether any element of a sequence satisfies a + /// condition. + /// + + public static bool Any( + this IEnumerable source, + Func predicate) + { + return source.Where(predicate).Any(); + } + + /// + /// Determines whether a sequence contains a specified element by + /// using the default equality comparer. + /// + + public static bool Contains( + this IEnumerable source, + TSource value) + { + return source.Contains(value, /* comparer */ null); + } + + /// + /// Determines whether a sequence contains a specified element by + /// using a specified . + /// + + public static bool Contains( + this IEnumerable source, + TSource value, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + if (comparer == null) + { + var collection = source as ICollection; + if (collection != null) + return collection.Contains(value); + } + + comparer = comparer ?? EqualityComparer.Default; + return source.Any(item => comparer.Equals(item, value)); + } + + /// + /// Determines whether two sequences are equal by comparing the + /// elements by using the default equality comparer for their type. + /// + + public static bool SequenceEqual( + this IEnumerable first, + IEnumerable second) + { + return first.SequenceEqual(second, /* comparer */ null); + } + + /// + /// Determines whether two sequences are equal by comparing their + /// elements by using a specified . + /// + + public static bool SequenceEqual( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer) + { + if (first == null) throw new ArgumentNullException("frist"); + if (second == null) throw new ArgumentNullException("second"); + + comparer = comparer ?? EqualityComparer.Default; + + using (IEnumerator lhs = first.GetEnumerator(), + rhs = second.GetEnumerator()) + { + do + { + if (!lhs.MoveNext()) + return !rhs.MoveNext(); + + if (!rhs.MoveNext()) + return false; + } + while (comparer.Equals(lhs.Current, rhs.Current)); + } + + return false; + } + + /// + /// Base implementation for Min/Max operator. + /// + + private static TSource MinMaxImpl( + this IEnumerable source, + Func lesser) + { + if (source == null) throw new ArgumentNullException("source"); + Debug.Assert(lesser != null); + + if (typeof(TSource).IsClass) // ReSharper disable CompareNonConstrainedGenericWithNull + source = source.Where(e => e != null).DefaultIfEmpty(); // ReSharper restore CompareNonConstrainedGenericWithNull + + return source.Aggregate((a, item) => lesser(a, item) ? a : item); + } + + /// + /// Base implementation for Min/Max operator for nullable types. + /// + + private static TSource? MinMaxImpl( + this IEnumerable source, + TSource? seed, Func lesser) where TSource : struct + { + if (source == null) throw new ArgumentNullException("source"); + Debug.Assert(lesser != null); + + return source.Aggregate(seed, (a, item) => lesser(a, item) ? a : item); + // == MinMaxImpl(Repeat(null, 1).Concat(source), lesser); + } + + /// + /// Returns the minimum value in a generic sequence. + /// + + public static TSource Min( + this IEnumerable source) + { + var comparer = Comparer.Default; + return source.MinMaxImpl((x, y) => comparer.Compare(x, y) < 0); + } + + /// + /// Invokes a transform function on each element of a generic + /// sequence and returns the minimum resulting value. + /// + + public static TResult Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a generic sequence. + /// + + public static TSource Max( + this IEnumerable source) + { + var comparer = Comparer.Default; + return source.MinMaxImpl((x, y) => comparer.Compare(x, y) > 0); + } + + /// + /// Invokes a transform function on each element of a generic + /// sequence and returns the maximum resulting value. + /// + + public static TResult Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Makes an enumerator seen as enumerable once more. + /// + /// + /// The supplied enumerator must have been started. The first element + /// returned is the element the enumerator was on when passed in. + /// DO NOT use this method if the caller must be a generator. It is + /// mostly safe among aggregate operations. + /// + + private static IEnumerable Renumerable(this IEnumerator e) + { + Debug.Assert(e != null); + + do { yield return e.Current; } while (e.MoveNext()); + } + + /// + /// Sorts the elements of a sequence in ascending order according to a key. + /// + + public static IOrderedEnumerable OrderBy( + this IEnumerable source, + Func keySelector) + { + return source.OrderBy(keySelector, /* comparer */ null); + } + + /// + /// Sorts the elements of a sequence in ascending order by using a + /// specified comparer. + /// + + public static IOrderedEnumerable OrderBy( + this IEnumerable source, + Func keySelector, + IComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + + return new OrderedEnumerable(source, keySelector, comparer, /* descending */ false); + } + + /// + /// Sorts the elements of a sequence in descending order according to a key. + /// + + public static IOrderedEnumerable OrderByDescending( + this IEnumerable source, + Func keySelector) + { + return source.OrderByDescending(keySelector, /* comparer */ null); + } + + /// + /// Sorts the elements of a sequence in descending order by using a + /// specified comparer. + /// + + public static IOrderedEnumerable OrderByDescending( + this IEnumerable source, + Func keySelector, + IComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (source == null) throw new ArgumentNullException("keySelector"); + + return new OrderedEnumerable(source, keySelector, comparer, /* descending */ true); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in + /// ascending order according to a key. + /// + + public static IOrderedEnumerable ThenBy( + this IOrderedEnumerable source, + Func keySelector) + { + return source.ThenBy(keySelector, /* comparer */ null); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in + /// ascending order by using a specified comparer. + /// + + public static IOrderedEnumerable ThenBy( + this IOrderedEnumerable source, + Func keySelector, + IComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + return source.CreateOrderedEnumerable(keySelector, comparer, /* descending */ false); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in + /// descending order, according to a key. + /// + + public static IOrderedEnumerable ThenByDescending( + this IOrderedEnumerable source, + Func keySelector) + { + return source.ThenByDescending(keySelector, /* comparer */ null); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in + /// descending order by using a specified comparer. + /// + + public static IOrderedEnumerable ThenByDescending( + this IOrderedEnumerable source, + Func keySelector, + IComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + return source.CreateOrderedEnumerable(keySelector, comparer, /* descending */ true); + } + + /// + /// Base implementation for Intersect and Except operators. + /// + + private static IEnumerable IntersectExceptImpl( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer, + bool flag) + { + if (first == null) throw new ArgumentNullException("first"); + if (second == null) throw new ArgumentNullException("second"); + + var keys = new List>(); + var flags = new Dictionary, bool>(new KeyComparer(comparer)); + + foreach (var item in from item in first + select new Key(item) into item + where !flags.ContainsKey(item) + select item) + { + flags.Add(item, !flag); + keys.Add(item); + } + + foreach (var item in from item in second + select new Key(item) into item + where flags.ContainsKey(item) + select item) + { + flags[item] = flag; + } + + // + // As per docs, "the marked elements are yielded in the order in + // which they were collected. + // + + return from item in keys where flags[item] select item.Value; + } + + /// + /// Produces the set intersection of two sequences by using the + /// default equality comparer to compare values. + /// + + public static IEnumerable Intersect( + this IEnumerable first, + IEnumerable second) + { + return first.Intersect(second, /* comparer */ null); + } + + /// + /// Produces the set intersection of two sequences by using the + /// specified to compare values. + /// + + public static IEnumerable Intersect( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer) + { + return IntersectExceptImpl(first, second, comparer, /* flag */ true); + } + + /// + /// Produces the set difference of two sequences by using the + /// default equality comparer to compare values. + /// + + public static IEnumerable Except( + this IEnumerable first, + IEnumerable second) + { + return first.Except(second, /* comparer */ null); + } + + /// + /// Produces the set difference of two sequences by using the + /// specified to compare values. + /// + + public static IEnumerable Except( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer) + { + return IntersectExceptImpl(first, second, comparer, /* flag */ false); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function. + /// + + public static Dictionary ToDictionary( + this IEnumerable source, + Func keySelector) + { + return source.ToDictionary(keySelector, /* comparer */ null); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function and key comparer. + /// + + public static Dictionary ToDictionary( + this IEnumerable source, + Func keySelector, + IEqualityComparer comparer) + { + return source.ToDictionary(keySelector, e => e, comparer); + } + + /// + /// Creates a from an + /// according to specified key + /// selector and element selector functions. + /// + + public static Dictionary ToDictionary( + this IEnumerable source, + Func keySelector, + Func elementSelector) + { + return source.ToDictionary(keySelector, elementSelector, /* comparer */ null); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function, a comparer, and an element selector function. + /// + + public static Dictionary ToDictionary( + this IEnumerable source, + Func keySelector, + Func elementSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (elementSelector == null) throw new ArgumentNullException("elementSelector"); + + var dict = new Dictionary(comparer); + + foreach (var item in source) + { + // + // ToDictionary is meant to throw ArgumentNullException if + // keySelector produces a key that is null and + // Argument exception if keySelector produces duplicate keys + // for two elements. Incidentally, the doucmentation for + // IDictionary.Add says that the Add method + // throws the same exceptions under the same circumstances + // so we don't need to do any additional checking or work + // here and let the Add implementation do all the heavy + // lifting. + // + + dict.Add(keySelector(item), elementSelector(item)); + } + + return dict; + } + + /// + /// Correlates the elements of two sequences based on matching keys. + /// The default equality comparer is used to compare keys. + /// + + public static IEnumerable Join( + this IEnumerable outer, + IEnumerable inner, + Func outerKeySelector, + Func innerKeySelector, + Func resultSelector) + { + return outer.Join(inner, outerKeySelector, innerKeySelector, resultSelector, /* comparer */ null); + } + + /// + /// Correlates the elements of two sequences based on matching keys. + /// The default equality comparer is used to compare keys. A + /// specified is used to compare keys. + /// + + public static IEnumerable Join( + this IEnumerable outer, + IEnumerable inner, + Func outerKeySelector, + Func innerKeySelector, + Func resultSelector, + IEqualityComparer comparer) + { + if (outer == null) throw new ArgumentNullException("outer"); + if (inner == null) throw new ArgumentNullException("inner"); + if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); + if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + var lookup = inner.ToLookup(innerKeySelector, comparer); + + return + from o in outer + from i in lookup[outerKeySelector(o)] + select resultSelector(o, i); + } + + /// + /// Correlates the elements of two sequences based on equality of + /// keys and groups the results. The default equality comparer is + /// used to compare keys. + /// + + public static IEnumerable GroupJoin( + this IEnumerable outer, + IEnumerable inner, + Func outerKeySelector, + Func innerKeySelector, + Func, TResult> resultSelector) + { + return outer.GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, /* comparer */ null); + } + + /// + /// Correlates the elements of two sequences based on equality of + /// keys and groups the results. The default equality comparer is + /// used to compare keys. A specified + /// is used to compare keys. + /// + + public static IEnumerable GroupJoin( + this IEnumerable outer, + IEnumerable inner, + Func outerKeySelector, + Func innerKeySelector, + Func, TResult> resultSelector, + IEqualityComparer comparer) + { + if (outer == null) throw new ArgumentNullException("outer"); + if (inner == null) throw new ArgumentNullException("inner"); + if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); + if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + var lookup = inner.ToLookup(innerKeySelector, comparer); + return outer.Select(o => resultSelector(o, lookup[outerKeySelector(o)])); + } + + private static class Sequence + { + public static readonly IEnumerable Empty = new T[0]; + } + + private sealed class Grouping : List, IGrouping + { + internal Grouping(K key) + { + Key = key; + } + + public K Key { get; private set; } + } + } +} + +// $Id: Enumerable.g.tt 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System.Linq +{ + #region Imports + + using System; + using System.Collections.Generic; + + #endregion + + // This partial implementation was template-generated: + // Mon, 16 Apr 2012 20:05:53 GMT + + partial class Enumerable + { + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static int Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + int sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static int Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static double Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (int) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (double) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static int? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + int sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static int? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static double? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (int) num; + count++; + } + + if (count == 0) + return null; + + return (double?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static int? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static int? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static int? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static int? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static long Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static long Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static double Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (long) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (double) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static long? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static long? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static double? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (long) num; + count++; + } + + if (count == 0) + return null; + + return (double?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static long? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static long? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static long? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static long? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static float Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + float sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static float Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static float Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + float sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (float) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (float) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static float Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static float? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + float sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static float? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static float? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + float sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (float) num; + count++; + } + + if (count == 0) + return null; + + return (float?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static float? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static float? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static float? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static float? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static float? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static double Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + double sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static double Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static double Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + double sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (double) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (double) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static double? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + double sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static double? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static double? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + double sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (double) num; + count++; + } + + if (count == 0) + return null; + + return (double?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static double? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static double? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static double? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static double? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static decimal Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + decimal sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static decimal Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static decimal Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + decimal sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (decimal) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (decimal) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static decimal Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static decimal? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + decimal sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static decimal? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static decimal? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + decimal sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (decimal) num; + count++; + } + + if (count == 0) + return null; + + return (decimal?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static decimal? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static decimal? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static decimal? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static decimal? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static decimal? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + } +} + +// $Id: ExtensionAttribute.cs 898b3d493ed6 2012/04/17 20:09:57 azizatif $ + +namespace System.Runtime.CompilerServices +{ + /// + /// This attribute allows us to define extension methods without + /// requiring .NET Framework 3.5. For more information, see the section, + /// Extension Methods in .NET Framework 2.0 Apps, + /// of Basic Instincts: Extension Methods + /// column in MSDN Magazine, + /// issue Nov 2007. + /// + + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] + sealed partial class ExtensionAttribute : Attribute { } +} + +// $Id: Func.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System +{ +#if LINQBRIDGE_LIB + public delegate TResult Func(); + public delegate TResult Func(T a); + public delegate TResult Func(T1 arg1, T2 arg2); + public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3); + public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +#else + delegate TResult Func(); + delegate TResult Func(T a); + delegate TResult Func(T1 arg1, T2 arg2); + delegate TResult Func(T1 arg1, T2 arg2, T3 arg3); + delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +#endif +} + +// $Id: IGrouping.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System.Linq +{ + #region Imports + + using System.Collections.Generic; + + #endregion + + /// + /// Represents a collection of objects that have a common key. + /// + + partial interface IGrouping : IEnumerable + { + /// + /// Gets the key of the . + /// + + TKey Key { get; } + } +} + +// $Id: ILookup.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System.Linq +{ + using System.Collections.Generic; + + /// + /// Defines an indexer, size property, and Boolean search method for + /// data structures that map keys to + /// sequences of values. + /// + + partial interface ILookup : IEnumerable> + { + bool Contains(TKey key); + int Count { get; } + IEnumerable this[TKey key] { get; } + } +} + +// $Id: Internal.cs 1567e00f1a20 2012/04/17 16:09:51 azizatif $ + +namespace LinqBridge +{ + #region Imports + + using System; + using System.Collections.Generic; + + #endregion + + /// + /// This type is not intended to be used directly from user code. + /// It may be removed or changed in a future version without notice. + /// + + sealed class DelegatingComparer : IComparer + { + private readonly Func _comparer; + + public DelegatingComparer(Func comparer) + { + if (comparer == null) throw new ArgumentNullException("comparer"); + _comparer = comparer; + } + + public int Compare(T x, T y) { return _comparer(x, y); } + } + + /// + /// This type is not intended to be used directly from user code. + /// It may be removed or changed in a future version without notice. + /// + + struct Key + { + public Key(T value) : this() { Value = value; } + public T Value { get; private set; } + } + + /// + /// This type is not intended to be used directly from user code. + /// It may be removed or changed in a future version without notice. + /// + + sealed class KeyComparer : IEqualityComparer> + { + private readonly IEqualityComparer _innerComparer; + + public KeyComparer(IEqualityComparer innerComparer) + { + _innerComparer = innerComparer ?? EqualityComparer.Default; + } + + public bool Equals(Key x, Key y) + { + return _innerComparer.Equals(x.Value, y.Value); + } + + public int GetHashCode(Key obj) + { + return obj.Value == null ? 0 : _innerComparer.GetHashCode(obj.Value); + } + } +} + +// $Id: IOrderedEnumerable.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System.Linq +{ + using System.Collections.Generic; + + /// + /// Represents a sorted sequence. + /// + + partial interface IOrderedEnumerable : IEnumerable + { + /// + /// Performs a subsequent ordering on the elements of an + /// according to a key. + /// + + IOrderedEnumerable CreateOrderedEnumerable( + Func keySelector, IComparer comparer, bool descending); + } +} + +// $Id: Lookup.cs c08984d432b1 2012/04/17 16:05:19 azizatif $ + +namespace System.Linq +{ + #region Imports + + using System; + using System.Collections; + using System.Collections.Generic; + using IEnumerable=System.Collections.IEnumerable; + using LinqBridge; + + #endregion + + /// + /// Represents a collection of keys each mapped to one or more values. + /// + + internal sealed class Lookup : ILookup + { + private readonly Dictionary, IGrouping> _map; + private readonly List> _orderedKeys; // remember order of insertion + + internal Lookup(IEqualityComparer comparer) + { + _map = new Dictionary, IGrouping>(new KeyComparer(comparer)); + _orderedKeys = new List>(); + } + + internal void Add(IGrouping item) + { + var key = new Key(item.Key); + _map.Add(key, item); + _orderedKeys.Add(key); + } + + internal IEnumerable Find(TKey key) + { + IGrouping grouping; + return _map.TryGetValue(new Key(key), out grouping) ? grouping : null; + } + + /// + /// Gets the number of key/value collection pairs in the . + /// + + public int Count + { + get { return _map.Count; } + } + + /// + /// Gets the collection of values indexed by the specified key. + /// + + public IEnumerable this[TKey key] + { + get + { + IGrouping result; + return _map.TryGetValue(new Key(key), out result) ? result : Enumerable.Empty(); + } + } + + /// + /// Determines whether a specified key is in the . + /// + + public bool Contains(TKey key) + { + return _map.ContainsKey(new Key(key)); + } + + /// + /// Applies a transform function to each key and its associated + /// values and returns the results. + /// + + public IEnumerable ApplyResultSelector( + Func, TResult> resultSelector) + { + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + foreach (var pair in _map) + yield return resultSelector(pair.Key.Value, pair.Value); + } + + /// + /// Returns a generic enumerator that iterates through the . + /// + + public IEnumerator> GetEnumerator() + { + foreach (var key in _orderedKeys) + yield return _map[key]; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} + +// $Id: OrderedEnumerable.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace LinqBridge +{ + #region Imports + + using System; + using System.Collections; + using System.Collections.Generic; + using System.Diagnostics; + using System.Linq; + + #endregion + + internal sealed class OrderedEnumerable : IOrderedEnumerable + { + private readonly IEnumerable _source; + private readonly Func, IComparer> _comparerComposer; + + public OrderedEnumerable(IEnumerable source, + Func keySelector, IComparer comparer, bool descending) : + this(source, (_, next) => next, keySelector, comparer, descending) {} + + private OrderedEnumerable(IEnumerable source, + Func, IComparer> parent, + Func keySelector, IComparer comparer, bool descending) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + Debug.Assert(parent != null); + + _source = source; + + comparer = comparer ?? Comparer.Default; + var direction = descending ? -1 : 1; + + _comparerComposer = (items, next) => + { + Debug.Assert(items != null); + Debug.Assert(next != null); + + var keys = new K[items.Length]; + for (var i = 0; i < items.Length; i++) + keys[i] = keySelector(items[i]); + + return parent(items, new DelegatingComparer((i, j) => + { + var result = direction * comparer.Compare(keys[i], keys[j]); + return result != 0 ? result : next.Compare(i, j); + })); + }; + } + + public IOrderedEnumerable CreateOrderedEnumerable( + Func keySelector, IComparer comparer, bool descending) + { + return new OrderedEnumerable(_source, _comparerComposer, keySelector, comparer, descending); + } + + public IEnumerator GetEnumerator() + { + // + // Sort using Array.Sort but docs say that it performs an + // unstable sort. LINQ, on the other hand, says OrderBy performs + // a stable sort. Use the item position then as a tie + // breaker when all keys compare equal, thus making the sort + // stable. + // + + var items = _source.ToArray(); + var positionComparer = new DelegatingComparer((i, j) => i.CompareTo(j)); + var comparer = _comparerComposer(items, positionComparer); + var keys = new int[items.Length]; + for (var i = 0; i < keys.Length; i++) + keys[i] = i; + Array.Sort(keys, items, comparer); + return ((IEnumerable) items).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} + +// $Id: Action.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System +{ +#if LINQBRIDGE_LIB + public delegate void Action(); + public delegate void Action(T1 arg1, T2 arg2); + public delegate void Action(T1 arg1, T2 arg2, T3 arg3); + public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +#else + delegate void Action(); + delegate void Action(T1 arg1, T2 arg2); + delegate void Action(T1 arg1, T2 arg2, T3 arg3); + delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +#endif } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/MemberMapping.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/MemberMapping.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/MemberMapping.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/MemberMapping.cs index 50ae699..c1cfe12 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/MemberMapping.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/MemberMapping.cs @@ -1,75 +1,75 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.Reflection; - -namespace Newtonsoft.Json -{ - internal struct MemberMapping - { - private readonly string _mappingName; - private readonly MemberInfo _member; - private readonly bool _ignored; - private readonly bool _readable; - private readonly bool _writable; - - public MemberMapping(string mappingName, MemberInfo member, bool ignored, bool readable, bool writable) - { - _mappingName = mappingName; - _member = member; - _ignored = ignored; - _readable = readable; - _writable = writable; - } - - public string MappingName - { - get { return _mappingName; } - } - - public MemberInfo Member - { - get { return _member; } - } - - public bool Ignored - { - get { return _ignored; } - } - - public bool Readable - { - get { return _readable; } - } - - public bool Writable - { - get { return _writable; } - } - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Reflection; + +namespace Newtonsoft.Json +{ + internal struct MemberMapping + { + private readonly string _mappingName; + private readonly MemberInfo _member; + private readonly bool _ignored; + private readonly bool _readable; + private readonly bool _writable; + + public MemberMapping(string mappingName, MemberInfo member, bool ignored, bool readable, bool writable) + { + _mappingName = mappingName; + _member = member; + _ignored = ignored; + _readable = readable; + _writable = writable; + } + + public string MappingName + { + get { return _mappingName; } + } + + public MemberInfo Member + { + get { return _member; } + } + + public bool Ignored + { + get { return _ignored; } + } + + public bool Readable + { + get { return _readable; } + } + + public bool Writable + { + get { return _writable; } + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/MemberMappingCollection.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/MemberMappingCollection.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/MemberMappingCollection.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/MemberMappingCollection.cs index 807fb0f..2c78cec 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/MemberMappingCollection.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/MemberMappingCollection.cs @@ -1,67 +1,67 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; -using System.Collections.ObjectModel; -using Newtonsoft.Json.Utilities; -using System.Globalization; - -namespace Newtonsoft.Json -{ - internal class MemberMappingCollection : KeyedCollection - { - protected override string GetKeyForItem(MemberMapping item) - { - return item.MappingName; - } - - public void AddMapping(MemberMapping memberMapping) - { - if (Contains(memberMapping.MappingName)) - { - // don't overwrite existing mapping with ignored mapping - if (memberMapping.Ignored) - return; - - MemberMapping existingMemberMapping = this[memberMapping.MappingName]; - - if (!existingMemberMapping.Ignored) - { - throw new JsonSerializationException( - "A member with the name '{0}' already exists on {1}. Use the JsonPropertyAttribute to specify another name.".FormatWith(CultureInfo.InvariantCulture, memberMapping.MappingName, memberMapping.Member.DeclaringType)); - } - else - { - // remove ignored mapping so it can be replaced in collection - Remove(existingMemberMapping); - } - } - - Add(memberMapping); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections.ObjectModel; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json +{ + internal class MemberMappingCollection : KeyedCollection + { + protected override string GetKeyForItem(MemberMapping item) + { + return item.MappingName; + } + + public void AddMapping(MemberMapping memberMapping) + { + if (Contains(memberMapping.MappingName)) + { + // don't overwrite existing mapping with ignored mapping + if (memberMapping.Ignored) + return; + + MemberMapping existingMemberMapping = this[memberMapping.MappingName]; + + if (!existingMemberMapping.Ignored) + { + throw new JsonSerializationException( + "A member with the name '{0}' already exists on {1}. Use the JsonPropertyAttribute to specify another name.".FormatWith(CultureInfo.InvariantCulture, memberMapping.MappingName, memberMapping.Member.DeclaringType)); + } + else + { + // remove ignored mapping so it can be replaced in collection + Remove(existingMemberMapping); + } + } + + Add(memberMapping); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/MemberSerialization.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/MemberSerialization.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/MemberSerialization.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/MemberSerialization.cs index 59bd227..86b546f 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/MemberSerialization.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/MemberSerialization.cs @@ -1,42 +1,42 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -namespace Newtonsoft.Json -{ - /// - /// Specifies the member serialization options for the . - /// - public enum MemberSerialization - { - /// - /// All members are serialized by default. Members can be excluded using the . - /// - OptOut, - /// - /// Only members must be marked with the are serialized. - /// - OptIn - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +namespace Newtonsoft.Json +{ + /// + /// Specifies the member serialization options for the . + /// + public enum MemberSerialization + { + /// + /// All members are serialized by default. Members can be excluded using the . + /// + OptOut, + /// + /// Only members must be marked with the are serialized. + /// + OptIn + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/MissingMemberHandling.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/MissingMemberHandling.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/MissingMemberHandling.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/MissingMemberHandling.cs index fe4d09b..a5a8def 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/MissingMemberHandling.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/MissingMemberHandling.cs @@ -1,46 +1,46 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Newtonsoft.Json -{ - /// - /// Specifies missing member handling options for the . - /// - public enum MissingMemberHandling - { - /// - /// Throw a when a missing member is encountered during deserialization. - /// - Error = 0, - /// - /// Ignore a missing member and do not attempt to deserialize it. - /// - Ignore = 1 - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Specifies missing member handling options for the . + /// + public enum MissingMemberHandling + { + /// + /// Throw a when a missing member is encountered during deserialization. + /// + Error = 0, + /// + /// Ignore a missing member and do not attempt to deserialize it. + /// + Ignore = 1 + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Newtonsoft.Json.csproj b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Newtonsoft.Json.csproj similarity index 98% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Newtonsoft.Json.csproj rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Newtonsoft.Json.csproj index 5a29133..950ff9b 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Newtonsoft.Json.csproj +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Newtonsoft.Json.csproj @@ -1,151 +1,151 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D} - Library - Properties - Newtonsoft.Json - Newtonsoft.Json - false - - - - - - - - - - - - - 3.5 - - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - v2.0 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Newtonsoft.Json.XML - true - -Microsoft.Design#CA1012;-Microsoft.Design#CA2210;-Microsoft.Design#CA1040;-Microsoft.Design#CA1005;-Microsoft.Design#CA1020;-Microsoft.Design#CA1021;-Microsoft.Design#CA1010;-Microsoft.Design#CA1011;-Microsoft.Design#CA1009;-Microsoft.Design#CA1050;-Microsoft.Design#CA1026;-Microsoft.Design#CA1019;-Microsoft.Design#CA1031;-Microsoft.Design#CA1047;-Microsoft.Design#CA1000;-Microsoft.Design#CA1048;-Microsoft.Design#CA1051;-Microsoft.Design#CA1002;-Microsoft.Design#CA1061;-Microsoft.Design#CA1006;-Microsoft.Design#CA1046;-Microsoft.Design#CA1045;-Microsoft.Design#CA1065;-Microsoft.Design#CA1038;-Microsoft.Design#CA1008;-Microsoft.Design#CA1028;-Microsoft.Design#CA1064;-Microsoft.Design#CA1004;-Microsoft.Design#CA1035;-Microsoft.Design#CA1063;-Microsoft.Design#CA1032;-Microsoft.Design#CA1023;-Microsoft.Design#CA1033;-Microsoft.Design#CA1039;-Microsoft.Design#CA1016;-Microsoft.Design#CA1014;-Microsoft.Design#CA1017;-Microsoft.Design#CA1018;-Microsoft.Design#CA1027;-Microsoft.Design#CA1059;-Microsoft.Design#CA1060;-Microsoft.Design#CA1034;-Microsoft.Design#CA1013;-Microsoft.Design#CA1036;-Microsoft.Design#CA1044;-Microsoft.Design#CA1041;-Microsoft.Design#CA1025;-Microsoft.Design#CA1052;-Microsoft.Design#CA1053;-Microsoft.Design#CA1057;-Microsoft.Design#CA1058;-Microsoft.Design#CA1001;-Microsoft.Design#CA1049;-Microsoft.Design#CA1054;-Microsoft.Design#CA1056;-Microsoft.Design#CA1055;-Microsoft.Design#CA1030;-Microsoft.Design#CA1003;-Microsoft.Design#CA1007;-Microsoft.Design#CA1043;-Microsoft.Design#CA1024;-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302;-Microsoft.Globalization#CA1308;-Microsoft.Globalization#CA1306;-Microsoft.Globalization#CA2101;-Microsoft.Globalization#CA1300;-Microsoft.Globalization#CA1307;-Microsoft.Globalization#CA1309;-Microsoft.Interoperability#CA1403;-Microsoft.Interoperability#CA1406;-Microsoft.Interoperability#CA1413;-Microsoft.Interoperability#CA1402;-Microsoft.Interoperability#CA1407;-Microsoft.Interoperability#CA1404;-Microsoft.Interoperability#CA1410;-Microsoft.Interoperability#CA1411;-Microsoft.Interoperability#CA1405;-Microsoft.Interoperability#CA1409;-Microsoft.Interoperability#CA1415;-Microsoft.Interoperability#CA1408;-Microsoft.Interoperability#CA1414;-Microsoft.Interoperability#CA1412;-Microsoft.Interoperability#CA1400;-Microsoft.Interoperability#CA1401;-Microsoft.Maintainability#CA1506;-Microsoft.Maintainability#CA1502;-Microsoft.Maintainability#CA1501;-Microsoft.Maintainability#CA1505;-Microsoft.Maintainability#CA1504;-Microsoft.Maintainability#CA1500;-Microsoft.Mobility#CA1600;-Microsoft.Mobility#CA1601;-Microsoft.Naming#CA1702;-Microsoft.Naming#CA1700;-Microsoft.Naming#CA1712;-Microsoft.Naming#CA1713;-Microsoft.Naming#CA1714;-Microsoft.Naming#CA1709;-Microsoft.Naming#CA1704;-Microsoft.Naming#CA1708;-Microsoft.Naming#CA1715;-Microsoft.Naming#CA1710;-Microsoft.Naming#CA1720;-Microsoft.Naming#CA1707;-Microsoft.Naming#CA1722;-Microsoft.Naming#CA1711;-Microsoft.Naming#CA1716;-Microsoft.Naming#CA1717;-Microsoft.Naming#CA1725;-Microsoft.Naming#CA1719;-Microsoft.Naming#CA1721;-Microsoft.Naming#CA1701;-Microsoft.Naming#CA1703;-Microsoft.Naming#CA1724;-Microsoft.Naming#CA1726;-Microsoft.Performance#CA1809;-Microsoft.Performance#CA1811;-Microsoft.Performance#CA1812;-Microsoft.Performance#CA1813;-Microsoft.Performance#CA1823;-Microsoft.Performance#CA1800;-Microsoft.Performance#CA1805;-Microsoft.Performance#CA1810;-Microsoft.Performance#CA1824;-Microsoft.Performance#CA1822;-Microsoft.Performance#CA1815;-Microsoft.Performance#CA1814;-Microsoft.Performance#CA1819;-Microsoft.Performance#CA1821;-Microsoft.Performance#CA1804;-Microsoft.Performance#CA1820;-Microsoft.Performance#CA1802;-Microsoft.Portability#CA1901;-Microsoft.Portability#CA1900;-Microsoft.Reliability#CA2001;-Microsoft.Reliability#CA2002;-Microsoft.Reliability#CA2003;-Microsoft.Reliability#CA2004;-Microsoft.Reliability#CA2006;-Microsoft.Security#CA2116;-Microsoft.Security#CA2117;-Microsoft.Security#CA2105;-Microsoft.Security#CA2115;-Microsoft.Security#CA2102;-Microsoft.Security#CA2104;-Microsoft.Security#CA2122;-Microsoft.Security#CA2114;-Microsoft.Security#CA2123;-Microsoft.Security#CA2111;-Microsoft.Security#CA2108;-Microsoft.Security#CA2107;-Microsoft.Security#CA2103;-Microsoft.Security#CA2118;-Microsoft.Security#CA2109;-Microsoft.Security#CA2119;-Microsoft.Security#CA2106;-Microsoft.Security#CA2112;-Microsoft.Security#CA2120;-Microsoft.Security#CA2121;-Microsoft.Security#CA2126;-Microsoft.Security#CA2124;-Microsoft.Security#CA2127;-Microsoft.Security#CA2128;-Microsoft.Security#CA2129;-Microsoft.Usage#CA2243;-Microsoft.Usage#CA2236;-Microsoft.Usage#CA1816;-Microsoft.Usage#CA2227;-Microsoft.Usage#CA2213;-Microsoft.Usage#CA2216;-Microsoft.Usage#CA2214;-Microsoft.Usage#CA2222;-Microsoft.Usage#CA1806;-Microsoft.Usage#CA2217;-Microsoft.Usage#CA2212;-Microsoft.Usage#CA2219;-Microsoft.Usage#CA2201;-Microsoft.Usage#CA2228;-Microsoft.Usage#CA2221;-Microsoft.Usage#CA2220;-Microsoft.Usage#CA2240;-Microsoft.Usage#CA2229;-Microsoft.Usage#CA2238;-Microsoft.Usage#CA2207;-Microsoft.Usage#CA2208;-Microsoft.Usage#CA2235;-Microsoft.Usage#CA2237;-Microsoft.Usage#CA2232;-Microsoft.Usage#CA2223;-Microsoft.Usage#CA2211;-Microsoft.Usage#CA2233;-Microsoft.Usage#CA2225;-Microsoft.Usage#CA2226;-Microsoft.Usage#CA2231;-Microsoft.Usage#CA2224;-Microsoft.Usage#CA2218;-Microsoft.Usage#CA2234;-Microsoft.Usage#CA2239;-Microsoft.Usage#CA2200;-Microsoft.Usage#CA1801;-Microsoft.Usage#CA2242;-Microsoft.Usage#CA2205;-Microsoft.Usage#CA2230 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Newtonsoft.Json.XML - - - - - 3.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D} + Library + Properties + Newtonsoft.Json + Newtonsoft.Json + false + + + + + + + + + + + + + 3.5 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + v2.0 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\Newtonsoft.Json.XML + true + -Microsoft.Design#CA1012;-Microsoft.Design#CA2210;-Microsoft.Design#CA1040;-Microsoft.Design#CA1005;-Microsoft.Design#CA1020;-Microsoft.Design#CA1021;-Microsoft.Design#CA1010;-Microsoft.Design#CA1011;-Microsoft.Design#CA1009;-Microsoft.Design#CA1050;-Microsoft.Design#CA1026;-Microsoft.Design#CA1019;-Microsoft.Design#CA1031;-Microsoft.Design#CA1047;-Microsoft.Design#CA1000;-Microsoft.Design#CA1048;-Microsoft.Design#CA1051;-Microsoft.Design#CA1002;-Microsoft.Design#CA1061;-Microsoft.Design#CA1006;-Microsoft.Design#CA1046;-Microsoft.Design#CA1045;-Microsoft.Design#CA1065;-Microsoft.Design#CA1038;-Microsoft.Design#CA1008;-Microsoft.Design#CA1028;-Microsoft.Design#CA1064;-Microsoft.Design#CA1004;-Microsoft.Design#CA1035;-Microsoft.Design#CA1063;-Microsoft.Design#CA1032;-Microsoft.Design#CA1023;-Microsoft.Design#CA1033;-Microsoft.Design#CA1039;-Microsoft.Design#CA1016;-Microsoft.Design#CA1014;-Microsoft.Design#CA1017;-Microsoft.Design#CA1018;-Microsoft.Design#CA1027;-Microsoft.Design#CA1059;-Microsoft.Design#CA1060;-Microsoft.Design#CA1034;-Microsoft.Design#CA1013;-Microsoft.Design#CA1036;-Microsoft.Design#CA1044;-Microsoft.Design#CA1041;-Microsoft.Design#CA1025;-Microsoft.Design#CA1052;-Microsoft.Design#CA1053;-Microsoft.Design#CA1057;-Microsoft.Design#CA1058;-Microsoft.Design#CA1001;-Microsoft.Design#CA1049;-Microsoft.Design#CA1054;-Microsoft.Design#CA1056;-Microsoft.Design#CA1055;-Microsoft.Design#CA1030;-Microsoft.Design#CA1003;-Microsoft.Design#CA1007;-Microsoft.Design#CA1043;-Microsoft.Design#CA1024;-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302;-Microsoft.Globalization#CA1308;-Microsoft.Globalization#CA1306;-Microsoft.Globalization#CA2101;-Microsoft.Globalization#CA1300;-Microsoft.Globalization#CA1307;-Microsoft.Globalization#CA1309;-Microsoft.Interoperability#CA1403;-Microsoft.Interoperability#CA1406;-Microsoft.Interoperability#CA1413;-Microsoft.Interoperability#CA1402;-Microsoft.Interoperability#CA1407;-Microsoft.Interoperability#CA1404;-Microsoft.Interoperability#CA1410;-Microsoft.Interoperability#CA1411;-Microsoft.Interoperability#CA1405;-Microsoft.Interoperability#CA1409;-Microsoft.Interoperability#CA1415;-Microsoft.Interoperability#CA1408;-Microsoft.Interoperability#CA1414;-Microsoft.Interoperability#CA1412;-Microsoft.Interoperability#CA1400;-Microsoft.Interoperability#CA1401;-Microsoft.Maintainability#CA1506;-Microsoft.Maintainability#CA1502;-Microsoft.Maintainability#CA1501;-Microsoft.Maintainability#CA1505;-Microsoft.Maintainability#CA1504;-Microsoft.Maintainability#CA1500;-Microsoft.Mobility#CA1600;-Microsoft.Mobility#CA1601;-Microsoft.Naming#CA1702;-Microsoft.Naming#CA1700;-Microsoft.Naming#CA1712;-Microsoft.Naming#CA1713;-Microsoft.Naming#CA1714;-Microsoft.Naming#CA1709;-Microsoft.Naming#CA1704;-Microsoft.Naming#CA1708;-Microsoft.Naming#CA1715;-Microsoft.Naming#CA1710;-Microsoft.Naming#CA1720;-Microsoft.Naming#CA1707;-Microsoft.Naming#CA1722;-Microsoft.Naming#CA1711;-Microsoft.Naming#CA1716;-Microsoft.Naming#CA1717;-Microsoft.Naming#CA1725;-Microsoft.Naming#CA1719;-Microsoft.Naming#CA1721;-Microsoft.Naming#CA1701;-Microsoft.Naming#CA1703;-Microsoft.Naming#CA1724;-Microsoft.Naming#CA1726;-Microsoft.Performance#CA1809;-Microsoft.Performance#CA1811;-Microsoft.Performance#CA1812;-Microsoft.Performance#CA1813;-Microsoft.Performance#CA1823;-Microsoft.Performance#CA1800;-Microsoft.Performance#CA1805;-Microsoft.Performance#CA1810;-Microsoft.Performance#CA1824;-Microsoft.Performance#CA1822;-Microsoft.Performance#CA1815;-Microsoft.Performance#CA1814;-Microsoft.Performance#CA1819;-Microsoft.Performance#CA1821;-Microsoft.Performance#CA1804;-Microsoft.Performance#CA1820;-Microsoft.Performance#CA1802;-Microsoft.Portability#CA1901;-Microsoft.Portability#CA1900;-Microsoft.Reliability#CA2001;-Microsoft.Reliability#CA2002;-Microsoft.Reliability#CA2003;-Microsoft.Reliability#CA2004;-Microsoft.Reliability#CA2006;-Microsoft.Security#CA2116;-Microsoft.Security#CA2117;-Microsoft.Security#CA2105;-Microsoft.Security#CA2115;-Microsoft.Security#CA2102;-Microsoft.Security#CA2104;-Microsoft.Security#CA2122;-Microsoft.Security#CA2114;-Microsoft.Security#CA2123;-Microsoft.Security#CA2111;-Microsoft.Security#CA2108;-Microsoft.Security#CA2107;-Microsoft.Security#CA2103;-Microsoft.Security#CA2118;-Microsoft.Security#CA2109;-Microsoft.Security#CA2119;-Microsoft.Security#CA2106;-Microsoft.Security#CA2112;-Microsoft.Security#CA2120;-Microsoft.Security#CA2121;-Microsoft.Security#CA2126;-Microsoft.Security#CA2124;-Microsoft.Security#CA2127;-Microsoft.Security#CA2128;-Microsoft.Security#CA2129;-Microsoft.Usage#CA2243;-Microsoft.Usage#CA2236;-Microsoft.Usage#CA1816;-Microsoft.Usage#CA2227;-Microsoft.Usage#CA2213;-Microsoft.Usage#CA2216;-Microsoft.Usage#CA2214;-Microsoft.Usage#CA2222;-Microsoft.Usage#CA1806;-Microsoft.Usage#CA2217;-Microsoft.Usage#CA2212;-Microsoft.Usage#CA2219;-Microsoft.Usage#CA2201;-Microsoft.Usage#CA2228;-Microsoft.Usage#CA2221;-Microsoft.Usage#CA2220;-Microsoft.Usage#CA2240;-Microsoft.Usage#CA2229;-Microsoft.Usage#CA2238;-Microsoft.Usage#CA2207;-Microsoft.Usage#CA2208;-Microsoft.Usage#CA2235;-Microsoft.Usage#CA2237;-Microsoft.Usage#CA2232;-Microsoft.Usage#CA2223;-Microsoft.Usage#CA2211;-Microsoft.Usage#CA2233;-Microsoft.Usage#CA2225;-Microsoft.Usage#CA2226;-Microsoft.Usage#CA2231;-Microsoft.Usage#CA2224;-Microsoft.Usage#CA2218;-Microsoft.Usage#CA2234;-Microsoft.Usage#CA2239;-Microsoft.Usage#CA2200;-Microsoft.Usage#CA1801;-Microsoft.Usage#CA2242;-Microsoft.Usage#CA2205;-Microsoft.Usage#CA2230 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + bin\Release\Newtonsoft.Json.XML + + + + + 3.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/NullValueHandling.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/NullValueHandling.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/NullValueHandling.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/NullValueHandling.cs index c7a9589..48f078f 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/NullValueHandling.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/NullValueHandling.cs @@ -1,42 +1,42 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -namespace Newtonsoft.Json -{ - /// - /// Specifies null value handling options for the . - /// - public enum NullValueHandling - { - /// - /// Include null values when serializing and deserializing objects. - /// - Include = 0, - /// - /// Ignore null values when serializing and deserializing objects. - /// - Ignore = 1 - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +namespace Newtonsoft.Json +{ + /// + /// Specifies null value handling options for the . + /// + public enum NullValueHandling + { + /// + /// Include null values when serializing and deserializing objects. + /// + Include = 0, + /// + /// Ignore null values when serializing and deserializing objects. + /// + Ignore = 1 + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/ObjectCreationHandling.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/ObjectCreationHandling.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/ObjectCreationHandling.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/ObjectCreationHandling.cs index 540fdc8..a3be502 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/ObjectCreationHandling.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/ObjectCreationHandling.cs @@ -1,46 +1,46 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -namespace Newtonsoft.Json -{ - /// - /// Specifies how object creation is handled by the . - /// - public enum ObjectCreationHandling - { - /// - /// Reuse existing objects, create new objects when needed. - /// - Auto = 0, - /// - /// Only reuse existing objects. - /// - Reuse = 1, - /// - /// Always create new objects. - /// - Replace = 2 - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +namespace Newtonsoft.Json +{ + /// + /// Specifies how object creation is handled by the . + /// + public enum ObjectCreationHandling + { + /// + /// Reuse existing objects, create new objects when needed. + /// + Auto = 0, + /// + /// Only reuse existing objects. + /// + Reuse = 1, + /// + /// Always create new objects. + /// + Replace = 2 + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Properties/AssemblyInfo.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Properties/AssemblyInfo.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Properties/AssemblyInfo.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Properties/AssemblyInfo.cs index 02723cb..da16764 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Properties/AssemblyInfo.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -1,58 +1,58 @@ -#region License -// Copyright 2006 James Newton-King -// http://www.newtonsoft.com -// -// This work is licensed under the Creative Commons Attribution 2.5 License -// http://creativecommons.org/licenses/by/2.5/ -// -// You are free: -// * to copy, distribute, display, and perform the work -// * to make derivative works -// * to make commercial use of the work -// -// Under the following conditions: -// * You must attribute the work in the manner specified by the author or licensor: -// - If you find this component useful a link to http://www.newtonsoft.com would be appreciated. -// * For any reuse or distribution, you must make clear to others the license terms of this work. -// * Any of these conditions can be waived if you get permission from the copyright holder. -#endregion - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security; - -// 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("Newtonsoft Json.NET")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Newtonsoft")] -[assembly: AssemblyProduct("Newtonsoft Json.NET")] -[assembly: AssemblyCopyright("Copyright © Newtonsoft 2006")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests")] -[assembly: AllowPartiallyTrustedCallers] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM componenets. 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("9ca358aa-317b-4925-8ada-4a29e943a363")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("2.0.0.0")] +#region License +// Copyright 2006 James Newton-King +// http://www.newtonsoft.com +// +// This work is licensed under the Creative Commons Attribution 2.5 License +// http://creativecommons.org/licenses/by/2.5/ +// +// You are free: +// * to copy, distribute, display, and perform the work +// * to make derivative works +// * to make commercial use of the work +// +// Under the following conditions: +// * You must attribute the work in the manner specified by the author or licensor: +// - If you find this component useful a link to http://www.newtonsoft.com would be appreciated. +// * For any reuse or distribution, you must make clear to others the license terms of this work. +// * Any of these conditions can be waived if you get permission from the copyright holder. +#endregion + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security; + +// 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("Newtonsoft Json.NET")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Newtonsoft")] +[assembly: AssemblyProduct("Newtonsoft Json.NET")] +[assembly: AssemblyCopyright("Copyright © Newtonsoft 2006")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests")] +[assembly: AllowPartiallyTrustedCallers] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM componenets. 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("9ca358aa-317b-4925-8ada-4a29e943a363")] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/ReferenceLoopHandling.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/ReferenceLoopHandling.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/ReferenceLoopHandling.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/ReferenceLoopHandling.cs index 19395f3..122efc6 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/ReferenceLoopHandling.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/ReferenceLoopHandling.cs @@ -1,50 +1,50 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Newtonsoft.Json -{ - /// - /// Specifies reference loop handling options for the . - /// - public enum ReferenceLoopHandling - { - /// - /// Throw a when a loop is encountered. - /// - Error = 0, - /// - /// Ignore loop references and do not serialize. - /// - Ignore = 1, - /// - /// Serialize loop references. - /// - Serialize = 2 - } -} +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Specifies reference loop handling options for the . + /// + public enum ReferenceLoopHandling + { + /// + /// Throw a when a loop is encountered. + /// + Error = 0, + /// + /// Ignore loop references and do not serialize. + /// + Ignore = 1, + /// + /// Serialize loop references. + /// + Serialize = 2 + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/StringBuffer.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/StringBuffer.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/StringBuffer.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/StringBuffer.cs index 083a5e9..c12415c 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/StringBuffer.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/StringBuffer.cs @@ -1,96 +1,96 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Newtonsoft.Json -{ - /// - /// Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. - /// - internal class StringBuffer - { - private char[] _buffer; - private int _position; - - private static char[] _emptyBuffer = new char[0]; - - public int Position - { - get { return _position; } - set { _position = value; } - } - - public StringBuffer() - { - _buffer = _emptyBuffer; - } - - public StringBuffer(int initalSize) - { - _buffer = new char[initalSize]; - } - - public void Append(char value) - { - // test if the buffer array is large enough to take the value - if (_position + 1 > _buffer.Length) - { - EnsureSize(1); - } - - // set value and increment poisition - _buffer[_position++] = value; - } - - public void Clear() - { - _buffer = _emptyBuffer; - _position = 0; - } - - private void EnsureSize(int appendLength) - { - char[] newBuffer = new char[_position + appendLength * 2]; - - Array.Copy(_buffer, newBuffer, _position); - - _buffer = newBuffer; - } - - public override string ToString() - { - return ToString(0, _position); - } - - public string ToString(int start, int length) - { - // TODO: validation - return new string(_buffer, start, length); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + /// + internal class StringBuffer + { + private char[] _buffer; + private int _position; + + private static char[] _emptyBuffer = new char[0]; + + public int Position + { + get { return _position; } + set { _position = value; } + } + + public StringBuffer() + { + _buffer = _emptyBuffer; + } + + public StringBuffer(int initalSize) + { + _buffer = new char[initalSize]; + } + + public void Append(char value) + { + // test if the buffer array is large enough to take the value + if (_position + 1 > _buffer.Length) + { + EnsureSize(1); + } + + // set value and increment poisition + _buffer[_position++] = value; + } + + public void Clear() + { + _buffer = _emptyBuffer; + _position = 0; + } + + private void EnsureSize(int appendLength) + { + char[] newBuffer = new char[_position + appendLength * 2]; + + Array.Copy(_buffer, newBuffer, _position); + + _buffer = newBuffer; + } + + public override string ToString() + { + return ToString(0, _position); + } + + public string ToString(int start, int length) + { + // TODO: validation + return new string(_buffer, start, length); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/CollectionUtils.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/CollectionUtils.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/CollectionUtils.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/CollectionUtils.cs index 32d558a..9d4d107 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/CollectionUtils.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/CollectionUtils.cs @@ -1,504 +1,504 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Reflection; -using System.Collections; -using System.Globalization; - -namespace Newtonsoft.Json.Utilities -{ - internal static class CollectionUtils - { - public static IEnumerable CastValid(this IEnumerable enumerable) - { - ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); - - return enumerable.Cast().Where(o => o is T).Cast(); - } - - public static List CreateList(params T[] values) - { - return new List(values); - } - - /// - /// Determines whether the collection is null or empty. - /// - /// The collection. - /// - /// true if the collection is null or empty; otherwise, false. - /// - public static bool IsNullOrEmpty(ICollection collection) - { - if (collection != null) - { - return (collection.Count == 0); - } - return true; - } - - /// - /// Determines whether the collection is null or empty. - /// - /// The collection. - /// - /// true if the collection is null or empty; otherwise, false. - /// - public static bool IsNullOrEmpty(ICollection collection) - { - if (collection != null) - { - return (collection.Count == 0); - } - return true; - } - - /// - /// Determines whether the collection is null, empty or its contents are uninitialized values. - /// - /// The list. - /// - /// true if the collection is null or empty or its contents are uninitialized values; otherwise, false. - /// - public static bool IsNullOrEmptyOrDefault(IList list) - { - if (IsNullOrEmpty(list)) - return true; - - return ReflectionUtils.ItemsUnitializedValue(list); - } - - /// - /// Makes a slice of the specified list in between the start and end indexes. - /// - /// The list. - /// The start index. - /// The end index. - /// A slice of the list. - public static IList Slice(IList list, int? start, int? end) - { - return Slice(list, start, end, null); - } - - /// - /// Makes a slice of the specified list in between the start and end indexes, - /// getting every so many items based upon the step. - /// - /// The list. - /// The start index. - /// The end index. - /// The step. - /// A slice of the list. - public static IList Slice(IList list, int? start, int? end, int? step) - { - if (list == null) - throw new ArgumentNullException("list"); - - if (step == 0) - throw new ArgumentException("Step cannot be zero.", "step"); - - List slicedList = new List(); - - // nothing to slice - if (list.Count == 0) - return slicedList; - - // set defaults for null arguments - int s = step ?? 1; - int startIndex = start ?? 0; - int endIndex = end ?? list.Count; - - // start from the end of the list if start is negitive - startIndex = (startIndex < 0) ? list.Count + startIndex : startIndex; - - // end from the start of the list if end is negitive - endIndex = (endIndex < 0) ? list.Count + endIndex : endIndex; - - // ensure indexes keep within collection bounds - startIndex = Math.Max(startIndex, 0); - endIndex = Math.Min(endIndex, list.Count - 1); - - // loop between start and end indexes, incrementing by the step - for (int i = startIndex; i < endIndex; i += s) - { - slicedList.Add(list[i]); - } - - return slicedList; - } - - - /// - /// Group the collection using a function which returns the key. - /// - /// The source collection to group. - /// The key selector. - /// A Dictionary with each key relating to a list of objects in a list grouped under it. - public static Dictionary> GroupBy(ICollection source, Func keySelector) - { - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - Dictionary> groupedValues = new Dictionary>(); - - foreach (V value in source) - { - // using delegate to get the value's key - K key = keySelector(value); - List groupedValueList; - - // add a list for grouped values if the key is not already in Dictionary - if (!groupedValues.TryGetValue(key, out groupedValueList)) - { - groupedValueList = new List(); - groupedValues.Add(key, groupedValueList); - } - - groupedValueList.Add(value); - } - - return groupedValues; - } - - /// - /// Adds the elements of the specified collection to the specified generic IList. - /// - /// The list to add to. - /// The collection of elements to add. - public static void AddRange(this IList initial, IEnumerable collection) - { - if (initial == null) - throw new ArgumentNullException("initial"); - - if (collection == null) - return; - - foreach (T value in collection) - { - initial.Add(value); - } - } - - public static void AddRange(this IList initial, IEnumerable collection) - { - ValidationUtils.ArgumentNotNull(initial, "initial"); - - ListWrapper wrapper = new ListWrapper(initial); - wrapper.AddRange(collection.Cast()); - } - - public static List Distinct(List collection) - { - List distinctList = new List(); - - foreach (T value in collection) - { - if (!distinctList.Contains(value)) - distinctList.Add(value); - } - - return distinctList; - } - - public static List> Flatten(params IList[] lists) - { - List> flattened = new List>(); - Dictionary currentList = new Dictionary(); - - Recurse(new List>(lists), 0, currentList, flattened); - - return flattened; - } - - private static void Recurse(IList> global, int current, Dictionary currentSet, List> flattenedResult) - { - IList currentArray = global[current]; - - for (int i = 0; i < currentArray.Count; i++) - { - currentSet[current] = currentArray[i]; - - if (current == global.Count - 1) - { - List items = new List(); - - for (int k = 0; k < currentSet.Count; k++) - { - items.Add(currentSet[k]); - } - - flattenedResult.Add(items); - } - else - { - Recurse(global, current + 1, currentSet, flattenedResult); - } - } - } - - public static List CreateList(ICollection collection) - { - if (collection == null) - throw new ArgumentNullException("collection"); - - T[] array = new T[collection.Count]; - collection.CopyTo(array, 0); - - return new List(array); - } - - public static bool ListEquals(IList a, IList b) - { - if (a == null || b == null) - return (a == null && b == null); - - if (a.Count != b.Count) - return false; - - EqualityComparer comparer = EqualityComparer.Default; - - for (int i = 0; i < a.Count; i++) - { - if (!comparer.Equals(a[i], b[i])) - return false; - } - - return true; - } - - #region GetSingleItem - public static bool TryGetSingleItem(IList list, out T value) - { - return TryGetSingleItem(list, false, out value); - } - - public static bool TryGetSingleItem(IList list, bool returnDefaultIfEmpty, out T value) - { - return MiscellaneousUtils.TryAction(delegate { return GetSingleItem(list, returnDefaultIfEmpty); }, out value); - } - - public static T GetSingleItem(IList list) - { - return GetSingleItem(list, false); - } - - public static T GetSingleItem(IList list, bool returnDefaultIfEmpty) - { - if (list.Count == 1) - return list[0]; - else if (returnDefaultIfEmpty && list.Count == 0) - return default(T); - else - throw new Exception("Expected single {0} in list but got {1}.".FormatWith(CultureInfo.InvariantCulture, typeof(T), list.Count)); - } - #endregion - - public static IList Minus(IList list, IList minus) - { - ValidationUtils.ArgumentNotNull(list, "list"); - - List result = new List(list.Count); - foreach (T t in list) - { - if (minus == null || !minus.Contains(t)) - result.Add(t); - } - - return result; - } - - public static T[] CreateArray(IEnumerable enumerable) - { - ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); - - if (enumerable is T[]) - return (T[])enumerable; - - List tempList = new List(enumerable); - return tempList.ToArray(); - } - - public static IList CreateGenericList(Type listType) - { - ValidationUtils.ArgumentNotNull(listType, "listType"); - - return (IList)ReflectionUtils.CreateGeneric(typeof(List<>), listType); - } - - public static bool IsListType(Type type) - { - ValidationUtils.ArgumentNotNull(type, "listType"); - - if (type.IsArray) - return true; - else if (typeof(IList).IsAssignableFrom(type)) - return true; - else if (ReflectionUtils.IsSubClass(type, typeof(IList<>))) - return true; - else - return false; - } - - public static IWrappedList CreateListWrapper(object list) - { - ValidationUtils.ArgumentNotNull(list, "list"); - - Type listDefinition; - if (ReflectionUtils.IsSubClass(list.GetType(), typeof(IList<>), out listDefinition)) - { - Type listItemType = ReflectionUtils.GetListItemType(listDefinition); - - // Activator.CreateInstance throws AmbiguousMatchException. Manually invoke constructor - Func, object> instanceCreator = (t, a) => - { - ConstructorInfo c = t.GetConstructor(new[] {listDefinition}); - return c.Invoke(new[] { list }); - }; - - return (IWrappedList)ReflectionUtils.CreateGeneric(typeof(ListWrapper<>), new[] { listItemType }, instanceCreator, list); - } - else if (list is IList) - { - return new ListWrapper((IList)list); - } - else - { - throw new Exception("Can not create ListWrapper for type {0}.".FormatWith(CultureInfo.InvariantCulture, list.GetType())); - } - } - - public static IWrappedDictionary CreateDictionaryWrapper(object dictionary) - { - ValidationUtils.ArgumentNotNull(dictionary, "dictionary"); - - Type dictionaryDefinition; - if (ReflectionUtils.IsSubClass(dictionary.GetType(), typeof(IDictionary<,>), out dictionaryDefinition)) - { - Type dictionaryKeyType = ReflectionUtils.GetDictionaryKeyType(dictionaryDefinition); - Type dictionaryValueType = ReflectionUtils.GetDictionaryValueType(dictionaryDefinition); - - // Activator.CreateInstance throws AmbiguousMatchException. Manually invoke constructor - Func, object> instanceCreator = (t, a) => - { - ConstructorInfo c = t.GetConstructor(new[] { dictionaryDefinition }); - return c.Invoke(new[] { dictionary }); - }; - - return (IWrappedDictionary)ReflectionUtils.CreateGeneric(typeof(DictionaryWrapper<,>), new[] { dictionaryKeyType, dictionaryValueType }, instanceCreator, dictionary); - } - else if (dictionary is IDictionary) - { - return new DictionaryWrapper((IDictionary)dictionary); - } - else - { - throw new Exception("Can not create DictionaryWrapper for type {0}.".FormatWith(CultureInfo.InvariantCulture, dictionary.GetType())); - } - } - - public static IList CreateAndPopulateList(Type listType, Action populateList) - { - ValidationUtils.ArgumentNotNull(listType, "listType"); - ValidationUtils.ArgumentNotNull(populateList, "populateList"); - - IList list; - Type collectionType; - bool isReadOnlyOrFixedSize = false; - - if (listType.IsArray) - { - // have to use an arraylist when creating array - // there is no way to know the size until it is finised - list = new ArrayList(); - isReadOnlyOrFixedSize = true; - } - else if (ReflectionUtils.IsSubClass(listType, typeof(ReadOnlyCollection<>), out collectionType)) - { - Type readOnlyCollectionContentsType = collectionType.GetGenericArguments()[0]; - Type genericEnumerable = ReflectionUtils.MakeGenericType(typeof(IEnumerable<>), readOnlyCollectionContentsType); - bool suitableConstructor = false; - - foreach (ConstructorInfo constructor in listType.GetConstructors()) - { - IList parameters = constructor.GetParameters(); - - if (parameters.Count == 1) - { - if (genericEnumerable.IsAssignableFrom(parameters[0].ParameterType)) - { - suitableConstructor = true; - break; - } - } - } - - if (!suitableConstructor) - throw new Exception("Read-only type {0} does not have a public constructor that takes a type that implements {1}.".FormatWith(CultureInfo.InvariantCulture, listType, genericEnumerable)); - - // can't add or modify a readonly list - // use List and convert once populated - list = (IList)CreateGenericList(readOnlyCollectionContentsType); - isReadOnlyOrFixedSize = true; - } - else if (typeof(IList).IsAssignableFrom(listType)) - { - if (ReflectionUtils.IsInstantiatableType(listType)) - list = (IList)Activator.CreateInstance(listType); - else if (listType == typeof(IList)) - list = new List(); - else - list = null; - } - else if (listType.IsGenericType && listType.GetGenericTypeDefinition() == typeof(IList<>)) - { - list = CollectionUtils.CreateGenericList(ReflectionUtils.GetListItemType(listType)); - } - else - { - list = null; - } - - if (list == null) - throw new Exception("Cannot create and populate list type {0}.".FormatWith(CultureInfo.InvariantCulture, listType)); - - populateList(list); - - // create readonly and fixed sized collections using the temporary list - if (isReadOnlyOrFixedSize) - { - if (listType.IsArray) - list = ((ArrayList)list).ToArray(ReflectionUtils.GetListItemType(listType)); - else if (ReflectionUtils.IsSubClass(listType, typeof(ReadOnlyCollection<>))) - list = (IList)Activator.CreateInstance(listType, list); - } - - return list; - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Collections; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal static class CollectionUtils + { + public static IEnumerable CastValid(this IEnumerable enumerable) + { + ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); + + return enumerable.Cast().Where(o => o is T).Cast(); + } + + public static List CreateList(params T[] values) + { + return new List(values); + } + + /// + /// Determines whether the collection is null or empty. + /// + /// The collection. + /// + /// true if the collection is null or empty; otherwise, false. + /// + public static bool IsNullOrEmpty(ICollection collection) + { + if (collection != null) + { + return (collection.Count == 0); + } + return true; + } + + /// + /// Determines whether the collection is null or empty. + /// + /// The collection. + /// + /// true if the collection is null or empty; otherwise, false. + /// + public static bool IsNullOrEmpty(ICollection collection) + { + if (collection != null) + { + return (collection.Count == 0); + } + return true; + } + + /// + /// Determines whether the collection is null, empty or its contents are uninitialized values. + /// + /// The list. + /// + /// true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + /// + public static bool IsNullOrEmptyOrDefault(IList list) + { + if (IsNullOrEmpty(list)) + return true; + + return ReflectionUtils.ItemsUnitializedValue(list); + } + + /// + /// Makes a slice of the specified list in between the start and end indexes. + /// + /// The list. + /// The start index. + /// The end index. + /// A slice of the list. + public static IList Slice(IList list, int? start, int? end) + { + return Slice(list, start, end, null); + } + + /// + /// Makes a slice of the specified list in between the start and end indexes, + /// getting every so many items based upon the step. + /// + /// The list. + /// The start index. + /// The end index. + /// The step. + /// A slice of the list. + public static IList Slice(IList list, int? start, int? end, int? step) + { + if (list == null) + throw new ArgumentNullException("list"); + + if (step == 0) + throw new ArgumentException("Step cannot be zero.", "step"); + + List slicedList = new List(); + + // nothing to slice + if (list.Count == 0) + return slicedList; + + // set defaults for null arguments + int s = step ?? 1; + int startIndex = start ?? 0; + int endIndex = end ?? list.Count; + + // start from the end of the list if start is negitive + startIndex = (startIndex < 0) ? list.Count + startIndex : startIndex; + + // end from the start of the list if end is negitive + endIndex = (endIndex < 0) ? list.Count + endIndex : endIndex; + + // ensure indexes keep within collection bounds + startIndex = Math.Max(startIndex, 0); + endIndex = Math.Min(endIndex, list.Count - 1); + + // loop between start and end indexes, incrementing by the step + for (int i = startIndex; i < endIndex; i += s) + { + slicedList.Add(list[i]); + } + + return slicedList; + } + + + /// + /// Group the collection using a function which returns the key. + /// + /// The source collection to group. + /// The key selector. + /// A Dictionary with each key relating to a list of objects in a list grouped under it. + public static Dictionary> GroupBy(ICollection source, Func keySelector) + { + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + Dictionary> groupedValues = new Dictionary>(); + + foreach (V value in source) + { + // using delegate to get the value's key + K key = keySelector(value); + List groupedValueList; + + // add a list for grouped values if the key is not already in Dictionary + if (!groupedValues.TryGetValue(key, out groupedValueList)) + { + groupedValueList = new List(); + groupedValues.Add(key, groupedValueList); + } + + groupedValueList.Add(value); + } + + return groupedValues; + } + + /// + /// Adds the elements of the specified collection to the specified generic IList. + /// + /// The list to add to. + /// The collection of elements to add. + public static void AddRange(this IList initial, IEnumerable collection) + { + if (initial == null) + throw new ArgumentNullException("initial"); + + if (collection == null) + return; + + foreach (T value in collection) + { + initial.Add(value); + } + } + + public static void AddRange(this IList initial, IEnumerable collection) + { + ValidationUtils.ArgumentNotNull(initial, "initial"); + + ListWrapper wrapper = new ListWrapper(initial); + wrapper.AddRange(collection.Cast()); + } + + public static List Distinct(List collection) + { + List distinctList = new List(); + + foreach (T value in collection) + { + if (!distinctList.Contains(value)) + distinctList.Add(value); + } + + return distinctList; + } + + public static List> Flatten(params IList[] lists) + { + List> flattened = new List>(); + Dictionary currentList = new Dictionary(); + + Recurse(new List>(lists), 0, currentList, flattened); + + return flattened; + } + + private static void Recurse(IList> global, int current, Dictionary currentSet, List> flattenedResult) + { + IList currentArray = global[current]; + + for (int i = 0; i < currentArray.Count; i++) + { + currentSet[current] = currentArray[i]; + + if (current == global.Count - 1) + { + List items = new List(); + + for (int k = 0; k < currentSet.Count; k++) + { + items.Add(currentSet[k]); + } + + flattenedResult.Add(items); + } + else + { + Recurse(global, current + 1, currentSet, flattenedResult); + } + } + } + + public static List CreateList(ICollection collection) + { + if (collection == null) + throw new ArgumentNullException("collection"); + + T[] array = new T[collection.Count]; + collection.CopyTo(array, 0); + + return new List(array); + } + + public static bool ListEquals(IList a, IList b) + { + if (a == null || b == null) + return (a == null && b == null); + + if (a.Count != b.Count) + return false; + + EqualityComparer comparer = EqualityComparer.Default; + + for (int i = 0; i < a.Count; i++) + { + if (!comparer.Equals(a[i], b[i])) + return false; + } + + return true; + } + + #region GetSingleItem + public static bool TryGetSingleItem(IList list, out T value) + { + return TryGetSingleItem(list, false, out value); + } + + public static bool TryGetSingleItem(IList list, bool returnDefaultIfEmpty, out T value) + { + return MiscellaneousUtils.TryAction(delegate { return GetSingleItem(list, returnDefaultIfEmpty); }, out value); + } + + public static T GetSingleItem(IList list) + { + return GetSingleItem(list, false); + } + + public static T GetSingleItem(IList list, bool returnDefaultIfEmpty) + { + if (list.Count == 1) + return list[0]; + else if (returnDefaultIfEmpty && list.Count == 0) + return default(T); + else + throw new Exception("Expected single {0} in list but got {1}.".FormatWith(CultureInfo.InvariantCulture, typeof(T), list.Count)); + } + #endregion + + public static IList Minus(IList list, IList minus) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + List result = new List(list.Count); + foreach (T t in list) + { + if (minus == null || !minus.Contains(t)) + result.Add(t); + } + + return result; + } + + public static T[] CreateArray(IEnumerable enumerable) + { + ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); + + if (enumerable is T[]) + return (T[])enumerable; + + List tempList = new List(enumerable); + return tempList.ToArray(); + } + + public static IList CreateGenericList(Type listType) + { + ValidationUtils.ArgumentNotNull(listType, "listType"); + + return (IList)ReflectionUtils.CreateGeneric(typeof(List<>), listType); + } + + public static bool IsListType(Type type) + { + ValidationUtils.ArgumentNotNull(type, "listType"); + + if (type.IsArray) + return true; + else if (typeof(IList).IsAssignableFrom(type)) + return true; + else if (ReflectionUtils.IsSubClass(type, typeof(IList<>))) + return true; + else + return false; + } + + public static IWrappedList CreateListWrapper(object list) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + Type listDefinition; + if (ReflectionUtils.IsSubClass(list.GetType(), typeof(IList<>), out listDefinition)) + { + Type listItemType = ReflectionUtils.GetListItemType(listDefinition); + + // Activator.CreateInstance throws AmbiguousMatchException. Manually invoke constructor + Func, object> instanceCreator = (t, a) => + { + ConstructorInfo c = t.GetConstructor(new[] {listDefinition}); + return c.Invoke(new[] { list }); + }; + + return (IWrappedList)ReflectionUtils.CreateGeneric(typeof(ListWrapper<>), new[] { listItemType }, instanceCreator, list); + } + else if (list is IList) + { + return new ListWrapper((IList)list); + } + else + { + throw new Exception("Can not create ListWrapper for type {0}.".FormatWith(CultureInfo.InvariantCulture, list.GetType())); + } + } + + public static IWrappedDictionary CreateDictionaryWrapper(object dictionary) + { + ValidationUtils.ArgumentNotNull(dictionary, "dictionary"); + + Type dictionaryDefinition; + if (ReflectionUtils.IsSubClass(dictionary.GetType(), typeof(IDictionary<,>), out dictionaryDefinition)) + { + Type dictionaryKeyType = ReflectionUtils.GetDictionaryKeyType(dictionaryDefinition); + Type dictionaryValueType = ReflectionUtils.GetDictionaryValueType(dictionaryDefinition); + + // Activator.CreateInstance throws AmbiguousMatchException. Manually invoke constructor + Func, object> instanceCreator = (t, a) => + { + ConstructorInfo c = t.GetConstructor(new[] { dictionaryDefinition }); + return c.Invoke(new[] { dictionary }); + }; + + return (IWrappedDictionary)ReflectionUtils.CreateGeneric(typeof(DictionaryWrapper<,>), new[] { dictionaryKeyType, dictionaryValueType }, instanceCreator, dictionary); + } + else if (dictionary is IDictionary) + { + return new DictionaryWrapper((IDictionary)dictionary); + } + else + { + throw new Exception("Can not create DictionaryWrapper for type {0}.".FormatWith(CultureInfo.InvariantCulture, dictionary.GetType())); + } + } + + public static IList CreateAndPopulateList(Type listType, Action populateList) + { + ValidationUtils.ArgumentNotNull(listType, "listType"); + ValidationUtils.ArgumentNotNull(populateList, "populateList"); + + IList list; + Type collectionType; + bool isReadOnlyOrFixedSize = false; + + if (listType.IsArray) + { + // have to use an arraylist when creating array + // there is no way to know the size until it is finised + list = new ArrayList(); + isReadOnlyOrFixedSize = true; + } + else if (ReflectionUtils.IsSubClass(listType, typeof(ReadOnlyCollection<>), out collectionType)) + { + Type readOnlyCollectionContentsType = collectionType.GetGenericArguments()[0]; + Type genericEnumerable = ReflectionUtils.MakeGenericType(typeof(IEnumerable<>), readOnlyCollectionContentsType); + bool suitableConstructor = false; + + foreach (ConstructorInfo constructor in listType.GetConstructors()) + { + IList parameters = constructor.GetParameters(); + + if (parameters.Count == 1) + { + if (genericEnumerable.IsAssignableFrom(parameters[0].ParameterType)) + { + suitableConstructor = true; + break; + } + } + } + + if (!suitableConstructor) + throw new Exception("Read-only type {0} does not have a public constructor that takes a type that implements {1}.".FormatWith(CultureInfo.InvariantCulture, listType, genericEnumerable)); + + // can't add or modify a readonly list + // use List and convert once populated + list = (IList)CreateGenericList(readOnlyCollectionContentsType); + isReadOnlyOrFixedSize = true; + } + else if (typeof(IList).IsAssignableFrom(listType)) + { + if (ReflectionUtils.IsInstantiatableType(listType)) + list = (IList)Activator.CreateInstance(listType); + else if (listType == typeof(IList)) + list = new List(); + else + list = null; + } + else if (listType.IsGenericType && listType.GetGenericTypeDefinition() == typeof(IList<>)) + { + list = CollectionUtils.CreateGenericList(ReflectionUtils.GetListItemType(listType)); + } + else + { + list = null; + } + + if (list == null) + throw new Exception("Cannot create and populate list type {0}.".FormatWith(CultureInfo.InvariantCulture, listType)); + + populateList(list); + + // create readonly and fixed sized collections using the temporary list + if (isReadOnlyOrFixedSize) + { + if (listType.IsArray) + list = ((ArrayList)list).ToArray(ReflectionUtils.GetListItemType(listType)); + else if (ReflectionUtils.IsSubClass(listType, typeof(ReadOnlyCollection<>))) + list = (IList)Activator.CreateInstance(listType, list); + } + + return list; + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/DateTimeUtils.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/DateTimeUtils.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/DateTimeUtils.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/DateTimeUtils.cs index f616c46..2167c9d 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/DateTimeUtils.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/DateTimeUtils.cs @@ -1,23 +1,23 @@ -using System; -using System.Xml; - -namespace Newtonsoft.Json.Utilities -{ - internal static class DateTimeUtils - { - public static XmlDateTimeSerializationMode ToSerializationMode(DateTimeKind kind) - { - switch (kind) - { - case DateTimeKind.Local: - return XmlDateTimeSerializationMode.Local; - case DateTimeKind.Unspecified: - return XmlDateTimeSerializationMode.Unspecified; - case DateTimeKind.Utc: - return XmlDateTimeSerializationMode.Utc; - default: - throw new ArgumentOutOfRangeException("kind", kind, "Unexpected DateTimeKind value."); - } - } - } -} +using System; +using System.Xml; + +namespace Newtonsoft.Json.Utilities +{ + internal static class DateTimeUtils + { + public static XmlDateTimeSerializationMode ToSerializationMode(DateTimeKind kind) + { + switch (kind) + { + case DateTimeKind.Local: + return XmlDateTimeSerializationMode.Local; + case DateTimeKind.Unspecified: + return XmlDateTimeSerializationMode.Unspecified; + case DateTimeKind.Utc: + return XmlDateTimeSerializationMode.Utc; + default: + throw new ArgumentOutOfRangeException("kind", kind, "Unexpected DateTimeKind value."); + } + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/DictionaryWrapper.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/DictionaryWrapper.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/DictionaryWrapper.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/DictionaryWrapper.cs index 56012b1..1d0f81c 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/DictionaryWrapper.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/DictionaryWrapper.cs @@ -1,422 +1,422 @@ -using System; -using System.Collections.Generic; -using System.Collections; -using System.Linq; -using System.Threading; - -namespace Newtonsoft.Json.Utilities -{ - internal interface IWrappedDictionary : IDictionary - { - object UnderlyingDictionary { get; } - } - - internal class DictionaryWrapper : IDictionary, IWrappedDictionary - { - private readonly IDictionary _dictionary; - private readonly IDictionary _genericDictionary; - private object _syncRoot; - - public DictionaryWrapper(IDictionary dictionary) - { - ValidationUtils.ArgumentNotNull(dictionary, "dictionary"); - - _dictionary = dictionary; - } - - public DictionaryWrapper(IDictionary dictionary) - { - ValidationUtils.ArgumentNotNull(dictionary, "dictionary"); - - _genericDictionary = dictionary; - } - - public void Add(TKey key, TValue value) - { - if (_genericDictionary != null) - _genericDictionary.Add(key, value); - else - _dictionary.Add(key, value); - } - - public bool ContainsKey(TKey key) - { - if (_genericDictionary != null) - return _genericDictionary.ContainsKey(key); - else - return _dictionary.Contains(key); - } - - public ICollection Keys - { - get - { - if (_genericDictionary != null) - return _genericDictionary.Keys; - else - return _dictionary.Keys.Cast().ToList(); - } - } - - public bool Remove(TKey key) - { - if (_genericDictionary != null) - { - return _genericDictionary.Remove(key); - } - else - { - if (_dictionary.Contains(key)) - { - _dictionary.Remove(key); - return true; - } - else - { - return false; - } - } - } - - public bool TryGetValue(TKey key, out TValue value) - { - if (_genericDictionary != null) - { - return _genericDictionary.TryGetValue(key, out value); - } - else - { - if (!_dictionary.Contains(key)) - { - value = default(TValue); - return false; - } - else - { - value = (TValue)_dictionary[key]; - return true; - } - } - } - - public ICollection Values - { - get - { - if (_genericDictionary != null) - return _genericDictionary.Values; - else - return _dictionary.Values.Cast().ToList(); - } - } - - public TValue this[TKey key] - { - get - { - if (_genericDictionary != null) - return _genericDictionary[key]; - else - return (TValue)_dictionary[key]; - } - set - { - if (_genericDictionary != null) - _genericDictionary[key] = value; - else - _dictionary[key] = value; - } - } - - public void Add(KeyValuePair item) - { - if (_genericDictionary != null) - _genericDictionary.Add(item); - else - ((IList)_dictionary).Add(item); - } - - public void Clear() - { - if (_genericDictionary != null) - _genericDictionary.Clear(); - else - _dictionary.Clear(); - } - - public bool Contains(KeyValuePair item) - { - if (_genericDictionary != null) - return _genericDictionary.Contains(item); - else - return ((IList)_dictionary).Contains(item); - } - - public void CopyTo(KeyValuePair[] array, int arrayIndex) - { - if (_genericDictionary != null) - { - _genericDictionary.CopyTo(array, arrayIndex); - } - else - { - foreach (DictionaryEntry item in _dictionary) - { - array[arrayIndex++] = new KeyValuePair((TKey)item.Key, (TValue)item.Value); - } - } - } - - public int Count - { - get - { - if (_genericDictionary != null) - return _genericDictionary.Count; - else - return _dictionary.Count; - } - } - - public bool IsReadOnly - { - get - { - if (_genericDictionary != null) - return _genericDictionary.IsReadOnly; - else - return _dictionary.IsReadOnly; - } - } - - public bool Remove(KeyValuePair item) - { - if (_genericDictionary != null) - { - return _genericDictionary.Remove(item); - } - else - { - if (_dictionary.Contains(item.Key)) - { - object value = _dictionary[item.Key]; - - if (object.Equals(value, item.Value)) - { - _dictionary.Remove(item.Key); - return true; - } - else - { - return false; - } - } - else - { - return true; - } - } - } - - public IEnumerator> GetEnumerator() - { - if (_genericDictionary != null) - { - return _genericDictionary.GetEnumerator(); - } - else - { - var ret = new List>(); - foreach (DictionaryEntry item in _dictionary) - { - ret.Add(new KeyValuePair((TKey)item.Key, (TValue)item.Value)); - } - return ret.GetEnumerator(); - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - void IDictionary.Add(object key, object value) - { - if (_genericDictionary != null) - _genericDictionary.Add((TKey)key, (TValue)value); - else - _dictionary.Add(key, value); - } - - bool IDictionary.Contains(object key) - { - if (_genericDictionary != null) - return _genericDictionary.ContainsKey((TKey)key); - else - return _dictionary.Contains(key); - } - - private struct DictionaryEnumerator : IDictionaryEnumerator - { - private IEnumerator _e; - - public DictionaryEnumerator(IEnumerator e) - { - ValidationUtils.ArgumentNotNull(e, "e"); - _e = e; - } - - public DictionaryEntry Entry - { - get { return (DictionaryEntry)Current; } - } - - public object Key - { - get { return Entry.Key; } - } - - public object Value - { - get { return Entry.Value; } - } - - public object Current - { - get { return _e.Current; } - } - - public bool MoveNext() - { - return _e.MoveNext(); - } - - public void Reset() - { - _e.Reset(); - } - } - - IDictionaryEnumerator IDictionary.GetEnumerator() - { - if (_genericDictionary != null) - return new DictionaryEnumerator(_genericDictionary.GetEnumerator()); - else - return _dictionary.GetEnumerator(); - } - - bool IDictionary.IsFixedSize - { - get - { - if (_genericDictionary != null) - return false; - else - return _dictionary.IsFixedSize; - } - } - - ICollection IDictionary.Keys - { - get - { - if (_genericDictionary != null) - { - var keys = new List(); - foreach (var item in _genericDictionary.Keys) - keys.Add(item); - return keys; - } - else - { - return _dictionary.Keys; - } - } - } - - public void Remove(object key) - { - if (_genericDictionary != null) - _genericDictionary.Remove((TKey)key); - else - _dictionary.Remove(key); - } - - ICollection IDictionary.Values - { - get - { - if (_genericDictionary != null) - { - var ret = new List(); - foreach (var item in _genericDictionary.Keys) - ret.Add((item)); - return ret; - } - else - { - return _dictionary.Values; - } - } - } - - object IDictionary.this[object key] - { - get - { - if (_genericDictionary != null) - return _genericDictionary[(TKey)key]; - else - return _dictionary[key]; - } - set - { - if (_genericDictionary != null) - _genericDictionary[(TKey)key] = (TValue)value; - else - _dictionary[key] = value; - } - } - - void ICollection.CopyTo(Array array, int index) - { - if (_genericDictionary != null) - _genericDictionary.CopyTo((KeyValuePair[])array, index); - else - _dictionary.CopyTo(array, index); - } - - bool ICollection.IsSynchronized - { - get - { - if (_genericDictionary != null) - return false; - else - return _dictionary.IsSynchronized; - } - } - - object ICollection.SyncRoot - { - get - { - if (_syncRoot == null) - Interlocked.CompareExchange(ref _syncRoot, new object(), null); - - return _syncRoot; - } - } - - public object UnderlyingDictionary - { - get - { - if (_genericDictionary != null) - return _genericDictionary; - else - return _dictionary; - } - } - } -} +using System; +using System.Collections.Generic; +using System.Collections; +using System.Linq; +using System.Threading; + +namespace Newtonsoft.Json.Utilities +{ + internal interface IWrappedDictionary : IDictionary + { + object UnderlyingDictionary { get; } + } + + internal class DictionaryWrapper : IDictionary, IWrappedDictionary + { + private readonly IDictionary _dictionary; + private readonly IDictionary _genericDictionary; + private object _syncRoot; + + public DictionaryWrapper(IDictionary dictionary) + { + ValidationUtils.ArgumentNotNull(dictionary, "dictionary"); + + _dictionary = dictionary; + } + + public DictionaryWrapper(IDictionary dictionary) + { + ValidationUtils.ArgumentNotNull(dictionary, "dictionary"); + + _genericDictionary = dictionary; + } + + public void Add(TKey key, TValue value) + { + if (_genericDictionary != null) + _genericDictionary.Add(key, value); + else + _dictionary.Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (_genericDictionary != null) + return _genericDictionary.ContainsKey(key); + else + return _dictionary.Contains(key); + } + + public ICollection Keys + { + get + { + if (_genericDictionary != null) + return _genericDictionary.Keys; + else + return _dictionary.Keys.Cast().ToList(); + } + } + + public bool Remove(TKey key) + { + if (_genericDictionary != null) + { + return _genericDictionary.Remove(key); + } + else + { + if (_dictionary.Contains(key)) + { + _dictionary.Remove(key); + return true; + } + else + { + return false; + } + } + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (_genericDictionary != null) + { + return _genericDictionary.TryGetValue(key, out value); + } + else + { + if (!_dictionary.Contains(key)) + { + value = default(TValue); + return false; + } + else + { + value = (TValue)_dictionary[key]; + return true; + } + } + } + + public ICollection Values + { + get + { + if (_genericDictionary != null) + return _genericDictionary.Values; + else + return _dictionary.Values.Cast().ToList(); + } + } + + public TValue this[TKey key] + { + get + { + if (_genericDictionary != null) + return _genericDictionary[key]; + else + return (TValue)_dictionary[key]; + } + set + { + if (_genericDictionary != null) + _genericDictionary[key] = value; + else + _dictionary[key] = value; + } + } + + public void Add(KeyValuePair item) + { + if (_genericDictionary != null) + _genericDictionary.Add(item); + else + ((IList)_dictionary).Add(item); + } + + public void Clear() + { + if (_genericDictionary != null) + _genericDictionary.Clear(); + else + _dictionary.Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (_genericDictionary != null) + return _genericDictionary.Contains(item); + else + return ((IList)_dictionary).Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + if (_genericDictionary != null) + { + _genericDictionary.CopyTo(array, arrayIndex); + } + else + { + foreach (DictionaryEntry item in _dictionary) + { + array[arrayIndex++] = new KeyValuePair((TKey)item.Key, (TValue)item.Value); + } + } + } + + public int Count + { + get + { + if (_genericDictionary != null) + return _genericDictionary.Count; + else + return _dictionary.Count; + } + } + + public bool IsReadOnly + { + get + { + if (_genericDictionary != null) + return _genericDictionary.IsReadOnly; + else + return _dictionary.IsReadOnly; + } + } + + public bool Remove(KeyValuePair item) + { + if (_genericDictionary != null) + { + return _genericDictionary.Remove(item); + } + else + { + if (_dictionary.Contains(item.Key)) + { + object value = _dictionary[item.Key]; + + if (object.Equals(value, item.Value)) + { + _dictionary.Remove(item.Key); + return true; + } + else + { + return false; + } + } + else + { + return true; + } + } + } + + public IEnumerator> GetEnumerator() + { + if (_genericDictionary != null) + { + return _genericDictionary.GetEnumerator(); + } + else + { + var ret = new List>(); + foreach (DictionaryEntry item in _dictionary) + { + ret.Add(new KeyValuePair((TKey)item.Key, (TValue)item.Value)); + } + return ret.GetEnumerator(); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + void IDictionary.Add(object key, object value) + { + if (_genericDictionary != null) + _genericDictionary.Add((TKey)key, (TValue)value); + else + _dictionary.Add(key, value); + } + + bool IDictionary.Contains(object key) + { + if (_genericDictionary != null) + return _genericDictionary.ContainsKey((TKey)key); + else + return _dictionary.Contains(key); + } + + private struct DictionaryEnumerator : IDictionaryEnumerator + { + private IEnumerator _e; + + public DictionaryEnumerator(IEnumerator e) + { + ValidationUtils.ArgumentNotNull(e, "e"); + _e = e; + } + + public DictionaryEntry Entry + { + get { return (DictionaryEntry)Current; } + } + + public object Key + { + get { return Entry.Key; } + } + + public object Value + { + get { return Entry.Value; } + } + + public object Current + { + get { return _e.Current; } + } + + public bool MoveNext() + { + return _e.MoveNext(); + } + + public void Reset() + { + _e.Reset(); + } + } + + IDictionaryEnumerator IDictionary.GetEnumerator() + { + if (_genericDictionary != null) + return new DictionaryEnumerator(_genericDictionary.GetEnumerator()); + else + return _dictionary.GetEnumerator(); + } + + bool IDictionary.IsFixedSize + { + get + { + if (_genericDictionary != null) + return false; + else + return _dictionary.IsFixedSize; + } + } + + ICollection IDictionary.Keys + { + get + { + if (_genericDictionary != null) + { + var keys = new List(); + foreach (var item in _genericDictionary.Keys) + keys.Add(item); + return keys; + } + else + { + return _dictionary.Keys; + } + } + } + + public void Remove(object key) + { + if (_genericDictionary != null) + _genericDictionary.Remove((TKey)key); + else + _dictionary.Remove(key); + } + + ICollection IDictionary.Values + { + get + { + if (_genericDictionary != null) + { + var ret = new List(); + foreach (var item in _genericDictionary.Keys) + ret.Add((item)); + return ret; + } + else + { + return _dictionary.Values; + } + } + } + + object IDictionary.this[object key] + { + get + { + if (_genericDictionary != null) + return _genericDictionary[(TKey)key]; + else + return _dictionary[key]; + } + set + { + if (_genericDictionary != null) + _genericDictionary[(TKey)key] = (TValue)value; + else + _dictionary[key] = value; + } + } + + void ICollection.CopyTo(Array array, int index) + { + if (_genericDictionary != null) + _genericDictionary.CopyTo((KeyValuePair[])array, index); + else + _dictionary.CopyTo(array, index); + } + + bool ICollection.IsSynchronized + { + get + { + if (_genericDictionary != null) + return false; + else + return _dictionary.IsSynchronized; + } + } + + object ICollection.SyncRoot + { + get + { + if (_syncRoot == null) + Interlocked.CompareExchange(ref _syncRoot, new object(), null); + + return _syncRoot; + } + } + + public object UnderlyingDictionary + { + get + { + if (_genericDictionary != null) + return _genericDictionary; + else + return _dictionary; + } + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/JavaScriptUtils.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/JavaScriptUtils.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/JavaScriptUtils.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/JavaScriptUtils.cs index fde0bb9..896dc05 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/JavaScriptUtils.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/JavaScriptUtils.cs @@ -1,137 +1,137 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Web; -using System.Collections.Generic; -using System.Drawing; -using System.Web.UI; -using System.Web.UI.WebControls; - -namespace Newtonsoft.Json.Utilities -{ - internal static class JavaScriptUtils - { - public static string GetCallbackEventFunction(Page page, Control control) - { - string script = page.ClientScript.GetCallbackEventReference(control, "eventArgument", "eventCallback", "context", "errorCallback", true); - - script = "function(eventArgument,eventCallback,context,errorCallback){" + script + "}"; - - return script; - } - - public static string GetCallbackEventFunction(Page page, Control control, string argument) - { - string script = page.ClientScript.GetCallbackEventReference(control, "'" + argument + "'", "eventCallback", "context", "errorCallback", true); - - script = "function(eventCallback,context,errorCallback){" + script + "}"; - - return script; - } - - public static void WriteEscapedJavaScriptChar(TextWriter writer, char c, char delimiter) - { - switch (c) - { - case '\t': - writer.Write(@"\t"); - break; - case '\n': - writer.Write(@"\n"); - break; - case '\r': - writer.Write(@"\r"); - break; - case '\f': - writer.Write(@"\f"); - break; - case '\b': - writer.Write(@"\b"); - break; - case '\\': - writer.Write(@"\\"); - break; - //case '<': - //case '>': - //case '\'': - // StringUtils.WriteCharAsUnicode(writer, c); - // break; - case '\'': - // only escape if this charater is being used as the delimiter - writer.Write((delimiter == '\'') ? @"\'" : @"'"); - break; - case '"': - // only escape if this charater is being used as the delimiter - writer.Write((delimiter == '"') ? "\\\"" : @""""); - break; - default: - if (c > '\u001f') - writer.Write(c); - else - StringUtils.WriteCharAsUnicode(writer, c); - break; - } - } - - public static void WriteEscapedJavaScriptString(TextWriter writer, string value, char delimiter, bool appendDelimiters) - { - // leading delimiter - if (appendDelimiters) - writer.Write(delimiter); - - if (value != null) - { - for (int i = 0; i < value.Length; i++) - { - WriteEscapedJavaScriptChar(writer, value[i], delimiter); - } - } - - // trailing delimiter - if (appendDelimiters) - writer.Write(delimiter); - } - - public static string ToEscapedJavaScriptString(string value) - { - return ToEscapedJavaScriptString(value, '"', true); - } - - public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters) - { - using (StringWriter w = StringUtils.CreateStringWriter(StringUtils.GetLength(value) ?? 16)) - { - WriteEscapedJavaScriptString(w, value, delimiter, appendDelimiters); - return w.ToString(); - } - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections; +using System.Globalization; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Web; +using System.Collections.Generic; +using System.Drawing; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Newtonsoft.Json.Utilities +{ + internal static class JavaScriptUtils + { + public static string GetCallbackEventFunction(Page page, Control control) + { + string script = page.ClientScript.GetCallbackEventReference(control, "eventArgument", "eventCallback", "context", "errorCallback", true); + + script = "function(eventArgument,eventCallback,context,errorCallback){" + script + "}"; + + return script; + } + + public static string GetCallbackEventFunction(Page page, Control control, string argument) + { + string script = page.ClientScript.GetCallbackEventReference(control, "'" + argument + "'", "eventCallback", "context", "errorCallback", true); + + script = "function(eventCallback,context,errorCallback){" + script + "}"; + + return script; + } + + public static void WriteEscapedJavaScriptChar(TextWriter writer, char c, char delimiter) + { + switch (c) + { + case '\t': + writer.Write(@"\t"); + break; + case '\n': + writer.Write(@"\n"); + break; + case '\r': + writer.Write(@"\r"); + break; + case '\f': + writer.Write(@"\f"); + break; + case '\b': + writer.Write(@"\b"); + break; + case '\\': + writer.Write(@"\\"); + break; + //case '<': + //case '>': + //case '\'': + // StringUtils.WriteCharAsUnicode(writer, c); + // break; + case '\'': + // only escape if this charater is being used as the delimiter + writer.Write((delimiter == '\'') ? @"\'" : @"'"); + break; + case '"': + // only escape if this charater is being used as the delimiter + writer.Write((delimiter == '"') ? "\\\"" : @""""); + break; + default: + if (c > '\u001f') + writer.Write(c); + else + StringUtils.WriteCharAsUnicode(writer, c); + break; + } + } + + public static void WriteEscapedJavaScriptString(TextWriter writer, string value, char delimiter, bool appendDelimiters) + { + // leading delimiter + if (appendDelimiters) + writer.Write(delimiter); + + if (value != null) + { + for (int i = 0; i < value.Length; i++) + { + WriteEscapedJavaScriptChar(writer, value[i], delimiter); + } + } + + // trailing delimiter + if (appendDelimiters) + writer.Write(delimiter); + } + + public static string ToEscapedJavaScriptString(string value) + { + return ToEscapedJavaScriptString(value, '"', true); + } + + public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters) + { + using (StringWriter w = StringUtils.CreateStringWriter(StringUtils.GetLength(value) ?? 16)) + { + WriteEscapedJavaScriptString(w, value, delimiter, appendDelimiters); + return w.ToString(); + } + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/ListWrapper.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/ListWrapper.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/ListWrapper.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/ListWrapper.cs index 3eb4745..edb4c6f 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/ListWrapper.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/ListWrapper.cs @@ -1,286 +1,286 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Globalization; - -namespace Newtonsoft.Json.Utilities -{ - internal interface IWrappedList : IList - { - object UnderlyingList { get; } - } - - internal class ListWrapper : IList, IWrappedList - { - private readonly IList _list; - private readonly IList _genericList; - private object _syncRoot; - - public ListWrapper(IList list) - { - ValidationUtils.ArgumentNotNull(list, "list"); - - _list = list; - } - - public ListWrapper(IList list) - { - ValidationUtils.ArgumentNotNull(list, "list"); - - _genericList = list; - } - - public int IndexOf(T item) - { - if (_genericList != null) - return _genericList.IndexOf(item); - else - return _list.IndexOf(item); - } - - public void Insert(int index, T item) - { - if (_genericList != null) - _genericList.Insert(index, item); - else - _list.Insert(index, item); - } - - public void RemoveAt(int index) - { - if (_genericList != null) - _genericList.RemoveAt(index); - else - _list.RemoveAt(index); - } - - public T this[int index] - { - get - { - if (_genericList != null) - return _genericList[index]; - else - return (T)_list[index]; - } - set - { - if (_genericList != null) - _genericList[index] = value; - else - _list[index] = value; - } - } - - public void Add(T item) - { - if (_genericList != null) - _genericList.Add(item); - else - _list.Add(item); - } - - public void Clear() - { - if (_genericList != null) - _genericList.Clear(); - else - _list.Clear(); - } - - public bool Contains(T item) - { - if (_genericList != null) - return _genericList.Contains(item); - else - return _list.Contains(item); - } - - public void CopyTo(T[] array, int arrayIndex) - { - if (_genericList != null) - _genericList.CopyTo(array, arrayIndex); - else - _list.CopyTo(array, arrayIndex); - } - - public int Count - { - get - { - if (_genericList != null) - return _genericList.Count; - else - return _list.Count; - } - } - - public bool IsReadOnly - { - get - { - if (_genericList != null) - return _genericList.IsReadOnly; - else - return _list.IsReadOnly; - } - } - - public bool Remove(T item) - { - if (_genericList != null) - { - return _genericList.Remove(item); - } - else - { - bool contains = _list.Contains(item); - - if (contains) - _list.Remove(item); - - return contains; - } - } - - public IEnumerator GetEnumerator() - { - if (_genericList != null) - return _genericList.GetEnumerator(); - - return _list.Cast().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - if (_genericList != null) - return _genericList.GetEnumerator(); - else - return _list.GetEnumerator(); - } - - int IList.Add(object value) - { - VerifyValueType(value); - Add((T)value); - - return (Count - 1); - } - - bool IList.Contains(object value) - { - if (IsCompatibleObject(value)) - return Contains((T)value); - - return false; - } - - int IList.IndexOf(object value) - { - if (IsCompatibleObject(value)) - return IndexOf((T)value); - - return -1; - } - - void IList.Insert(int index, object value) - { - VerifyValueType(value); - Insert(index, (T)value); - } - - bool IList.IsFixedSize - { - get { return false; } - } - - void IList.Remove(object value) - { - if (IsCompatibleObject(value)) - Remove((T)value); - } - - object IList.this[int index] - { - get { return this[index]; } - set - { - VerifyValueType(value); - this[index] = (T)value; - } - } - - void ICollection.CopyTo(Array array, int arrayIndex) - { - CopyTo((T[])array, arrayIndex); - } - - bool ICollection.IsSynchronized - { - get { return false; } - } - - object ICollection.SyncRoot - { - get - { - if (_syncRoot == null) - Interlocked.CompareExchange(ref _syncRoot, new object(), null); - - return _syncRoot; - } - } - - private static void VerifyValueType(object value) - { - if (!IsCompatibleObject(value)) - throw new ArgumentException("The value '{0}' is not of type '{1}' and cannot be used in this generic collection.".FormatWith(CultureInfo.InvariantCulture, value, typeof(T)), "value"); - } - - private static bool IsCompatibleObject(object value) - { - if (!(value is T) && (value != null || typeof(T).IsValueType)) - return false; - - return true; - } - - public object UnderlyingList - { - get - { - if (_genericList != null) - return _genericList; - else - return _list; - } - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal interface IWrappedList : IList + { + object UnderlyingList { get; } + } + + internal class ListWrapper : IList, IWrappedList + { + private readonly IList _list; + private readonly IList _genericList; + private object _syncRoot; + + public ListWrapper(IList list) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + _list = list; + } + + public ListWrapper(IList list) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + _genericList = list; + } + + public int IndexOf(T item) + { + if (_genericList != null) + return _genericList.IndexOf(item); + else + return _list.IndexOf(item); + } + + public void Insert(int index, T item) + { + if (_genericList != null) + _genericList.Insert(index, item); + else + _list.Insert(index, item); + } + + public void RemoveAt(int index) + { + if (_genericList != null) + _genericList.RemoveAt(index); + else + _list.RemoveAt(index); + } + + public T this[int index] + { + get + { + if (_genericList != null) + return _genericList[index]; + else + return (T)_list[index]; + } + set + { + if (_genericList != null) + _genericList[index] = value; + else + _list[index] = value; + } + } + + public void Add(T item) + { + if (_genericList != null) + _genericList.Add(item); + else + _list.Add(item); + } + + public void Clear() + { + if (_genericList != null) + _genericList.Clear(); + else + _list.Clear(); + } + + public bool Contains(T item) + { + if (_genericList != null) + return _genericList.Contains(item); + else + return _list.Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (_genericList != null) + _genericList.CopyTo(array, arrayIndex); + else + _list.CopyTo(array, arrayIndex); + } + + public int Count + { + get + { + if (_genericList != null) + return _genericList.Count; + else + return _list.Count; + } + } + + public bool IsReadOnly + { + get + { + if (_genericList != null) + return _genericList.IsReadOnly; + else + return _list.IsReadOnly; + } + } + + public bool Remove(T item) + { + if (_genericList != null) + { + return _genericList.Remove(item); + } + else + { + bool contains = _list.Contains(item); + + if (contains) + _list.Remove(item); + + return contains; + } + } + + public IEnumerator GetEnumerator() + { + if (_genericList != null) + return _genericList.GetEnumerator(); + + return _list.Cast().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + if (_genericList != null) + return _genericList.GetEnumerator(); + else + return _list.GetEnumerator(); + } + + int IList.Add(object value) + { + VerifyValueType(value); + Add((T)value); + + return (Count - 1); + } + + bool IList.Contains(object value) + { + if (IsCompatibleObject(value)) + return Contains((T)value); + + return false; + } + + int IList.IndexOf(object value) + { + if (IsCompatibleObject(value)) + return IndexOf((T)value); + + return -1; + } + + void IList.Insert(int index, object value) + { + VerifyValueType(value); + Insert(index, (T)value); + } + + bool IList.IsFixedSize + { + get { return false; } + } + + void IList.Remove(object value) + { + if (IsCompatibleObject(value)) + Remove((T)value); + } + + object IList.this[int index] + { + get { return this[index]; } + set + { + VerifyValueType(value); + this[index] = (T)value; + } + } + + void ICollection.CopyTo(Array array, int arrayIndex) + { + CopyTo((T[])array, arrayIndex); + } + + bool ICollection.IsSynchronized + { + get { return false; } + } + + object ICollection.SyncRoot + { + get + { + if (_syncRoot == null) + Interlocked.CompareExchange(ref _syncRoot, new object(), null); + + return _syncRoot; + } + } + + private static void VerifyValueType(object value) + { + if (!IsCompatibleObject(value)) + throw new ArgumentException("The value '{0}' is not of type '{1}' and cannot be used in this generic collection.".FormatWith(CultureInfo.InvariantCulture, value, typeof(T)), "value"); + } + + private static bool IsCompatibleObject(object value) + { + if (!(value is T) && (value != null || typeof(T).IsValueType)) + return false; + + return true; + } + + public object UnderlyingList + { + get + { + if (_genericList != null) + return _genericList; + else + return _list; + } + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/MathUtils.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/MathUtils.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/MathUtils.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/MathUtils.cs index 26a6b88..974f44a 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/MathUtils.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/MathUtils.cs @@ -1,60 +1,60 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Newtonsoft.Json.Utilities -{ - internal class MathUtils - { - public static int HexToInt(char h) - { - if ((h >= '0') && (h <= '9')) - { - return (h - '0'); - } - if ((h >= 'a') && (h <= 'f')) - { - return ((h - 'a') + 10); - } - if ((h >= 'A') && (h <= 'F')) - { - return ((h - 'A') + 10); - } - return -1; - } - - public static char IntToHex(int n) - { - if (n <= 9) - { - return (char)(n + 48); - } - return (char)((n - 10) + 97); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json.Utilities +{ + internal class MathUtils + { + public static int HexToInt(char h) + { + if ((h >= '0') && (h <= '9')) + { + return (h - '0'); + } + if ((h >= 'a') && (h <= 'f')) + { + return ((h - 'a') + 10); + } + if ((h >= 'A') && (h <= 'F')) + { + return ((h - 'A') + 10); + } + return -1; + } + + public static char IntToHex(int n) + { + if (n <= 9) + { + return (char)(n + 48); + } + return (char)((n - 10) + 97); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs index c365b75..2fa82eb 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs @@ -1,84 +1,84 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Reflection; -using System.Text; -using System.Globalization; - -namespace Newtonsoft.Json.Utilities -{ - internal delegate T Creator(); - - internal static class MiscellaneousUtils - { - public static bool TryAction(Creator creator, out T output) - { - ValidationUtils.ArgumentNotNull(creator, "creator"); - - try - { - output = creator(); - return true; - } - catch - { - output = default(T); - return false; - } - } - - public static bool TryGetDescription(object value, out string description) - { - return TryAction(delegate { return GetDescription(value); }, out description); - } - - public static string GetDescription(object o) - { - ValidationUtils.ArgumentNotNull(o, "o"); - - ICustomAttributeProvider attributeProvider = o as ICustomAttributeProvider; - - // object passed in isn't an attribute provider - // if value is an enum value, get value field member, otherwise get values type - if (attributeProvider == null) - { - Type valueType = o.GetType(); - - if (valueType.IsEnum) - attributeProvider = valueType.GetField(o.ToString()); - else - attributeProvider = valueType; - } - - DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute(attributeProvider); - - if (descriptionAttribute != null) - return descriptionAttribute.Description; - else - throw new Exception("No DescriptionAttribute on '{0}'.".FormatWith(CultureInfo.InvariantCulture, o.GetType())); - } - - public static IList GetDescriptions(IList values) - { - ValidationUtils.ArgumentNotNull(values, "values"); - - string[] descriptions = new string[values.Count]; - - for (int i = 0; i < values.Count; i++) - { - descriptions[i] = GetDescription(values[i]); - } - - return descriptions; - } - - public static string ToString(object value) - { - if (value == null) - return "{null}"; - - return (value is string) ? @"""" + value.ToString() + @"""" : value.ToString(); - } - } -} +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Reflection; +using System.Text; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal delegate T Creator(); + + internal static class MiscellaneousUtils + { + public static bool TryAction(Creator creator, out T output) + { + ValidationUtils.ArgumentNotNull(creator, "creator"); + + try + { + output = creator(); + return true; + } + catch + { + output = default(T); + return false; + } + } + + public static bool TryGetDescription(object value, out string description) + { + return TryAction(delegate { return GetDescription(value); }, out description); + } + + public static string GetDescription(object o) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + ICustomAttributeProvider attributeProvider = o as ICustomAttributeProvider; + + // object passed in isn't an attribute provider + // if value is an enum value, get value field member, otherwise get values type + if (attributeProvider == null) + { + Type valueType = o.GetType(); + + if (valueType.IsEnum) + attributeProvider = valueType.GetField(o.ToString()); + else + attributeProvider = valueType; + } + + DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute(attributeProvider); + + if (descriptionAttribute != null) + return descriptionAttribute.Description; + else + throw new Exception("No DescriptionAttribute on '{0}'.".FormatWith(CultureInfo.InvariantCulture, o.GetType())); + } + + public static IList GetDescriptions(IList values) + { + ValidationUtils.ArgumentNotNull(values, "values"); + + string[] descriptions = new string[values.Count]; + + for (int i = 0; i < values.Count; i++) + { + descriptions[i] = GetDescription(values[i]); + } + + return descriptions; + } + + public static string ToString(object value) + { + if (value == null) + return "{null}"; + + return (value is string) ? @"""" + value.ToString() + @"""" : value.ToString(); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/ReflectionUtils.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/ReflectionUtils.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/ReflectionUtils.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/ReflectionUtils.cs index 7420772..f79f70b 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/ReflectionUtils.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/ReflectionUtils.cs @@ -1,554 +1,554 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Collections; -using System.Globalization; - -namespace Newtonsoft.Json.Utilities -{ - internal static class ReflectionUtils - { - public static Type GetObjectType(object v) - { - return (v != null) ? v.GetType() : null; - } - - public static bool IsInstantiatableType(Type t) - { - ValidationUtils.ArgumentNotNull(t, "t"); - - if (t.IsAbstract || t.IsInterface || t.IsArray || t.IsGenericTypeDefinition || t == typeof(void)) - return false; - - if (!HasDefaultConstructor(t)) - return false; - - return true; - } - - public static bool HasDefaultConstructor(Type t) - { - ValidationUtils.ArgumentNotNull(t, "t"); - - if (t.IsValueType) - return true; - - return (t.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null) != null); - } - - public static bool IsNullable(Type t) - { - ValidationUtils.ArgumentNotNull(t, "t"); - - if (t.IsValueType) - return IsNullableType(t); - - return true; - } - - public static bool IsNullableType(Type t) - { - ValidationUtils.ArgumentNotNull(t, "t"); - - return (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)); - } - - //public static bool IsValueTypeUnitializedValue(ValueType value) - //{ - // if (value == null) - // return true; - - // return value.Equals(CreateUnitializedValue(value.GetType())); - //} - - public static bool IsUnitializedValue(object value) - { - if (value == null) - { - return true; - } - else - { - object unitializedValue = CreateUnitializedValue(value.GetType()); - return value.Equals(unitializedValue); - } - } - - public static object CreateUnitializedValue(Type type) - { - ValidationUtils.ArgumentNotNull(type, "type"); - - if (type.IsGenericTypeDefinition) - throw new ArgumentException("Type {0} is a generic type definition and cannot be instantiated.".FormatWith(CultureInfo.InvariantCulture, type), "type"); - - if (type.IsClass || type.IsInterface || type == typeof(void)) - return null; - else if (type.IsValueType) - return Activator.CreateInstance(type); - else - throw new ArgumentException("Type {0} cannot be instantiated.".FormatWith(CultureInfo.InvariantCulture, type), "type"); - } - - public static bool IsPropertyIndexed(PropertyInfo property) - { - ValidationUtils.ArgumentNotNull(property, "property"); - - return !CollectionUtils.IsNullOrEmpty(property.GetIndexParameters()); - } - - public static bool IsSubClass(Type type, Type check) - { - Type implementingType; - return IsSubClass(type, check, out implementingType); - } - - public static bool IsSubClass(Type type, Type check, out Type implementingType) - { - ValidationUtils.ArgumentNotNull(type, "type"); - ValidationUtils.ArgumentNotNull(check, "check"); - - return IsSubClassInternal(type, type, check, out implementingType); - } - - private static bool IsSubClassInternal(Type initialType, Type currentType, Type check, out Type implementingType) - { - if (currentType == check) - { - implementingType = currentType; - return true; - } - - // don't get interfaces for an interface unless the initial type is an interface - if (check.IsInterface && (initialType.IsInterface || currentType == initialType)) - { - foreach (Type t in currentType.GetInterfaces()) - { - if (IsSubClassInternal(initialType, t, check, out implementingType)) - { - // don't return the interface itself, return it's implementor - if (check == implementingType) - implementingType = currentType; - - return true; - } - } - } - - if (currentType.IsGenericType && !currentType.IsGenericTypeDefinition) - { - if (IsSubClassInternal(initialType, currentType.GetGenericTypeDefinition(), check, out implementingType)) - { - implementingType = currentType; - return true; - } - } - - if (currentType.BaseType == null) - { - implementingType = null; - return false; - } - - return IsSubClassInternal(initialType, currentType.BaseType, check, out implementingType); - } - - /// - /// Gets the type of the typed list's items. - /// - /// The type. - /// The type of the typed list's items. - public static Type GetListItemType(Type type) - { - ValidationUtils.ArgumentNotNull(type, "type"); - Type genericListType; - - if (type.IsArray) - { - return type.GetElementType(); - } - else if (IsSubClass(type, typeof(IList<>), out genericListType)) - { - if (genericListType.IsGenericTypeDefinition) - throw new Exception("Type {0} is not a list.".FormatWith(CultureInfo.InvariantCulture, type)); - - return genericListType.GetGenericArguments()[0]; - } - else if (typeof(IList).IsAssignableFrom(type)) - { - return null; - } - else - { - throw new Exception("Type {0} is not a list.".FormatWith(CultureInfo.InvariantCulture, type)); - } - } - - private static void GetDictionaryKeyValueTypes(Type dictionaryType, out Type keyType, out Type valueType) - { - ValidationUtils.ArgumentNotNull(dictionaryType, "type"); - - Type genericDictionaryType; - if (IsSubClass(dictionaryType, typeof(IDictionary<,>), out genericDictionaryType)) - { - if (genericDictionaryType.IsGenericTypeDefinition) - throw new Exception("Type {0} is not a dictionary.".FormatWith(CultureInfo.InvariantCulture, dictionaryType)); - - Type[] dictionaryGenericArguments = genericDictionaryType.GetGenericArguments(); - - keyType = dictionaryGenericArguments[0]; - valueType = dictionaryGenericArguments[1]; - return; - } - else if (typeof(IDictionary).IsAssignableFrom(dictionaryType)) - { - keyType = null; - valueType = null; - return; - } - else - { - throw new Exception("Type {0} is not a dictionary.".FormatWith(CultureInfo.InvariantCulture, dictionaryType)); - } - } - - public static Type GetDictionaryValueType(Type dictionaryType) - { - Type keyType; - Type valueType; - GetDictionaryKeyValueTypes(dictionaryType, out keyType, out valueType); - - return valueType; - } - - public static Type GetDictionaryKeyType(Type dictionaryType) - { - Type keyType; - Type valueType; - GetDictionaryKeyValueTypes(dictionaryType, out keyType, out valueType); - - return keyType; - } - - /// - /// Tests whether the list's items are their unitialized value. - /// - /// The list. - /// Whether the list's items are their unitialized value - public static bool ItemsUnitializedValue(IList list) - { - ValidationUtils.ArgumentNotNull(list, "list"); - - Type elementType = GetListItemType(list.GetType()); - - if (elementType.IsValueType) - { - object unitializedValue = CreateUnitializedValue(elementType); - - for (int i = 0; i < list.Count; i++) - { - if (!list[i].Equals(unitializedValue)) - return false; - } - } - else if (elementType.IsClass) - { - for (int i = 0; i < list.Count; i++) - { - object value = list[i]; - - if (value != null) - return false; - } - } - else - { - throw new Exception("Type {0} is neither a ValueType or a Class.".FormatWith(CultureInfo.InvariantCulture, elementType)); - } - - return true; - } - - /// - /// Gets the member's underlying type. - /// - /// The member. - /// The underlying type of the member. - public static Type GetMemberUnderlyingType(MemberInfo member) - { - ValidationUtils.ArgumentNotNull(member, "member"); - - switch (member.MemberType) - { - case MemberTypes.Field: - return ((FieldInfo)member).FieldType; - case MemberTypes.Property: - return ((PropertyInfo)member).PropertyType; - case MemberTypes.Event: - return ((EventInfo)member).EventHandlerType; - default: - throw new ArgumentException("MemberInfo must be if type FieldInfo, PropertyInfo or EventInfo", "member"); - } - } - - /// - /// Determines whether the member is an indexed property. - /// - /// The member. - /// - /// true if the member is an indexed property; otherwise, false. - /// - public static bool IsIndexedProperty(MemberInfo member) - { - ValidationUtils.ArgumentNotNull(member, "member"); - - PropertyInfo propertyInfo = member as PropertyInfo; - - if (propertyInfo != null) - return IsIndexedProperty(propertyInfo); - else - return false; - } - - /// - /// Determines whether the property is an indexed property. - /// - /// The property. - /// - /// true if the property is an indexed property; otherwise, false. - /// - public static bool IsIndexedProperty(PropertyInfo property) - { - ValidationUtils.ArgumentNotNull(property, "property"); - - return (property.GetIndexParameters().Length > 0); - } - - public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes) - { - return GetMember(type, name, memberTypes, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); - } - - public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes, BindingFlags bindingAttr) - { - ValidationUtils.ArgumentNotNull(type, "type"); - ValidationUtils.ArgumentNotNull(name, "name"); - - MemberInfo[] result = type.GetMember(name, memberTypes, bindingAttr); - - return CollectionUtils.GetSingleItem(result); - } - - /// - /// Gets the member's value on the object. - /// - /// The member. - /// The target object. - /// The member's value on the object. - public static object GetMemberValue(MemberInfo member, object target) - { - ValidationUtils.ArgumentNotNull(member, "member"); - ValidationUtils.ArgumentNotNull(target, "target"); - - switch (member.MemberType) - { - case MemberTypes.Field: - return ((FieldInfo)member).GetValue(target); - case MemberTypes.Property: - try - { - return ((PropertyInfo)member).GetValue(target, null); - } - catch (TargetParameterCountException e) - { - throw new ArgumentException("MemberInfo '{0}' has index parameters".FormatWith(CultureInfo.InvariantCulture, member.Name), "member", e); - } - default: - throw new ArgumentException("MemberInfo '{0}' is not of type FieldInfo or PropertyInfo".FormatWith(CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, member.Name), "member"); - } - } - - /// - /// Sets the member's value on the target object. - /// - /// The member. - /// The target. - /// The value. - public static void SetMemberValue(MemberInfo member, object target, object value) - { - ValidationUtils.ArgumentNotNull(member, "member"); - ValidationUtils.ArgumentNotNull(target, "target"); - - switch (member.MemberType) - { - case MemberTypes.Field: - ((FieldInfo)member).SetValue(target, value); - break; - case MemberTypes.Property: - ((PropertyInfo)member).SetValue(target, value, null); - break; - default: - throw new ArgumentException("MemberInfo '{0}' must be of type FieldInfo or PropertyInfo".FormatWith(CultureInfo.InvariantCulture, member.Name), "member"); - } - } - - /// - /// Determines whether the specified MemberInfo can be read. - /// - /// The MemberInfo to determine whether can be read. - /// - /// true if the specified MemberInfo can be read; otherwise, false. - /// - public static bool CanReadMemberValue(MemberInfo member) - { - switch (member.MemberType) - { - case MemberTypes.Field: - return true; - case MemberTypes.Property: - return ((PropertyInfo)member).CanRead; - default: - return false; - } - } - - /// - /// Determines whether the specified MemberInfo can be set. - /// - /// The MemberInfo to determine whether can be set. - /// - /// true if the specified MemberInfo can be set; otherwise, false. - /// - public static bool CanSetMemberValue(MemberInfo member) - { - switch (member.MemberType) - { - case MemberTypes.Field: - return true; - case MemberTypes.Property: - return ((PropertyInfo)member).CanWrite; - default: - return false; - } - } - - public static List GetFieldsAndProperties(BindingFlags bindingAttr) - { - return GetFieldsAndProperties(typeof(T), bindingAttr); - } - - public static List GetFieldsAndProperties(Type type, BindingFlags bindingAttr) - { - List targetMembers = new List(); - - targetMembers.AddRange(type.GetFields(bindingAttr)); - targetMembers.AddRange(type.GetProperties(bindingAttr)); - - return targetMembers; - } - - public static T GetAttribute(ICustomAttributeProvider attributeProvider) where T : Attribute - { - return GetAttribute(attributeProvider, true); - } - - public static T GetAttribute(ICustomAttributeProvider attributeProvider, bool inherit) where T : Attribute - { - T[] attributes = GetAttributes(attributeProvider, inherit); - - return CollectionUtils.GetSingleItem(attributes, true); - } - - public static T[] GetAttributes(ICustomAttributeProvider attributeProvider, bool inherit) where T : Attribute - { - ValidationUtils.ArgumentNotNull(attributeProvider, "attributeProvider"); - - return (T[])attributeProvider.GetCustomAttributes(typeof(T), inherit); - } - - public static string GetNameAndAssessmblyName(Type t) - { - ValidationUtils.ArgumentNotNull(t, "t"); - - return t.FullName + ", " + t.Assembly.GetName().Name; - } - - public static List FindMembers(Type targetType, MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria) - { - ValidationUtils.ArgumentNotNull(targetType, "targetType"); - - List memberInfos = new List(targetType.FindMembers(memberType, bindingAttr, filter, filterCriteria)); - - // fix weirdness with FieldInfos only being returned for the current Type - // find base type fields and add them to result - if ((memberType & MemberTypes.Field) != 0 - && (bindingAttr & BindingFlags.NonPublic) != 0) - { - // modify flags to not search for public fields - BindingFlags nonPublicBindingAttr = bindingAttr ^ BindingFlags.Public; - - while ((targetType = targetType.BaseType) != null) - { - memberInfos.AddRange(targetType.FindMembers(MemberTypes.Field, nonPublicBindingAttr, filter, filterCriteria)); - } - } - - return memberInfos; - } - - public static Type MakeGenericType(Type genericTypeDefinition, params Type[] innerTypes) - { - ValidationUtils.ArgumentNotNull(genericTypeDefinition, "genericTypeDefinition"); - ValidationUtils.ArgumentNotNullOrEmpty(innerTypes, "innerTypes"); - ValidationUtils.ArgumentConditionTrue(genericTypeDefinition.IsGenericTypeDefinition, "genericTypeDefinition", "Type {0} is not a generic type definition.".FormatWith(CultureInfo.InvariantCulture, genericTypeDefinition)); - - return genericTypeDefinition.MakeGenericType(innerTypes); - } - - public static object CreateGeneric(Type genericTypeDefinition, Type innerType, params object[] args) - { - return CreateGeneric(genericTypeDefinition, new Type[] { innerType }, args); - } - - public static object CreateGeneric(Type genericTypeDefinition, IList innerTypes, params object[] args) - { - return CreateGeneric(genericTypeDefinition, innerTypes, (t, a) => Activator.CreateInstance(t, a.ToArray()), args); - } - - public static object CreateGeneric(Type genericTypeDefinition, IList innerTypes, Func, object> instanceCreator, params object[] args) - { - ValidationUtils.ArgumentNotNull(genericTypeDefinition, "genericTypeDefinition"); - ValidationUtils.ArgumentNotNullOrEmpty(innerTypes, "innerTypes"); - ValidationUtils.ArgumentNotNull(instanceCreator, "createInstance"); - - Type specificType = MakeGenericType(genericTypeDefinition, CollectionUtils.CreateArray(innerTypes)); - - return instanceCreator(specificType, args); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Collections; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal static class ReflectionUtils + { + public static Type GetObjectType(object v) + { + return (v != null) ? v.GetType() : null; + } + + public static bool IsInstantiatableType(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + if (t.IsAbstract || t.IsInterface || t.IsArray || t.IsGenericTypeDefinition || t == typeof(void)) + return false; + + if (!HasDefaultConstructor(t)) + return false; + + return true; + } + + public static bool HasDefaultConstructor(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + if (t.IsValueType) + return true; + + return (t.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null) != null); + } + + public static bool IsNullable(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + if (t.IsValueType) + return IsNullableType(t); + + return true; + } + + public static bool IsNullableType(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + return (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)); + } + + //public static bool IsValueTypeUnitializedValue(ValueType value) + //{ + // if (value == null) + // return true; + + // return value.Equals(CreateUnitializedValue(value.GetType())); + //} + + public static bool IsUnitializedValue(object value) + { + if (value == null) + { + return true; + } + else + { + object unitializedValue = CreateUnitializedValue(value.GetType()); + return value.Equals(unitializedValue); + } + } + + public static object CreateUnitializedValue(Type type) + { + ValidationUtils.ArgumentNotNull(type, "type"); + + if (type.IsGenericTypeDefinition) + throw new ArgumentException("Type {0} is a generic type definition and cannot be instantiated.".FormatWith(CultureInfo.InvariantCulture, type), "type"); + + if (type.IsClass || type.IsInterface || type == typeof(void)) + return null; + else if (type.IsValueType) + return Activator.CreateInstance(type); + else + throw new ArgumentException("Type {0} cannot be instantiated.".FormatWith(CultureInfo.InvariantCulture, type), "type"); + } + + public static bool IsPropertyIndexed(PropertyInfo property) + { + ValidationUtils.ArgumentNotNull(property, "property"); + + return !CollectionUtils.IsNullOrEmpty(property.GetIndexParameters()); + } + + public static bool IsSubClass(Type type, Type check) + { + Type implementingType; + return IsSubClass(type, check, out implementingType); + } + + public static bool IsSubClass(Type type, Type check, out Type implementingType) + { + ValidationUtils.ArgumentNotNull(type, "type"); + ValidationUtils.ArgumentNotNull(check, "check"); + + return IsSubClassInternal(type, type, check, out implementingType); + } + + private static bool IsSubClassInternal(Type initialType, Type currentType, Type check, out Type implementingType) + { + if (currentType == check) + { + implementingType = currentType; + return true; + } + + // don't get interfaces for an interface unless the initial type is an interface + if (check.IsInterface && (initialType.IsInterface || currentType == initialType)) + { + foreach (Type t in currentType.GetInterfaces()) + { + if (IsSubClassInternal(initialType, t, check, out implementingType)) + { + // don't return the interface itself, return it's implementor + if (check == implementingType) + implementingType = currentType; + + return true; + } + } + } + + if (currentType.IsGenericType && !currentType.IsGenericTypeDefinition) + { + if (IsSubClassInternal(initialType, currentType.GetGenericTypeDefinition(), check, out implementingType)) + { + implementingType = currentType; + return true; + } + } + + if (currentType.BaseType == null) + { + implementingType = null; + return false; + } + + return IsSubClassInternal(initialType, currentType.BaseType, check, out implementingType); + } + + /// + /// Gets the type of the typed list's items. + /// + /// The type. + /// The type of the typed list's items. + public static Type GetListItemType(Type type) + { + ValidationUtils.ArgumentNotNull(type, "type"); + Type genericListType; + + if (type.IsArray) + { + return type.GetElementType(); + } + else if (IsSubClass(type, typeof(IList<>), out genericListType)) + { + if (genericListType.IsGenericTypeDefinition) + throw new Exception("Type {0} is not a list.".FormatWith(CultureInfo.InvariantCulture, type)); + + return genericListType.GetGenericArguments()[0]; + } + else if (typeof(IList).IsAssignableFrom(type)) + { + return null; + } + else + { + throw new Exception("Type {0} is not a list.".FormatWith(CultureInfo.InvariantCulture, type)); + } + } + + private static void GetDictionaryKeyValueTypes(Type dictionaryType, out Type keyType, out Type valueType) + { + ValidationUtils.ArgumentNotNull(dictionaryType, "type"); + + Type genericDictionaryType; + if (IsSubClass(dictionaryType, typeof(IDictionary<,>), out genericDictionaryType)) + { + if (genericDictionaryType.IsGenericTypeDefinition) + throw new Exception("Type {0} is not a dictionary.".FormatWith(CultureInfo.InvariantCulture, dictionaryType)); + + Type[] dictionaryGenericArguments = genericDictionaryType.GetGenericArguments(); + + keyType = dictionaryGenericArguments[0]; + valueType = dictionaryGenericArguments[1]; + return; + } + else if (typeof(IDictionary).IsAssignableFrom(dictionaryType)) + { + keyType = null; + valueType = null; + return; + } + else + { + throw new Exception("Type {0} is not a dictionary.".FormatWith(CultureInfo.InvariantCulture, dictionaryType)); + } + } + + public static Type GetDictionaryValueType(Type dictionaryType) + { + Type keyType; + Type valueType; + GetDictionaryKeyValueTypes(dictionaryType, out keyType, out valueType); + + return valueType; + } + + public static Type GetDictionaryKeyType(Type dictionaryType) + { + Type keyType; + Type valueType; + GetDictionaryKeyValueTypes(dictionaryType, out keyType, out valueType); + + return keyType; + } + + /// + /// Tests whether the list's items are their unitialized value. + /// + /// The list. + /// Whether the list's items are their unitialized value + public static bool ItemsUnitializedValue(IList list) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + Type elementType = GetListItemType(list.GetType()); + + if (elementType.IsValueType) + { + object unitializedValue = CreateUnitializedValue(elementType); + + for (int i = 0; i < list.Count; i++) + { + if (!list[i].Equals(unitializedValue)) + return false; + } + } + else if (elementType.IsClass) + { + for (int i = 0; i < list.Count; i++) + { + object value = list[i]; + + if (value != null) + return false; + } + } + else + { + throw new Exception("Type {0} is neither a ValueType or a Class.".FormatWith(CultureInfo.InvariantCulture, elementType)); + } + + return true; + } + + /// + /// Gets the member's underlying type. + /// + /// The member. + /// The underlying type of the member. + public static Type GetMemberUnderlyingType(MemberInfo member) + { + ValidationUtils.ArgumentNotNull(member, "member"); + + switch (member.MemberType) + { + case MemberTypes.Field: + return ((FieldInfo)member).FieldType; + case MemberTypes.Property: + return ((PropertyInfo)member).PropertyType; + case MemberTypes.Event: + return ((EventInfo)member).EventHandlerType; + default: + throw new ArgumentException("MemberInfo must be if type FieldInfo, PropertyInfo or EventInfo", "member"); + } + } + + /// + /// Determines whether the member is an indexed property. + /// + /// The member. + /// + /// true if the member is an indexed property; otherwise, false. + /// + public static bool IsIndexedProperty(MemberInfo member) + { + ValidationUtils.ArgumentNotNull(member, "member"); + + PropertyInfo propertyInfo = member as PropertyInfo; + + if (propertyInfo != null) + return IsIndexedProperty(propertyInfo); + else + return false; + } + + /// + /// Determines whether the property is an indexed property. + /// + /// The property. + /// + /// true if the property is an indexed property; otherwise, false. + /// + public static bool IsIndexedProperty(PropertyInfo property) + { + ValidationUtils.ArgumentNotNull(property, "property"); + + return (property.GetIndexParameters().Length > 0); + } + + public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes) + { + return GetMember(type, name, memberTypes, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); + } + + public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes, BindingFlags bindingAttr) + { + ValidationUtils.ArgumentNotNull(type, "type"); + ValidationUtils.ArgumentNotNull(name, "name"); + + MemberInfo[] result = type.GetMember(name, memberTypes, bindingAttr); + + return CollectionUtils.GetSingleItem(result); + } + + /// + /// Gets the member's value on the object. + /// + /// The member. + /// The target object. + /// The member's value on the object. + public static object GetMemberValue(MemberInfo member, object target) + { + ValidationUtils.ArgumentNotNull(member, "member"); + ValidationUtils.ArgumentNotNull(target, "target"); + + switch (member.MemberType) + { + case MemberTypes.Field: + return ((FieldInfo)member).GetValue(target); + case MemberTypes.Property: + try + { + return ((PropertyInfo)member).GetValue(target, null); + } + catch (TargetParameterCountException e) + { + throw new ArgumentException("MemberInfo '{0}' has index parameters".FormatWith(CultureInfo.InvariantCulture, member.Name), "member", e); + } + default: + throw new ArgumentException("MemberInfo '{0}' is not of type FieldInfo or PropertyInfo".FormatWith(CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, member.Name), "member"); + } + } + + /// + /// Sets the member's value on the target object. + /// + /// The member. + /// The target. + /// The value. + public static void SetMemberValue(MemberInfo member, object target, object value) + { + ValidationUtils.ArgumentNotNull(member, "member"); + ValidationUtils.ArgumentNotNull(target, "target"); + + switch (member.MemberType) + { + case MemberTypes.Field: + ((FieldInfo)member).SetValue(target, value); + break; + case MemberTypes.Property: + ((PropertyInfo)member).SetValue(target, value, null); + break; + default: + throw new ArgumentException("MemberInfo '{0}' must be of type FieldInfo or PropertyInfo".FormatWith(CultureInfo.InvariantCulture, member.Name), "member"); + } + } + + /// + /// Determines whether the specified MemberInfo can be read. + /// + /// The MemberInfo to determine whether can be read. + /// + /// true if the specified MemberInfo can be read; otherwise, false. + /// + public static bool CanReadMemberValue(MemberInfo member) + { + switch (member.MemberType) + { + case MemberTypes.Field: + return true; + case MemberTypes.Property: + return ((PropertyInfo)member).CanRead; + default: + return false; + } + } + + /// + /// Determines whether the specified MemberInfo can be set. + /// + /// The MemberInfo to determine whether can be set. + /// + /// true if the specified MemberInfo can be set; otherwise, false. + /// + public static bool CanSetMemberValue(MemberInfo member) + { + switch (member.MemberType) + { + case MemberTypes.Field: + return true; + case MemberTypes.Property: + return ((PropertyInfo)member).CanWrite; + default: + return false; + } + } + + public static List GetFieldsAndProperties(BindingFlags bindingAttr) + { + return GetFieldsAndProperties(typeof(T), bindingAttr); + } + + public static List GetFieldsAndProperties(Type type, BindingFlags bindingAttr) + { + List targetMembers = new List(); + + targetMembers.AddRange(type.GetFields(bindingAttr)); + targetMembers.AddRange(type.GetProperties(bindingAttr)); + + return targetMembers; + } + + public static T GetAttribute(ICustomAttributeProvider attributeProvider) where T : Attribute + { + return GetAttribute(attributeProvider, true); + } + + public static T GetAttribute(ICustomAttributeProvider attributeProvider, bool inherit) where T : Attribute + { + T[] attributes = GetAttributes(attributeProvider, inherit); + + return CollectionUtils.GetSingleItem(attributes, true); + } + + public static T[] GetAttributes(ICustomAttributeProvider attributeProvider, bool inherit) where T : Attribute + { + ValidationUtils.ArgumentNotNull(attributeProvider, "attributeProvider"); + + return (T[])attributeProvider.GetCustomAttributes(typeof(T), inherit); + } + + public static string GetNameAndAssessmblyName(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + return t.FullName + ", " + t.Assembly.GetName().Name; + } + + public static List FindMembers(Type targetType, MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria) + { + ValidationUtils.ArgumentNotNull(targetType, "targetType"); + + List memberInfos = new List(targetType.FindMembers(memberType, bindingAttr, filter, filterCriteria)); + + // fix weirdness with FieldInfos only being returned for the current Type + // find base type fields and add them to result + if ((memberType & MemberTypes.Field) != 0 + && (bindingAttr & BindingFlags.NonPublic) != 0) + { + // modify flags to not search for public fields + BindingFlags nonPublicBindingAttr = bindingAttr ^ BindingFlags.Public; + + while ((targetType = targetType.BaseType) != null) + { + memberInfos.AddRange(targetType.FindMembers(MemberTypes.Field, nonPublicBindingAttr, filter, filterCriteria)); + } + } + + return memberInfos; + } + + public static Type MakeGenericType(Type genericTypeDefinition, params Type[] innerTypes) + { + ValidationUtils.ArgumentNotNull(genericTypeDefinition, "genericTypeDefinition"); + ValidationUtils.ArgumentNotNullOrEmpty(innerTypes, "innerTypes"); + ValidationUtils.ArgumentConditionTrue(genericTypeDefinition.IsGenericTypeDefinition, "genericTypeDefinition", "Type {0} is not a generic type definition.".FormatWith(CultureInfo.InvariantCulture, genericTypeDefinition)); + + return genericTypeDefinition.MakeGenericType(innerTypes); + } + + public static object CreateGeneric(Type genericTypeDefinition, Type innerType, params object[] args) + { + return CreateGeneric(genericTypeDefinition, new Type[] { innerType }, args); + } + + public static object CreateGeneric(Type genericTypeDefinition, IList innerTypes, params object[] args) + { + return CreateGeneric(genericTypeDefinition, innerTypes, (t, a) => Activator.CreateInstance(t, a.ToArray()), args); + } + + public static object CreateGeneric(Type genericTypeDefinition, IList innerTypes, Func, object> instanceCreator, params object[] args) + { + ValidationUtils.ArgumentNotNull(genericTypeDefinition, "genericTypeDefinition"); + ValidationUtils.ArgumentNotNullOrEmpty(innerTypes, "innerTypes"); + ValidationUtils.ArgumentNotNull(instanceCreator, "createInstance"); + + Type specificType = MakeGenericType(genericTypeDefinition, CollectionUtils.CreateArray(innerTypes)); + + return instanceCreator(specificType, args); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/StringUtils.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/StringUtils.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/StringUtils.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/StringUtils.cs index 5fb6195..5517dee 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/StringUtils.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/StringUtils.cs @@ -1,409 +1,409 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections.Generic; -using System.Data.SqlTypes; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Globalization; - -namespace Newtonsoft.Json.Utilities -{ - internal static class StringUtils - { - public const string CarriageReturnLineFeed = "\r\n"; - public const string Empty = ""; - public const char CarriageReturn = '\r'; - public const char LineFeed = '\n'; - public const char Tab = '\t'; - - //public static string FormatWith(this string format, params object[] args) - //{ - // return FormatWith(format, null, args); - //} - - public static string FormatWith(this string format, IFormatProvider provider, params object[] args) - { - ValidationUtils.ArgumentNotNull(format, "format"); - - return string.Format(provider, format, args); - } - - /// - /// Determines whether the string contains white space. - /// - /// The string to test for white space. - /// - /// true if the string contains white space; otherwise, false. - /// - public static bool ContainsWhiteSpace(string s) - { - if (s == null) - throw new ArgumentNullException("s"); - - for (int i = 0; i < s.Length; i++) - { - if (char.IsWhiteSpace(s[i])) - return true; - } - return false; - } - - /// - /// Determines whether the string is all white space. Empty string will return false. - /// - /// The string to test whether it is all white space. - /// - /// true if the string is all white space; otherwise, false. - /// - public static bool IsWhiteSpace(string s) - { - if (s == null) - throw new ArgumentNullException("s"); - - if (s.Length == 0) - return false; - - for (int i = 0; i < s.Length; i++) - { - if (!char.IsWhiteSpace(s[i])) - return false; - } - - return true; - } - - /// - /// Ensures the target string ends with the specified string. - /// - /// The target. - /// The value. - /// The target string with the value string at the end. - public static string EnsureEndsWith(string target, string value) - { - if (target == null) - throw new ArgumentNullException("target"); - - if (value == null) - throw new ArgumentNullException("value"); - - if (target.Length >= value.Length) - { - if (string.Compare(target, target.Length - value.Length, value, 0, value.Length, StringComparison.OrdinalIgnoreCase) == - 0) - return target; - - string trimmedString = target.TrimEnd(null); - - if (string.Compare(trimmedString, trimmedString.Length - value.Length, value, 0, value.Length, - StringComparison.OrdinalIgnoreCase) == 0) - return target; - } - - return target + value; - } - - /// - /// Determines whether the SqlString is null or empty. - /// - /// The string. - /// - /// true if the SqlString is null or empty; otherwise, false. - /// - public static bool IsNullOrEmpty(SqlString s) - { - if (s.IsNull) - return true; - else - return string.IsNullOrEmpty(s.Value); - } - - public static bool IsNullOrEmptyOrWhiteSpace(string s) - { - if (string.IsNullOrEmpty(s)) - return true; - else if (IsWhiteSpace(s)) - return true; - else - return false; - } - - /// - /// Perform an action if the string is not null or empty. - /// - /// The value. - /// The action to perform. - public static void IfNotNullOrEmpty(string value, Action action) - { - IfNotNullOrEmpty(value, action, null); - } - - private static void IfNotNullOrEmpty(string value, Action trueAction, Action falseAction) - { - if (!string.IsNullOrEmpty(value)) - { - if (trueAction != null) - trueAction(value); - } - else - { - if (falseAction != null) - falseAction(value); - } - } - - /// - /// Indents the specified string. - /// - /// The string to indent. - /// The number of characters to indent by. - /// - public static string Indent(string s, int indentation) - { - return Indent(s, indentation, ' '); - } - - /// - /// Indents the specified string. - /// - /// The string to indent. - /// The number of characters to indent by. - /// The indent character. - /// - public static string Indent(string s, int indentation, char indentChar) - { - if (s == null) - throw new ArgumentNullException("s"); - - if (indentation <= 0) - throw new ArgumentException("Must be greater than zero.", "indentation"); - - StringReader sr = new StringReader(s); - StringWriter sw = new StringWriter(CultureInfo.InvariantCulture); - - ActionTextReaderLine(sr, sw, delegate(TextWriter tw, string line) - { - tw.Write(new string(indentChar, indentation)); - tw.Write(line); - }); - - return sw.ToString(); - } - - private delegate void ActionLine(TextWriter textWriter, string line); - - private static void ActionTextReaderLine(TextReader textReader, TextWriter textWriter, ActionLine lineAction) - { - string line; - bool firstLine = true; - while ((line = textReader.ReadLine()) != null) - { - if (!firstLine) - textWriter.WriteLine(); - else - firstLine = false; - - lineAction(textWriter, line); - } - } - - /// - /// Numbers the lines. - /// - /// The string to number. - /// - public static string NumberLines(string s) - { - if (s == null) - throw new ArgumentNullException("s"); - - StringReader sr = new StringReader(s); - StringWriter sw = new StringWriter(CultureInfo.InvariantCulture); - - int lineNumber = 1; - - ActionTextReaderLine(sr, sw, delegate(TextWriter tw, string line) - { - tw.Write(lineNumber.ToString(CultureInfo.InvariantCulture).PadLeft(4)); - tw.Write(". "); - tw.Write(line); - - lineNumber++; - }); - - return sw.ToString(); - } - - /// - /// Nulls an empty string. - /// - /// The string. - /// Null if the string was null, otherwise the string unchanged. - public static string NullEmptyString(string s) - { - return (string.IsNullOrEmpty(s)) ? null : s; - } - - public static string ReplaceNewLines(string s, string replacement) - { - StringReader sr = new StringReader(s); - StringBuilder sb = new StringBuilder(); - - bool first = true; - - string line; - while ((line = sr.ReadLine()) != null) - { - if (first) - first = false; - else - sb.Append(replacement); - - sb.Append(line); - } - - return sb.ToString(); - } - - public static string RemoveHtml(string s) - { - return RemoveHtmlInternal(s, null); - } - - public static string RemoveHtml(string s, IList removeTags) - { - if (removeTags == null) - throw new ArgumentNullException("removeTags"); - - return RemoveHtmlInternal(s, removeTags); - } - - private static string RemoveHtmlInternal(string s, IList removeTags) - { - List removeTagsUpper = null; - - if (removeTags != null) - { - removeTagsUpper = new List(removeTags.Count); - - foreach (string tag in removeTags) - { - removeTagsUpper.Add(tag.ToUpperInvariant()); - } - } - - Regex anyTag = new Regex(@"<[/]{0,1}\s*(?\w*)\s*(?.*?=['""].*?[""'])*?\s*[/]{0,1}>", RegexOptions.Compiled); - - return anyTag.Replace(s, delegate(Match match) - { - string tag = match.Groups["tag"].Value.ToUpperInvariant(); - - if (removeTagsUpper == null) - return string.Empty; - else if (removeTagsUpper.Contains(tag)) - return string.Empty; - else - return match.Value; - }); - } - - public static string Truncate(string s, int maximumLength) - { - return Truncate(s, maximumLength, "..."); - } - - public static string Truncate(string s, int maximumLength, string suffix) - { - if (suffix == null) - throw new ArgumentNullException("suffix"); - - if (maximumLength <= 0) - throw new ArgumentException("Maximum length must be greater than zero.", "maximumLength"); - - int subStringLength = maximumLength - suffix.Length; - - if (subStringLength <= 0) - throw new ArgumentException("Length of suffix string is greater or equal to maximumLength"); - - if (s != null && s.Length > maximumLength) - { - string truncatedString = s.Substring(0, subStringLength); - // incase the last character is a space - truncatedString = truncatedString.Trim(); - truncatedString += suffix; - - return truncatedString; - } - else - { - return s; - } - } - - public static StringWriter CreateStringWriter(int capacity) - { - StringBuilder sb = new StringBuilder(capacity); - StringWriter sw = new StringWriter(sb, CultureInfo.InvariantCulture); - - return sw; - } - - public static int? GetLength(string value) - { - if (value == null) - return null; - else - return value.Length; - } - - public static string ToCharAsUnicode(char c) - { - using (StringWriter w = new StringWriter(CultureInfo.InvariantCulture)) - { - WriteCharAsUnicode(w, c); - return w.ToString(); - } - } - - public static void WriteCharAsUnicode(TextWriter writer, char c) - { - ValidationUtils.ArgumentNotNull(writer, "writer"); - - char h1 = MathUtils.IntToHex((c >> 12) & '\x000f'); - char h2 = MathUtils.IntToHex((c >> 8) & '\x000f'); - char h3 = MathUtils.IntToHex((c >> 4) & '\x000f'); - char h4 = MathUtils.IntToHex(c & '\x000f'); - - writer.Write('\\'); - writer.Write('u'); - writer.Write(h1); - writer.Write(h2); - writer.Write(h3); - writer.Write(h4); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Data.SqlTypes; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal static class StringUtils + { + public const string CarriageReturnLineFeed = "\r\n"; + public const string Empty = ""; + public const char CarriageReturn = '\r'; + public const char LineFeed = '\n'; + public const char Tab = '\t'; + + //public static string FormatWith(this string format, params object[] args) + //{ + // return FormatWith(format, null, args); + //} + + public static string FormatWith(this string format, IFormatProvider provider, params object[] args) + { + ValidationUtils.ArgumentNotNull(format, "format"); + + return string.Format(provider, format, args); + } + + /// + /// Determines whether the string contains white space. + /// + /// The string to test for white space. + /// + /// true if the string contains white space; otherwise, false. + /// + public static bool ContainsWhiteSpace(string s) + { + if (s == null) + throw new ArgumentNullException("s"); + + for (int i = 0; i < s.Length; i++) + { + if (char.IsWhiteSpace(s[i])) + return true; + } + return false; + } + + /// + /// Determines whether the string is all white space. Empty string will return false. + /// + /// The string to test whether it is all white space. + /// + /// true if the string is all white space; otherwise, false. + /// + public static bool IsWhiteSpace(string s) + { + if (s == null) + throw new ArgumentNullException("s"); + + if (s.Length == 0) + return false; + + for (int i = 0; i < s.Length; i++) + { + if (!char.IsWhiteSpace(s[i])) + return false; + } + + return true; + } + + /// + /// Ensures the target string ends with the specified string. + /// + /// The target. + /// The value. + /// The target string with the value string at the end. + public static string EnsureEndsWith(string target, string value) + { + if (target == null) + throw new ArgumentNullException("target"); + + if (value == null) + throw new ArgumentNullException("value"); + + if (target.Length >= value.Length) + { + if (string.Compare(target, target.Length - value.Length, value, 0, value.Length, StringComparison.OrdinalIgnoreCase) == + 0) + return target; + + string trimmedString = target.TrimEnd(null); + + if (string.Compare(trimmedString, trimmedString.Length - value.Length, value, 0, value.Length, + StringComparison.OrdinalIgnoreCase) == 0) + return target; + } + + return target + value; + } + + /// + /// Determines whether the SqlString is null or empty. + /// + /// The string. + /// + /// true if the SqlString is null or empty; otherwise, false. + /// + public static bool IsNullOrEmpty(SqlString s) + { + if (s.IsNull) + return true; + else + return string.IsNullOrEmpty(s.Value); + } + + public static bool IsNullOrEmptyOrWhiteSpace(string s) + { + if (string.IsNullOrEmpty(s)) + return true; + else if (IsWhiteSpace(s)) + return true; + else + return false; + } + + /// + /// Perform an action if the string is not null or empty. + /// + /// The value. + /// The action to perform. + public static void IfNotNullOrEmpty(string value, Action action) + { + IfNotNullOrEmpty(value, action, null); + } + + private static void IfNotNullOrEmpty(string value, Action trueAction, Action falseAction) + { + if (!string.IsNullOrEmpty(value)) + { + if (trueAction != null) + trueAction(value); + } + else + { + if (falseAction != null) + falseAction(value); + } + } + + /// + /// Indents the specified string. + /// + /// The string to indent. + /// The number of characters to indent by. + /// + public static string Indent(string s, int indentation) + { + return Indent(s, indentation, ' '); + } + + /// + /// Indents the specified string. + /// + /// The string to indent. + /// The number of characters to indent by. + /// The indent character. + /// + public static string Indent(string s, int indentation, char indentChar) + { + if (s == null) + throw new ArgumentNullException("s"); + + if (indentation <= 0) + throw new ArgumentException("Must be greater than zero.", "indentation"); + + StringReader sr = new StringReader(s); + StringWriter sw = new StringWriter(CultureInfo.InvariantCulture); + + ActionTextReaderLine(sr, sw, delegate(TextWriter tw, string line) + { + tw.Write(new string(indentChar, indentation)); + tw.Write(line); + }); + + return sw.ToString(); + } + + private delegate void ActionLine(TextWriter textWriter, string line); + + private static void ActionTextReaderLine(TextReader textReader, TextWriter textWriter, ActionLine lineAction) + { + string line; + bool firstLine = true; + while ((line = textReader.ReadLine()) != null) + { + if (!firstLine) + textWriter.WriteLine(); + else + firstLine = false; + + lineAction(textWriter, line); + } + } + + /// + /// Numbers the lines. + /// + /// The string to number. + /// + public static string NumberLines(string s) + { + if (s == null) + throw new ArgumentNullException("s"); + + StringReader sr = new StringReader(s); + StringWriter sw = new StringWriter(CultureInfo.InvariantCulture); + + int lineNumber = 1; + + ActionTextReaderLine(sr, sw, delegate(TextWriter tw, string line) + { + tw.Write(lineNumber.ToString(CultureInfo.InvariantCulture).PadLeft(4)); + tw.Write(". "); + tw.Write(line); + + lineNumber++; + }); + + return sw.ToString(); + } + + /// + /// Nulls an empty string. + /// + /// The string. + /// Null if the string was null, otherwise the string unchanged. + public static string NullEmptyString(string s) + { + return (string.IsNullOrEmpty(s)) ? null : s; + } + + public static string ReplaceNewLines(string s, string replacement) + { + StringReader sr = new StringReader(s); + StringBuilder sb = new StringBuilder(); + + bool first = true; + + string line; + while ((line = sr.ReadLine()) != null) + { + if (first) + first = false; + else + sb.Append(replacement); + + sb.Append(line); + } + + return sb.ToString(); + } + + public static string RemoveHtml(string s) + { + return RemoveHtmlInternal(s, null); + } + + public static string RemoveHtml(string s, IList removeTags) + { + if (removeTags == null) + throw new ArgumentNullException("removeTags"); + + return RemoveHtmlInternal(s, removeTags); + } + + private static string RemoveHtmlInternal(string s, IList removeTags) + { + List removeTagsUpper = null; + + if (removeTags != null) + { + removeTagsUpper = new List(removeTags.Count); + + foreach (string tag in removeTags) + { + removeTagsUpper.Add(tag.ToUpperInvariant()); + } + } + + Regex anyTag = new Regex(@"<[/]{0,1}\s*(?\w*)\s*(?.*?=['""].*?[""'])*?\s*[/]{0,1}>", RegexOptions.Compiled); + + return anyTag.Replace(s, delegate(Match match) + { + string tag = match.Groups["tag"].Value.ToUpperInvariant(); + + if (removeTagsUpper == null) + return string.Empty; + else if (removeTagsUpper.Contains(tag)) + return string.Empty; + else + return match.Value; + }); + } + + public static string Truncate(string s, int maximumLength) + { + return Truncate(s, maximumLength, "..."); + } + + public static string Truncate(string s, int maximumLength, string suffix) + { + if (suffix == null) + throw new ArgumentNullException("suffix"); + + if (maximumLength <= 0) + throw new ArgumentException("Maximum length must be greater than zero.", "maximumLength"); + + int subStringLength = maximumLength - suffix.Length; + + if (subStringLength <= 0) + throw new ArgumentException("Length of suffix string is greater or equal to maximumLength"); + + if (s != null && s.Length > maximumLength) + { + string truncatedString = s.Substring(0, subStringLength); + // incase the last character is a space + truncatedString = truncatedString.Trim(); + truncatedString += suffix; + + return truncatedString; + } + else + { + return s; + } + } + + public static StringWriter CreateStringWriter(int capacity) + { + StringBuilder sb = new StringBuilder(capacity); + StringWriter sw = new StringWriter(sb, CultureInfo.InvariantCulture); + + return sw; + } + + public static int? GetLength(string value) + { + if (value == null) + return null; + else + return value.Length; + } + + public static string ToCharAsUnicode(char c) + { + using (StringWriter w = new StringWriter(CultureInfo.InvariantCulture)) + { + WriteCharAsUnicode(w, c); + return w.ToString(); + } + } + + public static void WriteCharAsUnicode(TextWriter writer, char c) + { + ValidationUtils.ArgumentNotNull(writer, "writer"); + + char h1 = MathUtils.IntToHex((c >> 12) & '\x000f'); + char h2 = MathUtils.IntToHex((c >> 8) & '\x000f'); + char h3 = MathUtils.IntToHex((c >> 4) & '\x000f'); + char h4 = MathUtils.IntToHex(c & '\x000f'); + + writer.Write('\\'); + writer.Write('u'); + writer.Write(h1); + writer.Write(h2); + writer.Write(h3); + writer.Write(h4); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/ValidationUtils.cs b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/ValidationUtils.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/ValidationUtils.cs rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/ValidationUtils.cs index 9796fb6..1d4d723 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/Utilities/ValidationUtils.cs +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/Utilities/ValidationUtils.cs @@ -1,149 +1,149 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.Globalization; - -namespace Newtonsoft.Json.Utilities -{ - internal static class ValidationUtils - { - public const string EmailAddressRegex = @"^([a-zA-Z0-9_'+*$%\^&!\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9:]{2,4})+$"; - public const string CurrencyRegex = @"(^\$?(?!0,?\d)\d{1,3}(,?\d{3})*(\.\d\d)?)$"; - public const string DateRegex = - @"^(((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00|[048])))$"; - public const string NumericRegex = @"\d*"; - - public static void ArgumentNotNullOrEmpty(string value, string parameterName) - { - if (value == null) - throw new ArgumentNullException(parameterName); - - if (value.Length == 0) - throw new ArgumentException("'{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName), parameterName); - } - - public static void ArgumentNotNullOrEmptyOrWhitespace(string value, string parameterName) - { - ArgumentNotNullOrEmpty(value, parameterName); - - if (StringUtils.IsWhiteSpace(value)) - throw new ArgumentException("'{0}' cannot only be whitespace.".FormatWith(CultureInfo.InvariantCulture, parameterName), parameterName); - } - - public static void ArgumentTypeIsEnum(Type enumType, string parameterName) - { - ArgumentNotNull(enumType, "enumType"); - - if (!enumType.IsEnum) - throw new ArgumentException("Type {0} is not an Enum.".FormatWith(CultureInfo.InvariantCulture, enumType), parameterName); - } - - public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName) - { - ArgumentNotNullOrEmpty(collection, parameterName, "Collection '{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName)); - } - - public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName, string message) - { - if (collection == null) - throw new ArgumentNullException(parameterName); - - if (collection.Count == 0) - throw new ArgumentException(message, parameterName); - } - - public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName) - { - ArgumentNotNullOrEmpty(collection, parameterName, "Collection '{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName)); - } - - public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName, string message) - { - if (collection == null) - throw new ArgumentNullException(parameterName); - - if (collection.Count == 0) - throw new ArgumentException(message, parameterName); - } - - public static void ArgumentNotNull(object value, string parameterName) - { - if (value == null) - throw new ArgumentNullException(parameterName); - } - - public static void ArgumentNotNegative(int value, string parameterName) - { - if (value <= 0) - throw new ArgumentOutOfRangeException(parameterName, value, "Argument cannot be negative."); - } - - public static void ArgumentNotNegative(int value, string parameterName, string message) - { - if (value <= 0) - throw new ArgumentOutOfRangeException(parameterName, value, message); - } - - public static void ArgumentNotZero(int value, string parameterName) - { - if (value == 0) - throw new ArgumentOutOfRangeException(parameterName, value, "Argument cannot be zero."); - } - - public static void ArgumentNotZero(int value, string parameterName, string message) - { - if (value == 0) - throw new ArgumentOutOfRangeException(parameterName, value, message); - } - - public static void ArgumentIsPositive(T value, string parameterName) where T : struct, IComparable - { - if (value.CompareTo(default(T)) != 1) - throw new ArgumentOutOfRangeException(parameterName, value, "Positive number required."); - } - - public static void ArgumentIsPositive(int value, string parameterName, string message) - { - if (value > 0) - throw new ArgumentOutOfRangeException(parameterName, value, message); - } - - public static void ObjectNotDisposed(bool disposed, Type objectType) - { - if (disposed) - throw new ObjectDisposedException(objectType.Name); - } - - public static void ArgumentConditionTrue(bool condition, string parameterName, string message) - { - if (!condition) - throw new ArgumentException(message, parameterName); - } - } +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal static class ValidationUtils + { + public const string EmailAddressRegex = @"^([a-zA-Z0-9_'+*$%\^&!\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9:]{2,4})+$"; + public const string CurrencyRegex = @"(^\$?(?!0,?\d)\d{1,3}(,?\d{3})*(\.\d\d)?)$"; + public const string DateRegex = + @"^(((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00|[048])))$"; + public const string NumericRegex = @"\d*"; + + public static void ArgumentNotNullOrEmpty(string value, string parameterName) + { + if (value == null) + throw new ArgumentNullException(parameterName); + + if (value.Length == 0) + throw new ArgumentException("'{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName), parameterName); + } + + public static void ArgumentNotNullOrEmptyOrWhitespace(string value, string parameterName) + { + ArgumentNotNullOrEmpty(value, parameterName); + + if (StringUtils.IsWhiteSpace(value)) + throw new ArgumentException("'{0}' cannot only be whitespace.".FormatWith(CultureInfo.InvariantCulture, parameterName), parameterName); + } + + public static void ArgumentTypeIsEnum(Type enumType, string parameterName) + { + ArgumentNotNull(enumType, "enumType"); + + if (!enumType.IsEnum) + throw new ArgumentException("Type {0} is not an Enum.".FormatWith(CultureInfo.InvariantCulture, enumType), parameterName); + } + + public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName) + { + ArgumentNotNullOrEmpty(collection, parameterName, "Collection '{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName)); + } + + public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName, string message) + { + if (collection == null) + throw new ArgumentNullException(parameterName); + + if (collection.Count == 0) + throw new ArgumentException(message, parameterName); + } + + public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName) + { + ArgumentNotNullOrEmpty(collection, parameterName, "Collection '{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName)); + } + + public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName, string message) + { + if (collection == null) + throw new ArgumentNullException(parameterName); + + if (collection.Count == 0) + throw new ArgumentException(message, parameterName); + } + + public static void ArgumentNotNull(object value, string parameterName) + { + if (value == null) + throw new ArgumentNullException(parameterName); + } + + public static void ArgumentNotNegative(int value, string parameterName) + { + if (value <= 0) + throw new ArgumentOutOfRangeException(parameterName, value, "Argument cannot be negative."); + } + + public static void ArgumentNotNegative(int value, string parameterName, string message) + { + if (value <= 0) + throw new ArgumentOutOfRangeException(parameterName, value, message); + } + + public static void ArgumentNotZero(int value, string parameterName) + { + if (value == 0) + throw new ArgumentOutOfRangeException(parameterName, value, "Argument cannot be zero."); + } + + public static void ArgumentNotZero(int value, string parameterName, string message) + { + if (value == 0) + throw new ArgumentOutOfRangeException(parameterName, value, message); + } + + public static void ArgumentIsPositive(T value, string parameterName) where T : struct, IComparable + { + if (value.CompareTo(default(T)) != 1) + throw new ArgumentOutOfRangeException(parameterName, value, "Positive number required."); + } + + public static void ArgumentIsPositive(int value, string parameterName, string message) + { + if (value > 0) + throw new ArgumentOutOfRangeException(parameterName, value, message); + } + + public static void ObjectNotDisposed(bool disposed, Type objectType) + { + if (disposed) + throw new ObjectDisposedException(objectType.Name); + } + + public static void ArgumentConditionTrue(bool condition, string parameterName, string message) + { + if (!condition) + throw new ArgumentException(message, parameterName); + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/Newtonsoft.Json.xml b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.XML old mode 100755 new mode 100644 similarity index 100% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/Newtonsoft.Json.xml rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.XML diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll similarity index 100% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.CodeAnalysisLog.xml b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.CodeAnalysisLog.xml similarity index 99% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.CodeAnalysisLog.xml rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.CodeAnalysisLog.xml index 86bdeea..cf6330b 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.CodeAnalysisLog.xml +++ b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.CodeAnalysisLog.xml @@ -1,589 +1,589 @@ - - - - - - - - - - - - - - - - In externally visible method 'Identifier.Equals(Identifier)', validate parameter 'function' before using it. - - - - - - - - - - - Member 'JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - In method 'JavaScriptConvert.DeserializeObject(string, Type, params JsonConverter[])', object 'sr' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. - - - In externally visible method 'JavaScriptConvert.DeserializeObject(string, Type, params JsonConverter[])', validate parameter 'converters' before using it. - - - - - - - In method 'JavaScriptConvert.SerializeObject(object, params JsonConverter[])', object 'sw' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'sw' before all references to it are out of scope. - - - In externally visible method 'JavaScriptConvert.SerializeObject(object, params JsonConverter[])', validate parameter 'converters' before using it. - - - - - - - Member 'JavaScriptConvert.ToString(DateTime)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - Member 'JavaScriptConvert.ToString(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - In externally visible method 'JavaScriptConvert.ToString(Enum)', validate parameter 'value' before using it. - - - - - - - Member 'JavaScriptConvert.ToString(object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - Member 'JavaScriptConvert.ToStringInternal(DateTimeOffset, DateTimeKind)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - - - - - Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Not a valid close JsonToken: "'. - - - - - - - Correct the spelling of the unrecognized token 'JsonType' in the literal '"While setting the reader state back to current object an unexpected JsonType was..."'. - - - - - - - - - - - Correct the spelling of the unrecognized token 'seralizable' in the literal '"Null collection of seralizable members returned."'. - - - - - - - Member 'JsonSerializer.EnsureType(object, Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - Member 'JsonSerializer.SerializeValue(JsonWriter, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - - - - - Correct the spelling of the unrecognized token 'encoutered' in the literal '"After parsing a value an unexpected character was encoutered: "'. - - - - - - - - - - - Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Invalid JsonToken: "'. - - - - - - - Member 'JsonTextWriter.WriteValue(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - - - - - Correct the spelling of the unrecognized token 'JsonType' in the literal '"Unknown JsonType: "'. - - - - - - - Member 'JsonWriter.WriteValue(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - - - - - - - - - In externally visible method 'HtmlColorConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. - - - - - - - - - - - Member 'IsoDateTimeConverter.CanConvert(Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - Member 'IsoDateTimeConverter.ReadJson(JsonReader, Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - In externally visible method 'IsoDateTimeConverter.ReadJson(JsonReader, Type)', validate parameter 'reader' before using it. - - - - - - - Member 'IsoDateTimeConverter.WriteJson(JsonWriter, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - In externally visible method 'IsoDateTimeConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. - - - - - - - - - - - Member 'JavaScriptDateTimeConverter.CanConvert(Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - Member 'JavaScriptDateTimeConverter.ReadJson(JsonReader, Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - In externally visible method 'JavaScriptDateTimeConverter.ReadJson(JsonReader, Type)', validate parameter 'reader' before using it. - - - - - - - Member 'JavaScriptDateTimeConverter.WriteJson(JsonWriter, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - In externally visible method 'JavaScriptDateTimeConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. - - - - - - - - - - - Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Unexpected JsonToken when deserializing node: "'. - - - - - - - Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Unexpected JsonToken: "'. - - - Correct the spelling of the unrecognized token 'XmlDeclaration' in the literal '"Unexpected property name encountered while deserializing XmlDeclaration: "'. - - - - - - - Correct the spelling of the unrecognized token 'XmlNodeType' in the literal '"Unexpected XmlNodeType when getting node name: "'. - - - - - - - Correct the spelling of the unrecognized token 'XmlDocuments' in the literal '"XmlNodeConverter only supports deserializing XmlDocuments"'. - - - Correct the spelling of the unrecognized token 'XmlNodeConverter' in the literal '"XmlNodeConverter can only convert JSON that begins with an object."'. - Correct the spelling of the unrecognized token 'XmlNodeConverter' in the literal '"XmlNodeConverter only supports deserializing XmlDocuments"'. - - - In externally visible method 'XmlNodeConverter.ReadJson(JsonReader, Type)', validate parameter 'reader' before using it. - - - - - - - Correct the spelling of the unrecognized token 'XmlNodeType' in the literal '"Unexpected XmlNodeType when serializing nodes: "'. - - - - - - - In externally visible method 'XmlNodeConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. - - - - - - - - - - - - - - - Correct the spelling of the unrecognized token 'JArray' in the literal '"Error reading JArray from JsonReader."'. - Correct the spelling of the unrecognized token 'JArray' in the literal '"Error reading JArray from JsonReader."'. - - - Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Current JsonReader item is not an object."'. - Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JArray from JsonReader."'. - Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JArray from JsonReader."'. - - - In externally visible method 'JArray.Load(JsonReader)', validate parameter 'reader' before using it. - - - - - - - In method 'JArray.Parse(string)', call System.IDisposable.Dispose on object 'new StringReader(json)' before all references to it are out of scope. - - - - - - - In externally visible method 'JArray.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. - - - - - - - - - - - In externally visible method 'JConstructor.JConstructor(JConstructor)', validate parameter 'other' before using it. - - - - - - - In externally visible method 'JConstructor.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. - - - - - - - - - - - Correct the spelling of the unrecognized token 'JObject' in the literal '"Error reading JObject from JsonReader."'. - Correct the spelling of the unrecognized token 'JObject' in the literal '"Error reading JObject from JsonReader."'. - - - Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Current JsonReader item is not an object."'. - Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JObject from JsonReader."'. - Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JObject from JsonReader."'. - - - - - - - In method 'JObject.Parse(string)', call System.IDisposable.Dispose on object 'new StringReader(json)' before all references to it are out of scope. - - - - - - - In externally visible method 'JObject.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. - - - - - - - - - - - In externally visible method 'JProperty.JProperty(JProperty)', validate parameter 'other' before using it. - - - - - - - In externally visible method 'JProperty.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. - - - - - - - - - - - Member 'JsonTokenWriter.WriteValue(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - - - - - Member 'JToken.explicit operator DateTimeOffset(JToken)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - Member 'JToken.explicit operator DateTimeOffset?(JToken)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - - - - - In externally visible method 'JValue.JValue(JValue)', validate parameter 'other' before using it. - - - - - - - Member 'JValue.GetValueType(JsonTokenType?, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - - - - - Member 'JValue.WriteTo(JsonWriter, params JsonConverter[])' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. - - - In externally visible method 'JValue.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. - - - - - - - - - - - - - - - In externally visible method 'DictionaryWrapper<TKey, TValue>.CopyTo(KeyValuePair<TKey, TValue>[], int)', validate parameter 'array' before using it. - - - - - - - - - - - In method 'StringUtils.Indent(string, int, char)', call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. - In method 'StringUtils.Indent(string, int, char)', call System.IDisposable.Dispose on object 'sw' before all references to it are out of scope. - - - - - - - In method 'StringUtils.NumberLines(string)', call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. - In method 'StringUtils.NumberLines(string)', call System.IDisposable.Dispose on object 'sw' before all references to it are out of scope. - - - - - - - In method 'StringUtils.ReplaceNewLines(string, string)', call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. - - - - - - - - - - - - - - - Dispose objects before losing scope - If a disposable object is not explicitly disposed before all references to it are out of scope, the object will be disposed at some indeterminate time when the garbage collector runs the finalizer of the object. Because an exceptional event might occur that will prevent the finalizer of the object from running, the object should be explicitly disposed instead. - In method {0}, object {1} is not disposed along all exception paths. Call System.IDisposable.Dispose on object {1} before all references to it are out of scope. - In method {0}, call System.IDisposable.Dispose on object {1} before all references to it are out of scope. - RuleOwner - http://msdn.microsoft.com/library/ms182289.aspx - - Warning - - - - Literals should be spelled correctly - This rule parses the literal string into words, tokenizing compound words, and checks the spelling of each word/token. - Correct the spelling of the unrecognized token '{0}' in the literal '{1}'. - RuleOwner - http://msdn.microsoft.com/library/bb264488.aspx - - Warning - - - - Use only API from targeted framework - - Member {0} uses type {1}. Because this type was introduced in {2}, which was not included in the project's target framework, {3}, your application may fail to run on systems without this service pack installed. - - http://msdn.microsoft.com/library/cc667408(VS.100).aspx - [none] - Error - - - - Validate arguments of public methods - All reference arguments passed to externally visible methods should be checked against null (Nothing in VB). If appropriate, throw a System.ArgumentNullException when the argument is null. - In externally visible method {0}, validate parameter '{1}' before using it. - RuleOwner - http://msdn.microsoft.com/library/ms182182.aspx - - Warning - - - - - Category - Certainty - Collapse All - Check Id - Error - error(s) - Expand All - Help - Line - message(s) - [Location not stored in Pdb] - Project - Resolution - Rule - Rule File - Rule Description - Source - Status - Target - Warning - warning(s) - Code Analysis Report - - + + + + + + + + + + + + + + + + In externally visible method 'Identifier.Equals(Identifier)', validate parameter 'function' before using it. + + + + + + + + + + + Member 'JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + In method 'JavaScriptConvert.DeserializeObject(string, Type, params JsonConverter[])', object 'sr' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. + + + In externally visible method 'JavaScriptConvert.DeserializeObject(string, Type, params JsonConverter[])', validate parameter 'converters' before using it. + + + + + + + In method 'JavaScriptConvert.SerializeObject(object, params JsonConverter[])', object 'sw' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'sw' before all references to it are out of scope. + + + In externally visible method 'JavaScriptConvert.SerializeObject(object, params JsonConverter[])', validate parameter 'converters' before using it. + + + + + + + Member 'JavaScriptConvert.ToString(DateTime)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JavaScriptConvert.ToString(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + In externally visible method 'JavaScriptConvert.ToString(Enum)', validate parameter 'value' before using it. + + + + + + + Member 'JavaScriptConvert.ToString(object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JavaScriptConvert.ToStringInternal(DateTimeOffset, DateTimeKind)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Not a valid close JsonToken: "'. + + + + + + + Correct the spelling of the unrecognized token 'JsonType' in the literal '"While setting the reader state back to current object an unexpected JsonType was..."'. + + + + + + + + + + + Correct the spelling of the unrecognized token 'seralizable' in the literal '"Null collection of seralizable members returned."'. + + + + + + + Member 'JsonSerializer.EnsureType(object, Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JsonSerializer.SerializeValue(JsonWriter, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + Correct the spelling of the unrecognized token 'encoutered' in the literal '"After parsing a value an unexpected character was encoutered: "'. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Invalid JsonToken: "'. + + + + + + + Member 'JsonTextWriter.WriteValue(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JsonType' in the literal '"Unknown JsonType: "'. + + + + + + + Member 'JsonWriter.WriteValue(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + + + + + In externally visible method 'HtmlColorConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. + + + + + + + + + + + Member 'IsoDateTimeConverter.CanConvert(Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'IsoDateTimeConverter.ReadJson(JsonReader, Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'IsoDateTimeConverter.ReadJson(JsonReader, Type)', validate parameter 'reader' before using it. + + + + + + + Member 'IsoDateTimeConverter.WriteJson(JsonWriter, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'IsoDateTimeConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. + + + + + + + + + + + Member 'JavaScriptDateTimeConverter.CanConvert(Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JavaScriptDateTimeConverter.ReadJson(JsonReader, Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'JavaScriptDateTimeConverter.ReadJson(JsonReader, Type)', validate parameter 'reader' before using it. + + + + + + + Member 'JavaScriptDateTimeConverter.WriteJson(JsonWriter, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'JavaScriptDateTimeConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Unexpected JsonToken when deserializing node: "'. + + + + + + + Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Unexpected JsonToken: "'. + + + Correct the spelling of the unrecognized token 'XmlDeclaration' in the literal '"Unexpected property name encountered while deserializing XmlDeclaration: "'. + + + + + + + Correct the spelling of the unrecognized token 'XmlNodeType' in the literal '"Unexpected XmlNodeType when getting node name: "'. + + + + + + + Correct the spelling of the unrecognized token 'XmlDocuments' in the literal '"XmlNodeConverter only supports deserializing XmlDocuments"'. + + + Correct the spelling of the unrecognized token 'XmlNodeConverter' in the literal '"XmlNodeConverter can only convert JSON that begins with an object."'. + Correct the spelling of the unrecognized token 'XmlNodeConverter' in the literal '"XmlNodeConverter only supports deserializing XmlDocuments"'. + + + In externally visible method 'XmlNodeConverter.ReadJson(JsonReader, Type)', validate parameter 'reader' before using it. + + + + + + + Correct the spelling of the unrecognized token 'XmlNodeType' in the literal '"Unexpected XmlNodeType when serializing nodes: "'. + + + + + + + In externally visible method 'XmlNodeConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. + + + + + + + + + + + + + + + Correct the spelling of the unrecognized token 'JArray' in the literal '"Error reading JArray from JsonReader."'. + Correct the spelling of the unrecognized token 'JArray' in the literal '"Error reading JArray from JsonReader."'. + + + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Current JsonReader item is not an object."'. + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JArray from JsonReader."'. + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JArray from JsonReader."'. + + + In externally visible method 'JArray.Load(JsonReader)', validate parameter 'reader' before using it. + + + + + + + In method 'JArray.Parse(string)', call System.IDisposable.Dispose on object 'new StringReader(json)' before all references to it are out of scope. + + + + + + + In externally visible method 'JArray.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + In externally visible method 'JConstructor.JConstructor(JConstructor)', validate parameter 'other' before using it. + + + + + + + In externally visible method 'JConstructor.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JObject' in the literal '"Error reading JObject from JsonReader."'. + Correct the spelling of the unrecognized token 'JObject' in the literal '"Error reading JObject from JsonReader."'. + + + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Current JsonReader item is not an object."'. + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JObject from JsonReader."'. + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JObject from JsonReader."'. + + + + + + + In method 'JObject.Parse(string)', call System.IDisposable.Dispose on object 'new StringReader(json)' before all references to it are out of scope. + + + + + + + In externally visible method 'JObject.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + In externally visible method 'JProperty.JProperty(JProperty)', validate parameter 'other' before using it. + + + + + + + In externally visible method 'JProperty.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + Member 'JsonTokenWriter.WriteValue(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + Member 'JToken.explicit operator DateTimeOffset(JToken)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JToken.explicit operator DateTimeOffset?(JToken)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + In externally visible method 'JValue.JValue(JValue)', validate parameter 'other' before using it. + + + + + + + Member 'JValue.GetValueType(JsonTokenType?, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JValue.WriteTo(JsonWriter, params JsonConverter[])' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'JValue.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + + + + + In externally visible method 'DictionaryWrapper<TKey, TValue>.CopyTo(KeyValuePair<TKey, TValue>[], int)', validate parameter 'array' before using it. + + + + + + + + + + + In method 'StringUtils.Indent(string, int, char)', call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. + In method 'StringUtils.Indent(string, int, char)', call System.IDisposable.Dispose on object 'sw' before all references to it are out of scope. + + + + + + + In method 'StringUtils.NumberLines(string)', call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. + In method 'StringUtils.NumberLines(string)', call System.IDisposable.Dispose on object 'sw' before all references to it are out of scope. + + + + + + + In method 'StringUtils.ReplaceNewLines(string, string)', call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. + + + + + + + + + + + + + + + Dispose objects before losing scope + If a disposable object is not explicitly disposed before all references to it are out of scope, the object will be disposed at some indeterminate time when the garbage collector runs the finalizer of the object. Because an exceptional event might occur that will prevent the finalizer of the object from running, the object should be explicitly disposed instead. + In method {0}, object {1} is not disposed along all exception paths. Call System.IDisposable.Dispose on object {1} before all references to it are out of scope. + In method {0}, call System.IDisposable.Dispose on object {1} before all references to it are out of scope. + RuleOwner + http://msdn.microsoft.com/library/ms182289.aspx + + Warning + + + + Literals should be spelled correctly + This rule parses the literal string into words, tokenizing compound words, and checks the spelling of each word/token. + Correct the spelling of the unrecognized token '{0}' in the literal '{1}'. + RuleOwner + http://msdn.microsoft.com/library/bb264488.aspx + + Warning + + + + Use only API from targeted framework + + Member {0} uses type {1}. Because this type was introduced in {2}, which was not included in the project's target framework, {3}, your application may fail to run on systems without this service pack installed. + + http://msdn.microsoft.com/library/cc667408(VS.100).aspx + [none] + Error + + + + Validate arguments of public methods + All reference arguments passed to externally visible methods should be checked against null (Nothing in VB). If appropriate, throw a System.ArgumentNullException when the argument is null. + In externally visible method {0}, validate parameter '{1}' before using it. + RuleOwner + http://msdn.microsoft.com/library/ms182182.aspx + + Warning + + + + + Category + Certainty + Collapse All + Check Id + Error + error(s) + Expand All + Help + Line + message(s) + [Location not stored in Pdb] + Project + Resolution + Rule + Rule File + Rule Description + Source + Status + Target + Warning + warning(s) + Code Analysis Report + + diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.lastcodeanalysissucceeded b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.lastcodeanalysissucceeded similarity index 100% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.lastcodeanalysissucceeded rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.lastcodeanalysissucceeded diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.pdb similarity index 100% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.pdb rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.pdb diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/Newtonsoft.Json.xml b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.XML old mode 100755 new mode 100644 similarity index 100% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/Newtonsoft.Json.xml rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.XML diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.dll similarity index 100% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.dll rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.dll diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.pdb similarity index 100% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.pdb rename to worldpay-lib-dotnet-4-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.pdb diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/App.config b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/App.config similarity index 80% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/App.config rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/App.config index 1305bdd..52f1164 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/App.config +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/App.config @@ -1,12 +1,12 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/OrderServiceTest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/OrderServiceTest.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/OrderServiceTest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/OrderServiceTest.cs index 356be55..bae2852 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/OrderServiceTest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/OrderServiceTest.cs @@ -1,357 +1,357 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections.Generic; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Test -{ - [TestClass] - public class OrderServiceTest - { - /// - /// Authorization service, for obtaining access tokens - /// - private AuthService _authService; - - /// - /// Order service, for handling interaction with the order API - /// - private OrderService _orderService; - - /// - /// Initialise the service clients - /// - [TestInitialize] - public void Setup() - { - var restClient = new WorldpayRestClient(Configuration.ServiceKey); - _authService = restClient.GetAuthService(); - _orderService = restClient.GetOrderService(); - } - - /// - /// Verify that creating an order works for a valid token - /// - [TestMethod] - public void ShouldCreateOrderForValidToken() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = CreateToken(); - - OrderResponse response = _orderService.Create(orderRequest); - - Assert.IsNotNull(response.orderCode); - Assert.AreEqual(1999, response.amount); - Assert.IsNotNull(response.customerIdentifiers); - } - - [TestMethod] - public void ShouldCreateTelephoneOrder() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = CreateToken(); - orderRequest.orderType = OrderType.MOTO.ToString(); - - OrderResponse response = _orderService.Create(orderRequest); - - Assert.IsNotNull(response.orderCode); - Assert.AreEqual(1999, response.amount); - Assert.IsNotNull(response.customerIdentifiers); - } - - [TestMethod] - public void ShouldCreateAuthorizationRequest() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = CreateToken(); - orderRequest.authorizeOnly = true; - - OrderResponse response = _orderService.Create(orderRequest); - - Assert.IsNotNull(response.orderCode); - Assert.AreEqual(1999, response.authorizedAmount); - Assert.IsTrue(response.authorizeOnly); - Assert.AreEqual(OrderStatus.AUTHORIZED, response.paymentStatus); - } - - [TestMethod] - public void ShouldCapturePaymentForAuthorizedOrder() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = CreateToken(); - orderRequest.authorizeOnly = true; - - string orderCode = _orderService.Create(orderRequest).orderCode; - - OrderResponse response = _orderService.CaptureAuthorizedOrder(orderCode); - - Assert.IsNotNull(response.orderCode); - Assert.AreEqual(1999, response.authorizedAmount); - Assert.AreEqual(1999, response.amount); - Assert.AreEqual(OrderStatus.SUCCESS, response.paymentStatus); - } - - [TestMethod] - public void ShouldPartiallyCapturePaymentForAuthorizedOrder() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = CreateToken(); - orderRequest.authorizeOnly = true; - - string orderCode = _orderService.Create(orderRequest).orderCode; - - OrderResponse response = _orderService.CaptureAuthorizedOrder(orderCode, 500); - - Assert.IsNotNull(response.orderCode); - Assert.AreEqual(1999, response.authorizedAmount); - Assert.AreEqual(500, response.amount); - Assert.AreEqual(OrderStatus.SUCCESS, response.paymentStatus); - } - - [TestMethod] - public void ShouldCancelPaymentForAuthorizedOrder() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = CreateToken(); - orderRequest.authorizeOnly = true; - - string orderCode = _orderService.Create(orderRequest).orderCode; - - _orderService.CancelAuthorizedOrder(orderCode); - } - - /// - /// Verify that creating a 3DS order works - /// - [TestMethod] - public void ShouldCreate3DSOrder() - { - OrderRequest orderRequest = create3DSOrderRequest(); - orderRequest.token = CreateToken(); - - OrderResponse response = _orderService.Create(orderRequest); - - Assert.IsNotNull(response.orderCode); - Assert.AreEqual(1999, response.amount); - Assert.IsNotNull(response.oneTime3DsToken); - Assert.IsTrue(response.is3DSOrder); - Assert.AreEqual(OrderStatus.PRE_AUTHORIZED, response.paymentStatus); - } - - /// - /// Verify that creating a APM order works - /// - [TestMethod] - public void ShouldCreateAPMOrder() - { - OrderRequest orderRequest = createAPMOrderRequest(); - orderRequest.token = CreateAPMToken(); - - OrderResponse response = _orderService.Create(orderRequest); - - Assert.IsNotNull(response.redirectURL); - Assert.IsNotNull(response.orderCode); - Assert.AreEqual(1999, response.amount); - Assert.IsFalse(response.is3DSOrder); - - Assert.AreEqual(OrderStatus.PRE_AUTHORIZED, response.paymentStatus); - } - - /// - /// Vefiy that authorize 3DS Order works - /// - [TestMethod] - public void ShouldAuthorize3DSOrder() - { - OrderRequest orderRequest = create3DSOrderRequest(); - orderRequest.token = CreateToken(); - - OrderResponse response = _orderService.Create(orderRequest); - - var threeDSInfo = new ThreeDSecureInfo() - { - shopperIpAddress = "127.0.0.1", - shopperSessionId = "sessionId", - shopperUserAgent = "Mozilla/v1", - shopperAcceptHeader = "application/json" - }; - - var authorizationResponse = _orderService.Authorize(response.orderCode, "IDENTIFIED", threeDSInfo); - - Assert.AreEqual(response.orderCode, authorizationResponse.orderCode); - Assert.AreEqual(1999, authorizationResponse.amount); - Assert.IsTrue(response.is3DSOrder); - Assert.AreEqual(OrderStatus.SUCCESS, authorizationResponse.paymentStatus); - } - - /// - /// Vefiy that authorize APM Order works - /// - [Ignore] - [TestMethod] - public void ShouldAuthorizeAPMOrder() - { - //We need to amend the simulator to auto submit the form and send notifications automatically in order to unit test this - } - - /// - /// Verify that refunding the order works - /// - [TestMethod] - public void ShouldRefundOrder() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = CreateToken(); - - string orderCode = _orderService.Create(orderRequest).orderCode; - Assert.IsNotNull(orderCode); - - _orderService.Refund(orderCode); - } - - [TestMethod] - public void ShouldGetExistingOrder() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = CreateToken(); - string orderCode = _orderService.Create(orderRequest).orderCode; - - TransferOrder order = _orderService.FindOrder(orderCode); - - Assert.AreEqual(orderCode, order.orderCode); - } - - [TestMethod] - public void ShouldPartiallyRefundOrder() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = CreateToken(); - - string orderCode = _orderService.Create(orderRequest).orderCode; - Assert.IsNotNull(orderCode); - - _orderService.Refund(orderCode, 500); - } - - /// - /// Verify that an exception is thrown when creating an order with an invalid token - /// - [TestMethod] - public void ShouldThrowExceptionForInvalidToken() - { - OrderRequest orderRequest = createOrderRequest(); - orderRequest.token = "invalid-token"; - - try - { - _orderService.Create(orderRequest); - } - catch (WorldpayException e) - { - Assert.AreEqual("TKN_NOT_FOUND", e.apiError.customCode); - } - } - - private string CreateToken() - { - return TestHelpers.CreateToken(_authService); - } - - private string CreateAPMToken() - { - return TestHelpers.CreateAPMToken(_authService); - } - - /// - /// Create an order request - /// - private OrderRequest createOrderRequest() - { - var orderRequest = new OrderRequest(); - orderRequest.amount = 1999; - orderRequest.currencyCode = CurrencyCode.GBP.ToString(); - orderRequest.name = "test name"; - orderRequest.orderDescription = "test description"; - - var address = new Address(); - address.address1 = "line 1"; - address.address2 = "line 2"; - address.city = "city"; - address.countryCode = CountryCode.GB.ToString(); - address.postalCode = "AB1 2CD"; - orderRequest.billingAddress = address; - - var customerIdentifiers = new Dictionary(); - customerIdentifiers["test key 1"] = "test value 1"; - - orderRequest.customerIdentifiers = customerIdentifiers; - return orderRequest; - } - - /// - /// Create a 3DS order request - /// - private OrderRequest create3DSOrderRequest() - { - var orderRequest = new OrderRequest(); - orderRequest.amount = 1999; - orderRequest.currencyCode = CurrencyCode.GBP.ToString(); - orderRequest.name = "3D"; - orderRequest.orderDescription = "test description"; - - var threeDSInfo = new ThreeDSecureInfo(); - threeDSInfo.shopperIpAddress = "127.0.0.1"; - threeDSInfo.shopperSessionId = "sessionId"; - threeDSInfo.shopperUserAgent = "Mozilla/v1"; - threeDSInfo.shopperAcceptHeader = "application/json"; - orderRequest.threeDSecureInfo = threeDSInfo; - orderRequest.is3DSOrder = true; - - var address = new Address(); - address.address1 = "line 1"; - address.address2 = "line 2"; - address.city = "city"; - address.countryCode = CountryCode.GB.ToString(); - address.postalCode = "AB1 2CD"; - orderRequest.billingAddress = address; - - var customerIdentifiers = new Dictionary(); - customerIdentifiers["test key 1"] = "test value 1"; - - orderRequest.customerIdentifiers = customerIdentifiers; - return orderRequest; - } - - /// - /// Create a APM order request - /// - private OrderRequest createAPMOrderRequest() - { - var orderRequest = new OrderRequest(); - orderRequest.amount = 1999; - orderRequest.successUrl = "http://www.testurl.com/success"; - orderRequest.cancelUrl = "http://www.testurl.com/cancel"; - orderRequest.failureUrl = "http://www.testurl.com/failure"; - orderRequest.pendingUrl = "http://www.testurl.com/pending"; - - orderRequest.currencyCode = CurrencyCode.GBP.ToString(); - orderRequest.name = "Test"; - orderRequest.orderDescription = "test description"; - orderRequest.is3DSOrder = false; - - var address = new Address(); - address.address1 = "line 1"; - address.address2 = "line 2"; - address.city = "city"; - address.countryCode = CountryCode.GB.ToString(); - address.postalCode = "AB1 2CD"; - orderRequest.billingAddress = address; - - var customerIdentifiers = new Dictionary(); - customerIdentifiers["test key 1"] = "test value 1"; - - orderRequest.customerIdentifiers = customerIdentifiers; - return orderRequest; - } - } +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Test +{ + [TestClass] + public class OrderServiceTest + { + /// + /// Authorization service, for obtaining access tokens + /// + private AuthService _authService; + + /// + /// Order service, for handling interaction with the order API + /// + private OrderService _orderService; + + /// + /// Initialise the service clients + /// + [TestInitialize] + public void Setup() + { + var restClient = new WorldpayRestClient(Configuration.ServiceKey); + _authService = restClient.GetAuthService(); + _orderService = restClient.GetOrderService(); + } + + /// + /// Verify that creating an order works for a valid token + /// + [TestMethod] + public void ShouldCreateOrderForValidToken() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.amount); + Assert.IsNotNull(response.customerIdentifiers); + } + + [TestMethod] + public void ShouldCreateTelephoneOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.orderType = OrderType.MOTO.ToString(); + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.amount); + Assert.IsNotNull(response.customerIdentifiers); + } + + [TestMethod] + public void ShouldCreateAuthorizationRequest() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.authorizeOnly = true; + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.authorizedAmount); + Assert.IsTrue(response.authorizeOnly); + Assert.AreEqual(OrderStatus.AUTHORIZED, response.paymentStatus); + } + + [TestMethod] + public void ShouldCapturePaymentForAuthorizedOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.authorizeOnly = true; + + string orderCode = _orderService.Create(orderRequest).orderCode; + + OrderResponse response = _orderService.CaptureAuthorizedOrder(orderCode); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.authorizedAmount); + Assert.AreEqual(1999, response.amount); + Assert.AreEqual(OrderStatus.SUCCESS, response.paymentStatus); + } + + [TestMethod] + public void ShouldPartiallyCapturePaymentForAuthorizedOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.authorizeOnly = true; + + string orderCode = _orderService.Create(orderRequest).orderCode; + + OrderResponse response = _orderService.CaptureAuthorizedOrder(orderCode, 500); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.authorizedAmount); + Assert.AreEqual(500, response.amount); + Assert.AreEqual(OrderStatus.SUCCESS, response.paymentStatus); + } + + [TestMethod] + public void ShouldCancelPaymentForAuthorizedOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.authorizeOnly = true; + + string orderCode = _orderService.Create(orderRequest).orderCode; + + _orderService.CancelAuthorizedOrder(orderCode); + } + + /// + /// Verify that creating a 3DS order works + /// + [TestMethod] + public void ShouldCreate3DSOrder() + { + OrderRequest orderRequest = create3DSOrderRequest(); + orderRequest.token = CreateToken(); + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.amount); + Assert.IsNotNull(response.oneTime3DsToken); + Assert.IsTrue(response.is3DSOrder); + Assert.AreEqual(OrderStatus.PRE_AUTHORIZED, response.paymentStatus); + } + + /// + /// Verify that creating a APM order works + /// + [TestMethod] + public void ShouldCreateAPMOrder() + { + OrderRequest orderRequest = createAPMOrderRequest(); + orderRequest.token = CreateAPMToken(); + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.redirectURL); + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.amount); + Assert.IsFalse(response.is3DSOrder); + + Assert.AreEqual(OrderStatus.PRE_AUTHORIZED, response.paymentStatus); + } + + /// + /// Vefiy that authorize 3DS Order works + /// + [TestMethod] + public void ShouldAuthorize3DSOrder() + { + OrderRequest orderRequest = create3DSOrderRequest(); + orderRequest.token = CreateToken(); + + OrderResponse response = _orderService.Create(orderRequest); + + var threeDSInfo = new ThreeDSecureInfo() + { + shopperIpAddress = "127.0.0.1", + shopperSessionId = "sessionId", + shopperUserAgent = "Mozilla/v1", + shopperAcceptHeader = "application/json" + }; + + var authorizationResponse = _orderService.Authorize(response.orderCode, "IDENTIFIED", threeDSInfo); + + Assert.AreEqual(response.orderCode, authorizationResponse.orderCode); + Assert.AreEqual(1999, authorizationResponse.amount); + Assert.IsTrue(response.is3DSOrder); + Assert.AreEqual(OrderStatus.SUCCESS, authorizationResponse.paymentStatus); + } + + /// + /// Vefiy that authorize APM Order works + /// + [Ignore] + [TestMethod] + public void ShouldAuthorizeAPMOrder() + { + //We need to amend the simulator to auto submit the form and send notifications automatically in order to unit test this + } + + /// + /// Verify that refunding the order works + /// + [TestMethod] + public void ShouldRefundOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + + string orderCode = _orderService.Create(orderRequest).orderCode; + Assert.IsNotNull(orderCode); + + _orderService.Refund(orderCode); + } + + [TestMethod] + public void ShouldGetExistingOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + string orderCode = _orderService.Create(orderRequest).orderCode; + + TransferOrder order = _orderService.FindOrder(orderCode); + + Assert.AreEqual(orderCode, order.orderCode); + } + + [TestMethod] + public void ShouldPartiallyRefundOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + + string orderCode = _orderService.Create(orderRequest).orderCode; + Assert.IsNotNull(orderCode); + + _orderService.Refund(orderCode, 500); + } + + /// + /// Verify that an exception is thrown when creating an order with an invalid token + /// + [TestMethod] + public void ShouldThrowExceptionForInvalidToken() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = "invalid-token"; + + try + { + _orderService.Create(orderRequest); + } + catch (WorldpayException e) + { + Assert.AreEqual("TKN_NOT_FOUND", e.apiError.customCode); + } + } + + private string CreateToken() + { + return TestHelpers.CreateToken(_authService); + } + + private string CreateAPMToken() + { + return TestHelpers.CreateAPMToken(_authService); + } + + /// + /// Create an order request + /// + private OrderRequest createOrderRequest() + { + var orderRequest = new OrderRequest(); + orderRequest.amount = 1999; + orderRequest.currencyCode = CurrencyCode.GBP.ToString(); + orderRequest.name = "test name"; + orderRequest.orderDescription = "test description"; + + var address = new Address(); + address.address1 = "line 1"; + address.address2 = "line 2"; + address.city = "city"; + address.countryCode = CountryCode.GB.ToString(); + address.postalCode = "AB1 2CD"; + orderRequest.billingAddress = address; + + var customerIdentifiers = new Dictionary(); + customerIdentifiers["test key 1"] = "test value 1"; + + orderRequest.customerIdentifiers = customerIdentifiers; + return orderRequest; + } + + /// + /// Create a 3DS order request + /// + private OrderRequest create3DSOrderRequest() + { + var orderRequest = new OrderRequest(); + orderRequest.amount = 1999; + orderRequest.currencyCode = CurrencyCode.GBP.ToString(); + orderRequest.name = "3D"; + orderRequest.orderDescription = "test description"; + + var threeDSInfo = new ThreeDSecureInfo(); + threeDSInfo.shopperIpAddress = "127.0.0.1"; + threeDSInfo.shopperSessionId = "sessionId"; + threeDSInfo.shopperUserAgent = "Mozilla/v1"; + threeDSInfo.shopperAcceptHeader = "application/json"; + orderRequest.threeDSecureInfo = threeDSInfo; + orderRequest.is3DSOrder = true; + + var address = new Address(); + address.address1 = "line 1"; + address.address2 = "line 2"; + address.city = "city"; + address.countryCode = CountryCode.GB.ToString(); + address.postalCode = "AB1 2CD"; + orderRequest.billingAddress = address; + + var customerIdentifiers = new Dictionary(); + customerIdentifiers["test key 1"] = "test value 1"; + + orderRequest.customerIdentifiers = customerIdentifiers; + return orderRequest; + } + + /// + /// Create a APM order request + /// + private OrderRequest createAPMOrderRequest() + { + var orderRequest = new OrderRequest(); + orderRequest.amount = 1999; + orderRequest.successUrl = "http://www.testurl.com/success"; + orderRequest.cancelUrl = "http://www.testurl.com/cancel"; + orderRequest.failureUrl = "http://www.testurl.com/failure"; + orderRequest.pendingUrl = "http://www.testurl.com/pending"; + + orderRequest.currencyCode = CurrencyCode.GBP.ToString(); + orderRequest.name = "Test"; + orderRequest.orderDescription = "test description"; + orderRequest.is3DSOrder = false; + + var address = new Address(); + address.address1 = "line 1"; + address.address2 = "line 2"; + address.city = "city"; + address.countryCode = CountryCode.GB.ToString(); + address.postalCode = "AB1 2CD"; + orderRequest.billingAddress = address; + + var customerIdentifiers = new Dictionary(); + customerIdentifiers["test key 1"] = "test value 1"; + + orderRequest.customerIdentifiers = customerIdentifiers; + return orderRequest; + } + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/Properties/AssemblyInfo.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/Properties/AssemblyInfo.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/Properties/AssemblyInfo.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/Properties/AssemblyInfo.cs index 8818ee2..d1cb43e 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/Properties/AssemblyInfo.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/Properties/AssemblyInfo.cs @@ -1,36 +1,36 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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("Worldpay.Sdk.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Worldpay.Sdk.Test")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[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("ebd2e2b4-30db-4587-af69-ab905785d5e9")] - -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +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("Worldpay.Sdk.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Worldpay.Sdk.Test")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[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("ebd2e2b4-30db-4587-af69-ab905785d5e9")] + +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/SettingsServiceTest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/SettingsServiceTest.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/SettingsServiceTest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/SettingsServiceTest.cs index 038864c..0d13de9 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/SettingsServiceTest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/SettingsServiceTest.cs @@ -1,71 +1,71 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Test -{ - [TestClass] - public class SettingsServiceTest - { - private SettingsService _settingsService; - - private const string MerchantId = "01346fe3-86b7-40d4-9406-a4646e9fa520"; - - [TestInitialize] - public void Setup() - { - var restClient = new WorldpayRestClient(Configuration.ServiceKey); - _settingsService = restClient.GetSettingsService(); - } - - [TestMethod] - public void TestGetSettings() - { - SettingsResponse settings = _settingsService.GetSettings(MerchantId); - - Assert.IsNotNull(settings); - } - - [Ignore] - [TestMethod] - public void TestUpdateBillingSettings() - { - _settingsService.UpdateRecurringBilling(MerchantId, true); - - SettingsResponse settings = _settingsService.GetSettings(MerchantId); - Assert.AreEqual(true, settings.orderSetting.optInForRecurringBilling); - - _settingsService.UpdateRecurringBilling(MerchantId, true); - - settings = _settingsService.GetSettings(MerchantId); - Assert.AreEqual(false, settings.orderSetting.optInForRecurringBilling); - } - - [TestMethod] - public void TestUpdateRiskSettings() - { - var riskSetting = new RiskSetting() - { - avsEnabled = false, - cvcEnabled = true - }; - - _settingsService.UpdateRiskSettings(MerchantId, riskSetting); - - var settings = _settingsService.GetSettings(MerchantId); - Assert.AreEqual(false, settings.riskSetting.avsEnabled); - Assert.AreEqual(true, settings.riskSetting.cvcEnabled); - - riskSetting = new RiskSetting() - { - avsEnabled = true, - cvcEnabled = false - }; - _settingsService.UpdateRiskSettings(MerchantId, riskSetting); - - settings = _settingsService.GetSettings(MerchantId); - Assert.AreEqual(true, settings.riskSetting.avsEnabled); - Assert.AreEqual(false, settings.riskSetting.cvcEnabled); - } - } -} - +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Test +{ + [TestClass] + public class SettingsServiceTest + { + private SettingsService _settingsService; + + private const string MerchantId = "01346fe3-86b7-40d4-9406-a4646e9fa520"; + + [TestInitialize] + public void Setup() + { + var restClient = new WorldpayRestClient(Configuration.ServiceKey); + _settingsService = restClient.GetSettingsService(); + } + + [TestMethod] + public void TestGetSettings() + { + SettingsResponse settings = _settingsService.GetSettings(MerchantId); + + Assert.IsNotNull(settings); + } + + [Ignore] + [TestMethod] + public void TestUpdateBillingSettings() + { + _settingsService.UpdateRecurringBilling(MerchantId, true); + + SettingsResponse settings = _settingsService.GetSettings(MerchantId); + Assert.AreEqual(true, settings.orderSetting.optInForRecurringBilling); + + _settingsService.UpdateRecurringBilling(MerchantId, true); + + settings = _settingsService.GetSettings(MerchantId); + Assert.AreEqual(false, settings.orderSetting.optInForRecurringBilling); + } + + [TestMethod] + public void TestUpdateRiskSettings() + { + var riskSetting = new RiskSetting() + { + avsEnabled = false, + cvcEnabled = true + }; + + _settingsService.UpdateRiskSettings(MerchantId, riskSetting); + + var settings = _settingsService.GetSettings(MerchantId); + Assert.AreEqual(false, settings.riskSetting.avsEnabled); + Assert.AreEqual(true, settings.riskSetting.cvcEnabled); + + riskSetting = new RiskSetting() + { + avsEnabled = true, + cvcEnabled = false + }; + _settingsService.UpdateRiskSettings(MerchantId, riskSetting); + + settings = _settingsService.GetSettings(MerchantId); + Assert.AreEqual(true, settings.riskSetting.avsEnabled); + Assert.AreEqual(false, settings.riskSetting.cvcEnabled); + } + } +} + diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/TestHelpers.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/TestHelpers.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/TestHelpers.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/TestHelpers.cs index 4d22e3c..c89a995 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/TestHelpers.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/TestHelpers.cs @@ -1,61 +1,61 @@ -using System.Collections.Generic; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Test -{ - class TestHelpers - { - /// - /// Test mastercard number - /// - const string TestMastercardNumber = "5555 5555 5555 4444"; - - /// - /// Test Cvv number - /// - const string TestCvv = "123"; - - /// - /// Create an access token - /// - internal static string CreateToken(AuthService authService) - { - var tokenRequest = new TokenRequest(); - tokenRequest.clientKey = Configuration.ClientKey; - - var cardRequest = new CardRequest(); - cardRequest.cardNumber = TestMastercardNumber; - cardRequest.cvc = TestCvv; - cardRequest.name = "csharplib client"; - cardRequest.expiryMonth = 2; - cardRequest.expiryYear = 2018; - cardRequest.type = "Card"; - - tokenRequest.paymentMethod = cardRequest; - - TokenResponse response = authService.GetToken(tokenRequest); - return response.token; - } - - /// - /// Create an APM token - /// - internal static string CreateAPMToken(AuthService authService) - { - var tokenRequest = new TokenRequest(); - tokenRequest.clientKey = Configuration.ClientKey; - - var cardRequest = new APMRequest(); - cardRequest.type = "APM"; - cardRequest.apmName = "PAYPAL"; - cardRequest.shopperCountryCode = "GB"; - cardRequest.apmFields = new Dictionary(); - - tokenRequest.paymentMethod = cardRequest; - - TokenResponse response = authService.GetToken(tokenRequest); - return response.token; - } - - } -} +using System.Collections.Generic; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Test +{ + class TestHelpers + { + /// + /// Test mastercard number + /// + const string TestMastercardNumber = "5555 5555 5555 4444"; + + /// + /// Test Cvv number + /// + const string TestCvv = "123"; + + /// + /// Create an access token + /// + internal static string CreateToken(AuthService authService) + { + var tokenRequest = new TokenRequest(); + tokenRequest.clientKey = Configuration.ClientKey; + + var cardRequest = new CardRequest(); + cardRequest.cardNumber = TestMastercardNumber; + cardRequest.cvc = TestCvv; + cardRequest.name = "csharplib client"; + cardRequest.expiryMonth = 2; + cardRequest.expiryYear = 2018; + cardRequest.type = "Card"; + + tokenRequest.paymentMethod = cardRequest; + + TokenResponse response = authService.GetToken(tokenRequest); + return response.token; + } + + /// + /// Create an APM token + /// + internal static string CreateAPMToken(AuthService authService) + { + var tokenRequest = new TokenRequest(); + tokenRequest.clientKey = Configuration.ClientKey; + + var cardRequest = new APMRequest(); + cardRequest.type = "APM"; + cardRequest.apmName = "PAYPAL"; + cardRequest.shopperCountryCode = "GB"; + cardRequest.apmFields = new Dictionary(); + + tokenRequest.paymentMethod = cardRequest; + + TokenResponse response = authService.GetToken(tokenRequest); + return response.token; + } + + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/TokenServiceTest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/TokenServiceTest.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/TokenServiceTest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/TokenServiceTest.cs index e22be92..93c0770 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/TokenServiceTest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/TokenServiceTest.cs @@ -1,56 +1,56 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Worldpay.Sdk; -using Worldpay.Sdk.Models; -using Worldpay.Sdk.Test; - -namespace WorldPay.Sdk.Test -{ - [TestClass] - public class TokenServiceTest - { - /// - /// Authorization service, for obtaining access tokens - /// - private AuthService _authService; - - /// - /// Token service, for handling interaction with the token API - /// - private TokenService _tokenService; - - /// - /// Initialise the service clients - /// - [TestInitialize] - public void Setup() - { - var restClient = new WorldpayRestClient(Configuration.ServiceKey); - _authService = restClient.GetAuthService(); - _tokenService = restClient.GetTokenService(); - } - - /// - /// Verify that retrieving an existing token works - /// - [TestMethod] - public void ShouldRetrieveToken() - { - var token = CreateToken(); - - TokenResponse response = _tokenService.Get(token); - - Assert.AreEqual(token, response.token); - Assert.AreEqual("csharplib client", response.paymentMethod.name); - Assert.IsInstanceOfType(response.paymentMethod, typeof(PaymentResponse)); - Assert.AreEqual("**** **** **** 4444", ((PaymentResponse)response.paymentMethod).maskedCardNumber); - } - - /// - /// Create an access token - /// - private string CreateToken() - { - return TestHelpers.CreateToken(_authService); - } - } -} +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Worldpay.Sdk; +using Worldpay.Sdk.Models; +using Worldpay.Sdk.Test; + +namespace WorldPay.Sdk.Test +{ + [TestClass] + public class TokenServiceTest + { + /// + /// Authorization service, for obtaining access tokens + /// + private AuthService _authService; + + /// + /// Token service, for handling interaction with the token API + /// + private TokenService _tokenService; + + /// + /// Initialise the service clients + /// + [TestInitialize] + public void Setup() + { + var restClient = new WorldpayRestClient(Configuration.ServiceKey); + _authService = restClient.GetAuthService(); + _tokenService = restClient.GetTokenService(); + } + + /// + /// Verify that retrieving an existing token works + /// + [TestMethod] + public void ShouldRetrieveToken() + { + var token = CreateToken(); + + TokenResponse response = _tokenService.Get(token); + + Assert.AreEqual(token, response.token); + Assert.AreEqual("csharplib client", response.paymentMethod.name); + Assert.IsInstanceOfType(response.paymentMethod, typeof(PaymentResponse)); + Assert.AreEqual("**** **** **** 4444", ((PaymentResponse)response.paymentMethod).maskedCardNumber); + } + + /// + /// Create an access token + /// + private string CreateToken() + { + return TestHelpers.CreateToken(_authService); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/TransferServiceTest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/TransferServiceTest.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/TransferServiceTest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/TransferServiceTest.cs index e999cbf..217e6e8 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/TransferServiceTest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/TransferServiceTest.cs @@ -1,32 +1,32 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Worldpay.Sdk.Test -{ - [TestClass] - public class TransferServiceTest - { - private TransferService _transferService; - - [TestInitialize] - public void Setup() - { - var restClient = new WorldpayRestClient(Configuration.ServiceKey); - _transferService = restClient.GetTransferService(); - } - - [TestMethod] - public void TestGetTransfers() - { - var response = _transferService.GetTransfers(Configuration.MerchantId, null); - Assert.IsNotNull(response); - } - - [Ignore] - [TestMethod] - public void TestGetTransfer() - { - var response = _transferService.GetTransfer(Configuration.MerchantId); - Assert.IsNotNull(response); - } - } -} +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Worldpay.Sdk.Test +{ + [TestClass] + public class TransferServiceTest + { + private TransferService _transferService; + + [TestInitialize] + public void Setup() + { + var restClient = new WorldpayRestClient(Configuration.ServiceKey); + _transferService = restClient.GetTransferService(); + } + + [TestMethod] + public void TestGetTransfers() + { + var response = _transferService.GetTransfers(Configuration.MerchantId, null); + Assert.IsNotNull(response); + } + + [Ignore] + [TestMethod] + public void TestGetTransfer() + { + var response = _transferService.GetTransfer(Configuration.MerchantId); + Assert.IsNotNull(response); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/WebhookServiceTest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/WebhookServiceTest.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/WebhookServiceTest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/WebhookServiceTest.cs index 0402931..2fb4cf7 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/WebhookServiceTest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/WebhookServiceTest.cs @@ -1,67 +1,67 @@ -using System; -using System.IO; -using System.Net; -using System.Text; -using System.Web.Script.Serialization; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Test -{ - [TestClass] - public class WebhookServiceTest - { - [Ignore] - [TestMethod] - public void shouldLogOrderStatus() - { - var logFile = new FileInfo(Configuration.OrderLog); - logFile.Delete(); - - var adminCode = "testAdminCode"; - var environment = "test"; - var merchantId = "testMerchant"; - var notificationEventType = "ORDER CHANGED"; - var orderCode = "testCode"; - var status = OrderStatus.SUCCESS; - - var notification = new OrderChangeNotification() - { - adminCode = adminCode, - environment = environment, - merchantId = merchantId, - notificationEventType = notificationEventType, - orderCode = orderCode, - paymentStatus = status - }; - - var request = (HttpWebRequest) HttpWebRequest.Create(Configuration.WebhookUrl); - request.ContentType = "application/json"; - request.Method = "POST"; - - var serializedData = new JavaScriptSerializer().Serialize(notification); - var bytes = Encoding.ASCII.GetBytes(serializedData); - request.ContentLength = bytes.Length; - - using (Stream outputStream = request.GetRequestStream()) - { - outputStream.Write(bytes, 0, bytes.Length); - } - - using (var response = (HttpWebResponse)request.GetResponse()) - { - Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); - } - - using (var reader = new StreamReader(new FileStream(Configuration.OrderLog, FileMode.Open))) - { - var firstLine = reader.ReadLine(); - Assert.AreEqual(String.Format("{0}: {1} {2}", notificationEventType, orderCode, status.ToString()), firstLine); - - var secondLine = reader.ReadLine(); - Assert.AreEqual(null, secondLine); - } - } - } -} +using System; +using System.IO; +using System.Net; +using System.Text; +using System.Web.Script.Serialization; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Test +{ + [TestClass] + public class WebhookServiceTest + { + [Ignore] + [TestMethod] + public void shouldLogOrderStatus() + { + var logFile = new FileInfo(Configuration.OrderLog); + logFile.Delete(); + + var adminCode = "testAdminCode"; + var environment = "test"; + var merchantId = "testMerchant"; + var notificationEventType = "ORDER CHANGED"; + var orderCode = "testCode"; + var status = OrderStatus.SUCCESS; + + var notification = new OrderChangeNotification() + { + adminCode = adminCode, + environment = environment, + merchantId = merchantId, + notificationEventType = notificationEventType, + orderCode = orderCode, + paymentStatus = status + }; + + var request = (HttpWebRequest) HttpWebRequest.Create(Configuration.WebhookUrl); + request.ContentType = "application/json"; + request.Method = "POST"; + + var serializedData = new JavaScriptSerializer().Serialize(notification); + var bytes = Encoding.ASCII.GetBytes(serializedData); + request.ContentLength = bytes.Length; + + using (Stream outputStream = request.GetRequestStream()) + { + outputStream.Write(bytes, 0, bytes.Length); + } + + using (var response = (HttpWebResponse)request.GetResponse()) + { + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + } + + using (var reader = new StreamReader(new FileStream(Configuration.OrderLog, FileMode.Open))) + { + var firstLine = reader.ReadLine(); + Assert.AreEqual(String.Format("{0}: {1} {2}", notificationEventType, orderCode, status.ToString()), firstLine); + + var secondLine = reader.ReadLine(); + Assert.AreEqual(null, secondLine); + } + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj index bfb5e2f..1689210 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj @@ -1,101 +1,103 @@ - - - - Debug - AnyCPU - {F4C39D0A-B55F-4332-8933-257BA89BADA7} - Library - Properties - WorldPay.Sdk.Test - Worldpay.Sdk.Test - v3.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {d2ab0290-8b33-4467-a0df-975372b29e38} - Worldpay.Sdk - - - - - - - - - - False - - - False - - - False - - - False - - - - - - - + + + + Debug + AnyCPU + {F4C39D0A-B55F-4332-8933-257BA89BADA7} + Library + Properties + WorldPay.Sdk.Test + Worldpay.Sdk.Test + v4.0 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {d2ab0290-8b33-4467-a0df-975372b29e38} + Worldpay.Sdk + + + + + + + + + + False + + + False + + + False + + + False + + + + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll new file mode 100644 index 0000000..53ba392 Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.dll similarity index 100% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.dll rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.dll diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.pdb similarity index 100% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.pdb rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.pdb diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.xml b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.xml similarity index 98% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.xml rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.xml index f960454..e84b1b5 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.xml +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.xml @@ -1,3995 +1,3995 @@ - - - - Newtonsoft.Json - - - - - Instructs the how to serialize the object. - - - - - Gets or sets the member serialization. - - The member serialization. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified member serialization. - - The member serialization. - - - - Specifies the member serialization options for the . - - - - - All members are serialized by default. Members can be excluded using the . - - - - - Only members must be marked with the are serialized. - - - - - Specifies how object creation is handled by the . - - - - - Reuse existing objects, create new objects when needed. - - - - - Only reuse existing objects. - - - - - Always create new objects. - - - - - Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). - - - - - Gets or sets the date time styles used when converting a date to and from JSON. - - The date time styles used when converting a date to and from JSON. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. - - - - - The time represented is local time. - - - - - The time represented is UTC. - - - - - The time represented is not specified as either local time or Coordinated Universal Time (UTC). - - - - - Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. - - - - - Converts an to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Checks if the attributeName is a namespace attribute. - - Attribute name to test. - The attribute name prefix if it has one, otherwise an empty string. - True if attribute name is for a namespace attribute, otherwise false. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Converts a object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class with the specified . - - The TextReader containing the XML data to read. - - - - Sets the current token and value. - - The new token. - The value. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Changes the to Closed. - - - - - Instructs the to always serialize the member with the specified name. - - - - - Gets or sets the name of the property. - - The name of the property. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified name. - - Name of the property. - - - - Instructs the not to serialize the public field or public read/write property value. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. - - - - - Gets or sets which character to use to quote attribute values. - - - - - Gets or sets which character to use for indenting when is set to Formatting.Indented. - - - - - Gets or sets a value indicating whether object names will be surrounded with quotes. - - - - - Creates an instance of the JsonWriter class using the specified . - - The TextWriter to write to. - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the specified end token. - - The end token to write. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - - - - - - Gets the name. - - The name. - - - - Initializes a new instance of the class. - - The name. - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - - true if the specified is equal to the current ; otherwise, false. - - The parameter is null. - - - - Equalses the specified function. - - The function. - - - - - Equalses the specified a. - - A. - The b. - - - - - Serves as a hash function for a particular type. - - - A hash code for the current . - - - - - Returns a that represents the current . - - - A that represents the current . - - - - - Implements the operator ==. - - A. - The b. - The result of the operator. - - - - Implements the operator !=. - - A. - The b. - The result of the operator. - - - - Converts an object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Represents a collection of . - - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Specifies the state of the reader. - - - - - The Read method has not been called. - - - - - The end of the file has been reached successfully. - - - - - Reader is at a property. - - - - - Reader is at the start of an object. - - - - - Reader is in an object. - - - - - Reader is at the start of an array. - - - - - Reader is in an array. - - - - - The Close method has been called. - - - - - Reader has just read a value. - - - - - Reader is at the start of a constructor. - - - - - Reader in a constructor. - - - - - An error occurred that prevents the read operation from continuing. - - - - - The end of the file has been reached successfully. - - - - - Gets the current reader state. - - The current reader state. - - - - Gets the quotation mark character used to enclose the value of a string. - - - - - Gets the type of the current Json token. - - - - - Gets the text value of the current Json token. - - - - - Gets The Common Language Runtime (CLR) type for the current Json token. - - - - - Gets the depth of the current token in the JSON document. - - The depth of the current token in the JSON document. - - - - Initializes a new instance of the class with the specified . - - - - - Reads the next Json token from the stream. - - true if the next token was read successfully; false if there are no more tokens to read. - - - - Skips the children of the current token. - - - - - Sets the current token. - - The new token. - - - - Sets the current token and value. - - The new token. - The value. - - - - Sets the state based on current token type. - - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - - - - Releases unmanaged and - optionally - managed resources - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Changes the to Closed. - - - - - Provides methods for converting between common language runtime types and JavaScript types. - - - - - Represents JavaScript's boolean value true as a string. This field is read-only. - - - - - Represents JavaScript's boolean value false as a string. This field is read-only. - - - - - Represents JavaScript's null as a string. This field is read-only. - - - - - Represents JavaScript's undefined as a string. This field is read-only. - - - - - Represents JavaScript's positive infinity as a string. This field is read-only. - - - - - Represents JavaScript's negative infinity as a string. This field is read-only. - - - - - Represents JavaScript's NaN as a string. This field is read-only. - - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - The string delimiter character. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Serializes the specified object to a JSON string. - - The object to serialize. - A JSON string representation of the object. - - - - Serializes the specified object to a JSON string using a collection of . - - The object to serialize. - A collection converters used while serializing. - A JSON string representation of the object. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The of object being deserialized. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The type of the object to deserialize. - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified JSON to the given anonymous type. - - - The anonymous type to deserialize to. This can't be specified - traditionally and must be infered from the anonymous type passed - as a parameter. - - The object to deserialize. - The anonymous type object. - The deserialized anonymous type from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The type of the object to deserialize. - The object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The object to deserialize. - The type of the object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Serializes the XML node to a JSON string. - - The node to serialize. - A JSON string of the XmlNode. - - - - Deserializes the XmlNode from a JSON string. - - The JSON string. - The deserialized XmlNode - - - - The exception thrown when an error occurs during Json serialization or deserialization. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - Serializes and deserializes objects into and from the Json format. - The enables you to control how objects are encoded into Json. - - - - - Get or set how reference loops (e.g. a class referencing itself) is handled. - - - - - Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. - - - - - Get or set how null values are handled during serialization and deserialization. - - - - - Gets or sets how objects are created during deserialization. - - The object creation handling. - - - - Gets a collection that will be used during serialization. - - Collection that will be used during serialization. - - - - Initializes a new instance of the class. - - - - - Deserializes the Json structure contained by the specified . - - The that contains the Json structure to deserialize. - The being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Gets the serializable members for the given . - - The object to get seralizable members for. - Seralizable members for the given type. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Contains the LINQ to JSON extension methods. - - - - - Returns a collection of tokens that contains the ancestors of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the ancestors of every node in the source collection. - - - - Returns a collection of tokens that contains the descendants of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the descendants of every node in the source collection. - - - - Returns a collection of child properties of every object in the source collection. - - An of that contains the source collection. - An of that contains the properties of every object in the source collection. - - - - Returns a collection of child values of every object in the source collection with the given key. - - An of that contains the source collection. - The token key. - An of that contains the values of every node in the source collection with the given key. - - - - Returns a collection of child values of every object in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child values of every object in the source collection with the given key. - - The type to convert the values to. - An of that contains the source collection. - The token key. - An that contains the converted values of every node in the source collection with the given key. - - - - Returns a collection of converted child values of every object in the source collection. - - The type to convert the values to. - An of that contains the source collection. - An that contains the converted values of every node in the source collection. - - - - Returns a collection of child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the converted values of every node in the source collection. - - - - Represents a JSON constructor. - - - - - Gets or sets the name of this constructor. - - The constructor name. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name. - - The constructor name. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a token that can contain other tokens. - - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Get the first child token of this token. - - - A containing the first child token of the . - - - - - Get the last child token of this token. - - - A containing the last child token of the . - - - - - Returns a collection of the child tokens of this token, in document order. - - - An of containing the child tokens of this , in document order. - - - - - Returns a collection of the child values of this token, in document order. - - - - A containing the child values of this , in document order. - - - - - Returns a collection of the descendant tokens for this token in document order. - - An containing the descendant tokens of the . - - - - Adds the specified content as children of this . - - The content to be added. - - - - Adds the specified content as the first children of this . - - The content to be added. - - - - Creates an that can be used to add tokens to the . - - An that is ready to have content written to it. - - - - Replaces the children nodes of this token with the specified content. - - The content. - - - - Removes the child nodes from this token. - - - - - Represents a collection of objects. - - The type of token - - - - An empty collection of objects. - - - - - Initializes a new instance of the struct. - - The enumerable. - - - - Returns an enumerator that iterates through the collection. - - - A that can be used to iterate through the collection. - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Gets the with the specified key. - - - - - - Represents a JSON object. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Gets the node type for this . - - The type. - - - - Gets an of this object's properties. - - An of this object's properties. - - - - Gets a the specified name. - - The property name. - A with the specified name or null. - - - - Gets an of this object's property values. - - An of this object's property values. - - - - Gets the with the specified key. - - The with the specified key. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Represents a JSON array. - - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Returns a count of this token's child tokens. - - A count of this token's child tokens. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class. - - The token to read from. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the token being writen. - - The token being writen. - - - - Initializes a new instance of the class writing to the given . - - The container being written to. - - - - Initializes a new instance of the class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end. - - The token. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Represents an abstract JSON token. - - - - - Gets or sets the parent. - - The parent. - - - - Gets the root of this . - - The root of this . - - - - Gets the node type for this . - - The type. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Compares the values of two tokens, including the values of all descendant tokens. - - The first to compare. - The second to compare. - true if the tokens are equal; otherwise false. - - - - Gets the next sibling token of this node. - - The that contains the next sibling token. - - - - Gets the previous sibling token of this node. - - The that contains the previous sibling token. - - - - Returns a collection of the ancestor tokens of this token. - - A collection of the ancestor tokens of this token. - - - - Returns a collection of the sibling tokens after this token, in document order. - - A collection of the sibling tokens after this tokens, in document order. - - - - Returns a collection of the sibling tokens before this token, in document order. - - A collection of the sibling tokens before this token, in document order. - - - - Gets the with the specified key. - - The with the specified key. - - - - Gets the with the specified key converted to the specified type. - - The type to convert the token to. - The token key. - The converted token value. - - - - Get the first child token of this token. - - A containing the first child token of the . - - - - Get the last child token of this token. - - A containing the last child token of the . - - - - Returns a collection of the child tokens of this token, in document order. - - An of containing the child tokens of this , in document order. - - - - Returns a collection of the child tokens of this token, in document order. - - A containing the child tokens of this , in document order. - - - - Returns a collection of the child values of this token, in document order. - - A containing the child values of this , in document order. - - - - Removes this token from its parent. - - - - - Replaces this token with the specified token. - - The value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Returns the indented JSON for this token. - - - A containing the indented JSON. - - - - - Returns the indented JSON for this token using any given converters. - - A collection of which will be used when writing the token. - - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Represents a JSON property. - - - - - Gets the property name. - - The property name. - - - - Gets or sets the property value. - - The property value. - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - The property name. - - - - Initializes a new instance of the class. - - The property name. - The property value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies the type of token. - - - - - No token type has been set. - - - - - A JSON object. - - - - - A JSON array. - - - - - A JSON constructor. - - - - - A JSON object property. - - - - - A comment. - - - - - An integer value. - - - - - A float value. - - - - - A string value. - - - - - A boolean value. - - - - - A null value. - - - - - An undefined value. - - - - - A date value. - - - - - Represents a value in JSON (string, integer, date, etc). - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Creates a comment with the given value. - - The value. - A comment with the given value. - - - - Creates a string with the given value. - - The value. - A string with the given value. - - - - Gets the node type for this . - - The type. - - - - Gets or sets the underlying token value. - - The underlying token value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies missing member handling options for the . - - - - - Throw a when a missing member is encountered during deserialization. - - - - - Ignore a missing member and do not attempt to deserialize it. - - - - - Specifies null value handling options for the . - - - - - Include null values when serializing and deserializing objects. - - - - - Ignore null values when serializing and deserializing objects. - - - - - Specifies reference loop handling options for the . - - - - - Throw a when a loop is encountered. - - - - - Ignore loop references and do not serialize. - - - - - Serialize loop references. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null, empty or its contents are uninitialized values. - - The list. - - true if the collection is null or empty or its contents are uninitialized values; otherwise, false. - - - - - Makes a slice of the specified list in between the start and end indexes. - - The list. - The start index. - The end index. - A slice of the list. - - - - Makes a slice of the specified list in between the start and end indexes, - getting every so many items based upon the step. - - The list. - The start index. - The end index. - The step. - A slice of the list. - - - - Group the collection using a function which returns the key. - - The source collection to group. - The key selector. - A Dictionary with each key relating to a list of objects in a list grouped under it. - - - - Adds the elements of the specified collection to the specified generic IList. - - The list to add to. - The collection of elements to add. - - - - Gets the type of the typed list's items. - - The type. - The type of the typed list's items. - - - - Tests whether the list's items are their unitialized value. - - The list. - Whether the list's items are their unitialized value - - - - Gets the member's underlying type. - - The member. - The underlying type of the member. - - - - Determines whether the member is an indexed property. - - The member. - - true if the member is an indexed property; otherwise, false. - - - - - Determines whether the property is an indexed property. - - The property. - - true if the property is an indexed property; otherwise, false. - - - - - Gets the member's value on the object. - - The member. - The target object. - The member's value on the object. - - - - Sets the member's value on the target object. - - The member. - The target. - The value. - - - - Determines whether the specified MemberInfo can be read. - - The MemberInfo to determine whether can be read. - - true if the specified MemberInfo can be read; otherwise, false. - - - - - Determines whether the specified MemberInfo can be set. - - The MemberInfo to determine whether can be set. - - true if the specified MemberInfo can be set; otherwise, false. - - - - - Determines whether the string contains white space. - - The string to test for white space. - - true if the string contains white space; otherwise, false. - - - - - Determines whether the string is all white space. Empty string will return false. - - The string to test whether it is all white space. - - true if the string is all white space; otherwise, false. - - - - - Ensures the target string ends with the specified string. - - The target. - The value. - The target string with the value string at the end. - - - - Determines whether the SqlString is null or empty. - - The string. - - true if the SqlString is null or empty; otherwise, false. - - - - - Perform an action if the string is not null or empty. - - The value. - The action to perform. - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - The indent character. - - - - - Numbers the lines. - - The string to number. - - - - - Nulls an empty string. - - The string. - Null if the string was null, otherwise the string unchanged. - - - - Specifies the type of Json token. - - - - - This is returned by the if a method has not been called. - - - - - An object start token. - - - - - An array start token. - - - - - An object property name. - - - - - A constructor end token. - - - - - A comment. - - - - - An interger. - - - - - A float. - - - - - A string. - - - - - A boolean. - - - - - A null token. - - - - - An undefined token. - - - - - An object end token. - - - - - An array end token. - - - - - A constructor start token. - - - - - A Date. - - - - - Specifies the state of the . - - - - - An exception has been thrown, which has left the in an invalid state. - You may call the method to put the in the Closed state. - Any other method calls results in an being thrown. - - - - - The method has been called. - - - - - An object is being written. - - - - - A array is being written. - - - - - A constructor is being written. - - - - - A property is being written. - - - - - A write method has not been called. - - - - - Specifies formatting options for the . - - - - - No special formatting is applied. This is the default. - - - - - Causes child objects to be indented according to the and settings. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the top. - - The top. - - - - Gets the state of the writer. - - - - - Indicates how the output is formatted. - - - - - Creates an instance of the JsonWriter class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the end of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the end of an array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end constructor. - - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes the end of the current Json object or array. - - - - - Writes the current token. - - The to read the token from. - - - - Writes the specified end token. - - The end token to write. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. - - - - - Provides a set of static (Shared in Visual Basic) methods for - querying objects that implement . - - - - - Returns the input typed as . - - - - - Returns an empty that has the - specified type argument. - - - - - Converts the elements of an to the - specified type. - - - - - Filters the elements of an based on a specified type. - - - - - Generates a sequence of integral numbers within a specified range. - - The value of the first integer in the sequence. - The number of sequential integers to generate. - - - - Generates a sequence that contains one repeated value. - - - - - Filters a sequence of values based on a predicate. - - - - - Filters a sequence of values based on a predicate. - Each element's index is used in the logic of the predicate function. - - - - - Projects each element of a sequence into a new form. - - - - - Projects each element of a sequence into a new form by - incorporating the element's index. - - - - - Projects each element of a sequence to an - and flattens the resulting sequences into one sequence. - - - - - Projects each element of a sequence to an , - and flattens the resulting sequences into one sequence. The - index of each source element is used in the projected form of - that element. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. The index of - each source element is used in the intermediate projected form - of that element. - - - - - Returns elements from a sequence as long as a specified condition is true. - - - - - Returns elements from a sequence as long as a specified condition is true. - The element's index is used in the logic of the predicate function. - - - - - Returns a specified number of contiguous elements from the start - of a sequence. - - - - - Base implementation of First operator. - - - - - Returns the first element of a sequence. - - - - - Returns the first element in a sequence that satisfies a specified condition. - - - - - Returns the first element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the first element of the sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Last operator. - - - - - Returns the last element of a sequence. - - - - - Returns the last element of a sequence that satisfies a - specified condition. - - - - - Returns the last element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the last element of a sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Single operator. - - - - - Returns the only element of a sequence, and throws an exception - if there is not exactly one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition, and throws an exception if more than one - such element exists. - - - - - Returns the only element of a sequence, or a default value if - the sequence is empty; this method throws an exception if there - is more than one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition or a default value if no such element - exists; this method throws an exception if more than one element - satisfies the condition. - - - - - Returns the element at a specified index in a sequence. - - - - - Returns the element at a specified index in a sequence or a - default value if the index is out of range. - - - - - Inverts the order of the elements in a sequence. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. The element's - index is used in the logic of the predicate function. - - - - - Bypasses a specified number of elements in a sequence and then - returns the remaining elements. - - - - - Returns the number of elements in a sequence. - - - - - Returns a number that represents how many elements in the - specified sequence satisfy a condition. - - - - - Returns an that represents the total number - of elements in a sequence. - - - - - Returns an that represents how many elements - in a sequence satisfy a condition. - - - - - Concatenates two sequences. - - - - - Creates a from an . - - - - - Creates an array from an . - - - - - Returns distinct elements from a sequence by using the default - equality comparer to compare values. - - - - - Returns distinct elements from a sequence by using a specified - to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and a key comparer. - - - - - Creates a from an - according to specified key - and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer and an element selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function and compares the keys by using a specified - comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and projects the elements for each group by - using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. - - - - - Groups the elements of a sequence according to a key selector - function. The keys are compared by using a comparer and each - group's elements are projected by using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The elements of each group are projected by using a - specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The keys are compared by using a specified comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. Key values are compared by using a specified comparer, - and the elements of each group are projected by using a - specified function. - - - - - Applies an accumulator function over a sequence. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value, and the - specified function is used to select the result value. - - - - - Produces the set union of two sequences by using the default - equality comparer. - - - - - Produces the set union of two sequences by using a specified - . - - - - - Returns the elements of the specified sequence or the type - parameter's default value in a singleton collection if the - sequence is empty. - - - - - Returns the elements of the specified sequence or the specified - value in a singleton collection if the sequence is empty. - - - - - Determines whether all elements of a sequence satisfy a condition. - - - - - Determines whether a sequence contains any elements. - - - - - Determines whether any element of a sequence satisfies a - condition. - - - - - Determines whether a sequence contains a specified element by - using the default equality comparer. - - - - - Determines whether a sequence contains a specified element by - using a specified . - - - - - Determines whether two sequences are equal by comparing the - elements by using the default equality comparer for their type. - - - - - Determines whether two sequences are equal by comparing their - elements by using a specified . - - - - - Base implementation for Min/Max operator. - - - - - Base implementation for Min/Max operator for nullable types. - - - - - Returns the minimum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the minimum resulting value. - - - - - Returns the maximum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the maximum resulting value. - - - - - Makes an enumerator seen as enumerable once more. - - - The supplied enumerator must have been started. The first element - returned is the element the enumerator was on when passed in. - DO NOT use this method if the caller must be a generator. It is - mostly safe among aggregate operations. - - - - - Sorts the elements of a sequence in ascending order according to a key. - - - - - Sorts the elements of a sequence in ascending order by using a - specified comparer. - - - - - Sorts the elements of a sequence in descending order according to a key. - - - - - Sorts the elements of a sequence in descending order by using a - specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order by using a specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order, according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order by using a specified comparer. - - - - - Base implementation for Intersect and Except operators. - - - - - Produces the set intersection of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set intersection of two sequences by using the - specified to compare values. - - - - - Produces the set difference of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set difference of two sequences by using the - specified to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and key comparer. - - - - - Creates a from an - according to specified key - selector and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer, and an element selector function. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. A - specified is used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. A specified - is used to compare keys. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Represents a collection of objects that have a common key. - - - - - Gets the key of the . - - - - - Defines an indexer, size property, and Boolean search method for - data structures that map keys to - sequences of values. - - - - - Represents a sorted sequence. - - - - - Performs a subsequent ordering on the elements of an - according to a key. - - - - - Represents a collection of keys each mapped to one or more values. - - - - - Gets the number of key/value collection pairs in the . - - - - - Gets the collection of values indexed by the specified key. - - - - - Determines whether a specified key is in the . - - - - - Applies a transform function to each key and its associated - values and returns the results. - - - - - Returns a generic enumerator that iterates through the . - - - - - This attribute allows us to define extension methods without - requiring .NET Framework 3.5. For more information, see the section, - Extension Methods in .NET Framework 2.0 Apps, - of Basic Instincts: Extension Methods - column in MSDN Magazine, - issue Nov 2007. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - + + + + Newtonsoft.Json + + + + + Instructs the how to serialize the object. + + + + + Gets or sets the member serialization. + + The member serialization. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Specifies the member serialization options for the . + + + + + All members are serialized by default. Members can be excluded using the . + + + + + Only members must be marked with the are serialized. + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + + + + + The time represented is local time. + + + + + The time represented is UTC. + + + + + The time represented is not specified as either local time or Coordinated Universal Time (UTC). + + + + + Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + + + + + Converts an to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Sets the current token and value. + + The new token. + The value. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Instructs the to always serialize the member with the specified name. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + + + + + + Gets the name. + + The name. + + + + Initializes a new instance of the class. + + The name. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + The parameter is null. + + + + Equalses the specified function. + + The function. + + + + + Equalses the specified a. + + A. + The b. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Implements the operator ==. + + A. + The b. + The result of the operator. + + + + Implements the operator !=. + + A. + The b. + The result of the operator. + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Represents a collection of . + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Gets the type of the current Json token. + + + + + Gets the text value of the current Json token. + + + + + Gets The Common Language Runtime (CLR) type for the current Json token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next Json token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Provides methods for converting between common language runtime types and JavaScript types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + The string delimiter character. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The type of the object to deserialize. + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The object to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The type of the object to deserialize. + The object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The object to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Serializes and deserializes objects into and from the Json format. + The enables you to control how objects are encoded into Json. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Initializes a new instance of the class. + + + + + Deserializes the Json structure contained by the specified . + + The that contains the Json structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Gets the serializable members for the given . + + The object to get seralizable members for. + Seralizable members for the given type. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Returns a collection of child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the converted values of every node in the source collection. + + + + Represents a JSON constructor. + + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a token that can contain other tokens. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets the node type for this . + + The type. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Gets the with the specified key. + + The with the specified key. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Represents a JSON array. + + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Returns a count of this token's child tokens. + + A count of this token's child tokens. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the token being writen. + + The token being writen. + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Represents an abstract JSON token. + + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order. + + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + A containing the indented JSON. + + + + + Returns the indented JSON for this token using any given converters. + + A collection of which will be used when writing the token. + + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Represents a JSON property. + + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + The property name. + + + + Initializes a new instance of the class. + + The property name. + The property value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies missing member handling options for the . + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null, empty or its contents are uninitialized values. + + The list. + + true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + + + + + Makes a slice of the specified list in between the start and end indexes. + + The list. + The start index. + The end index. + A slice of the list. + + + + Makes a slice of the specified list in between the start and end indexes, + getting every so many items based upon the step. + + The list. + The start index. + The end index. + The step. + A slice of the list. + + + + Group the collection using a function which returns the key. + + The source collection to group. + The key selector. + A Dictionary with each key relating to a list of objects in a list grouped under it. + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Gets the type of the typed list's items. + + The type. + The type of the typed list's items. + + + + Tests whether the list's items are their unitialized value. + + The list. + Whether the list's items are their unitialized value + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string contains white space. + + The string to test for white space. + + true if the string contains white space; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Ensures the target string ends with the specified string. + + The target. + The value. + The target string with the value string at the end. + + + + Determines whether the SqlString is null or empty. + + The string. + + true if the SqlString is null or empty; otherwise, false. + + + + + Perform an action if the string is not null or empty. + + The value. + The action to perform. + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + The indent character. + + + + + Numbers the lines. + + The string to number. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + An object property name. + + + + + A constructor end token. + + + + + A comment. + + + + + An interger. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor start token. + + + + + A Date. + + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Indicates how the output is formatted. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Provides a set of static (Shared in Visual Basic) methods for + querying objects that implement . + + + + + Returns the input typed as . + + + + + Returns an empty that has the + specified type argument. + + + + + Converts the elements of an to the + specified type. + + + + + Filters the elements of an based on a specified type. + + + + + Generates a sequence of integral numbers within a specified range. + + The value of the first integer in the sequence. + The number of sequential integers to generate. + + + + Generates a sequence that contains one repeated value. + + + + + Filters a sequence of values based on a predicate. + + + + + Filters a sequence of values based on a predicate. + Each element's index is used in the logic of the predicate function. + + + + + Projects each element of a sequence into a new form. + + + + + Projects each element of a sequence into a new form by + incorporating the element's index. + + + + + Projects each element of a sequence to an + and flattens the resulting sequences into one sequence. + + + + + Projects each element of a sequence to an , + and flattens the resulting sequences into one sequence. The + index of each source element is used in the projected form of + that element. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. The index of + each source element is used in the intermediate projected form + of that element. + + + + + Returns elements from a sequence as long as a specified condition is true. + + + + + Returns elements from a sequence as long as a specified condition is true. + The element's index is used in the logic of the predicate function. + + + + + Returns a specified number of contiguous elements from the start + of a sequence. + + + + + Base implementation of First operator. + + + + + Returns the first element of a sequence. + + + + + Returns the first element in a sequence that satisfies a specified condition. + + + + + Returns the first element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the first element of the sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Last operator. + + + + + Returns the last element of a sequence. + + + + + Returns the last element of a sequence that satisfies a + specified condition. + + + + + Returns the last element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the last element of a sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Single operator. + + + + + Returns the only element of a sequence, and throws an exception + if there is not exactly one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition, and throws an exception if more than one + such element exists. + + + + + Returns the only element of a sequence, or a default value if + the sequence is empty; this method throws an exception if there + is more than one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition or a default value if no such element + exists; this method throws an exception if more than one element + satisfies the condition. + + + + + Returns the element at a specified index in a sequence. + + + + + Returns the element at a specified index in a sequence or a + default value if the index is out of range. + + + + + Inverts the order of the elements in a sequence. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. The element's + index is used in the logic of the predicate function. + + + + + Bypasses a specified number of elements in a sequence and then + returns the remaining elements. + + + + + Returns the number of elements in a sequence. + + + + + Returns a number that represents how many elements in the + specified sequence satisfy a condition. + + + + + Returns an that represents the total number + of elements in a sequence. + + + + + Returns an that represents how many elements + in a sequence satisfy a condition. + + + + + Concatenates two sequences. + + + + + Creates a from an . + + + + + Creates an array from an . + + + + + Returns distinct elements from a sequence by using the default + equality comparer to compare values. + + + + + Returns distinct elements from a sequence by using a specified + to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and a key comparer. + + + + + Creates a from an + according to specified key + and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer and an element selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function and compares the keys by using a specified + comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and projects the elements for each group by + using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. + + + + + Groups the elements of a sequence according to a key selector + function. The keys are compared by using a comparer and each + group's elements are projected by using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The elements of each group are projected by using a + specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The keys are compared by using a specified comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. Key values are compared by using a specified comparer, + and the elements of each group are projected by using a + specified function. + + + + + Applies an accumulator function over a sequence. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value, and the + specified function is used to select the result value. + + + + + Produces the set union of two sequences by using the default + equality comparer. + + + + + Produces the set union of two sequences by using a specified + . + + + + + Returns the elements of the specified sequence or the type + parameter's default value in a singleton collection if the + sequence is empty. + + + + + Returns the elements of the specified sequence or the specified + value in a singleton collection if the sequence is empty. + + + + + Determines whether all elements of a sequence satisfy a condition. + + + + + Determines whether a sequence contains any elements. + + + + + Determines whether any element of a sequence satisfies a + condition. + + + + + Determines whether a sequence contains a specified element by + using the default equality comparer. + + + + + Determines whether a sequence contains a specified element by + using a specified . + + + + + Determines whether two sequences are equal by comparing the + elements by using the default equality comparer for their type. + + + + + Determines whether two sequences are equal by comparing their + elements by using a specified . + + + + + Base implementation for Min/Max operator. + + + + + Base implementation for Min/Max operator for nullable types. + + + + + Returns the minimum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the minimum resulting value. + + + + + Returns the maximum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the maximum resulting value. + + + + + Makes an enumerator seen as enumerable once more. + + + The supplied enumerator must have been started. The first element + returned is the element the enumerator was on when passed in. + DO NOT use this method if the caller must be a generator. It is + mostly safe among aggregate operations. + + + + + Sorts the elements of a sequence in ascending order according to a key. + + + + + Sorts the elements of a sequence in ascending order by using a + specified comparer. + + + + + Sorts the elements of a sequence in descending order according to a key. + + + + + Sorts the elements of a sequence in descending order by using a + specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order by using a specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order, according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order by using a specified comparer. + + + + + Base implementation for Intersect and Except operators. + + + + + Produces the set intersection of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set intersection of two sequences by using the + specified to compare values. + + + + + Produces the set difference of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set difference of two sequences by using the + specified to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and key comparer. + + + + + Creates a from an + according to specified key + selector and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer, and an element selector function. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. A + specified is used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. A specified + is used to compare keys. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Represents a collection of objects that have a common key. + + + + + Gets the key of the . + + + + + Defines an indexer, size property, and Boolean search method for + data structures that map keys to + sequences of values. + + + + + Represents a sorted sequence. + + + + + Performs a subsequent ordering on the elements of an + according to a key. + + + + + Represents a collection of keys each mapped to one or more values. + + + + + Gets the number of key/value collection pairs in the . + + + + + Gets the collection of values indexed by the specified key. + + + + + Determines whether a specified key is in the . + + + + + Applies a transform function to each key and its associated + values and returns the results. + + + + + Returns a generic enumerator that iterates through the . + + + + + This attribute allows us to define extension methods without + requiring .NET Framework 3.5. For more information, see the section, + Extension Methods in .NET Framework 2.0 Apps, + of Basic Instincts: Extension Methods + column in MSDN Magazine, + issue Nov 2007. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll new file mode 100644 index 0000000..126c3f6 Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config similarity index 80% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config index 1305bdd..52f1164 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config @@ -1,12 +1,12 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.Test.pdb b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb old mode 100755 new mode 100644 similarity index 52% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.Test.pdb rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb index 2fba2dc..1c4ac25 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.Test.pdb and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb differ diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll new file mode 100644 index 0000000..5c38424 Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll differ diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb new file mode 100644 index 0000000..2f96a0a Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb differ diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll new file mode 100644 index 0000000..53ba392 Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.dll similarity index 100% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Newtonsoft.Json.dll rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.dll diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.pdb similarity index 100% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Newtonsoft.Json.pdb rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.pdb diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Newtonsoft.Json.xml b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.xml similarity index 98% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Newtonsoft.Json.xml rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.xml index f960454..e84b1b5 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Newtonsoft.Json.xml +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.xml @@ -1,3995 +1,3995 @@ - - - - Newtonsoft.Json - - - - - Instructs the how to serialize the object. - - - - - Gets or sets the member serialization. - - The member serialization. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified member serialization. - - The member serialization. - - - - Specifies the member serialization options for the . - - - - - All members are serialized by default. Members can be excluded using the . - - - - - Only members must be marked with the are serialized. - - - - - Specifies how object creation is handled by the . - - - - - Reuse existing objects, create new objects when needed. - - - - - Only reuse existing objects. - - - - - Always create new objects. - - - - - Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). - - - - - Gets or sets the date time styles used when converting a date to and from JSON. - - The date time styles used when converting a date to and from JSON. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. - - - - - The time represented is local time. - - - - - The time represented is UTC. - - - - - The time represented is not specified as either local time or Coordinated Universal Time (UTC). - - - - - Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. - - - - - Converts an to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Checks if the attributeName is a namespace attribute. - - Attribute name to test. - The attribute name prefix if it has one, otherwise an empty string. - True if attribute name is for a namespace attribute, otherwise false. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Converts a object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class with the specified . - - The TextReader containing the XML data to read. - - - - Sets the current token and value. - - The new token. - The value. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Changes the to Closed. - - - - - Instructs the to always serialize the member with the specified name. - - - - - Gets or sets the name of the property. - - The name of the property. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified name. - - Name of the property. - - - - Instructs the not to serialize the public field or public read/write property value. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. - - - - - Gets or sets which character to use to quote attribute values. - - - - - Gets or sets which character to use for indenting when is set to Formatting.Indented. - - - - - Gets or sets a value indicating whether object names will be surrounded with quotes. - - - - - Creates an instance of the JsonWriter class using the specified . - - The TextWriter to write to. - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the specified end token. - - The end token to write. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - - - - - - Gets the name. - - The name. - - - - Initializes a new instance of the class. - - The name. - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - - true if the specified is equal to the current ; otherwise, false. - - The parameter is null. - - - - Equalses the specified function. - - The function. - - - - - Equalses the specified a. - - A. - The b. - - - - - Serves as a hash function for a particular type. - - - A hash code for the current . - - - - - Returns a that represents the current . - - - A that represents the current . - - - - - Implements the operator ==. - - A. - The b. - The result of the operator. - - - - Implements the operator !=. - - A. - The b. - The result of the operator. - - - - Converts an object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Represents a collection of . - - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Specifies the state of the reader. - - - - - The Read method has not been called. - - - - - The end of the file has been reached successfully. - - - - - Reader is at a property. - - - - - Reader is at the start of an object. - - - - - Reader is in an object. - - - - - Reader is at the start of an array. - - - - - Reader is in an array. - - - - - The Close method has been called. - - - - - Reader has just read a value. - - - - - Reader is at the start of a constructor. - - - - - Reader in a constructor. - - - - - An error occurred that prevents the read operation from continuing. - - - - - The end of the file has been reached successfully. - - - - - Gets the current reader state. - - The current reader state. - - - - Gets the quotation mark character used to enclose the value of a string. - - - - - Gets the type of the current Json token. - - - - - Gets the text value of the current Json token. - - - - - Gets The Common Language Runtime (CLR) type for the current Json token. - - - - - Gets the depth of the current token in the JSON document. - - The depth of the current token in the JSON document. - - - - Initializes a new instance of the class with the specified . - - - - - Reads the next Json token from the stream. - - true if the next token was read successfully; false if there are no more tokens to read. - - - - Skips the children of the current token. - - - - - Sets the current token. - - The new token. - - - - Sets the current token and value. - - The new token. - The value. - - - - Sets the state based on current token type. - - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - - - - Releases unmanaged and - optionally - managed resources - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Changes the to Closed. - - - - - Provides methods for converting between common language runtime types and JavaScript types. - - - - - Represents JavaScript's boolean value true as a string. This field is read-only. - - - - - Represents JavaScript's boolean value false as a string. This field is read-only. - - - - - Represents JavaScript's null as a string. This field is read-only. - - - - - Represents JavaScript's undefined as a string. This field is read-only. - - - - - Represents JavaScript's positive infinity as a string. This field is read-only. - - - - - Represents JavaScript's negative infinity as a string. This field is read-only. - - - - - Represents JavaScript's NaN as a string. This field is read-only. - - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - The string delimiter character. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Serializes the specified object to a JSON string. - - The object to serialize. - A JSON string representation of the object. - - - - Serializes the specified object to a JSON string using a collection of . - - The object to serialize. - A collection converters used while serializing. - A JSON string representation of the object. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The of object being deserialized. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The type of the object to deserialize. - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified JSON to the given anonymous type. - - - The anonymous type to deserialize to. This can't be specified - traditionally and must be infered from the anonymous type passed - as a parameter. - - The object to deserialize. - The anonymous type object. - The deserialized anonymous type from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The type of the object to deserialize. - The object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The object to deserialize. - The type of the object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Serializes the XML node to a JSON string. - - The node to serialize. - A JSON string of the XmlNode. - - - - Deserializes the XmlNode from a JSON string. - - The JSON string. - The deserialized XmlNode - - - - The exception thrown when an error occurs during Json serialization or deserialization. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - Serializes and deserializes objects into and from the Json format. - The enables you to control how objects are encoded into Json. - - - - - Get or set how reference loops (e.g. a class referencing itself) is handled. - - - - - Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. - - - - - Get or set how null values are handled during serialization and deserialization. - - - - - Gets or sets how objects are created during deserialization. - - The object creation handling. - - - - Gets a collection that will be used during serialization. - - Collection that will be used during serialization. - - - - Initializes a new instance of the class. - - - - - Deserializes the Json structure contained by the specified . - - The that contains the Json structure to deserialize. - The being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Gets the serializable members for the given . - - The object to get seralizable members for. - Seralizable members for the given type. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Contains the LINQ to JSON extension methods. - - - - - Returns a collection of tokens that contains the ancestors of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the ancestors of every node in the source collection. - - - - Returns a collection of tokens that contains the descendants of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the descendants of every node in the source collection. - - - - Returns a collection of child properties of every object in the source collection. - - An of that contains the source collection. - An of that contains the properties of every object in the source collection. - - - - Returns a collection of child values of every object in the source collection with the given key. - - An of that contains the source collection. - The token key. - An of that contains the values of every node in the source collection with the given key. - - - - Returns a collection of child values of every object in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child values of every object in the source collection with the given key. - - The type to convert the values to. - An of that contains the source collection. - The token key. - An that contains the converted values of every node in the source collection with the given key. - - - - Returns a collection of converted child values of every object in the source collection. - - The type to convert the values to. - An of that contains the source collection. - An that contains the converted values of every node in the source collection. - - - - Returns a collection of child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the converted values of every node in the source collection. - - - - Represents a JSON constructor. - - - - - Gets or sets the name of this constructor. - - The constructor name. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name. - - The constructor name. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a token that can contain other tokens. - - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Get the first child token of this token. - - - A containing the first child token of the . - - - - - Get the last child token of this token. - - - A containing the last child token of the . - - - - - Returns a collection of the child tokens of this token, in document order. - - - An of containing the child tokens of this , in document order. - - - - - Returns a collection of the child values of this token, in document order. - - - - A containing the child values of this , in document order. - - - - - Returns a collection of the descendant tokens for this token in document order. - - An containing the descendant tokens of the . - - - - Adds the specified content as children of this . - - The content to be added. - - - - Adds the specified content as the first children of this . - - The content to be added. - - - - Creates an that can be used to add tokens to the . - - An that is ready to have content written to it. - - - - Replaces the children nodes of this token with the specified content. - - The content. - - - - Removes the child nodes from this token. - - - - - Represents a collection of objects. - - The type of token - - - - An empty collection of objects. - - - - - Initializes a new instance of the struct. - - The enumerable. - - - - Returns an enumerator that iterates through the collection. - - - A that can be used to iterate through the collection. - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Gets the with the specified key. - - - - - - Represents a JSON object. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Gets the node type for this . - - The type. - - - - Gets an of this object's properties. - - An of this object's properties. - - - - Gets a the specified name. - - The property name. - A with the specified name or null. - - - - Gets an of this object's property values. - - An of this object's property values. - - - - Gets the with the specified key. - - The with the specified key. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Represents a JSON array. - - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Returns a count of this token's child tokens. - - A count of this token's child tokens. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class. - - The token to read from. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the token being writen. - - The token being writen. - - - - Initializes a new instance of the class writing to the given . - - The container being written to. - - - - Initializes a new instance of the class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end. - - The token. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Represents an abstract JSON token. - - - - - Gets or sets the parent. - - The parent. - - - - Gets the root of this . - - The root of this . - - - - Gets the node type for this . - - The type. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Compares the values of two tokens, including the values of all descendant tokens. - - The first to compare. - The second to compare. - true if the tokens are equal; otherwise false. - - - - Gets the next sibling token of this node. - - The that contains the next sibling token. - - - - Gets the previous sibling token of this node. - - The that contains the previous sibling token. - - - - Returns a collection of the ancestor tokens of this token. - - A collection of the ancestor tokens of this token. - - - - Returns a collection of the sibling tokens after this token, in document order. - - A collection of the sibling tokens after this tokens, in document order. - - - - Returns a collection of the sibling tokens before this token, in document order. - - A collection of the sibling tokens before this token, in document order. - - - - Gets the with the specified key. - - The with the specified key. - - - - Gets the with the specified key converted to the specified type. - - The type to convert the token to. - The token key. - The converted token value. - - - - Get the first child token of this token. - - A containing the first child token of the . - - - - Get the last child token of this token. - - A containing the last child token of the . - - - - Returns a collection of the child tokens of this token, in document order. - - An of containing the child tokens of this , in document order. - - - - Returns a collection of the child tokens of this token, in document order. - - A containing the child tokens of this , in document order. - - - - Returns a collection of the child values of this token, in document order. - - A containing the child values of this , in document order. - - - - Removes this token from its parent. - - - - - Replaces this token with the specified token. - - The value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Returns the indented JSON for this token. - - - A containing the indented JSON. - - - - - Returns the indented JSON for this token using any given converters. - - A collection of which will be used when writing the token. - - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Represents a JSON property. - - - - - Gets the property name. - - The property name. - - - - Gets or sets the property value. - - The property value. - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - The property name. - - - - Initializes a new instance of the class. - - The property name. - The property value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies the type of token. - - - - - No token type has been set. - - - - - A JSON object. - - - - - A JSON array. - - - - - A JSON constructor. - - - - - A JSON object property. - - - - - A comment. - - - - - An integer value. - - - - - A float value. - - - - - A string value. - - - - - A boolean value. - - - - - A null value. - - - - - An undefined value. - - - - - A date value. - - - - - Represents a value in JSON (string, integer, date, etc). - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Creates a comment with the given value. - - The value. - A comment with the given value. - - - - Creates a string with the given value. - - The value. - A string with the given value. - - - - Gets the node type for this . - - The type. - - - - Gets or sets the underlying token value. - - The underlying token value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies missing member handling options for the . - - - - - Throw a when a missing member is encountered during deserialization. - - - - - Ignore a missing member and do not attempt to deserialize it. - - - - - Specifies null value handling options for the . - - - - - Include null values when serializing and deserializing objects. - - - - - Ignore null values when serializing and deserializing objects. - - - - - Specifies reference loop handling options for the . - - - - - Throw a when a loop is encountered. - - - - - Ignore loop references and do not serialize. - - - - - Serialize loop references. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null, empty or its contents are uninitialized values. - - The list. - - true if the collection is null or empty or its contents are uninitialized values; otherwise, false. - - - - - Makes a slice of the specified list in between the start and end indexes. - - The list. - The start index. - The end index. - A slice of the list. - - - - Makes a slice of the specified list in between the start and end indexes, - getting every so many items based upon the step. - - The list. - The start index. - The end index. - The step. - A slice of the list. - - - - Group the collection using a function which returns the key. - - The source collection to group. - The key selector. - A Dictionary with each key relating to a list of objects in a list grouped under it. - - - - Adds the elements of the specified collection to the specified generic IList. - - The list to add to. - The collection of elements to add. - - - - Gets the type of the typed list's items. - - The type. - The type of the typed list's items. - - - - Tests whether the list's items are their unitialized value. - - The list. - Whether the list's items are their unitialized value - - - - Gets the member's underlying type. - - The member. - The underlying type of the member. - - - - Determines whether the member is an indexed property. - - The member. - - true if the member is an indexed property; otherwise, false. - - - - - Determines whether the property is an indexed property. - - The property. - - true if the property is an indexed property; otherwise, false. - - - - - Gets the member's value on the object. - - The member. - The target object. - The member's value on the object. - - - - Sets the member's value on the target object. - - The member. - The target. - The value. - - - - Determines whether the specified MemberInfo can be read. - - The MemberInfo to determine whether can be read. - - true if the specified MemberInfo can be read; otherwise, false. - - - - - Determines whether the specified MemberInfo can be set. - - The MemberInfo to determine whether can be set. - - true if the specified MemberInfo can be set; otherwise, false. - - - - - Determines whether the string contains white space. - - The string to test for white space. - - true if the string contains white space; otherwise, false. - - - - - Determines whether the string is all white space. Empty string will return false. - - The string to test whether it is all white space. - - true if the string is all white space; otherwise, false. - - - - - Ensures the target string ends with the specified string. - - The target. - The value. - The target string with the value string at the end. - - - - Determines whether the SqlString is null or empty. - - The string. - - true if the SqlString is null or empty; otherwise, false. - - - - - Perform an action if the string is not null or empty. - - The value. - The action to perform. - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - The indent character. - - - - - Numbers the lines. - - The string to number. - - - - - Nulls an empty string. - - The string. - Null if the string was null, otherwise the string unchanged. - - - - Specifies the type of Json token. - - - - - This is returned by the if a method has not been called. - - - - - An object start token. - - - - - An array start token. - - - - - An object property name. - - - - - A constructor end token. - - - - - A comment. - - - - - An interger. - - - - - A float. - - - - - A string. - - - - - A boolean. - - - - - A null token. - - - - - An undefined token. - - - - - An object end token. - - - - - An array end token. - - - - - A constructor start token. - - - - - A Date. - - - - - Specifies the state of the . - - - - - An exception has been thrown, which has left the in an invalid state. - You may call the method to put the in the Closed state. - Any other method calls results in an being thrown. - - - - - The method has been called. - - - - - An object is being written. - - - - - A array is being written. - - - - - A constructor is being written. - - - - - A property is being written. - - - - - A write method has not been called. - - - - - Specifies formatting options for the . - - - - - No special formatting is applied. This is the default. - - - - - Causes child objects to be indented according to the and settings. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the top. - - The top. - - - - Gets the state of the writer. - - - - - Indicates how the output is formatted. - - - - - Creates an instance of the JsonWriter class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the end of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the end of an array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end constructor. - - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes the end of the current Json object or array. - - - - - Writes the current token. - - The to read the token from. - - - - Writes the specified end token. - - The end token to write. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. - - - - - Provides a set of static (Shared in Visual Basic) methods for - querying objects that implement . - - - - - Returns the input typed as . - - - - - Returns an empty that has the - specified type argument. - - - - - Converts the elements of an to the - specified type. - - - - - Filters the elements of an based on a specified type. - - - - - Generates a sequence of integral numbers within a specified range. - - The value of the first integer in the sequence. - The number of sequential integers to generate. - - - - Generates a sequence that contains one repeated value. - - - - - Filters a sequence of values based on a predicate. - - - - - Filters a sequence of values based on a predicate. - Each element's index is used in the logic of the predicate function. - - - - - Projects each element of a sequence into a new form. - - - - - Projects each element of a sequence into a new form by - incorporating the element's index. - - - - - Projects each element of a sequence to an - and flattens the resulting sequences into one sequence. - - - - - Projects each element of a sequence to an , - and flattens the resulting sequences into one sequence. The - index of each source element is used in the projected form of - that element. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. The index of - each source element is used in the intermediate projected form - of that element. - - - - - Returns elements from a sequence as long as a specified condition is true. - - - - - Returns elements from a sequence as long as a specified condition is true. - The element's index is used in the logic of the predicate function. - - - - - Returns a specified number of contiguous elements from the start - of a sequence. - - - - - Base implementation of First operator. - - - - - Returns the first element of a sequence. - - - - - Returns the first element in a sequence that satisfies a specified condition. - - - - - Returns the first element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the first element of the sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Last operator. - - - - - Returns the last element of a sequence. - - - - - Returns the last element of a sequence that satisfies a - specified condition. - - - - - Returns the last element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the last element of a sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Single operator. - - - - - Returns the only element of a sequence, and throws an exception - if there is not exactly one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition, and throws an exception if more than one - such element exists. - - - - - Returns the only element of a sequence, or a default value if - the sequence is empty; this method throws an exception if there - is more than one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition or a default value if no such element - exists; this method throws an exception if more than one element - satisfies the condition. - - - - - Returns the element at a specified index in a sequence. - - - - - Returns the element at a specified index in a sequence or a - default value if the index is out of range. - - - - - Inverts the order of the elements in a sequence. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. The element's - index is used in the logic of the predicate function. - - - - - Bypasses a specified number of elements in a sequence and then - returns the remaining elements. - - - - - Returns the number of elements in a sequence. - - - - - Returns a number that represents how many elements in the - specified sequence satisfy a condition. - - - - - Returns an that represents the total number - of elements in a sequence. - - - - - Returns an that represents how many elements - in a sequence satisfy a condition. - - - - - Concatenates two sequences. - - - - - Creates a from an . - - - - - Creates an array from an . - - - - - Returns distinct elements from a sequence by using the default - equality comparer to compare values. - - - - - Returns distinct elements from a sequence by using a specified - to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and a key comparer. - - - - - Creates a from an - according to specified key - and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer and an element selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function and compares the keys by using a specified - comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and projects the elements for each group by - using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. - - - - - Groups the elements of a sequence according to a key selector - function. The keys are compared by using a comparer and each - group's elements are projected by using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The elements of each group are projected by using a - specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The keys are compared by using a specified comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. Key values are compared by using a specified comparer, - and the elements of each group are projected by using a - specified function. - - - - - Applies an accumulator function over a sequence. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value, and the - specified function is used to select the result value. - - - - - Produces the set union of two sequences by using the default - equality comparer. - - - - - Produces the set union of two sequences by using a specified - . - - - - - Returns the elements of the specified sequence or the type - parameter's default value in a singleton collection if the - sequence is empty. - - - - - Returns the elements of the specified sequence or the specified - value in a singleton collection if the sequence is empty. - - - - - Determines whether all elements of a sequence satisfy a condition. - - - - - Determines whether a sequence contains any elements. - - - - - Determines whether any element of a sequence satisfies a - condition. - - - - - Determines whether a sequence contains a specified element by - using the default equality comparer. - - - - - Determines whether a sequence contains a specified element by - using a specified . - - - - - Determines whether two sequences are equal by comparing the - elements by using the default equality comparer for their type. - - - - - Determines whether two sequences are equal by comparing their - elements by using a specified . - - - - - Base implementation for Min/Max operator. - - - - - Base implementation for Min/Max operator for nullable types. - - - - - Returns the minimum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the minimum resulting value. - - - - - Returns the maximum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the maximum resulting value. - - - - - Makes an enumerator seen as enumerable once more. - - - The supplied enumerator must have been started. The first element - returned is the element the enumerator was on when passed in. - DO NOT use this method if the caller must be a generator. It is - mostly safe among aggregate operations. - - - - - Sorts the elements of a sequence in ascending order according to a key. - - - - - Sorts the elements of a sequence in ascending order by using a - specified comparer. - - - - - Sorts the elements of a sequence in descending order according to a key. - - - - - Sorts the elements of a sequence in descending order by using a - specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order by using a specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order, according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order by using a specified comparer. - - - - - Base implementation for Intersect and Except operators. - - - - - Produces the set intersection of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set intersection of two sequences by using the - specified to compare values. - - - - - Produces the set difference of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set difference of two sequences by using the - specified to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and key comparer. - - - - - Creates a from an - according to specified key - selector and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer, and an element selector function. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. A - specified is used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. A specified - is used to compare keys. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Represents a collection of objects that have a common key. - - - - - Gets the key of the . - - - - - Defines an indexer, size property, and Boolean search method for - data structures that map keys to - sequences of values. - - - - - Represents a sorted sequence. - - - - - Performs a subsequent ordering on the elements of an - according to a key. - - - - - Represents a collection of keys each mapped to one or more values. - - - - - Gets the number of key/value collection pairs in the . - - - - - Gets the collection of values indexed by the specified key. - - - - - Determines whether a specified key is in the . - - - - - Applies a transform function to each key and its associated - values and returns the results. - - - - - Returns a generic enumerator that iterates through the . - - - - - This attribute allows us to define extension methods without - requiring .NET Framework 3.5. For more information, see the section, - Extension Methods in .NET Framework 2.0 Apps, - of Basic Instincts: Extension Methods - column in MSDN Magazine, - issue Nov 2007. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - + + + + Newtonsoft.Json + + + + + Instructs the how to serialize the object. + + + + + Gets or sets the member serialization. + + The member serialization. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Specifies the member serialization options for the . + + + + + All members are serialized by default. Members can be excluded using the . + + + + + Only members must be marked with the are serialized. + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + + + + + The time represented is local time. + + + + + The time represented is UTC. + + + + + The time represented is not specified as either local time or Coordinated Universal Time (UTC). + + + + + Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + + + + + Converts an to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Sets the current token and value. + + The new token. + The value. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Instructs the to always serialize the member with the specified name. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + + + + + + Gets the name. + + The name. + + + + Initializes a new instance of the class. + + The name. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + The parameter is null. + + + + Equalses the specified function. + + The function. + + + + + Equalses the specified a. + + A. + The b. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Implements the operator ==. + + A. + The b. + The result of the operator. + + + + Implements the operator !=. + + A. + The b. + The result of the operator. + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Represents a collection of . + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Gets the type of the current Json token. + + + + + Gets the text value of the current Json token. + + + + + Gets The Common Language Runtime (CLR) type for the current Json token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next Json token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Provides methods for converting between common language runtime types and JavaScript types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + The string delimiter character. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The type of the object to deserialize. + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The object to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The type of the object to deserialize. + The object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The object to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Serializes and deserializes objects into and from the Json format. + The enables you to control how objects are encoded into Json. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Initializes a new instance of the class. + + + + + Deserializes the Json structure contained by the specified . + + The that contains the Json structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Gets the serializable members for the given . + + The object to get seralizable members for. + Seralizable members for the given type. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Returns a collection of child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the converted values of every node in the source collection. + + + + Represents a JSON constructor. + + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a token that can contain other tokens. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets the node type for this . + + The type. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Gets the with the specified key. + + The with the specified key. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Represents a JSON array. + + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Returns a count of this token's child tokens. + + A count of this token's child tokens. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the token being writen. + + The token being writen. + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Represents an abstract JSON token. + + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order. + + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + A containing the indented JSON. + + + + + Returns the indented JSON for this token using any given converters. + + A collection of which will be used when writing the token. + + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Represents a JSON property. + + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + The property name. + + + + Initializes a new instance of the class. + + The property name. + The property value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies missing member handling options for the . + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null, empty or its contents are uninitialized values. + + The list. + + true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + + + + + Makes a slice of the specified list in between the start and end indexes. + + The list. + The start index. + The end index. + A slice of the list. + + + + Makes a slice of the specified list in between the start and end indexes, + getting every so many items based upon the step. + + The list. + The start index. + The end index. + The step. + A slice of the list. + + + + Group the collection using a function which returns the key. + + The source collection to group. + The key selector. + A Dictionary with each key relating to a list of objects in a list grouped under it. + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Gets the type of the typed list's items. + + The type. + The type of the typed list's items. + + + + Tests whether the list's items are their unitialized value. + + The list. + Whether the list's items are their unitialized value + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string contains white space. + + The string to test for white space. + + true if the string contains white space; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Ensures the target string ends with the specified string. + + The target. + The value. + The target string with the value string at the end. + + + + Determines whether the SqlString is null or empty. + + The string. + + true if the SqlString is null or empty; otherwise, false. + + + + + Perform an action if the string is not null or empty. + + The value. + The action to perform. + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + The indent character. + + + + + Numbers the lines. + + The string to number. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + An object property name. + + + + + A constructor end token. + + + + + A comment. + + + + + An interger. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor start token. + + + + + A Date. + + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Indicates how the output is formatted. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Provides a set of static (Shared in Visual Basic) methods for + querying objects that implement . + + + + + Returns the input typed as . + + + + + Returns an empty that has the + specified type argument. + + + + + Converts the elements of an to the + specified type. + + + + + Filters the elements of an based on a specified type. + + + + + Generates a sequence of integral numbers within a specified range. + + The value of the first integer in the sequence. + The number of sequential integers to generate. + + + + Generates a sequence that contains one repeated value. + + + + + Filters a sequence of values based on a predicate. + + + + + Filters a sequence of values based on a predicate. + Each element's index is used in the logic of the predicate function. + + + + + Projects each element of a sequence into a new form. + + + + + Projects each element of a sequence into a new form by + incorporating the element's index. + + + + + Projects each element of a sequence to an + and flattens the resulting sequences into one sequence. + + + + + Projects each element of a sequence to an , + and flattens the resulting sequences into one sequence. The + index of each source element is used in the projected form of + that element. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. The index of + each source element is used in the intermediate projected form + of that element. + + + + + Returns elements from a sequence as long as a specified condition is true. + + + + + Returns elements from a sequence as long as a specified condition is true. + The element's index is used in the logic of the predicate function. + + + + + Returns a specified number of contiguous elements from the start + of a sequence. + + + + + Base implementation of First operator. + + + + + Returns the first element of a sequence. + + + + + Returns the first element in a sequence that satisfies a specified condition. + + + + + Returns the first element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the first element of the sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Last operator. + + + + + Returns the last element of a sequence. + + + + + Returns the last element of a sequence that satisfies a + specified condition. + + + + + Returns the last element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the last element of a sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Single operator. + + + + + Returns the only element of a sequence, and throws an exception + if there is not exactly one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition, and throws an exception if more than one + such element exists. + + + + + Returns the only element of a sequence, or a default value if + the sequence is empty; this method throws an exception if there + is more than one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition or a default value if no such element + exists; this method throws an exception if more than one element + satisfies the condition. + + + + + Returns the element at a specified index in a sequence. + + + + + Returns the element at a specified index in a sequence or a + default value if the index is out of range. + + + + + Inverts the order of the elements in a sequence. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. The element's + index is used in the logic of the predicate function. + + + + + Bypasses a specified number of elements in a sequence and then + returns the remaining elements. + + + + + Returns the number of elements in a sequence. + + + + + Returns a number that represents how many elements in the + specified sequence satisfy a condition. + + + + + Returns an that represents the total number + of elements in a sequence. + + + + + Returns an that represents how many elements + in a sequence satisfy a condition. + + + + + Concatenates two sequences. + + + + + Creates a from an . + + + + + Creates an array from an . + + + + + Returns distinct elements from a sequence by using the default + equality comparer to compare values. + + + + + Returns distinct elements from a sequence by using a specified + to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and a key comparer. + + + + + Creates a from an + according to specified key + and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer and an element selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function and compares the keys by using a specified + comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and projects the elements for each group by + using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. + + + + + Groups the elements of a sequence according to a key selector + function. The keys are compared by using a comparer and each + group's elements are projected by using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The elements of each group are projected by using a + specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The keys are compared by using a specified comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. Key values are compared by using a specified comparer, + and the elements of each group are projected by using a + specified function. + + + + + Applies an accumulator function over a sequence. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value, and the + specified function is used to select the result value. + + + + + Produces the set union of two sequences by using the default + equality comparer. + + + + + Produces the set union of two sequences by using a specified + . + + + + + Returns the elements of the specified sequence or the type + parameter's default value in a singleton collection if the + sequence is empty. + + + + + Returns the elements of the specified sequence or the specified + value in a singleton collection if the sequence is empty. + + + + + Determines whether all elements of a sequence satisfy a condition. + + + + + Determines whether a sequence contains any elements. + + + + + Determines whether any element of a sequence satisfies a + condition. + + + + + Determines whether a sequence contains a specified element by + using the default equality comparer. + + + + + Determines whether a sequence contains a specified element by + using a specified . + + + + + Determines whether two sequences are equal by comparing the + elements by using the default equality comparer for their type. + + + + + Determines whether two sequences are equal by comparing their + elements by using a specified . + + + + + Base implementation for Min/Max operator. + + + + + Base implementation for Min/Max operator for nullable types. + + + + + Returns the minimum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the minimum resulting value. + + + + + Returns the maximum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the maximum resulting value. + + + + + Makes an enumerator seen as enumerable once more. + + + The supplied enumerator must have been started. The first element + returned is the element the enumerator was on when passed in. + DO NOT use this method if the caller must be a generator. It is + mostly safe among aggregate operations. + + + + + Sorts the elements of a sequence in ascending order according to a key. + + + + + Sorts the elements of a sequence in ascending order by using a + specified comparer. + + + + + Sorts the elements of a sequence in descending order according to a key. + + + + + Sorts the elements of a sequence in descending order by using a + specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order by using a specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order, according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order by using a specified comparer. + + + + + Base implementation for Intersect and Except operators. + + + + + Produces the set intersection of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set intersection of two sequences by using the + specified to compare values. + + + + + Produces the set difference of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set difference of two sequences by using the + specified to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and key comparer. + + + + + Creates a from an + according to specified key + selector and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer, and an element selector function. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. A + specified is used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. A specified + is used to compare keys. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Represents a collection of objects that have a common key. + + + + + Gets the key of the . + + + + + Defines an indexer, size property, and Boolean search method for + data structures that map keys to + sequences of values. + + + + + Represents a sorted sequence. + + + + + Performs a subsequent ordering on the elements of an + according to a key. + + + + + Represents a collection of keys each mapped to one or more values. + + + + + Gets the number of key/value collection pairs in the . + + + + + Gets the collection of values indexed by the specified key. + + + + + Determines whether a specified key is in the . + + + + + Applies a transform function to each key and its associated + values and returns the results. + + + + + Returns a generic enumerator that iterates through the . + + + + + This attribute allows us to define extension methods without + requiring .NET Framework 3.5. For more information, see the section, + Extension Methods in .NET Framework 2.0 Apps, + of Basic Instincts: Extension Methods + column in MSDN Magazine, + issue Nov 2007. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll new file mode 100644 index 0000000..10aced4 Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.Test.dll.config b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config old mode 100755 new mode 100644 similarity index 80% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.Test.dll.config rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config index d48219c..52f1164 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Debug/WorldPay.Sdk.Test.dll.config +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config @@ -1,4 +1,4 @@ - + @@ -9,4 +9,4 @@ - + diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb similarity index 78% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb index a8a5320..bdf083c 100644 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb differ diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll new file mode 100644 index 0000000..de9b6e1 Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll differ diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb new file mode 100644 index 0000000..da8426c Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.sln b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.sln similarity index 72% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.sln rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk.sln index eeac2c7..b16e6de 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.sln +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk.sln @@ -1,17 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worldpay.Sdk", "Worldpay.Sdk\Worldpay.Sdk20.csproj", "{D2AB0290-8B33-4467-A0DF-975372B29E38}" +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worldpay.Sdk", "Worldpay.Sdk\Worldpay.Sdk35.csproj", "{D2AB0290-8B33-4467-A0DF-975372B29E38}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worldpay.Sdk.Test", "Worldpay.Sdk.Test\Worldpay.Sdk.Test.csproj", "{F4C39D0A-B55F-4332-8933-257BA89BADA7}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6C59865C-07ED-4BD8-99D8-4A8BAE7BF16C}" ProjectSection(SolutionItems) = preProject + POM.xml = POM.xml README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json", "Newtonsoft.Json\Newtonsoft.Json.csproj", "{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worldpay.Sdk.Test", "Worldpay.Sdk.Test\Worldpay.Sdk.Test.csproj", "{F4C39D0A-B55F-4332-8933-257BA89BADA7}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -22,10 +21,6 @@ Global {D2AB0290-8B33-4467-A0DF-975372B29E38}.Debug|Any CPU.Build.0 = Debug|Any CPU {D2AB0290-8B33-4467-A0DF-975372B29E38}.Release|Any CPU.ActiveCfg = Release|Any CPU {D2AB0290-8B33-4467-A0DF-975372B29E38}.Release|Any CPU.Build.0 = Release|Any CPU - {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}.Release|Any CPU.Build.0 = Release|Any CPU {F4C39D0A-B55F-4332-8933-257BA89BADA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F4C39D0A-B55F-4332-8933-257BA89BADA7}.Debug|Any CPU.Build.0 = Debug|Any CPU {F4C39D0A-B55F-4332-8933-257BA89BADA7}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/AbstractService.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/AbstractService.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/AbstractService.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/AbstractService.cs index 467ea49..0aa37de 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/AbstractService.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/AbstractService.cs @@ -1,12 +1,12 @@ -namespace Worldpay.Sdk -{ - abstract public class AbstractService - { - protected Http Http; - - protected AbstractService(Http http) - { - this.Http = http; - } - } -} +namespace Worldpay.Sdk +{ + abstract public class AbstractService + { + protected Http Http; + + protected AbstractService(Http http) + { + this.Http = http; + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/App.config b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/App.config similarity index 81% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/App.config rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/App.config index f9fb7e9..f7a40b3 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/App.config +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/App.config @@ -1,12 +1,12 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/AuthService.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/AuthService.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/AuthService.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/AuthService.cs index 3313fa9..21c2b63 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/AuthService.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/AuthService.cs @@ -1,22 +1,22 @@ -using Worldpay.Sdk; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk -{ - /// - /// Class for interacting with the Worldpay authorization API - /// - public class AuthService : AbstractService - { - public AuthService(Http http) : base(http) { } - - /// - /// Get a temporary access token - /// - public TokenResponse GetToken(TokenRequest tokenRequest) - { - var tokenResponse = Http.Post(Configuration.TokenUrl, tokenRequest); - return tokenResponse; - } - } -} +using Worldpay.Sdk; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Class for interacting with the Worldpay authorization API + /// + public class AuthService : AbstractService + { + public AuthService(Http http) : base(http) { } + + /// + /// Get a temporary access token + /// + public TokenResponse GetToken(TokenRequest tokenRequest) + { + var tokenResponse = Http.Post(Configuration.TokenUrl, tokenRequest); + return tokenResponse; + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Configuration.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Configuration.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Configuration.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Configuration.cs index 750a8d2..a1fa966 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Configuration.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Configuration.cs @@ -1,60 +1,60 @@ -using System; -using System.Configuration; - -namespace Worldpay.Sdk -{ - public class Configuration - { - /// - /// Uri of the token request API - /// - public static string TokenUrl - { - get { return ConfigurationManager.AppSettings["TokenUrl"]; } - } - - /// - /// Base Uri of the service - /// - public static string BaseUrl - { - get { return ConfigurationManager.AppSettings["BaseUrl"]; } - } - - /// - /// The secret key for service authorization - /// - public static string ServiceKey - { - get { return ConfigurationManager.AppSettings["ServiceKey"]; } - } - - /// - /// The merchant id corresponding to the service and client key - /// - public static string MerchantId - { - get { return ConfigurationManager.AppSettings["MerchantId"]; } - } - - /// - /// The client key for service authorization - /// - public static string ClientKey - { - get { return ConfigurationManager.AppSettings["ClientKey"]; } - } - - - public static string OrderLog - { - get { return ConfigurationManager.AppSettings["OrderLog"]; } - } - - - public static string WebhookUrl - { - get { return ConfigurationManager.AppSettings["WebhookUrl"]; } - } - } -} +using System; +using System.Configuration; + +namespace Worldpay.Sdk +{ + public class Configuration + { + /// + /// Uri of the token request API + /// + public static string TokenUrl + { + get { return ConfigurationManager.AppSettings["TokenUrl"]; } + } + + /// + /// Base Uri of the service + /// + public static string BaseUrl + { + get { return ConfigurationManager.AppSettings["BaseUrl"]; } + } + + /// + /// The secret key for service authorization + /// + public static string ServiceKey + { + get { return ConfigurationManager.AppSettings["ServiceKey"]; } + } + + /// + /// The merchant id corresponding to the service and client key + /// + public static string MerchantId + { + get { return ConfigurationManager.AppSettings["MerchantId"]; } + } + + /// + /// The client key for service authorization + /// + public static string ClientKey + { + get { return ConfigurationManager.AppSettings["ClientKey"]; } + } + + + public static string OrderLog + { + get { return ConfigurationManager.AppSettings["OrderLog"]; } + } + + + public static string WebhookUrl + { + get { return ConfigurationManager.AppSettings["WebhookUrl"]; } + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/CountryCode.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/CountryCode.cs similarity index 98% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/CountryCode.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/CountryCode.cs index 4545dd4..3c3a59e 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/CountryCode.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/CountryCode.cs @@ -1,16 +1,16 @@ -namespace Worldpay.Sdk.Enums -{ - public enum CountryCode - { - AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT, AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, - BO, BQ, BA, BW, BV, BR, IO, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL, CN, CX, CC, CO, KM, CG, CD, - CK, CR, CI, HR, CU, CW, CY, CZ, DK, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI, FR, GF, PF, - TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, - IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW, KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, - MO, MK, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, MM, NA, NR, NP, - NL, NC, NZ, NI, NE, NG, NU, NF, MP, NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RE, RO, - RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA, SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, - ES, LK, SD, SR, SJ, SZ, SE, CH, SY, TW, TJ, TZ, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, UG, UA, AE, - GB, US, UM, UY, UZ, VU, VE, VN, VG, VI, WF, EH, YE, ZM, ZW - } -} +namespace Worldpay.Sdk.Enums +{ + public enum CountryCode + { + AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT, AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, + BO, BQ, BA, BW, BV, BR, IO, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL, CN, CX, CC, CO, KM, CG, CD, + CK, CR, CI, HR, CU, CW, CY, CZ, DK, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI, FR, GF, PF, + TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, + IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW, KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, + MO, MK, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, MM, NA, NR, NP, + NL, NC, NZ, NI, NE, NG, NU, NF, MP, NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RE, RO, + RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA, SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, + ES, LK, SD, SR, SJ, SZ, SE, CH, SY, TW, TJ, TZ, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, UG, UA, AE, + GB, US, UM, UY, UZ, VU, VE, VN, VG, VI, WF, EH, YE, ZM, ZW + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/CurrencyCode.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/CurrencyCode.cs similarity index 98% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/CurrencyCode.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/CurrencyCode.cs index 843792c..18b734f 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/CurrencyCode.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/CurrencyCode.cs @@ -1,12 +1,12 @@ -namespace Worldpay.Sdk.Enums -{ - public enum CurrencyCode - { - ALL, DZD, XCD, ARS, AWG, AUD, AZN, BSD, BHD, BDT, BBD, BZD, BMD, BOB, BWP, BRL, BND, BGN, XOF, MMK, KHR, - XAF, CAD, KYD, CLP, CNY, COP, CRC, HRK, CZK, DKK, DJF, DOP, EGP, SVC, ERN, ETB, EUR, FJD, XPF, GEL, GHS, - GIP, GTQ, HNL, HKD, HUF, ISK, INR, IDR, IRR, ILS, JMD, JPY, JOD, KZT, KES, KWD, LVL, LBP, LSL, LYD, LTL, - MOP, MKD, MYR, MVR, MRO, MUR, MXN, MNT, MAD, MZN, NAD, ANG, NZD, NIO, NGN, NOK, OMR, PKR, PAB, PYG, PEN, - PHP, PLN, QAR, RON, RUB, RWF, SAR, RSD, SCR, SLL, SGD, ZAR, KRW, LKR, SZL, SEK, CHF, SYP, TWD, TZS, THB, - TTD, TND, TRY, UAH, AED, GBP, USD, UYU, UZS, VEF, VND, YER, ZMW - } -} +namespace Worldpay.Sdk.Enums +{ + public enum CurrencyCode + { + ALL, DZD, XCD, ARS, AWG, AUD, AZN, BSD, BHD, BDT, BBD, BZD, BMD, BOB, BWP, BRL, BND, BGN, XOF, MMK, KHR, + XAF, CAD, KYD, CLP, CNY, COP, CRC, HRK, CZK, DKK, DJF, DOP, EGP, SVC, ERN, ETB, EUR, FJD, XPF, GEL, GHS, + GIP, GTQ, HNL, HKD, HUF, ISK, INR, IDR, IRR, ILS, JMD, JPY, JOD, KZT, KES, KWD, LVL, LBP, LSL, LYD, LTL, + MOP, MKD, MYR, MVR, MRO, MUR, MXN, MNT, MAD, MZN, NAD, ANG, NZD, NIO, NGN, NOK, OMR, PKR, PAB, PYG, PEN, + PHP, PLN, QAR, RON, RUB, RWF, SAR, RSD, SCR, SLL, SGD, ZAR, KRW, LKR, SZL, SEK, CHF, SYP, TWD, TZS, THB, + TTD, TND, TRY, UAH, AED, GBP, USD, UYU, UZS, VEF, VND, YER, ZMW + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/Environment.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/Environment.cs similarity index 93% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/Environment.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/Environment.cs index 2420078..abdded6 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/Environment.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/Environment.cs @@ -1,8 +1,8 @@ -namespace Worldpay.Sdk.Enums -{ - public enum Environment - { - TEST, - LIVE - } -} +namespace Worldpay.Sdk.Enums +{ + public enum Environment + { + TEST, + LIVE + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/OrderStatus.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/OrderStatus.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/OrderStatus.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/OrderStatus.cs index c7eb772..b5ea698 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/OrderStatus.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/OrderStatus.cs @@ -1,19 +1,19 @@ -namespace Worldpay.Sdk.Enums -{ - public enum OrderStatus - { - SUCCESS, - FAILED, - AUTHORIZED, - PRE_AUTHORIZED, - SENT_FOR_REFUND, - PARTIALLY_REFUNDED, - REFUNDED, - SETTLED, - INFORMATION_REQUESTED, - INFORMATION_SUPPLIED, - CHARGED_BACK, - EXPIRED, - CHARGEBACK_REVERSED - } +namespace Worldpay.Sdk.Enums +{ + public enum OrderStatus + { + SUCCESS, + FAILED, + AUTHORIZED, + PRE_AUTHORIZED, + SENT_FOR_REFUND, + PARTIALLY_REFUNDED, + REFUNDED, + SETTLED, + INFORMATION_REQUESTED, + INFORMATION_SUPPLIED, + CHARGED_BACK, + EXPIRED, + CHARGEBACK_REVERSED + } } \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/OrderType.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/OrderType.cs similarity index 93% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/OrderType.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/OrderType.cs index c7a32e4..3068d7d 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/OrderType.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/OrderType.cs @@ -1,10 +1,10 @@ -namespace Worldpay.Sdk.Enums -{ - public enum OrderType - { - ECOM, - RECURRING, - MOTO, - APM - } -} +namespace Worldpay.Sdk.Enums +{ + public enum OrderType + { + ECOM, + RECURRING, + MOTO, + APM + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/RequestMethod.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/RequestMethod.cs similarity index 93% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/RequestMethod.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/RequestMethod.cs index 75464dd..73a8133 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/RequestMethod.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/RequestMethod.cs @@ -1,10 +1,10 @@ -namespace Worldpay.Sdk.Enums -{ - public enum RequestMethod - { - Delete, - Get, - Post, - Put - } -} +namespace Worldpay.Sdk.Enums +{ + public enum RequestMethod + { + Delete, + Get, + Post, + Put + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/WarningCode.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/WarningCode.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/WarningCode.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/WarningCode.cs index 0c6ff11..c1a29f1 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Enums/WarningCode.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Enums/WarningCode.cs @@ -1,13 +1,13 @@ -namespace Worldpay.Sdk.Enums -{ - public enum WarningCode - { - INVALID_KEY_FORMAT, - INVALID_KEY_VALUE, - INVALID_KEY_VALUE_ENTRY, - INVALID_VALUE_FOR_KEY, - INVALID_KEY, - KEY_VALUE_ENTRIES_LIMIT_EXCEEDED, - DUPLICATE_KEY_VALUE_ENTRIES_REMOVED - } -} +namespace Worldpay.Sdk.Enums +{ + public enum WarningCode + { + INVALID_KEY_FORMAT, + INVALID_KEY_VALUE, + INVALID_KEY_VALUE_ENTRY, + INVALID_VALUE_FOR_KEY, + INVALID_KEY, + KEY_VALUE_ENTRIES_LIMIT_EXCEEDED, + DUPLICATE_KEY_VALUE_ENTRIES_REMOVED + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Http.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Http.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Http.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Http.cs index c0a9a23..57c5a10 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Http.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Http.cs @@ -1,241 +1,243 @@ -using System; -using System.IO; -using System.Net; -using System.Text; -using System.Web; -using Newtonsoft.Json; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk -{ - /// - /// Class for handling generic HTTP API interactions - /// - public class Http - { - /// - /// Connection timeout in milliseconds - /// - private const int ConnectionTimeout = 61000; - - /// - /// JSON header value - /// - private const string ApplicationJson = "application/json"; - - /// - /// Service key - /// - private readonly string _serviceKey; - - /// - /// Authenticated - /// - private readonly bool _authenticated; - - /// - /// Constructor - /// - public Http() - { - _authenticated = false; - } - - /// - /// Constructor - /// - /// The authorization key for the service - public Http(string serviceKey) - { - _serviceKey = serviceKey; - _authenticated = true; - } - - /// - /// Perform a GET request - /// - internal TO Get(string api) - { - HttpWebRequest request = CreateRequest(api, RequestMethod.Get, null, _authenticated); - return SendRequest(request); - } - - /// - /// Perform a POST request - /// - internal void Post(string api, object item) - { - HttpWebRequest request = CreateRequest(api, RequestMethod.Post, item, _authenticated); - SendRequest(request); - } - - /// - /// Perform a PUT request - /// - internal void Put(string api, object item) - { - HttpWebRequest request = CreateRequest(api, RequestMethod.Put, item, _authenticated); - SendRequest(request); - } - - /// - /// Perform a POST request - /// - internal TO Post(string api, TI item) - { - HttpWebRequest request = CreateRequest(api, RequestMethod.Post, item, _authenticated); - return SendRequest(request); - } - - /// - /// Perform a POST request - /// - internal TO Put(string api, TI item) - { - HttpWebRequest request = CreateRequest(api, RequestMethod.Put, item, _authenticated); - return SendRequest(request); - } - - /// - /// Perform a DELETE request - /// - public void Delete(string api) - { - HttpWebRequest request = CreateRequest(api, RequestMethod.Delete, null, _authenticated); - SendRequest(request); - } - - /// - /// Handle an incoming request - /// - /// - /// - /// - public TO HandleRequest(HttpRequest request) - { - if (request.HttpMethod != "POST") - { - throw new WorldpayException("Invalid request"); - } - - return HandleResponse(request.InputStream); - } - - #region helpers - - private HttpWebRequest CreateRequest(string api, RequestMethod method, object data, bool authorize) - { - var request = (HttpWebRequest)HttpWebRequest.Create(api); - request.Accept = ApplicationJson; - request.Timeout = ConnectionTimeout; - - switch (method) - { - case RequestMethod.Get: - request.Method = WebRequestMethods.Http.Get; - break; - case RequestMethod.Post: - request.Method = WebRequestMethods.Http.Post; - break; - case RequestMethod.Put: - request.Method = WebRequestMethods.Http.Put; - break; - case RequestMethod.Delete: - request.Method = "DELETE"; - break; - default: - throw new NotSupportedException(String.Format("Request method {0} not supported", method.ToString())); - } - - if (authorize) - { - request.Headers.Add(HttpRequestHeader.Authorization, _serviceKey); - } - - try - { - if (data != null) - { - request.ContentType = ApplicationJson; - string serializedData = JavaScriptConvert.SerializeObject(data); - byte[] bytes = Encoding.UTF8.GetBytes(serializedData); - request.ContentLength = bytes.Length; - - using (Stream outputStream = request.GetRequestStream()) - { - outputStream.Write(bytes, 0, bytes.Length); - } - } - } - catch (WebException exc) - { - throw new WebException("Error with request " + request.RequestUri, exc); - } - - return request; - } - - private void SendRequest(HttpWebRequest request) - { - try - { - using (var response = request.GetResponse()) - { - // NO action to take - } - } - catch (WebException exc) - { - HandleError(exc); - } - } - - private T SendRequest(HttpWebRequest request) - { - try - { - using (var response = request.GetResponse()) - { - return HandleResponse(response.GetResponseStream()); - } - } - catch (WebException exc) - { - HandleError(exc); - return default(T); - } - } - - private T HandleResponse(Stream responseStream) - { - using (var reader = new StreamReader(responseStream)) - { - var serializer = new JsonSerializer(); - serializer.MissingMemberHandling = MissingMemberHandling.Ignore; - return (T)serializer.Deserialize(new JsonTextReader(reader), typeof(T)); - } - } - - private void HandleError(WebException exc) - { - using (var reader = new StreamReader(exc.Response.GetResponseStream())) - { - ApiError error = null; - try - { - string content = reader.ReadToEnd(); - error = JavaScriptConvert.DeserializeObject(content); - } - catch (Exception) - { - throw exc; - } - throw new WorldpayException(error, "API error: " + error.message); - } - } - - #endregion - - } -} +using System; +using System.IO; +using System.Net; +using System.Text; +using System.Web; +using Newtonsoft.Json; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Class for handling generic HTTP API interactions + /// + public class Http + { + /// + /// Connection timeout in milliseconds + /// + private const int ConnectionTimeout = 61000; + + /// + /// JSON header value + /// + private const string ApplicationJson = "application/json"; + + /// + /// Service key + /// + private readonly string _serviceKey; + + /// + /// Authenticated + /// + private readonly bool _authenticated; + + /// + /// Constructor + /// + public Http() + { + _authenticated = false; + } + + /// + /// Constructor + /// + /// The authorization key for the service + public Http(string serviceKey) + { + _serviceKey = serviceKey; + _authenticated = true; + } + + /// + /// Perform a GET request + /// + internal TO Get(string api) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Get, null, _authenticated); + return SendRequest(request); + } + + /// + /// Perform a POST request + /// + internal void Post(string api, object item) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Post, item, _authenticated); + SendRequest(request); + } + + /// + /// Perform a PUT request + /// + internal void Put(string api, object item) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Put, item, _authenticated); + SendRequest(request); + } + + /// + /// Perform a POST request + /// + internal TO Post(string api, TI item) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Post, item, _authenticated); + return SendRequest(request); + } + + /// + /// Perform a POST request + /// + internal TO Put(string api, TI item) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Put, item, _authenticated); + return SendRequest(request); + } + + /// + /// Perform a DELETE request + /// + public void Delete(string api) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Delete, null, _authenticated); + SendRequest(request); + } + + /// + /// Handle an incoming request + /// + /// + /// + /// + public TO HandleRequest(HttpRequest request) + { + if (request.HttpMethod != "POST") + { + throw new WorldpayException("Invalid request"); + } + + return HandleResponse(request.InputStream); + } + + #region helpers + + private HttpWebRequest CreateRequest(string api, RequestMethod method, object data, bool authorize) + { + var request = (HttpWebRequest)HttpWebRequest.Create(api); + request.Accept = ApplicationJson; + request.Timeout = ConnectionTimeout; + + request.Headers.Add("x-wp-client-user-agent", "NET-Client-4"); + + switch (method) + { + case RequestMethod.Get: + request.Method = WebRequestMethods.Http.Get; + break; + case RequestMethod.Post: + request.Method = WebRequestMethods.Http.Post; + break; + case RequestMethod.Put: + request.Method = WebRequestMethods.Http.Put; + break; + case RequestMethod.Delete: + request.Method = "DELETE"; + break; + default: + throw new NotSupportedException(String.Format("Request method {0} not supported", method.ToString())); + } + + if (authorize) + { + request.Headers.Add(HttpRequestHeader.Authorization, _serviceKey); + } + + try + { + if (data != null) + { + request.ContentType = ApplicationJson; + string serializedData = JavaScriptConvert.SerializeObject(data); + byte[] bytes = Encoding.UTF8.GetBytes(serializedData); + request.ContentLength = bytes.Length; + + using (Stream outputStream = request.GetRequestStream()) + { + outputStream.Write(bytes, 0, bytes.Length); + } + } + } + catch (WebException exc) + { + throw new WebException("Error with request " + request.RequestUri, exc); + } + + return request; + } + + private void SendRequest(HttpWebRequest request) + { + try + { + using (var response = request.GetResponse()) + { + // NO action to take + } + } + catch (WebException exc) + { + HandleError(exc); + } + } + + private T SendRequest(HttpWebRequest request) + { + try + { + using (var response = request.GetResponse()) + { + return HandleResponse(response.GetResponseStream()); + } + } + catch (WebException exc) + { + HandleError(exc); + return default(T); + } + } + + private T HandleResponse(Stream responseStream) + { + using (var reader = new StreamReader(responseStream)) + { + var serializer = new JsonSerializer(); + serializer.MissingMemberHandling = MissingMemberHandling.Ignore; + return (T)serializer.Deserialize(new JsonTextReader(reader), typeof(T)); + } + } + + private void HandleError(WebException exc) + { + using (var reader = new StreamReader(exc.Response.GetResponseStream())) + { + ApiError error = null; + try + { + string content = reader.ReadToEnd(); + error = JavaScriptConvert.DeserializeObject(content); + } + catch (Exception) + { + throw exc; + } + throw new WorldpayException(error, "API error: " + error.message); + } + } + + #endregion + + } +} diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Json/EntryConvertcs.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Json/EntryConvertcs.cs new file mode 100644 index 0000000..7a717f8 --- /dev/null +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Json/EntryConvertcs.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Json +{ + public class EntryConverter : JsonConverter + { + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + var list = value as List; + if (list == null) return; + + writer.WriteStartObject(); + foreach (var item in list) + { + writer.WritePropertyName(item.key); + writer.WriteValue(item.value); + } + writer.WriteEndObject(); + } + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + var jsonObject = JObject.Load(reader); + return jsonObject.Properties().Select(property => new Entry(property.Name, Convert.ToString(property.Value))).ToList(); + } + + public override bool CanConvert(Type objectType) + { + return objectType == typeof(List); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/MerchantService.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/MerchantService.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/MerchantService.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/MerchantService.cs index 8e4357e..dda8834 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/MerchantService.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/MerchantService.cs @@ -1,57 +1,57 @@ -using System; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk -{ - public class MerchantService : AbstractService - { - private readonly string _baseUrl; - - /// - /// Constructor - /// - public MerchantService(string baseUrl, Http http) : base(http) - { - _baseUrl = baseUrl; - } - - /// - /// - /// - /// - public void Create(BaseMerchant merchant) - { - Http.Post(String.Format("{0}/merchants", _baseUrl), merchant); - } - - /// - /// - /// - /// - public Merchant Get(string merchantId) - { - return Http.Get(String.Format("{0}/merchants/{1}", _baseUrl, merchantId)); - } - - /// - /// - /// - /// - /// - public void Update(string merchantId, Merchant merchant) - { - Http.Post(String.Format("{0}/merchants/{1}", _baseUrl, merchantId), merchant); - } - - /// - /// - /// - /// - /// - public void Put(string merchantId, Merchant merchant) - { - Http.Post(String.Format("{0}/merchants/{1}", _baseUrl, merchantId), merchant); - } - - } -} +using System; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + public class MerchantService : AbstractService + { + private readonly string _baseUrl; + + /// + /// Constructor + /// + public MerchantService(string baseUrl, Http http) : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// + /// + /// + public void Create(BaseMerchant merchant) + { + Http.Post(String.Format("{0}/merchants", _baseUrl), merchant); + } + + /// + /// + /// + /// + public Merchant Get(string merchantId) + { + return Http.Get(String.Format("{0}/merchants/{1}", _baseUrl, merchantId)); + } + + /// + /// + /// + /// + /// + public void Update(string merchantId, Merchant merchant) + { + Http.Post(String.Format("{0}/merchants/{1}", _baseUrl, merchantId), merchant); + } + + /// + /// + /// + /// + /// + public void Put(string merchantId, Merchant merchant) + { + Http.Post(String.Format("{0}/merchants/{1}", _baseUrl, merchantId), merchant); + } + + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/APMRequest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/APMRequest.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/APMRequest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/APMRequest.cs index 837b73b..91cd4cd 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/APMRequest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/APMRequest.cs @@ -1,18 +1,18 @@ -using System.Collections.Generic; - -namespace Worldpay.Sdk.Models -{ - public class APMRequest : AbstractPaymentMethod - { - public APMRequest() - { - this.type = "APM"; - } - - public string apmName { get; set; } - - public string shopperCountryCode { get; set; } - - public Dictionary apmFields { get; set; } - } -} +using System.Collections.Generic; + +namespace Worldpay.Sdk.Models +{ + public class APMRequest : AbstractPaymentMethod + { + public APMRequest() + { + this.type = "APM"; + } + + public string apmName { get; set; } + + public string shopperCountryCode { get; set; } + + public Dictionary apmFields { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractCard.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractCard.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractCard.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractCard.cs index 02a78fc..9143cfb 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractCard.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractCard.cs @@ -1,17 +1,17 @@ -namespace Worldpay.Sdk.Models -{ - abstract public class AbstractCard : AbstractPaymentMethod - { - public string name { get; set; } - - public int expiryMonth { get; set; } - - public int expiryYear { get; set; } - - public int? issueNumber { get; set; } - - public int? startMonth { get; set; } - - public int? startYear { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + abstract public class AbstractCard : AbstractPaymentMethod + { + public string name { get; set; } + + public int expiryMonth { get; set; } + + public int expiryYear { get; set; } + + public int? issueNumber { get; set; } + + public int? startMonth { get; set; } + + public int? startYear { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractOrder.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractOrder.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractOrder.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractOrder.cs index 1234674..864eee5 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractOrder.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractOrder.cs @@ -1,23 +1,23 @@ -namespace Worldpay.Sdk.Models -{ - public class AbstractOrder - { - public string token { get; set; } - - public string orderDescription { get; set; } - - public int? amount { get; set; } - - public string currencyCode { get; set; } - - public string settlementCurrency { get; set; } - - public string siteCode { get; set; } - - public bool authorizeOnly { get; set; } - - public bool authoriseOnly { get; set; } - - public int? authorizedAmount { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class AbstractOrder + { + public string token { get; set; } + + public string orderDescription { get; set; } + + public int? amount { get; set; } + + public string currencyCode { get; set; } + + public string settlementCurrency { get; set; } + + public string siteCode { get; set; } + + public bool authorizeOnly { get; set; } + + public bool authoriseOnly { get; set; } + + public int? authorizedAmount { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractPaymentMethod.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractPaymentMethod.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractPaymentMethod.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractPaymentMethod.cs index 7bf6ba5..b905089 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractPaymentMethod.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractPaymentMethod.cs @@ -1,7 +1,7 @@ -namespace Worldpay.Sdk.Models -{ - abstract public class AbstractPaymentMethod - { - public string type { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + abstract public class AbstractPaymentMethod + { + public string type { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractPerson.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractPerson.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractPerson.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractPerson.cs index 38ab893..53f4413 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractPerson.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractPerson.cs @@ -1,7 +1,7 @@ -namespace Worldpay.Sdk.Models -{ - abstract public class AbstractPerson - { - public Name name { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + abstract public class AbstractPerson + { + public Name name { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractTokenRequest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractTokenRequest.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractTokenRequest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractTokenRequest.cs index 124acf4..351cd17 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/AbstractTokenRequest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/AbstractTokenRequest.cs @@ -1,7 +1,7 @@ -namespace Worldpay.Sdk.Models -{ - abstract public class AbstractTokenRequest - { - public string clientKey { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + abstract public class AbstractTokenRequest + { + public string clientKey { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Account.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Account.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Account.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Account.cs index 7ccf729..e9cbc80 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Account.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Account.cs @@ -1,17 +1,17 @@ -using Worldpay.Sdk.Enums; - -namespace Worldpay.Sdk.Models -{ - public class Account - { - public string bankName { get; set; } - - public string sortCode { get; set; } - - public string accountNumber { get; set; } - - public string accountHolderName { get; set; } - - public CurrencyCode settlementCurrency { get; set; } - } -} +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + public class Account + { + public string bankName { get; set; } + + public string sortCode { get; set; } + + public string accountNumber { get; set; } + + public string accountHolderName { get; set; } + + public CurrencyCode settlementCurrency { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Address.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Address.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Address.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Address.cs index e73c20b..232160c 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Address.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Address.cs @@ -1,25 +1,25 @@ -using System; -using Worldpay.Sdk.Enums; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class Address - { - public string address1 { get; set; } - - public string address2 { get; set; } - - public string address3 { get; set; } - - public string postalCode { get; set; } - - public string city { get; set; } - - public string state { get; set; } - - public string countryCode { get; set; } - - public string telephoneNumber { get; set; } - } -} +using System; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class Address + { + public string address1 { get; set; } + + public string address2 { get; set; } + + public string address3 { get; set; } + + public string postalCode { get; set; } + + public string city { get; set; } + + public string state { get; set; } + + public string countryCode { get; set; } + + public string telephoneNumber { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/ApiError.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/ApiError.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/ApiError.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/ApiError.cs index 1848a38..a6fcadd 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/ApiError.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/ApiError.cs @@ -1,20 +1,20 @@ -using System; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class ApiError - { - public int httpStatusCode { get; set; } - - public string customCode { get; set; } - - public string message { get; set; } - - public string description { get; set; } - - public string errorHelpUrl { get; set; } - - public string originalRequest { get; set; } - } -} +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class ApiError + { + public int httpStatusCode { get; set; } + + public string customCode { get; set; } + + public string message { get; set; } + + public string description { get; set; } + + public string errorHelpUrl { get; set; } + + public string originalRequest { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/BaseMerchant.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/BaseMerchant.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/BaseMerchant.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/BaseMerchant.cs index f936573..4cc6e30 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/BaseMerchant.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/BaseMerchant.cs @@ -1,7 +1,7 @@ -namespace Worldpay.Sdk.Models -{ - public class BaseMerchant - { - public string aggregateMerchantId { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class BaseMerchant + { + public string aggregateMerchantId { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/BusinessProfile.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/BusinessProfile.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/BusinessProfile.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/BusinessProfile.cs index d11fb53..6b2cbab 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/BusinessProfile.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/BusinessProfile.cs @@ -1,33 +1,33 @@ -namespace Worldpay.Sdk.Models -{ - public class BusinessProfile - { - public string descriptionOfYourGoodsAndServices { get; set; } - - public int anticipatedAverageMonthlyTurnover { get; set; } - - public int anticipatedPeakMonthlyTurnover { get; set; } - - public int daysFromOrderConfirmationToDelivery { get; set; } - - public bool depositInAdvance { get; set; } - - public int percentageOfTotalTurnoverToRelatedBusiness { get; set; } - - public int percentageOfTotalTurnoverTakenAsDeposit { get; set; } - - public int averageDaysBetweenDepositAndFullPayment { get; set; } - - public int averageDaysBetweenFullPaymentAndDelivery { get; set; } - - public int averageDaysInHolidayDuration { get; set; } - - public bool doYouOfferSubscriptionMembershipServices { get; set; } - - public int averageSubscriptionLengthInMonths { get; set; } - - public int percentageOfTotalTurnoverToSubscriptionBusiness { get; set; } - - public int anticipatedTotalTurnoverForSubscription { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class BusinessProfile + { + public string descriptionOfYourGoodsAndServices { get; set; } + + public int anticipatedAverageMonthlyTurnover { get; set; } + + public int anticipatedPeakMonthlyTurnover { get; set; } + + public int daysFromOrderConfirmationToDelivery { get; set; } + + public bool depositInAdvance { get; set; } + + public int percentageOfTotalTurnoverToRelatedBusiness { get; set; } + + public int percentageOfTotalTurnoverTakenAsDeposit { get; set; } + + public int averageDaysBetweenDepositAndFullPayment { get; set; } + + public int averageDaysBetweenFullPaymentAndDelivery { get; set; } + + public int averageDaysInHolidayDuration { get; set; } + + public bool doYouOfferSubscriptionMembershipServices { get; set; } + + public int averageSubscriptionLengthInMonths { get; set; } + + public int percentageOfTotalTurnoverToSubscriptionBusiness { get; set; } + + public int anticipatedTotalTurnoverForSubscription { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/CaptureRequest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/CaptureRequest.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/CaptureRequest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/CaptureRequest.cs index 6a16a15..253f2a5 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/CaptureRequest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/CaptureRequest.cs @@ -1,8 +1,8 @@ - -namespace WorldPay.Sdk.Models -{ - public class CaptureRequest - { - public int captureAmount { get; set; } - } -} + +namespace WorldPay.Sdk.Models +{ + public class CaptureRequest + { + public int captureAmount { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/CardRequest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/CardRequest.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/CardRequest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/CardRequest.cs index c12c992..ac3202f 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/CardRequest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/CardRequest.cs @@ -1,14 +1,14 @@ -namespace Worldpay.Sdk.Models -{ - public class CardRequest : AbstractCard - { - public CardRequest() - { - this.type = "Card"; - } - - public string cardNumber { get; set; } - - public string cvc { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class CardRequest : AbstractCard + { + public CardRequest() + { + this.type = "Card"; + } + + public string cardNumber { get; set; } + + public string cvc { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Company.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Company.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Company.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Company.cs index 7ae529a..8f403e8 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Company.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Company.cs @@ -1,27 +1,27 @@ -namespace Worldpay.Sdk.Models -{ - public class Company - { - public string legalName { get; set; } - - public string tradingName { get; set; } - - public Address tradingAddress { get; set; } - - public Address legalAddress { get; set; } - - public string website { get; set; } - - public string companyType { get; set; } - - public string registrationNumber { get; set; } - - public string vatNumber { get; set; } - - public string incorporationMonth { get; set; } - - public string incorporationYear { get; set; } - - public string merchantCategoryPseudoName { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class Company + { + public string legalName { get; set; } + + public string tradingName { get; set; } + + public Address tradingAddress { get; set; } + + public Address legalAddress { get; set; } + + public string website { get; set; } + + public string companyType { get; set; } + + public string registrationNumber { get; set; } + + public string vatNumber { get; set; } + + public string incorporationMonth { get; set; } + + public string incorporationYear { get; set; } + + public string merchantCategoryPseudoName { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/DeliveryAddress.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/DeliveryAddress.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/DeliveryAddress.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/DeliveryAddress.cs index 499a548..1f25653 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/DeliveryAddress.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/DeliveryAddress.cs @@ -1,14 +1,14 @@ -using System; -using Worldpay.Sdk.Enums; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class DeliveryAddress : Address - { - public string firstName { get; set; } - - public string lastName { get; set; } - - } -} +using System; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class DeliveryAddress : Address + { + public string firstName { get; set; } + + public string lastName { get; set; } + + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Entry.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Entry.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Entry.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Entry.cs index faa7fe5..ca699c8 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Entry.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Entry.cs @@ -1,23 +1,23 @@ -using System; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class Entry - { - public string key { get; set; } - - public string value { get; set; } - - public Entry() - { - - } - - public Entry(string key, string value) - { - this.key = key; - this.value = value; - } - } -} +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class Entry + { + public string key { get; set; } + + public string value { get; set; } + + public Entry() + { + + } + + public Entry(string key, string value) + { + this.key = key; + this.value = value; + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Merchant.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Merchant.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Merchant.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Merchant.cs index 629a8c1..288ba7d 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Merchant.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Merchant.cs @@ -1,23 +1,23 @@ -namespace Worldpay.Sdk.Models -{ - public class Merchant : BaseMerchant - { - public MerchantOrderSetting orderSetting { get; set; } - - public PersonContact mainBusinessRepresentative { get; set; } - - public Company companyDetail { get; set; } - - public Account bankDetail { get; set; } - - public string statementNarrative { get; set; } - - public PersonContact technicalContact { get; set; } - - public BusinessProfile BusinessProfile { get; set; } - - public string priceCode { get; set; } - - public string shoppingCardUsed { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class Merchant : BaseMerchant + { + public MerchantOrderSetting orderSetting { get; set; } + + public PersonContact mainBusinessRepresentative { get; set; } + + public Company companyDetail { get; set; } + + public Account bankDetail { get; set; } + + public string statementNarrative { get; set; } + + public PersonContact technicalContact { get; set; } + + public BusinessProfile BusinessProfile { get; set; } + + public string priceCode { get; set; } + + public string shoppingCardUsed { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/MerchantOrderSetting.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/MerchantOrderSetting.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/MerchantOrderSetting.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/MerchantOrderSetting.cs index 55820ac..8a64b6f 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/MerchantOrderSetting.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/MerchantOrderSetting.cs @@ -1,7 +1,7 @@ -namespace Worldpay.Sdk.Models -{ - public class MerchantOrderSetting - { - public string optInForRecurringBilling { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class MerchantOrderSetting + { + public string optInForRecurringBilling { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Name.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Name.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Name.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Name.cs index cd89cc3..cd4f0ee 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Name.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Name.cs @@ -1,13 +1,13 @@ -namespace Worldpay.Sdk.Models -{ - public class Name - { - public string title { get; set; } - - public string firstName { get; set; } - - public string middleName { get; set; } - - public string lastName { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class Name + { + public string title { get; set; } + + public string firstName { get; set; } + + public string middleName { get; set; } + + public string lastName { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderAuthorizationRequest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderAuthorizationRequest.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderAuthorizationRequest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderAuthorizationRequest.cs index 2e98729..c506aaa 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderAuthorizationRequest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderAuthorizationRequest.cs @@ -1,38 +1,38 @@ -namespace Worldpay.Sdk.Models -{ - class OrderAuthorizationRequest - { - public OrderAuthorizationRequest() - { - this.threeDSecureInfo = new ThreeDSecureInfo(); - } - - public string threeDSResponseCode { get; set; } - - public ThreeDSecureInfo threeDSecureInfo { get; set; } - - public string shopperIpAddress - { - get { return threeDSecureInfo.shopperIpAddress; } - set { threeDSecureInfo.shopperIpAddress = value; } - } - - public string shopperSessionId - { - get { return threeDSecureInfo.shopperSessionId; } - set { threeDSecureInfo.shopperSessionId = value; } - } - - public string shopperUserAgent - { - get { return threeDSecureInfo.shopperUserAgent; } - set { threeDSecureInfo.shopperUserAgent = value; } - } - - public string shopperAcceptHeader - { - get { return threeDSecureInfo.shopperAcceptHeader; } - set { threeDSecureInfo.shopperAcceptHeader = value; } - } - } -} +namespace Worldpay.Sdk.Models +{ + class OrderAuthorizationRequest + { + public OrderAuthorizationRequest() + { + this.threeDSecureInfo = new ThreeDSecureInfo(); + } + + public string threeDSResponseCode { get; set; } + + public ThreeDSecureInfo threeDSecureInfo { get; set; } + + public string shopperIpAddress + { + get { return threeDSecureInfo.shopperIpAddress; } + set { threeDSecureInfo.shopperIpAddress = value; } + } + + public string shopperSessionId + { + get { return threeDSecureInfo.shopperSessionId; } + set { threeDSecureInfo.shopperSessionId = value; } + } + + public string shopperUserAgent + { + get { return threeDSecureInfo.shopperUserAgent; } + set { threeDSecureInfo.shopperUserAgent = value; } + } + + public string shopperAcceptHeader + { + get { return threeDSecureInfo.shopperAcceptHeader; } + set { threeDSecureInfo.shopperAcceptHeader = value; } + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderChangeNotification.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderChangeNotification.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderChangeNotification.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderChangeNotification.cs index 635bd3c..c23bf72 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderChangeNotification.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderChangeNotification.cs @@ -1,21 +1,21 @@ -using System; -using Worldpay.Sdk.Enums; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class OrderChangeNotification - { - public string merchantId { get; set; } - - public string notificationEventType { get; set; } - - public string adminCode { get; set; } - - public string orderCode { get; set; } - - public OrderStatus paymentStatus { get; set; } - - public string environment { get; set; } - } -} +using System; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class OrderChangeNotification + { + public string merchantId { get; set; } + + public string notificationEventType { get; set; } + + public string adminCode { get; set; } + + public string orderCode { get; set; } + + public OrderStatus paymentStatus { get; set; } + + public string environment { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderHistory.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderHistory.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderHistory.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderHistory.cs index e576625..ecf925c 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderHistory.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderHistory.cs @@ -1,26 +1,26 @@ -using System; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class OrderHistory - { - public string modificationDate { get; set; } - - public string state { get; set; } - - public int amount { get; set; } - - public string currencyCode { get; set; } - - public int currencyCodeExponent { get; set; } - - public int netAmount { get; set; } - - public string settlementCurrency { get; set; } - - public int settlementCurrencyExponent { get; set; } - - public int commission { get; set; } - } -} +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class OrderHistory + { + public string modificationDate { get; set; } + + public string state { get; set; } + + public int amount { get; set; } + + public string currencyCode { get; set; } + + public int currencyCodeExponent { get; set; } + + public int netAmount { get; set; } + + public string settlementCurrency { get; set; } + + public int settlementCurrencyExponent { get; set; } + + public int commission { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderRequest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderRequest.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderRequest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderRequest.cs index 161de9a..c51414d 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderRequest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderRequest.cs @@ -1,84 +1,84 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using Worldpay.Sdk.Enums; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class OrderRequest : AbstractOrder - { - public OrderRequest() - { - this.threeDSecureInfo = new ThreeDSecureInfo(); - } - - public string name { get; set; } - - public Address billingAddress { get; set; } - - public DeliveryAddress deliveryAddress { get; set; } - - public Dictionary customerIdentifiers { get; set; } - - public string customerOrderCode { get; set; } - - public string orderCodeSuffix { get; set; } - - public string orderCodePrefix { get; set; } - - public string shopperLanguageCode { get; set; } - - public bool reusable { get; set; } - - public AbstractPaymentMethod paymentMethod { get; set; } - - public string orderType { get; set; } - - public ThreeDSecureInfo threeDSecureInfo { get; set; } - - public string shopperIpAddress - { - get { return threeDSecureInfo.shopperIpAddress; } - set { threeDSecureInfo.shopperIpAddress = value; } - } - - public string shopperSessionId - { - get { return threeDSecureInfo.shopperSessionId; } - set { threeDSecureInfo.shopperSessionId = value; } - } - - public string shopperUserAgent - { - get { return threeDSecureInfo.shopperUserAgent; } - set { threeDSecureInfo.shopperUserAgent = value; } - } - - public string shopperAcceptHeader - { - get { return threeDSecureInfo.shopperAcceptHeader; } - set { threeDSecureInfo.shopperAcceptHeader = value; } - } - - [JsonIgnore] - public bool authoriseOnly { - get { return this.authorizeOnly; } - set { this.authorizeOnly = value; } - } - public bool is3DSOrder { get; set; } - - public string successUrl { get; set; } - - public string failureUrl { get; set; } - - public string cancelUrl { get; set; } - - public string pendingUrl { get; set; } - - public string shopperEmailAddress { get; set; } - - public string statementNarrative { get; set; } - - } -} +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class OrderRequest : AbstractOrder + { + public OrderRequest() + { + this.threeDSecureInfo = new ThreeDSecureInfo(); + } + + public string name { get; set; } + + public Address billingAddress { get; set; } + + public DeliveryAddress deliveryAddress { get; set; } + + public Dictionary customerIdentifiers { get; set; } + + public string customerOrderCode { get; set; } + + public string orderCodeSuffix { get; set; } + + public string orderCodePrefix { get; set; } + + public string shopperLanguageCode { get; set; } + + public bool reusable { get; set; } + + public AbstractPaymentMethod paymentMethod { get; set; } + + public string orderType { get; set; } + + public ThreeDSecureInfo threeDSecureInfo { get; set; } + + public string shopperIpAddress + { + get { return threeDSecureInfo.shopperIpAddress; } + set { threeDSecureInfo.shopperIpAddress = value; } + } + + public string shopperSessionId + { + get { return threeDSecureInfo.shopperSessionId; } + set { threeDSecureInfo.shopperSessionId = value; } + } + + public string shopperUserAgent + { + get { return threeDSecureInfo.shopperUserAgent; } + set { threeDSecureInfo.shopperUserAgent = value; } + } + + public string shopperAcceptHeader + { + get { return threeDSecureInfo.shopperAcceptHeader; } + set { threeDSecureInfo.shopperAcceptHeader = value; } + } + + [JsonIgnore] + public bool authoriseOnly { + get { return this.authorizeOnly; } + set { this.authorizeOnly = value; } + } + public bool is3DSOrder { get; set; } + + public string successUrl { get; set; } + + public string failureUrl { get; set; } + + public string cancelUrl { get; set; } + + public string pendingUrl { get; set; } + + public string shopperEmailAddress { get; set; } + + public string statementNarrative { get; set; } + + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderResponse.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderResponse.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderResponse.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderResponse.cs index db27876..ce47030 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/OrderResponse.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/OrderResponse.cs @@ -1,35 +1,35 @@ -using System.Collections.Generic; -using Worldpay.Sdk.Enums; - -namespace Worldpay.Sdk.Models -{ - public class OrderResponse : AbstractOrder - { - public string orderCode { get; set; } - - public OrderStatus paymentStatus { get; set; } - - public string paymentStatusReason { get; set; } - - public PaymentResponse paymentResponse { get; set; } - - public string customerOrderCode { get; set; } - - public bool is3DSOrder { get; set; } - - public string oneTime3DsToken { get; set; } - - public string redirectURL { get; set; } - - public Dictionary customerIdentifiers { get; set; } - - public Environment environment { get; set; } - - public string shopperEmailAddress { get; set; } - - public DeliveryAddress deliveryAddress { get; set; } - - public string statementNarrative { get; set; } - - } -} +using System.Collections.Generic; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + public class OrderResponse : AbstractOrder + { + public string orderCode { get; set; } + + public OrderStatus paymentStatus { get; set; } + + public string paymentStatusReason { get; set; } + + public PaymentResponse paymentResponse { get; set; } + + public string customerOrderCode { get; set; } + + public bool is3DSOrder { get; set; } + + public string oneTime3DsToken { get; set; } + + public string redirectURL { get; set; } + + public Dictionary customerIdentifiers { get; set; } + + public Environment environment { get; set; } + + public string shopperEmailAddress { get; set; } + + public DeliveryAddress deliveryAddress { get; set; } + + public string statementNarrative { get; set; } + + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PartialRefundRequest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PartialRefundRequest.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PartialRefundRequest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PartialRefundRequest.cs index 26db6ac..7aaa545 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PartialRefundRequest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PartialRefundRequest.cs @@ -1,7 +1,7 @@ -namespace WorldPay.Sdk.Models -{ - class PartialRefundRequest - { - public int refundAmount { get; set; } - } -} +namespace WorldPay.Sdk.Models +{ + class PartialRefundRequest + { + public int refundAmount { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PaymentResponse.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PaymentResponse.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PaymentResponse.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PaymentResponse.cs index 743283c..4a4596d 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PaymentResponse.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PaymentResponse.cs @@ -1,18 +1,18 @@ -using System; -using System.Collections.Generic; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class PaymentResponse : AbstractCard - { - public string cardType { get; set; } - - public string maskedCardNumber { get; set; } - - public Address billingAddress { get; set; } - - public Dictionary apmFields { get; set; } - - } -} +using System; +using System.Collections.Generic; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class PaymentResponse : AbstractCard + { + public string cardType { get; set; } + + public string maskedCardNumber { get; set; } + + public Address billingAddress { get; set; } + + public Dictionary apmFields { get; set; } + + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PersonContact.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PersonContact.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PersonContact.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PersonContact.cs index fd560bb..7ce275d 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PersonContact.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PersonContact.cs @@ -1,9 +1,9 @@ -namespace Worldpay.Sdk.Models -{ - public class PersonContact : AbstractPerson - { - public string email { get; set; } - - public string phone { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class PersonContact : AbstractPerson + { + public string email { get; set; } + + public string phone { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PersonRecord.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PersonRecord.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PersonRecord.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PersonRecord.cs index ab728c0..20d597b 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/PersonRecord.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/PersonRecord.cs @@ -1,19 +1,19 @@ -using Worldpay.Sdk.Enums; - -namespace Worldpay.Sdk.Models -{ - class PersonRecord : AbstractPerson - { - public int dayOfBirth { get; set; } - - public int monthOfBirth { get; set; } - - public int yearOfBirth { get; set; } - - public int ownershipPercentage { get; set; } - - public Address homeAddress { get; set; } - - public CountryCode nationality { get; set; } - } -} +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + class PersonRecord : AbstractPerson + { + public int dayOfBirth { get; set; } + + public int monthOfBirth { get; set; } + + public int yearOfBirth { get; set; } + + public int ownershipPercentage { get; set; } + + public Address homeAddress { get; set; } + + public CountryCode nationality { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/RiskSetting.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/RiskSetting.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/RiskSetting.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/RiskSetting.cs index 18ca725..3bb7d0d 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/RiskSetting.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/RiskSetting.cs @@ -1,12 +1,12 @@ -using System; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class RiskSetting - { - public bool cvcEnabled { get; set; } - - public bool avsEnabled { get; set; } - } -} +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class RiskSetting + { + public bool cvcEnabled { get; set; } + + public bool avsEnabled { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Setting.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Setting.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Setting.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Setting.cs index 9cf35e8..db3f141 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Setting.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Setting.cs @@ -1,16 +1,16 @@ -using System; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class Setting - { - public string keyType { get; set; } - - public string environment { get; set; } - - public bool enabled { get; set; } - - public string key { get; set; } - } -} +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class Setting + { + public string keyType { get; set; } + + public string environment { get; set; } + + public bool enabled { get; set; } + + public string key { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/SettingsResponse.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/SettingsResponse.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/SettingsResponse.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/SettingsResponse.cs index e6ce69d..7cfe594 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/SettingsResponse.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/SettingsResponse.cs @@ -1,19 +1,19 @@ -using System; -using System.Collections.Generic; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class SettingsResponse - { - public List keys { get; set; } - - public RiskSetting riskSetting { get; set; } - - public MerchantOrderSetting orderSetting { get; set; } - - public List webhooks { get; set; } - - public string webhookKey { get; set; } - } -} +using System; +using System.Collections.Generic; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class SettingsResponse + { + public List keys { get; set; } + + public RiskSetting riskSetting { get; set; } + + public MerchantOrderSetting orderSetting { get; set; } + + public List webhooks { get; set; } + + public string webhookKey { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/ThreeDSecureInfo.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/ThreeDSecureInfo.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/ThreeDSecureInfo.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/ThreeDSecureInfo.cs index 1a7098d..b38c17e 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/ThreeDSecureInfo.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/ThreeDSecureInfo.cs @@ -1,13 +1,13 @@ -namespace Worldpay.Sdk.Models -{ - public class ThreeDSecureInfo - { - public string shopperIpAddress { get; set; } - - public string shopperSessionId { get; set; } - - public string shopperAcceptHeader { get; set; } - - public string shopperUserAgent { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class ThreeDSecureInfo + { + public string shopperIpAddress { get; set; } + + public string shopperSessionId { get; set; } + + public string shopperAcceptHeader { get; set; } + + public string shopperUserAgent { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TokenRequest.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TokenRequest.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TokenRequest.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TokenRequest.cs index a21cbf8..c9b75c8 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TokenRequest.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TokenRequest.cs @@ -1,9 +1,9 @@ -namespace Worldpay.Sdk.Models -{ - public class TokenRequest : AbstractTokenRequest - { - public AbstractPaymentMethod paymentMethod { get; set; } - - public bool reusable { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class TokenRequest : AbstractTokenRequest + { + public AbstractPaymentMethod paymentMethod { get; set; } + + public bool reusable { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TokenResponse.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TokenResponse.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TokenResponse.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TokenResponse.cs index 7e02ae0..3ad4312 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TokenResponse.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TokenResponse.cs @@ -1,11 +1,11 @@ -namespace Worldpay.Sdk.Models -{ - public class TokenResponse - { - public string token { get; set; } - - public PaymentResponse paymentMethod { get; set; } - - public bool reusable { get; set; } - } -} +namespace Worldpay.Sdk.Models +{ + public class TokenResponse + { + public string token { get; set; } + + public PaymentResponse paymentMethod { get; set; } + + public bool reusable { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferDetail.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferDetail.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferDetail.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferDetail.cs index c944bde..0211021 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferDetail.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferDetail.cs @@ -1,12 +1,12 @@ -using System; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class TransferDetail - { - public string transferId { get; set; } - - public TransferOrder orders { get; set; } - } -} +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class TransferDetail + { + public string transferId { get; set; } + + public TransferOrder orders { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferOrder.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferOrder.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferOrder.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferOrder.cs index 2778ecb..63746cb 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferOrder.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferOrder.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using Worldpay.Sdk.Enums; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class TransferOrder - { - public int netAmount { get; set; } - - public int commission { get; set; } - - public string settlementCurrency { get; set; } - - public int settlementCurrencyExponent { get; set; } - - public int chargedbackAmount { get; set; } - - public int currencyCodeExponent { get; set; } - - public DateTime creationDate { get; set; } - - public string modificationDate { get; set; } - - public List history { get; set; } - - public string environment { get; set; } - - public string paymentStatus { get; set; } - - public string orderCode { get; set; } - - public string customerOrderCode { get; set; } - - public PaymentResponse paymentResponse { get; set; } - - public List warnings { get; set; } - - public Dictionary customerIdentifiers { get; set; } - - public string paymentStatusReason { get; set; } - - public CurrencyCode currencyCode { get; set; } - - public string token { get; set; } - - public string orderDescription { get; set; } - - public int amount { get; set; } - } -} +using System; +using System.Collections.Generic; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class TransferOrder + { + public int netAmount { get; set; } + + public int commission { get; set; } + + public string settlementCurrency { get; set; } + + public int settlementCurrencyExponent { get; set; } + + public int chargedbackAmount { get; set; } + + public int currencyCodeExponent { get; set; } + + public DateTime creationDate { get; set; } + + public string modificationDate { get; set; } + + public List history { get; set; } + + public string environment { get; set; } + + public string paymentStatus { get; set; } + + public string orderCode { get; set; } + + public string customerOrderCode { get; set; } + + public PaymentResponse paymentResponse { get; set; } + + public List warnings { get; set; } + + public Dictionary customerIdentifiers { get; set; } + + public string paymentStatusReason { get; set; } + + public CurrencyCode currencyCode { get; set; } + + public string token { get; set; } + + public string orderDescription { get; set; } + + public int amount { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferResponse.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferResponse.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferResponse.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferResponse.cs index e12df07..888fcd9 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferResponse.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferResponse.cs @@ -1,17 +1,17 @@ -using System; -using System.Collections.Generic; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class TransferResponse - { - public List transfers { get; set; } - - public int totalPages { get; set; } - - public int numberOfElements { get; set; } - - public int currentPageNumber { get; set; } - } -} +using System; +using System.Collections.Generic; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class TransferResponse + { + public List transfers { get; set; } + + public int totalPages { get; set; } + + public int numberOfElements { get; set; } + + public int currentPageNumber { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferSummary.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferSummary.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferSummary.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferSummary.cs index c09b99c..180396e 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/TransferSummary.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/TransferSummary.cs @@ -1,22 +1,22 @@ -using System; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class TransferSummary - { - public int netAmount { get; set; } - - public string settlementCurrency { get; set; } - - public string settlementCurrencyExponent { get; set; } - - public string bankName { get; set; } - - public string transferDate { get; set; } - - public string transferId { get; set; } - - public string batchId { get; set; } - } -} +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class TransferSummary + { + public int netAmount { get; set; } + + public string settlementCurrency { get; set; } + + public string settlementCurrencyExponent { get; set; } + + public string bankName { get; set; } + + public string transferDate { get; set; } + + public string transferId { get; set; } + + public string batchId { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Warning.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Warning.cs similarity index 94% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Warning.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Warning.cs index 3b29587..4000aeb 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/Warning.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/Warning.cs @@ -1,12 +1,12 @@ -using System; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class Warning - { - public string code { get; set; } - - public string message { get; set; } - } -} +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class Warning + { + public string code { get; set; } + + public string message { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/WebhookSetting.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/WebhookSetting.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/WebhookSetting.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/WebhookSetting.cs index 24865d4..8551cad 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Models/WebhookSetting.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Models/WebhookSetting.cs @@ -1,16 +1,16 @@ -using System; - -namespace Worldpay.Sdk.Models -{ - [Serializable] - public class WebhookSetting - { - public string webHookUrl { get; set; } - - public string webHookId { get; set; } - - public string creationDate { get; set; } - - public string[] events { get; set; } - } -} +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class WebhookSetting + { + public string webHookUrl { get; set; } + + public string webHookId { get; set; } + + public string creationDate { get; set; } + + public string[] events { get; set; } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/OrderService.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/OrderService.cs similarity index 97% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/OrderService.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/OrderService.cs index 3f20edc..2298d9e 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/OrderService.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/OrderService.cs @@ -1,125 +1,125 @@ -using System; -using WorldPay.Sdk.Models; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk -{ - /// - /// Service for interacting with the Worldpay Order API - /// - [Serializable] - public class OrderService : AbstractService - { - private readonly string _baseUrl; - - /// - /// Constructor - /// - public OrderService(string baseUrl, Http http) - : base(http) - { - _baseUrl = baseUrl; - } - - /// - /// Retrieve an existing order - /// - /// Code of the order to retrieve - /// Details of the existing order - public TransferOrder FindOrder(string orderCode) - { - return Http.Get(String.Format("{0}/orders/{1}", _baseUrl, orderCode)); - } - - /// - /// Create a new order - /// - /// Details of the order to be created - /// Confirmation of the new order - public OrderResponse Create(OrderRequest orderRequest) - { - return Http.Post(_baseUrl + "/orders", orderRequest); - } - - /// - /// Capture entire payment from an authorized order. - /// - /// The code of the authorized order to capture. - /// Confirmation of the captured order - public OrderResponse CaptureAuthorizedOrder(string orderCode) - { - return Http.Post(String.Format("{0}/orders/{1}/capture", _baseUrl, orderCode), null); - } - - /// - /// Partially capture payment from an authorized order. - /// - /// The code of the authorized order to capture. - /// The amount to capture. This must be less than or equal to the amount that was Authorized. - /// Confirmation of the captured order - public OrderResponse CaptureAuthorizedOrder(string orderCode, int amount) - { - if (amount == 0) - { - return CaptureAuthorizedOrder(orderCode); - } - else - { - return Http.Post(String.Format("{0}/orders/{1}/capture", _baseUrl, orderCode),new CaptureRequest { captureAmount = amount }); - } - } - - /// - /// Cancel an authorized order. - /// - /// The code of the authorized order to cancel. - public void CancelAuthorizedOrder(string orderCode) - { - Http.Delete(String.Format("{0}/orders/{1}", _baseUrl, orderCode)); - } - - /// - /// Authorize a 3DS order - /// - /// Order code for the orer to be authorized - /// Authorization Response code from Issuer - /// 3D Secure Information - /// Confirmation of the new order - public OrderResponse Authorize(string orderCode, string responseCode, ThreeDSecureInfo threeDSInfo) - { - return Http.Put(String.Format("{0}/orders/{1}", _baseUrl, orderCode), - new OrderAuthorizationRequest() - { - threeDSResponseCode = responseCode, - threeDSecureInfo = threeDSInfo - }); - } - - /// - /// Refund and existing order - /// - /// The code of the order to be refunded - public void Refund(String orderCode) - { - Http.Post(String.Format("{0}/orders/{1}/refund", _baseUrl, orderCode), null); - } - - /// - /// Partially refund an existing order - /// - /// The code of the order to be partially refunded - /// The amount of the order to be partially refunded - public void Refund(String orderCode, int amount) - { - if (amount == 0) - { - Refund(orderCode); - } - else - { - PartialRefundRequest partialRefundRequest = new PartialRefundRequest { refundAmount = amount }; - Http.Post(String.Format("{0}/orders/{1}/refund", _baseUrl, orderCode), partialRefundRequest); - } - } - } -} +using System; +using WorldPay.Sdk.Models; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Service for interacting with the Worldpay Order API + /// + [Serializable] + public class OrderService : AbstractService + { + private readonly string _baseUrl; + + /// + /// Constructor + /// + public OrderService(string baseUrl, Http http) + : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// Retrieve an existing order + /// + /// Code of the order to retrieve + /// Details of the existing order + public TransferOrder FindOrder(string orderCode) + { + return Http.Get(String.Format("{0}/orders/{1}", _baseUrl, orderCode)); + } + + /// + /// Create a new order + /// + /// Details of the order to be created + /// Confirmation of the new order + public OrderResponse Create(OrderRequest orderRequest) + { + return Http.Post(_baseUrl + "/orders", orderRequest); + } + + /// + /// Capture entire payment from an authorized order. + /// + /// The code of the authorized order to capture. + /// Confirmation of the captured order + public OrderResponse CaptureAuthorizedOrder(string orderCode) + { + return Http.Post(String.Format("{0}/orders/{1}/capture", _baseUrl, orderCode), null); + } + + /// + /// Partially capture payment from an authorized order. + /// + /// The code of the authorized order to capture. + /// The amount to capture. This must be less than or equal to the amount that was Authorized. + /// Confirmation of the captured order + public OrderResponse CaptureAuthorizedOrder(string orderCode, int amount) + { + if (amount == 0) + { + return CaptureAuthorizedOrder(orderCode); + } + else + { + return Http.Post(String.Format("{0}/orders/{1}/capture", _baseUrl, orderCode),new CaptureRequest { captureAmount = amount }); + } + } + + /// + /// Cancel an authorized order. + /// + /// The code of the authorized order to cancel. + public void CancelAuthorizedOrder(string orderCode) + { + Http.Delete(String.Format("{0}/orders/{1}", _baseUrl, orderCode)); + } + + /// + /// Authorize a 3DS order + /// + /// Order code for the orer to be authorized + /// Authorization Response code from Issuer + /// 3D Secure Information + /// Confirmation of the new order + public OrderResponse Authorize(string orderCode, string responseCode, ThreeDSecureInfo threeDSInfo) + { + return Http.Put(String.Format("{0}/orders/{1}", _baseUrl, orderCode), + new OrderAuthorizationRequest() + { + threeDSResponseCode = responseCode, + threeDSecureInfo = threeDSInfo + }); + } + + /// + /// Refund and existing order + /// + /// The code of the order to be refunded + public void Refund(String orderCode) + { + Http.Post(String.Format("{0}/orders/{1}/refund", _baseUrl, orderCode), null); + } + + /// + /// Partially refund an existing order + /// + /// The code of the order to be partially refunded + /// The amount of the order to be partially refunded + public void Refund(String orderCode, int amount) + { + if (amount == 0) + { + Refund(orderCode); + } + else + { + PartialRefundRequest partialRefundRequest = new PartialRefundRequest { refundAmount = amount }; + Http.Post(String.Format("{0}/orders/{1}/refund", _baseUrl, orderCode), partialRefundRequest); + } + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Properties/AssemblyInfo.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Properties/AssemblyInfo.cs similarity index 91% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Properties/AssemblyInfo.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Properties/AssemblyInfo.cs index ce853d0..556c9f1 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Properties/AssemblyInfo.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Properties/AssemblyInfo.cs @@ -1,36 +1,36 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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("Worldpay.Sdk")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Worldpay.Sdk")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[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("e5913d84-e250-4cb9-b780-bdd8786a76e7")] - -// 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("1.2.0.0")] -[assembly: AssemblyFileVersion("1.2.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +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("Worldpay.Sdk")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Worldpay.Sdk")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[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("e5913d84-e250-4cb9-b780-bdd8786a76e7")] + +// 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("1.2.0.1")] +[assembly: AssemblyFileVersion("1.2.0.1")] diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/SettingsService.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/SettingsService.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/SettingsService.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/SettingsService.cs index 702360a..119e32d 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/SettingsService.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/SettingsService.cs @@ -1,55 +1,55 @@ -using System; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk -{ - /// - /// Service for interacting with the Worldpay Order API - /// - [Serializable] - public class SettingsService : AbstractService - { - private readonly string _baseUrl; - - /// - /// Constructor - /// - public SettingsService(string baseUrl, Http http) : base(http) - { - _baseUrl = baseUrl; - } - - /// - /// - /// - /// - /// - public SettingsResponse GetSettings(string merchantId) - { - var url = String.Format("{0}/merchants/{1}/settings", _baseUrl, merchantId); - return Http.Get(url); - } - - /// - /// - /// - /// - /// - public void UpdateRiskSettings(string merchantId, RiskSetting riskSettings) - { - var url = String.Format("{0}/merchants/{1}/settings/riskSettings", _baseUrl, merchantId); - Http.Put(url, riskSettings); - } - - /// - /// - /// - /// - /// - public void UpdateRecurringBilling(string merchantId, bool enable) - { - var url = String.Format("{0}/merchants/{1}/settings/orderSettings/recurringBilling/{2}", _baseUrl, merchantId, enable); - Http.Put(url, null); - } - } -} +using System; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Service for interacting with the Worldpay Order API + /// + [Serializable] + public class SettingsService : AbstractService + { + private readonly string _baseUrl; + + /// + /// Constructor + /// + public SettingsService(string baseUrl, Http http) : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// + /// + /// + /// + public SettingsResponse GetSettings(string merchantId) + { + var url = String.Format("{0}/merchants/{1}/settings", _baseUrl, merchantId); + return Http.Get(url); + } + + /// + /// + /// + /// + /// + public void UpdateRiskSettings(string merchantId, RiskSetting riskSettings) + { + var url = String.Format("{0}/merchants/{1}/settings/riskSettings", _baseUrl, merchantId); + Http.Put(url, riskSettings); + } + + /// + /// + /// + /// + /// + public void UpdateRecurringBilling(string merchantId, bool enable) + { + var url = String.Format("{0}/merchants/{1}/settings/orderSettings/recurringBilling/{2}", _baseUrl, merchantId, enable); + Http.Put(url, null); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/TokenService.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/TokenService.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/TokenService.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/TokenService.cs index 145fe6e..3f245f2 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/TokenService.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/TokenService.cs @@ -1,27 +1,27 @@ -using System; -using Worldpay.Sdk; -using Worldpay.Sdk.Models; - -namespace WorldPay.Sdk -{ - public class TokenService : AbstractService - { - private readonly string _baseUrl; - - public TokenService(String baseUrl, Http http) - : base(http) - { - _baseUrl = baseUrl; - } - - /// - /// Retrieve stored card details - /// - /// The token of the card to obtain details for - /// The obfuscated card details associated with the token provided - public TokenResponse Get(string token) - { - return Http.Get(String.Format("{0}/tokens/{1}", _baseUrl, token)); - } - } -} +using System; +using Worldpay.Sdk; +using Worldpay.Sdk.Models; + +namespace WorldPay.Sdk +{ + public class TokenService : AbstractService + { + private readonly string _baseUrl; + + public TokenService(String baseUrl, Http http) + : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// Retrieve stored card details + /// + /// The token of the card to obtain details for + /// The obfuscated card details associated with the token provided + public TokenResponse Get(string token) + { + return Http.Get(String.Format("{0}/tokens/{1}", _baseUrl, token)); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/TransferService.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/TransferService.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/TransferService.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/TransferService.cs index ac86790..0d6e86e 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/TransferService.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/TransferService.cs @@ -1,45 +1,45 @@ -using System; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk -{ - /// - /// - /// - public class TransferService : AbstractService - { - /// - /// - /// - private readonly string _baseUrl; - - /// - /// Constructor - /// - public TransferService(string baseUrl, Http http) - : base(http) - { - _baseUrl = baseUrl; - } - - /// - /// - /// - /// - public TransferResponse GetTransfers(string merchantId, int? pageNumber) - { - var url = String.Format("{0}/transfers?merchantId={1}&pageNumber={2}", _baseUrl, merchantId, pageNumber); - return Http.Get(url); - } - - /// - /// - /// - /// - public TransferResponse GetTransfer(string transferId) - { - var url = String.Format("{0}/transfers", transferId); - return Http.Get(url); - } - } -} +using System; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// + /// + public class TransferService : AbstractService + { + /// + /// + /// + private readonly string _baseUrl; + + /// + /// Constructor + /// + public TransferService(string baseUrl, Http http) + : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// + /// + /// + public TransferResponse GetTransfers(string merchantId, int? pageNumber) + { + var url = String.Format("{0}/transfers?merchantId={1}&pageNumber={2}", _baseUrl, merchantId, pageNumber); + return Http.Get(url); + } + + /// + /// + /// + /// + public TransferResponse GetTransfer(string transferId) + { + var url = String.Format("{0}/transfers", transferId); + return Http.Get(url); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/WebhookHandler.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/WebhookHandler.cs similarity index 92% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/WebhookHandler.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/WebhookHandler.cs index 154fa7b..3fc70c4 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/WebhookHandler.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/WebhookHandler.cs @@ -1,6 +1,6 @@ -namespace Worldpay.Sdk -{ - public class WebhookHandler - { - } -} +namespace Worldpay.Sdk +{ + public class WebhookHandler + { + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/WebhookService.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/WebhookService.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/WebhookService.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/WebhookService.cs index b7f42ee..c499e24 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/WebhookService.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/WebhookService.cs @@ -1,26 +1,26 @@ -using System.Web; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk -{ - public class WebhookService : AbstractService - { - /// - /// Constructor - /// - public WebhookService(Http http) : base(http) - { - - } - - /// - /// Handle an order webhook - /// - /// The incoming web request - /// Order response data - public OrderChangeNotification ProcessWebhook(HttpRequest request) - { - return Http.HandleRequest(request); - } - } -} +using System.Web; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + public class WebhookService : AbstractService + { + /// + /// Constructor + /// + public WebhookService(Http http) : base(http) + { + + } + + /// + /// Handle an order webhook + /// + /// The incoming web request + /// Order response data + public OrderChangeNotification ProcessWebhook(HttpRequest request) + { + return Http.HandleRequest(request); + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/WorldPayException.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/WorldPayException.cs similarity index 95% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/WorldPayException.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/WorldPayException.cs index c79c63f..ba3cd26 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/WorldPayException.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/WorldPayException.cs @@ -1,31 +1,31 @@ -using System; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk -{ - /// - /// Exception thrown when error returned by Worldpay API - /// - public class WorldpayException : Exception - { - /// - /// Details of the API error - /// - public ApiError apiError { get; private set; } - - /// - /// Constructor - /// - public WorldpayException(string message) : this(null, message) - { - } - - /// - /// Constructor - /// - public WorldpayException(ApiError error, string message) : base(message) - { - apiError = error; - } - } -} +using System; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Exception thrown when error returned by Worldpay API + /// + public class WorldpayException : Exception + { + /// + /// Details of the API error + /// + public ApiError apiError { get; private set; } + + /// + /// Constructor + /// + public WorldpayException(string message) : this(null, message) + { + } + + /// + /// Constructor + /// + public WorldpayException(ApiError error, string message) : base(message) + { + apiError = error; + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/WorldPayRestClient.cs b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/WorldPayRestClient.cs similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/WorldPayRestClient.cs rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/WorldPayRestClient.cs index 8ddc73e..d5b3080 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/WorldPayRestClient.cs +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/WorldPayRestClient.cs @@ -1,104 +1,104 @@ -using System.IO; -using WorldPay.Sdk; - -namespace Worldpay.Sdk -{ - /// - /// Master client for interacting with Worldpay REST services - /// - public class WorldpayRestClient - { - /// - /// The base url for the REST service - /// - private readonly string _baseUrl; - - /// - /// The service key for authorizing access - /// - private readonly string _serviceKey; - - /// - /// Constructor - /// - public WorldpayRestClient(string baseUrl, string serviceKey) - { - if (baseUrl == null) - { - throw new InvalidDataException("baseUrl cannot be null"); - } - - _baseUrl = baseUrl; - - if (serviceKey == null) - { - throw new InvalidDataException("serviceKey cannot be null"); - } - - _serviceKey = serviceKey; - } - - /// - /// Constructor - /// - public WorldpayRestClient(string serviceKey) : this(Configuration.BaseUrl, serviceKey) { } - - /// - /// Get service for interacting with authorization API - /// - public AuthService GetAuthService() - { - return new AuthService(new Http()); - } - - public TokenService GetTokenService() - { - return new TokenService(_baseUrl, new Http(_serviceKey)); - } - - /// - /// - /// - /// - public MerchantService GetMerchantService() - { - return new MerchantService(_baseUrl, new Http(_serviceKey)); - } - - /// - /// - /// - /// - public OrderService GetOrderService() - { - return new OrderService(_baseUrl, new Http(_serviceKey)); - } - - /// - /// - /// - /// - public SettingsService GetSettingsService() - { - return new SettingsService(_baseUrl, new Http(_serviceKey)); - } - - /// - /// - /// - /// - public WebhookService GetWebhookService() - { - return new WebhookService(new Http(_serviceKey)); - } - - /// - /// - /// - /// - public TransferService GetTransferService() - { - return new TransferService(_baseUrl, new Http(_serviceKey)); - } - } -} +using System.IO; +using WorldPay.Sdk; + +namespace Worldpay.Sdk +{ + /// + /// Master client for interacting with Worldpay REST services + /// + public class WorldpayRestClient + { + /// + /// The base url for the REST service + /// + private readonly string _baseUrl; + + /// + /// The service key for authorizing access + /// + private readonly string _serviceKey; + + /// + /// Constructor + /// + public WorldpayRestClient(string baseUrl, string serviceKey) + { + if (baseUrl == null) + { + throw new InvalidDataException("baseUrl cannot be null"); + } + + _baseUrl = baseUrl; + + if (serviceKey == null) + { + throw new InvalidDataException("serviceKey cannot be null"); + } + + _serviceKey = serviceKey; + } + + /// + /// Constructor + /// + public WorldpayRestClient(string serviceKey) : this(Configuration.BaseUrl, serviceKey) { } + + /// + /// Get service for interacting with authorization API + /// + public AuthService GetAuthService() + { + return new AuthService(new Http()); + } + + public TokenService GetTokenService() + { + return new TokenService(_baseUrl, new Http(_serviceKey)); + } + + /// + /// + /// + /// + public MerchantService GetMerchantService() + { + return new MerchantService(_baseUrl, new Http(_serviceKey)); + } + + /// + /// + /// + /// + public OrderService GetOrderService() + { + return new OrderService(_baseUrl, new Http(_serviceKey)); + } + + /// + /// + /// + /// + public SettingsService GetSettingsService() + { + return new SettingsService(_baseUrl, new Http(_serviceKey)); + } + + /// + /// + /// + /// + public WebhookService GetWebhookService() + { + return new WebhookService(new Http(_serviceKey)); + } + + /// + /// + /// + /// + public TransferService GetTransferService() + { + return new TransferService(_baseUrl, new Http(_serviceKey)); + } + } +} diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Worldpay.Sdk.csproj b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Worldpay.Sdk.csproj new file mode 100644 index 0000000..894feab --- /dev/null +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Worldpay.Sdk.csproj @@ -0,0 +1,126 @@ + + + + + Debug + AnyCPU + {D2AB0290-8B33-4467-A0DF-975372B29E38} + Library + Properties + Worldpay.Sdk + Worldpay.Sdk + v3.5 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + lib\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Worldpay.Sdk20.csproj b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Worldpay.Sdk20.csproj similarity index 97% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Worldpay.Sdk20.csproj rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Worldpay.Sdk20.csproj index ae3eed9..43d718e 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Worldpay.Sdk20.csproj +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Worldpay.Sdk20.csproj @@ -1,122 +1,122 @@ - - - - - Debug - AnyCPU - {D2AB0290-8B33-4467-A0DF-975372B29E38} - Library - Properties - Worldpay.Sdk - Worldpay.Sdk - v2.0 - 512 - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\ - TRACE - prompt - 4 - false - - - - False - ..\Newtonsoft.Json\bin\Release\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - + + + + + Debug + AnyCPU + {D2AB0290-8B33-4467-A0DF-975372B29E38} + Library + Properties + Worldpay.Sdk + Worldpay.Sdk + v2.0 + 512 + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\ + TRACE + prompt + 4 + false + + + + False + ..\Newtonsoft.Json\bin\Release\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Worldpay.Sdk.csproj b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Worldpay.Sdk35.csproj old mode 100755 new mode 100644 similarity index 90% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Worldpay.Sdk.csproj rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/Worldpay.Sdk35.csproj index cc6fc60..eea1994 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Worldpay.Sdk.csproj +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/Worldpay.Sdk35.csproj @@ -1,5 +1,5 @@  - + Debug @@ -7,9 +7,9 @@ {D2AB0290-8B33-4467-A0DF-975372B29E38} Library Properties - WorldPay.Sdk + Worldpay.Sdk Worldpay.Sdk - v2.0 + v4.0 512 @@ -17,7 +17,7 @@ true full false - bin\Debug\ + bin\ DEBUG;TRACE prompt 4 @@ -26,13 +26,17 @@ pdbonly true - bin\Release\ + bin\ TRACE prompt 4 false + + False + ..\Newtonsoft.Json\bin\Release\Newtonsoft.Json.dll + @@ -102,12 +106,6 @@ - - - {a9ae40ff-1a21-414a-9fe7-3be13644cc6d} - Newtonsoft.Json - - Designer diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Newtonsoft.Json.dll old mode 100755 new mode 100644 similarity index 78% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/Newtonsoft.Json.dll rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Newtonsoft.Json.dll index b5c7bb5..a81b347 Binary files a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/Newtonsoft.Json.dll and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Newtonsoft.Json.dll differ diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Newtonsoft.Json.pdb new file mode 100644 index 0000000..2851c63 Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Newtonsoft.Json.pdb differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.xml b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Newtonsoft.Json.xml similarity index 98% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.xml rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Newtonsoft.Json.xml index f960454..e84b1b5 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.xml +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Newtonsoft.Json.xml @@ -1,3995 +1,3995 @@ - - - - Newtonsoft.Json - - - - - Instructs the how to serialize the object. - - - - - Gets or sets the member serialization. - - The member serialization. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified member serialization. - - The member serialization. - - - - Specifies the member serialization options for the . - - - - - All members are serialized by default. Members can be excluded using the . - - - - - Only members must be marked with the are serialized. - - - - - Specifies how object creation is handled by the . - - - - - Reuse existing objects, create new objects when needed. - - - - - Only reuse existing objects. - - - - - Always create new objects. - - - - - Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). - - - - - Gets or sets the date time styles used when converting a date to and from JSON. - - The date time styles used when converting a date to and from JSON. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. - - - - - The time represented is local time. - - - - - The time represented is UTC. - - - - - The time represented is not specified as either local time or Coordinated Universal Time (UTC). - - - - - Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. - - - - - Converts an to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Checks if the attributeName is a namespace attribute. - - Attribute name to test. - The attribute name prefix if it has one, otherwise an empty string. - True if attribute name is for a namespace attribute, otherwise false. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Converts a object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class with the specified . - - The TextReader containing the XML data to read. - - - - Sets the current token and value. - - The new token. - The value. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Changes the to Closed. - - - - - Instructs the to always serialize the member with the specified name. - - - - - Gets or sets the name of the property. - - The name of the property. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified name. - - Name of the property. - - - - Instructs the not to serialize the public field or public read/write property value. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. - - - - - Gets or sets which character to use to quote attribute values. - - - - - Gets or sets which character to use for indenting when is set to Formatting.Indented. - - - - - Gets or sets a value indicating whether object names will be surrounded with quotes. - - - - - Creates an instance of the JsonWriter class using the specified . - - The TextWriter to write to. - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the specified end token. - - The end token to write. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - - - - - - Gets the name. - - The name. - - - - Initializes a new instance of the class. - - The name. - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - - true if the specified is equal to the current ; otherwise, false. - - The parameter is null. - - - - Equalses the specified function. - - The function. - - - - - Equalses the specified a. - - A. - The b. - - - - - Serves as a hash function for a particular type. - - - A hash code for the current . - - - - - Returns a that represents the current . - - - A that represents the current . - - - - - Implements the operator ==. - - A. - The b. - The result of the operator. - - - - Implements the operator !=. - - A. - The b. - The result of the operator. - - - - Converts an object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Represents a collection of . - - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Specifies the state of the reader. - - - - - The Read method has not been called. - - - - - The end of the file has been reached successfully. - - - - - Reader is at a property. - - - - - Reader is at the start of an object. - - - - - Reader is in an object. - - - - - Reader is at the start of an array. - - - - - Reader is in an array. - - - - - The Close method has been called. - - - - - Reader has just read a value. - - - - - Reader is at the start of a constructor. - - - - - Reader in a constructor. - - - - - An error occurred that prevents the read operation from continuing. - - - - - The end of the file has been reached successfully. - - - - - Gets the current reader state. - - The current reader state. - - - - Gets the quotation mark character used to enclose the value of a string. - - - - - Gets the type of the current Json token. - - - - - Gets the text value of the current Json token. - - - - - Gets The Common Language Runtime (CLR) type for the current Json token. - - - - - Gets the depth of the current token in the JSON document. - - The depth of the current token in the JSON document. - - - - Initializes a new instance of the class with the specified . - - - - - Reads the next Json token from the stream. - - true if the next token was read successfully; false if there are no more tokens to read. - - - - Skips the children of the current token. - - - - - Sets the current token. - - The new token. - - - - Sets the current token and value. - - The new token. - The value. - - - - Sets the state based on current token type. - - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - - - - Releases unmanaged and - optionally - managed resources - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Changes the to Closed. - - - - - Provides methods for converting between common language runtime types and JavaScript types. - - - - - Represents JavaScript's boolean value true as a string. This field is read-only. - - - - - Represents JavaScript's boolean value false as a string. This field is read-only. - - - - - Represents JavaScript's null as a string. This field is read-only. - - - - - Represents JavaScript's undefined as a string. This field is read-only. - - - - - Represents JavaScript's positive infinity as a string. This field is read-only. - - - - - Represents JavaScript's negative infinity as a string. This field is read-only. - - - - - Represents JavaScript's NaN as a string. This field is read-only. - - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - The string delimiter character. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Serializes the specified object to a JSON string. - - The object to serialize. - A JSON string representation of the object. - - - - Serializes the specified object to a JSON string using a collection of . - - The object to serialize. - A collection converters used while serializing. - A JSON string representation of the object. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The of object being deserialized. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The type of the object to deserialize. - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified JSON to the given anonymous type. - - - The anonymous type to deserialize to. This can't be specified - traditionally and must be infered from the anonymous type passed - as a parameter. - - The object to deserialize. - The anonymous type object. - The deserialized anonymous type from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The type of the object to deserialize. - The object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The object to deserialize. - The type of the object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Serializes the XML node to a JSON string. - - The node to serialize. - A JSON string of the XmlNode. - - - - Deserializes the XmlNode from a JSON string. - - The JSON string. - The deserialized XmlNode - - - - The exception thrown when an error occurs during Json serialization or deserialization. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - Serializes and deserializes objects into and from the Json format. - The enables you to control how objects are encoded into Json. - - - - - Get or set how reference loops (e.g. a class referencing itself) is handled. - - - - - Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. - - - - - Get or set how null values are handled during serialization and deserialization. - - - - - Gets or sets how objects are created during deserialization. - - The object creation handling. - - - - Gets a collection that will be used during serialization. - - Collection that will be used during serialization. - - - - Initializes a new instance of the class. - - - - - Deserializes the Json structure contained by the specified . - - The that contains the Json structure to deserialize. - The being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Gets the serializable members for the given . - - The object to get seralizable members for. - Seralizable members for the given type. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Contains the LINQ to JSON extension methods. - - - - - Returns a collection of tokens that contains the ancestors of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the ancestors of every node in the source collection. - - - - Returns a collection of tokens that contains the descendants of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the descendants of every node in the source collection. - - - - Returns a collection of child properties of every object in the source collection. - - An of that contains the source collection. - An of that contains the properties of every object in the source collection. - - - - Returns a collection of child values of every object in the source collection with the given key. - - An of that contains the source collection. - The token key. - An of that contains the values of every node in the source collection with the given key. - - - - Returns a collection of child values of every object in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child values of every object in the source collection with the given key. - - The type to convert the values to. - An of that contains the source collection. - The token key. - An that contains the converted values of every node in the source collection with the given key. - - - - Returns a collection of converted child values of every object in the source collection. - - The type to convert the values to. - An of that contains the source collection. - An that contains the converted values of every node in the source collection. - - - - Returns a collection of child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the converted values of every node in the source collection. - - - - Represents a JSON constructor. - - - - - Gets or sets the name of this constructor. - - The constructor name. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name. - - The constructor name. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a token that can contain other tokens. - - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Get the first child token of this token. - - - A containing the first child token of the . - - - - - Get the last child token of this token. - - - A containing the last child token of the . - - - - - Returns a collection of the child tokens of this token, in document order. - - - An of containing the child tokens of this , in document order. - - - - - Returns a collection of the child values of this token, in document order. - - - - A containing the child values of this , in document order. - - - - - Returns a collection of the descendant tokens for this token in document order. - - An containing the descendant tokens of the . - - - - Adds the specified content as children of this . - - The content to be added. - - - - Adds the specified content as the first children of this . - - The content to be added. - - - - Creates an that can be used to add tokens to the . - - An that is ready to have content written to it. - - - - Replaces the children nodes of this token with the specified content. - - The content. - - - - Removes the child nodes from this token. - - - - - Represents a collection of objects. - - The type of token - - - - An empty collection of objects. - - - - - Initializes a new instance of the struct. - - The enumerable. - - - - Returns an enumerator that iterates through the collection. - - - A that can be used to iterate through the collection. - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Gets the with the specified key. - - - - - - Represents a JSON object. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Gets the node type for this . - - The type. - - - - Gets an of this object's properties. - - An of this object's properties. - - - - Gets a the specified name. - - The property name. - A with the specified name or null. - - - - Gets an of this object's property values. - - An of this object's property values. - - - - Gets the with the specified key. - - The with the specified key. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Represents a JSON array. - - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Returns a count of this token's child tokens. - - A count of this token's child tokens. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class. - - The token to read from. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the token being writen. - - The token being writen. - - - - Initializes a new instance of the class writing to the given . - - The container being written to. - - - - Initializes a new instance of the class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end. - - The token. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Represents an abstract JSON token. - - - - - Gets or sets the parent. - - The parent. - - - - Gets the root of this . - - The root of this . - - - - Gets the node type for this . - - The type. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Compares the values of two tokens, including the values of all descendant tokens. - - The first to compare. - The second to compare. - true if the tokens are equal; otherwise false. - - - - Gets the next sibling token of this node. - - The that contains the next sibling token. - - - - Gets the previous sibling token of this node. - - The that contains the previous sibling token. - - - - Returns a collection of the ancestor tokens of this token. - - A collection of the ancestor tokens of this token. - - - - Returns a collection of the sibling tokens after this token, in document order. - - A collection of the sibling tokens after this tokens, in document order. - - - - Returns a collection of the sibling tokens before this token, in document order. - - A collection of the sibling tokens before this token, in document order. - - - - Gets the with the specified key. - - The with the specified key. - - - - Gets the with the specified key converted to the specified type. - - The type to convert the token to. - The token key. - The converted token value. - - - - Get the first child token of this token. - - A containing the first child token of the . - - - - Get the last child token of this token. - - A containing the last child token of the . - - - - Returns a collection of the child tokens of this token, in document order. - - An of containing the child tokens of this , in document order. - - - - Returns a collection of the child tokens of this token, in document order. - - A containing the child tokens of this , in document order. - - - - Returns a collection of the child values of this token, in document order. - - A containing the child values of this , in document order. - - - - Removes this token from its parent. - - - - - Replaces this token with the specified token. - - The value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Returns the indented JSON for this token. - - - A containing the indented JSON. - - - - - Returns the indented JSON for this token using any given converters. - - A collection of which will be used when writing the token. - - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Represents a JSON property. - - - - - Gets the property name. - - The property name. - - - - Gets or sets the property value. - - The property value. - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - The property name. - - - - Initializes a new instance of the class. - - The property name. - The property value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies the type of token. - - - - - No token type has been set. - - - - - A JSON object. - - - - - A JSON array. - - - - - A JSON constructor. - - - - - A JSON object property. - - - - - A comment. - - - - - An integer value. - - - - - A float value. - - - - - A string value. - - - - - A boolean value. - - - - - A null value. - - - - - An undefined value. - - - - - A date value. - - - - - Represents a value in JSON (string, integer, date, etc). - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Creates a comment with the given value. - - The value. - A comment with the given value. - - - - Creates a string with the given value. - - The value. - A string with the given value. - - - - Gets the node type for this . - - The type. - - - - Gets or sets the underlying token value. - - The underlying token value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies missing member handling options for the . - - - - - Throw a when a missing member is encountered during deserialization. - - - - - Ignore a missing member and do not attempt to deserialize it. - - - - - Specifies null value handling options for the . - - - - - Include null values when serializing and deserializing objects. - - - - - Ignore null values when serializing and deserializing objects. - - - - - Specifies reference loop handling options for the . - - - - - Throw a when a loop is encountered. - - - - - Ignore loop references and do not serialize. - - - - - Serialize loop references. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null, empty or its contents are uninitialized values. - - The list. - - true if the collection is null or empty or its contents are uninitialized values; otherwise, false. - - - - - Makes a slice of the specified list in between the start and end indexes. - - The list. - The start index. - The end index. - A slice of the list. - - - - Makes a slice of the specified list in between the start and end indexes, - getting every so many items based upon the step. - - The list. - The start index. - The end index. - The step. - A slice of the list. - - - - Group the collection using a function which returns the key. - - The source collection to group. - The key selector. - A Dictionary with each key relating to a list of objects in a list grouped under it. - - - - Adds the elements of the specified collection to the specified generic IList. - - The list to add to. - The collection of elements to add. - - - - Gets the type of the typed list's items. - - The type. - The type of the typed list's items. - - - - Tests whether the list's items are their unitialized value. - - The list. - Whether the list's items are their unitialized value - - - - Gets the member's underlying type. - - The member. - The underlying type of the member. - - - - Determines whether the member is an indexed property. - - The member. - - true if the member is an indexed property; otherwise, false. - - - - - Determines whether the property is an indexed property. - - The property. - - true if the property is an indexed property; otherwise, false. - - - - - Gets the member's value on the object. - - The member. - The target object. - The member's value on the object. - - - - Sets the member's value on the target object. - - The member. - The target. - The value. - - - - Determines whether the specified MemberInfo can be read. - - The MemberInfo to determine whether can be read. - - true if the specified MemberInfo can be read; otherwise, false. - - - - - Determines whether the specified MemberInfo can be set. - - The MemberInfo to determine whether can be set. - - true if the specified MemberInfo can be set; otherwise, false. - - - - - Determines whether the string contains white space. - - The string to test for white space. - - true if the string contains white space; otherwise, false. - - - - - Determines whether the string is all white space. Empty string will return false. - - The string to test whether it is all white space. - - true if the string is all white space; otherwise, false. - - - - - Ensures the target string ends with the specified string. - - The target. - The value. - The target string with the value string at the end. - - - - Determines whether the SqlString is null or empty. - - The string. - - true if the SqlString is null or empty; otherwise, false. - - - - - Perform an action if the string is not null or empty. - - The value. - The action to perform. - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - The indent character. - - - - - Numbers the lines. - - The string to number. - - - - - Nulls an empty string. - - The string. - Null if the string was null, otherwise the string unchanged. - - - - Specifies the type of Json token. - - - - - This is returned by the if a method has not been called. - - - - - An object start token. - - - - - An array start token. - - - - - An object property name. - - - - - A constructor end token. - - - - - A comment. - - - - - An interger. - - - - - A float. - - - - - A string. - - - - - A boolean. - - - - - A null token. - - - - - An undefined token. - - - - - An object end token. - - - - - An array end token. - - - - - A constructor start token. - - - - - A Date. - - - - - Specifies the state of the . - - - - - An exception has been thrown, which has left the in an invalid state. - You may call the method to put the in the Closed state. - Any other method calls results in an being thrown. - - - - - The method has been called. - - - - - An object is being written. - - - - - A array is being written. - - - - - A constructor is being written. - - - - - A property is being written. - - - - - A write method has not been called. - - - - - Specifies formatting options for the . - - - - - No special formatting is applied. This is the default. - - - - - Causes child objects to be indented according to the and settings. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the top. - - The top. - - - - Gets the state of the writer. - - - - - Indicates how the output is formatted. - - - - - Creates an instance of the JsonWriter class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the end of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the end of an array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end constructor. - - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes the end of the current Json object or array. - - - - - Writes the current token. - - The to read the token from. - - - - Writes the specified end token. - - The end token to write. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. - - - - - Provides a set of static (Shared in Visual Basic) methods for - querying objects that implement . - - - - - Returns the input typed as . - - - - - Returns an empty that has the - specified type argument. - - - - - Converts the elements of an to the - specified type. - - - - - Filters the elements of an based on a specified type. - - - - - Generates a sequence of integral numbers within a specified range. - - The value of the first integer in the sequence. - The number of sequential integers to generate. - - - - Generates a sequence that contains one repeated value. - - - - - Filters a sequence of values based on a predicate. - - - - - Filters a sequence of values based on a predicate. - Each element's index is used in the logic of the predicate function. - - - - - Projects each element of a sequence into a new form. - - - - - Projects each element of a sequence into a new form by - incorporating the element's index. - - - - - Projects each element of a sequence to an - and flattens the resulting sequences into one sequence. - - - - - Projects each element of a sequence to an , - and flattens the resulting sequences into one sequence. The - index of each source element is used in the projected form of - that element. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. The index of - each source element is used in the intermediate projected form - of that element. - - - - - Returns elements from a sequence as long as a specified condition is true. - - - - - Returns elements from a sequence as long as a specified condition is true. - The element's index is used in the logic of the predicate function. - - - - - Returns a specified number of contiguous elements from the start - of a sequence. - - - - - Base implementation of First operator. - - - - - Returns the first element of a sequence. - - - - - Returns the first element in a sequence that satisfies a specified condition. - - - - - Returns the first element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the first element of the sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Last operator. - - - - - Returns the last element of a sequence. - - - - - Returns the last element of a sequence that satisfies a - specified condition. - - - - - Returns the last element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the last element of a sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Single operator. - - - - - Returns the only element of a sequence, and throws an exception - if there is not exactly one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition, and throws an exception if more than one - such element exists. - - - - - Returns the only element of a sequence, or a default value if - the sequence is empty; this method throws an exception if there - is more than one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition or a default value if no such element - exists; this method throws an exception if more than one element - satisfies the condition. - - - - - Returns the element at a specified index in a sequence. - - - - - Returns the element at a specified index in a sequence or a - default value if the index is out of range. - - - - - Inverts the order of the elements in a sequence. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. The element's - index is used in the logic of the predicate function. - - - - - Bypasses a specified number of elements in a sequence and then - returns the remaining elements. - - - - - Returns the number of elements in a sequence. - - - - - Returns a number that represents how many elements in the - specified sequence satisfy a condition. - - - - - Returns an that represents the total number - of elements in a sequence. - - - - - Returns an that represents how many elements - in a sequence satisfy a condition. - - - - - Concatenates two sequences. - - - - - Creates a from an . - - - - - Creates an array from an . - - - - - Returns distinct elements from a sequence by using the default - equality comparer to compare values. - - - - - Returns distinct elements from a sequence by using a specified - to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and a key comparer. - - - - - Creates a from an - according to specified key - and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer and an element selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function and compares the keys by using a specified - comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and projects the elements for each group by - using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. - - - - - Groups the elements of a sequence according to a key selector - function. The keys are compared by using a comparer and each - group's elements are projected by using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The elements of each group are projected by using a - specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The keys are compared by using a specified comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. Key values are compared by using a specified comparer, - and the elements of each group are projected by using a - specified function. - - - - - Applies an accumulator function over a sequence. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value, and the - specified function is used to select the result value. - - - - - Produces the set union of two sequences by using the default - equality comparer. - - - - - Produces the set union of two sequences by using a specified - . - - - - - Returns the elements of the specified sequence or the type - parameter's default value in a singleton collection if the - sequence is empty. - - - - - Returns the elements of the specified sequence or the specified - value in a singleton collection if the sequence is empty. - - - - - Determines whether all elements of a sequence satisfy a condition. - - - - - Determines whether a sequence contains any elements. - - - - - Determines whether any element of a sequence satisfies a - condition. - - - - - Determines whether a sequence contains a specified element by - using the default equality comparer. - - - - - Determines whether a sequence contains a specified element by - using a specified . - - - - - Determines whether two sequences are equal by comparing the - elements by using the default equality comparer for their type. - - - - - Determines whether two sequences are equal by comparing their - elements by using a specified . - - - - - Base implementation for Min/Max operator. - - - - - Base implementation for Min/Max operator for nullable types. - - - - - Returns the minimum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the minimum resulting value. - - - - - Returns the maximum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the maximum resulting value. - - - - - Makes an enumerator seen as enumerable once more. - - - The supplied enumerator must have been started. The first element - returned is the element the enumerator was on when passed in. - DO NOT use this method if the caller must be a generator. It is - mostly safe among aggregate operations. - - - - - Sorts the elements of a sequence in ascending order according to a key. - - - - - Sorts the elements of a sequence in ascending order by using a - specified comparer. - - - - - Sorts the elements of a sequence in descending order according to a key. - - - - - Sorts the elements of a sequence in descending order by using a - specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order by using a specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order, according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order by using a specified comparer. - - - - - Base implementation for Intersect and Except operators. - - - - - Produces the set intersection of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set intersection of two sequences by using the - specified to compare values. - - - - - Produces the set difference of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set difference of two sequences by using the - specified to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and key comparer. - - - - - Creates a from an - according to specified key - selector and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer, and an element selector function. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. A - specified is used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. A specified - is used to compare keys. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Represents a collection of objects that have a common key. - - - - - Gets the key of the . - - - - - Defines an indexer, size property, and Boolean search method for - data structures that map keys to - sequences of values. - - - - - Represents a sorted sequence. - - - - - Performs a subsequent ordering on the elements of an - according to a key. - - - - - Represents a collection of keys each mapped to one or more values. - - - - - Gets the number of key/value collection pairs in the . - - - - - Gets the collection of values indexed by the specified key. - - - - - Determines whether a specified key is in the . - - - - - Applies a transform function to each key and its associated - values and returns the results. - - - - - Returns a generic enumerator that iterates through the . - - - - - This attribute allows us to define extension methods without - requiring .NET Framework 3.5. For more information, see the section, - Extension Methods in .NET Framework 2.0 Apps, - of Basic Instincts: Extension Methods - column in MSDN Magazine, - issue Nov 2007. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - + + + + Newtonsoft.Json + + + + + Instructs the how to serialize the object. + + + + + Gets or sets the member serialization. + + The member serialization. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Specifies the member serialization options for the . + + + + + All members are serialized by default. Members can be excluded using the . + + + + + Only members must be marked with the are serialized. + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + + + + + The time represented is local time. + + + + + The time represented is UTC. + + + + + The time represented is not specified as either local time or Coordinated Universal Time (UTC). + + + + + Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + + + + + Converts an to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Sets the current token and value. + + The new token. + The value. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Instructs the to always serialize the member with the specified name. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + + + + + + Gets the name. + + The name. + + + + Initializes a new instance of the class. + + The name. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + The parameter is null. + + + + Equalses the specified function. + + The function. + + + + + Equalses the specified a. + + A. + The b. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Implements the operator ==. + + A. + The b. + The result of the operator. + + + + Implements the operator !=. + + A. + The b. + The result of the operator. + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Represents a collection of . + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Gets the type of the current Json token. + + + + + Gets the text value of the current Json token. + + + + + Gets The Common Language Runtime (CLR) type for the current Json token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next Json token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Provides methods for converting between common language runtime types and JavaScript types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + The string delimiter character. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The type of the object to deserialize. + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The object to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The type of the object to deserialize. + The object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The object to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Serializes and deserializes objects into and from the Json format. + The enables you to control how objects are encoded into Json. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Initializes a new instance of the class. + + + + + Deserializes the Json structure contained by the specified . + + The that contains the Json structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Gets the serializable members for the given . + + The object to get seralizable members for. + Seralizable members for the given type. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Returns a collection of child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the converted values of every node in the source collection. + + + + Represents a JSON constructor. + + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a token that can contain other tokens. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets the node type for this . + + The type. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Gets the with the specified key. + + The with the specified key. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Represents a JSON array. + + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Returns a count of this token's child tokens. + + A count of this token's child tokens. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the token being writen. + + The token being writen. + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Represents an abstract JSON token. + + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order. + + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + A containing the indented JSON. + + + + + Returns the indented JSON for this token using any given converters. + + A collection of which will be used when writing the token. + + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Represents a JSON property. + + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + The property name. + + + + Initializes a new instance of the class. + + The property name. + The property value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies missing member handling options for the . + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null, empty or its contents are uninitialized values. + + The list. + + true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + + + + + Makes a slice of the specified list in between the start and end indexes. + + The list. + The start index. + The end index. + A slice of the list. + + + + Makes a slice of the specified list in between the start and end indexes, + getting every so many items based upon the step. + + The list. + The start index. + The end index. + The step. + A slice of the list. + + + + Group the collection using a function which returns the key. + + The source collection to group. + The key selector. + A Dictionary with each key relating to a list of objects in a list grouped under it. + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Gets the type of the typed list's items. + + The type. + The type of the typed list's items. + + + + Tests whether the list's items are their unitialized value. + + The list. + Whether the list's items are their unitialized value + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string contains white space. + + The string to test for white space. + + true if the string contains white space; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Ensures the target string ends with the specified string. + + The target. + The value. + The target string with the value string at the end. + + + + Determines whether the SqlString is null or empty. + + The string. + + true if the SqlString is null or empty; otherwise, false. + + + + + Perform an action if the string is not null or empty. + + The value. + The action to perform. + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + The indent character. + + + + + Numbers the lines. + + The string to number. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + An object property name. + + + + + A constructor end token. + + + + + A comment. + + + + + An interger. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor start token. + + + + + A Date. + + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Indicates how the output is formatted. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Provides a set of static (Shared in Visual Basic) methods for + querying objects that implement . + + + + + Returns the input typed as . + + + + + Returns an empty that has the + specified type argument. + + + + + Converts the elements of an to the + specified type. + + + + + Filters the elements of an based on a specified type. + + + + + Generates a sequence of integral numbers within a specified range. + + The value of the first integer in the sequence. + The number of sequential integers to generate. + + + + Generates a sequence that contains one repeated value. + + + + + Filters a sequence of values based on a predicate. + + + + + Filters a sequence of values based on a predicate. + Each element's index is used in the logic of the predicate function. + + + + + Projects each element of a sequence into a new form. + + + + + Projects each element of a sequence into a new form by + incorporating the element's index. + + + + + Projects each element of a sequence to an + and flattens the resulting sequences into one sequence. + + + + + Projects each element of a sequence to an , + and flattens the resulting sequences into one sequence. The + index of each source element is used in the projected form of + that element. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. The index of + each source element is used in the intermediate projected form + of that element. + + + + + Returns elements from a sequence as long as a specified condition is true. + + + + + Returns elements from a sequence as long as a specified condition is true. + The element's index is used in the logic of the predicate function. + + + + + Returns a specified number of contiguous elements from the start + of a sequence. + + + + + Base implementation of First operator. + + + + + Returns the first element of a sequence. + + + + + Returns the first element in a sequence that satisfies a specified condition. + + + + + Returns the first element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the first element of the sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Last operator. + + + + + Returns the last element of a sequence. + + + + + Returns the last element of a sequence that satisfies a + specified condition. + + + + + Returns the last element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the last element of a sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Single operator. + + + + + Returns the only element of a sequence, and throws an exception + if there is not exactly one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition, and throws an exception if more than one + such element exists. + + + + + Returns the only element of a sequence, or a default value if + the sequence is empty; this method throws an exception if there + is more than one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition or a default value if no such element + exists; this method throws an exception if more than one element + satisfies the condition. + + + + + Returns the element at a specified index in a sequence. + + + + + Returns the element at a specified index in a sequence or a + default value if the index is out of range. + + + + + Inverts the order of the elements in a sequence. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. The element's + index is used in the logic of the predicate function. + + + + + Bypasses a specified number of elements in a sequence and then + returns the remaining elements. + + + + + Returns the number of elements in a sequence. + + + + + Returns a number that represents how many elements in the + specified sequence satisfy a condition. + + + + + Returns an that represents the total number + of elements in a sequence. + + + + + Returns an that represents how many elements + in a sequence satisfy a condition. + + + + + Concatenates two sequences. + + + + + Creates a from an . + + + + + Creates an array from an . + + + + + Returns distinct elements from a sequence by using the default + equality comparer to compare values. + + + + + Returns distinct elements from a sequence by using a specified + to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and a key comparer. + + + + + Creates a from an + according to specified key + and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer and an element selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function and compares the keys by using a specified + comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and projects the elements for each group by + using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. + + + + + Groups the elements of a sequence according to a key selector + function. The keys are compared by using a comparer and each + group's elements are projected by using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The elements of each group are projected by using a + specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The keys are compared by using a specified comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. Key values are compared by using a specified comparer, + and the elements of each group are projected by using a + specified function. + + + + + Applies an accumulator function over a sequence. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value, and the + specified function is used to select the result value. + + + + + Produces the set union of two sequences by using the default + equality comparer. + + + + + Produces the set union of two sequences by using a specified + . + + + + + Returns the elements of the specified sequence or the type + parameter's default value in a singleton collection if the + sequence is empty. + + + + + Returns the elements of the specified sequence or the specified + value in a singleton collection if the sequence is empty. + + + + + Determines whether all elements of a sequence satisfy a condition. + + + + + Determines whether a sequence contains any elements. + + + + + Determines whether any element of a sequence satisfies a + condition. + + + + + Determines whether a sequence contains a specified element by + using the default equality comparer. + + + + + Determines whether a sequence contains a specified element by + using a specified . + + + + + Determines whether two sequences are equal by comparing the + elements by using the default equality comparer for their type. + + + + + Determines whether two sequences are equal by comparing their + elements by using a specified . + + + + + Base implementation for Min/Max operator. + + + + + Base implementation for Min/Max operator for nullable types. + + + + + Returns the minimum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the minimum resulting value. + + + + + Returns the maximum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the maximum resulting value. + + + + + Makes an enumerator seen as enumerable once more. + + + The supplied enumerator must have been started. The first element + returned is the element the enumerator was on when passed in. + DO NOT use this method if the caller must be a generator. It is + mostly safe among aggregate operations. + + + + + Sorts the elements of a sequence in ascending order according to a key. + + + + + Sorts the elements of a sequence in ascending order by using a + specified comparer. + + + + + Sorts the elements of a sequence in descending order according to a key. + + + + + Sorts the elements of a sequence in descending order by using a + specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order by using a specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order, according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order by using a specified comparer. + + + + + Base implementation for Intersect and Except operators. + + + + + Produces the set intersection of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set intersection of two sequences by using the + specified to compare values. + + + + + Produces the set difference of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set difference of two sequences by using the + specified to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and key comparer. + + + + + Creates a from an + according to specified key + selector and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer, and an element selector function. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. A + specified is used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. A specified + is used to compare keys. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Represents a collection of objects that have a common key. + + + + + Gets the key of the . + + + + + Defines an indexer, size property, and Boolean search method for + data structures that map keys to + sequences of values. + + + + + Represents a sorted sequence. + + + + + Performs a subsequent ordering on the elements of an + according to a key. + + + + + Represents a collection of keys each mapped to one or more values. + + + + + Gets the number of key/value collection pairs in the . + + + + + Gets the collection of values indexed by the specified key. + + + + + Determines whether a specified key is in the . + + + + + Applies a transform function to each key and its associated + values and returns the results. + + + + + Returns a generic enumerator that iterates through the . + + + + + This attribute allows us to define extension methods without + requiring .NET Framework 3.5. For more information, see the section, + Extension Methods in .NET Framework 2.0 Apps, + of Basic Instincts: Extension Methods + column in MSDN Magazine, + issue Nov 2007. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll new file mode 100644 index 0000000..de9b6e1 Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config similarity index 81% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config rename to worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config index f9fb7e9..f7a40b3 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config +++ b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config @@ -1,12 +1,12 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Worldpay.Sdk.pdb new file mode 100644 index 0000000..da8426c Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/bin/Worldpay.Sdk.pdb differ diff --git a/worldpay-lib-dotnet-4-0/Worldpay.Sdk/lib/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/lib/Newtonsoft.Json.dll new file mode 100644 index 0000000..4703b89 Binary files /dev/null and b/worldpay-lib-dotnet-4-0/Worldpay.Sdk/lib/Newtonsoft.Json.dll differ diff --git a/worldpay-lib-dotnet-2-0/.gitignore b/worldpay-lib-dotnet-4-6/.gitignore similarity index 90% rename from worldpay-lib-dotnet-2-0/.gitignore rename to worldpay-lib-dotnet-4-6/.gitignore index a879798..f4ecdc5 100644 --- a/worldpay-lib-dotnet-2-0/.gitignore +++ b/worldpay-lib-dotnet-4-6/.gitignore @@ -1,4 +1,4 @@ -TestResults -obj -*.suo +TestResults +obj +*.suo *.user \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/HtmlColorConverter.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/HtmlColorConverter.cs new file mode 100644 index 0000000..71c09fa --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/HtmlColorConverter.cs @@ -0,0 +1,71 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Drawing; + +namespace Newtonsoft.Json.Converters +{ + /// + /// Converts a object to and from JSON. + /// + public class HtmlColorConverter : JsonConverter + { + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public override void WriteJson(JsonWriter writer, object value) + { + writer.WriteValue(ColorTranslator.ToHtml((Color)value)); + } + + /// + /// Determines whether this instance can convert the specified value type. + /// + /// Type of the value. + /// + /// true if this instance can convert the specified value type; otherwise, false. + /// + public override bool CanConvert(Type valueType) + { + return typeof(Color).IsAssignableFrom(valueType); + } + + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public override object ReadJson(JsonReader reader, Type objectType) + { + throw new NotImplementedException(); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs new file mode 100644 index 0000000..dad4e0d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs @@ -0,0 +1,90 @@ +using System; +using System.Globalization; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Converters +{ + /// + /// Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + /// + public class IsoDateTimeConverter : JsonConverter + { + private const string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK"; + + private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind; + + /// + /// Gets or sets the date time styles used when converting a date to and from JSON. + /// + /// The date time styles used when converting a date to and from JSON. + public DateTimeStyles DateTimeStyles + { + get { return _dateTimeStyles; } + set { _dateTimeStyles = value; } + } + + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public override void WriteJson(JsonWriter writer, object value) + { + string text; + + if (value is DateTime) + { + DateTime dateTime = (DateTime)value; + + if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal + || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal) + dateTime = dateTime.ToUniversalTime(); + + text = dateTime.ToString(DateTimeFormat, CultureInfo.InvariantCulture); + } + else + { + DateTimeOffset dateTimeOffset = (DateTimeOffset)value; + if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal + || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal) + dateTimeOffset = dateTimeOffset.ToUniversalTime(); + + text = dateTimeOffset.ToString(DateTimeFormat, CultureInfo.InvariantCulture); + } + + writer.WriteValue(text); + } + + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public override object ReadJson(JsonReader reader, Type objectType) + { + if (reader.TokenType != JsonToken.String) + throw new Exception("Unexpected token parsing date. Expected String, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); + + string dateText = reader.Value.ToString(); + + if (objectType == typeof(DateTimeOffset)) + return DateTimeOffset.Parse(dateText, CultureInfo.InvariantCulture, _dateTimeStyles); + + return DateTime.Parse(dateText, CultureInfo.InvariantCulture, _dateTimeStyles); + } + + /// + /// Determines whether this instance can convert the specified object type. + /// + /// Type of the object. + /// + /// true if this instance can convert the specified object type; otherwise, false. + /// + public override bool CanConvert(Type objectType) + { + return (typeof(DateTime).IsAssignableFrom(objectType) + || typeof(DateTimeOffset).IsAssignableFrom(objectType)); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs new file mode 100644 index 0000000..5704d6a --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs @@ -0,0 +1,83 @@ +using System; +using System.Globalization; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Converters +{ + /// + /// Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + /// + public class JavaScriptDateTimeConverter : JsonConverter + { + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public override void WriteJson(JsonWriter writer, object value) + { + long ticks; + + if (value is DateTime) + { + DateTime dateTime = (DateTime)value; + DateTime utcDateTime = dateTime.ToUniversalTime(); + ticks = JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(utcDateTime); + } + else + { + DateTimeOffset dateTimeOffset = (DateTimeOffset)value; + DateTimeOffset utcDateTimeOffset = dateTimeOffset.ToUniversalTime(); + ticks = JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(utcDateTimeOffset.UtcDateTime); + } + + writer.WriteStartConstructor("Date"); + writer.WriteValue(ticks); + writer.WriteEndConstructor(); + } + + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public override object ReadJson(JsonReader reader, Type objectType) + { + if (reader.TokenType != JsonToken.StartConstructor || string.Compare(reader.Value.ToString(), "Date", StringComparison.Ordinal) != 0) + throw new Exception("Unexpected token or value when parsing date. Token: {0}, Value: {1}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType, reader.Value)); + + reader.Read(); + + if (reader.TokenType != JsonToken.Integer) + throw new Exception("Unexpected token parsing date. Expected Integer, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); + + long ticks = (long)reader.Value; + + DateTime d = JavaScriptConvert.ConvertJavaScriptTicksToDateTime(ticks); + + reader.Read(); + + if (reader.TokenType != JsonToken.EndConstructor) + throw new Exception("Unexpected token parsing date. Expected EndConstructor, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); + + if (objectType == typeof(DateTimeOffset)) + return new DateTimeOffset(d); + + return d; + } + + /// + /// Determines whether this instance can convert the specified object type. + /// + /// Type of the object. + /// + /// true if this instance can convert the specified object type; otherwise, false. + /// + public override bool CanConvert(Type objectType) + { + return (typeof(DateTime).IsAssignableFrom(objectType) + || typeof(DateTimeOffset).IsAssignableFrom(objectType)); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/JsonDateTimeSerializationMode.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/JsonDateTimeSerializationMode.cs new file mode 100644 index 0000000..ab53622 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/JsonDateTimeSerializationMode.cs @@ -0,0 +1,25 @@ +namespace Newtonsoft.Json.Converters +{ + /// + /// Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + /// + public enum JsonDateTimeSerializationMode + { + /// + /// The time represented is local time. + /// + Local, + /// + /// The time represented is UTC. + /// + Utc, + /// + /// The time represented is not specified as either local time or Coordinated Universal Time (UTC). + /// + Unspecified, + /// + /// Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + /// + RoundtripKind + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/XmlNodeConverter.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/XmlNodeConverter.cs new file mode 100644 index 0000000..79d8c56 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Converters/XmlNodeConverter.cs @@ -0,0 +1,552 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Converters +{ + /// + /// Converts an to and from JSON. + /// + public class XmlNodeConverter : JsonConverter + { + private const string TextName = "#text"; + private const string CommentName = "#comment"; + private const string CDataName = "#cdata-section"; + private const string WhitespaceName = "#whitespace"; + private const string SignificantWhitespaceName = "#significant-whitespace"; + private const string DeclarationName = "?xml"; + private const string JsonNamespaceUri = "http://james.newtonking.com/projects/json"; + + #region Writing + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public override void WriteJson(JsonWriter writer, object value) + { + XmlNode node = value as XmlNode; + + if (node == null) + throw new ArgumentException("Value must be an XmlNode", "value"); + + writer.WriteStartObject(); + SerializeNode(writer, node, true); + writer.WriteEndObject(); + } + + private string GetPropertyName(XmlNode node) + { + switch (node.NodeType) + { + case XmlNodeType.Attribute: + return "@" + node.Name; + case XmlNodeType.CDATA: + return CDataName; + case XmlNodeType.Comment: + return CommentName; + case XmlNodeType.Element: + return node.Name; + case XmlNodeType.ProcessingInstruction: + return "?" + node.Name; + case XmlNodeType.XmlDeclaration: + return DeclarationName; + case XmlNodeType.SignificantWhitespace: + return SignificantWhitespaceName; + case XmlNodeType.Text: + return TextName; + case XmlNodeType.Whitespace: + return WhitespaceName; + default: + throw new JsonSerializationException("Unexpected XmlNodeType when getting node name: " + node.NodeType); + } + } + + private void SerializeGroupedNodes(JsonWriter writer, XmlNode node) + { + // group nodes together by name + Dictionary> nodesGroupedByName = new Dictionary>(); + + for (int i = 0; i < node.ChildNodes.Count; i++) + { + XmlNode childNode = node.ChildNodes[i]; + string nodeName = GetPropertyName(childNode); + + List nodes; + if (!nodesGroupedByName.TryGetValue(nodeName, out nodes)) + { + nodes = new List(); + nodesGroupedByName.Add(nodeName, nodes); + } + + nodes.Add(childNode); + } + + // loop through grouped nodes. write single name instances as normal, + // write multiple names together in an array + foreach (KeyValuePair> nodeNameGroup in nodesGroupedByName) + { + List groupedNodes = nodeNameGroup.Value; + bool writeArray; + + if (groupedNodes.Count == 1) + { + XmlNode singleNode = groupedNodes[0]; + XmlAttribute jsonArrayAttribute = (singleNode.Attributes != null) ? singleNode.Attributes["Array", JsonNamespaceUri] : null; + if (jsonArrayAttribute != null) + writeArray = XmlConvert.ToBoolean(jsonArrayAttribute.Value); + else + writeArray = false; + } + else + { + writeArray = true; + } + + if (!writeArray) + { + SerializeNode(writer, groupedNodes[0], true); + } + else + { + string elementNames = nodeNameGroup.Key; + writer.WritePropertyName(nodeNameGroup.Key); + writer.WriteStartArray(); + + for (int i = 0; i < groupedNodes.Count; i++) + { + SerializeNode(writer, groupedNodes[i], false); + } + + writer.WriteEndArray(); + } + } + } + + private void SerializeNode(JsonWriter writer, XmlNode node, bool writePropertyName) + { + switch (node.NodeType) + { + case XmlNodeType.Document: + case XmlNodeType.DocumentFragment: + SerializeGroupedNodes(writer, node); + break; + case XmlNodeType.Element: + if (writePropertyName) + writer.WritePropertyName(node.Name); + + if (ValueAttributes(node.Attributes).Count() == 0 && node.ChildNodes.Count == 1 + && node.ChildNodes[0].NodeType == XmlNodeType.Text) + { + // write elements with a single text child as a name value pair + writer.WriteValue(node.ChildNodes[0].Value); + } + else if (node.ChildNodes.Count == 0 && CollectionUtils.IsNullOrEmpty(node.Attributes)) + { + // empty element + writer.WriteNull(); + } + else if (node.ChildNodes.OfType().Where(x => x.Name.StartsWith("-")).Count() > 1) + { + XmlElement constructorValueElement = node.ChildNodes.OfType().Where(x => x.Name.StartsWith("-")).First(); + string constructorName = constructorValueElement.Name.Substring(1); + + writer.WriteStartConstructor(constructorName); + + for (int i = 0; i < node.ChildNodes.Count; i++) + { + SerializeNode(writer, node.ChildNodes[i], false); + } + + writer.WriteEndConstructor(); + } + else + { + writer.WriteStartObject(); + + for (int i = 0; i < node.Attributes.Count; i++) + { + SerializeNode(writer, node.Attributes[i], true); + } + + SerializeGroupedNodes(writer, node); + + writer.WriteEndObject(); + } + + break; + case XmlNodeType.Comment: + if (writePropertyName) + writer.WriteComment(node.Value); + break; + case XmlNodeType.Attribute: + case XmlNodeType.Text: + case XmlNodeType.CDATA: + case XmlNodeType.ProcessingInstruction: + case XmlNodeType.Whitespace: + case XmlNodeType.SignificantWhitespace: + if (node.Prefix == "xmlns" && node.Value == JsonNamespaceUri) + break; + else if (node.NamespaceURI == JsonNamespaceUri) + break; + + if (writePropertyName) + writer.WritePropertyName(GetPropertyName(node)); + writer.WriteValue(node.Value); + break; + case XmlNodeType.XmlDeclaration: + XmlDeclaration declaration = (XmlDeclaration)node; + writer.WritePropertyName(GetPropertyName(node)); + writer.WriteStartObject(); + + if (!string.IsNullOrEmpty(declaration.Version)) + { + writer.WritePropertyName("@version"); + writer.WriteValue(declaration.Version); + } + if (!string.IsNullOrEmpty(declaration.Encoding)) + { + writer.WritePropertyName("@encoding"); + writer.WriteValue(declaration.Encoding); + } + if (!string.IsNullOrEmpty(declaration.Standalone)) + { + writer.WritePropertyName("@standalone"); + writer.WriteValue(declaration.Standalone); + } + + writer.WriteEndObject(); + break; + default: + throw new JsonSerializationException("Unexpected XmlNodeType when serializing nodes: " + node.NodeType); + } + } + #endregion + + #region Reading + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public override object ReadJson(JsonReader reader, Type objectType) + { + // maybe have CanReader and a CanWrite methods so this sort of test wouldn't be necessary + if (objectType != typeof(XmlDocument)) + throw new JsonSerializationException("XmlNodeConverter only supports deserializing XmlDocuments"); + + XmlDocument document = new XmlDocument(); + XmlNamespaceManager manager = new XmlNamespaceManager(document.NameTable); + + if (reader.TokenType != JsonToken.StartObject) + throw new JsonSerializationException("XmlNodeConverter can only convert JSON that begins with an object."); + + reader.Read(); + + DeserializeNode(reader, document, manager, document); + + return document; + } + + private void DeserializeValue(JsonReader reader, XmlDocument document, XmlNamespaceManager manager, string propertyName, XmlNode currentNode) + { + switch (propertyName) + { + case TextName: + currentNode.AppendChild(document.CreateTextNode(reader.Value.ToString())); + break; + case CDataName: + currentNode.AppendChild(document.CreateCDataSection(reader.Value.ToString())); + break; + case WhitespaceName: + currentNode.AppendChild(document.CreateWhitespace(reader.Value.ToString())); + break; + case SignificantWhitespaceName: + currentNode.AppendChild(document.CreateSignificantWhitespace(reader.Value.ToString())); + break; + default: + // processing instructions and the xml declaration start with ? + if (!string.IsNullOrEmpty(propertyName) && propertyName[0] == '?') + { + if (propertyName == DeclarationName) + { + string version = null; + string encoding = null; + string standalone = null; + while (reader.Read() && reader.TokenType != JsonToken.EndObject) + { + switch (reader.Value.ToString()) + { + case "@version": + reader.Read(); + version = reader.Value.ToString(); + break; + case "@encoding": + reader.Read(); + encoding = reader.Value.ToString(); + break; + case "@standalone": + reader.Read(); + standalone = reader.Value.ToString(); + break; + default: + throw new JsonSerializationException("Unexpected property name encountered while deserializing XmlDeclaration: " + reader.Value); + } + } + + XmlDeclaration declaration = document.CreateXmlDeclaration(version, encoding, standalone); + currentNode.AppendChild(declaration); + } + else + { + XmlProcessingInstruction instruction = document.CreateProcessingInstruction(propertyName.Substring(1), reader.Value.ToString()); + currentNode.AppendChild(instruction); + } + } + else + { + // deserialize xml element + bool finishedAttributes = false; + bool finishedElement = false; + string elementPrefix = GetPrefix(propertyName); + Dictionary attributeNameValues = new Dictionary(); + + // a string token means the element only has a single text child + if (reader.TokenType != JsonToken.String + && reader.TokenType != JsonToken.Null + && reader.TokenType != JsonToken.Boolean + && reader.TokenType != JsonToken.Integer + && reader.TokenType != JsonToken.Float + && reader.TokenType != JsonToken.Date + && reader.TokenType != JsonToken.StartConstructor) + { + // read properties until first non-attribute is encountered + while (!finishedAttributes && !finishedElement && reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + string attributeName = reader.Value.ToString(); + + if (attributeName[0] == '@') + { + attributeName = attributeName.Substring(1); + reader.Read(); + string attributeValue = reader.Value.ToString(); + attributeNameValues.Add(attributeName, attributeValue); + + string namespacePrefix; + + if (IsNamespaceAttribute(attributeName, out namespacePrefix)) + { + manager.AddNamespace(namespacePrefix, attributeValue); + } + } + else + { + finishedAttributes = true; + } + break; + case JsonToken.EndObject: + finishedElement = true; + break; + default: + throw new JsonSerializationException("Unexpected JsonToken: " + reader.TokenType); + } + } + } + + // have to wait until attributes have been parsed before creating element + // attributes may contain namespace info used by the element + XmlElement element = (!string.IsNullOrEmpty(elementPrefix)) + ? document.CreateElement(propertyName, manager.LookupNamespace(elementPrefix)) + : document.CreateElement(propertyName); + + currentNode.AppendChild(element); + + // add attributes to newly created element + foreach (KeyValuePair nameValue in attributeNameValues) + { + string attributePrefix = GetPrefix(nameValue.Key); + + XmlAttribute attribute = (!string.IsNullOrEmpty(attributePrefix)) + ? document.CreateAttribute(nameValue.Key, manager.LookupNamespace(attributePrefix)) + : document.CreateAttribute(nameValue.Key); + + attribute.Value = nameValue.Value; + + element.SetAttributeNode(attribute); + } + + if (reader.TokenType == JsonToken.String) + { + element.AppendChild(document.CreateTextNode(reader.Value.ToString())); + } + else if (reader.TokenType == JsonToken.Integer) + { + element.AppendChild(document.CreateTextNode(XmlConvert.ToString((long)reader.Value))); + } + else if (reader.TokenType == JsonToken.Float) + { + element.AppendChild(document.CreateTextNode(XmlConvert.ToString((double)reader.Value))); + } + else if (reader.TokenType == JsonToken.Boolean) + { + element.AppendChild(document.CreateTextNode(XmlConvert.ToString((bool)reader.Value))); + } + else if (reader.TokenType == JsonToken.Date) + { + DateTime d = (DateTime)reader.Value; + element.AppendChild(document.CreateTextNode(XmlConvert.ToString(d, DateTimeUtils.ToSerializationMode(d.Kind)))); + } + else if (reader.TokenType == JsonToken.Null) + { + // empty element. do nothing + } + else + { + // finished element will have no children to deserialize + if (!finishedElement) + { + manager.PushScope(); + + DeserializeNode(reader, document, manager, element); + + manager.PopScope(); + } + } + } + break; + } + } + + private void DeserializeNode(JsonReader reader, XmlDocument document, XmlNamespaceManager manager, XmlNode currentNode) + { + do + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + if (currentNode.NodeType == XmlNodeType.Document && document.DocumentElement != null) + throw new JsonSerializationException("JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document."); + + string propertyName = reader.Value.ToString(); + reader.Read(); + + if (reader.TokenType == JsonToken.StartArray) + { + while (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + DeserializeValue(reader, document, manager, propertyName, currentNode); + } + } + else + { + DeserializeValue(reader, document, manager, propertyName, currentNode); + } + break; + case JsonToken.StartConstructor: + string constructorName = reader.Value.ToString(); + + while (reader.Read() && reader.TokenType != JsonToken.EndConstructor) + { + DeserializeValue(reader, document, manager, "-" + constructorName, currentNode); + } + break; + case JsonToken.EndObject: + case JsonToken.EndArray: + return; + default: + throw new JsonSerializationException("Unexpected JsonToken when deserializing node: " + reader.TokenType); + } + } while (reader.TokenType == JsonToken.PropertyName || reader.Read()); + // don't read if current token is a property. token was already read when parsing element attributes + } + + /// + /// Checks if the attributeName is a namespace attribute. + /// + /// Attribute name to test. + /// The attribute name prefix if it has one, otherwise an empty string. + /// True if attribute name is for a namespace attribute, otherwise false. + private bool IsNamespaceAttribute(string attributeName, out string prefix) + { + if (attributeName.StartsWith("xmlns", StringComparison.Ordinal)) + { + if (attributeName.Length == 5) + { + prefix = string.Empty; + return true; + } + else if (attributeName[5] == ':') + { + prefix = attributeName.Substring(6, attributeName.Length - 6); + return true; + } + } + prefix = null; + return false; + } + + private string GetPrefix(string qualifiedName) + { + int colonPosition = qualifiedName.IndexOf(':'); + + if ((colonPosition == -1 || colonPosition == 0) || (qualifiedName.Length - 1) == colonPosition) + return string.Empty; + else + return qualifiedName.Substring(0, colonPosition); + } + + private IEnumerable ValueAttributes(XmlAttributeCollection c) + { + return c.OfType().Where(a => a.NamespaceURI != JsonNamespaceUri); + } + + private IEnumerable ValueNodes(XmlNodeList c) + { + return c.OfType().Where(n => n.NamespaceURI != JsonNamespaceUri); + } + #endregion + + /// + /// Determines whether this instance can convert the specified value type. + /// + /// Type of the value. + /// + /// true if this instance can convert the specified value type; otherwise, false. + /// + public override bool CanConvert(Type valueType) + { + return typeof(XmlNode).IsAssignableFrom(valueType); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Identifier.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Identifier.cs new file mode 100644 index 0000000..df4e28c --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Identifier.cs @@ -0,0 +1,156 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections; +using System.Globalization; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Web; +using System.Collections.Generic; +using System.Drawing; +using System.Web.UI.WebControls; +using System.ComponentModel; + +namespace Newtonsoft.Json +{ + /// + /// + /// + public class Identifier + { + private string _name; + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get { return _name; } + } + + /// + /// Initializes a new instance of the class. + /// + /// The name. + public Identifier(string name) + { + _name = name; + } + + private static bool IsAsciiLetter(char c) + { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); + } + + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// + /// true if the specified is equal to the current ; otherwise, false. + /// + /// The parameter is null. + public override bool Equals(object obj) + { + Identifier function = obj as Identifier; + + return Equals(function); + } + + /// + /// Equalses the specified function. + /// + /// The function. + /// + public bool Equals(Identifier function) + { + return (_name == function.Name); + } + + /// + /// Equalses the specified a. + /// + /// A. + /// The b. + /// + public static bool Equals(Identifier a, Identifier b) + { + if (a == b) + return true; + + if (a != null && b != null) + return a.Equals(b); + + return false; + } + + /// + /// Serves as a hash function for a particular type. + /// + /// + /// A hash code for the current . + /// + public override int GetHashCode() + { + return _name.GetHashCode(); + } + + /// + /// Returns a that represents the current . + /// + /// + /// A that represents the current . + /// + public override string ToString() + { + return _name; + } + + /// + /// Implements the operator ==. + /// + /// A. + /// The b. + /// The result of the operator. + public static bool operator ==(Identifier a, Identifier b) + { + return Identifier.Equals(a, b); + } + + /// + /// Implements the operator !=. + /// + /// A. + /// The b. + /// The result of the operator. + public static bool operator !=(Identifier a, Identifier b) + { + return !Identifier.Equals(a, b); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JavaScriptConvert.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JavaScriptConvert.cs new file mode 100644 index 0000000..8422469 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JavaScriptConvert.cs @@ -0,0 +1,542 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Drawing; +using System.Web.UI.WebControls; +using System.Collections; +using System.IO; +using System.Globalization; +using System.Runtime.Serialization; +using System.Reflection; +using System.Data.SqlTypes; +using Newtonsoft.Json.Utilities; +using System.Xml; +using Newtonsoft.Json.Converters; + +namespace Newtonsoft.Json +{ + /// + /// Provides methods for converting between common language runtime types and JavaScript types. + /// + public static class JavaScriptConvert + { + /// + /// Represents JavaScript's boolean value true as a string. This field is read-only. + /// + public static readonly string True; + + /// + /// Represents JavaScript's boolean value false as a string. This field is read-only. + /// + public static readonly string False; + + /// + /// Represents JavaScript's null as a string. This field is read-only. + /// + public static readonly string Null; + + /// + /// Represents JavaScript's undefined as a string. This field is read-only. + /// + public static readonly string Undefined; + + /// + /// Represents JavaScript's positive infinity as a string. This field is read-only. + /// + public static readonly string PositiveInfinity; + + /// + /// Represents JavaScript's negative infinity as a string. This field is read-only. + /// + public static readonly string NegativeInfinity; + + /// + /// Represents JavaScript's NaN as a string. This field is read-only. + /// + public static readonly string NaN; + + internal static long InitialJavaScriptDateTicks; + internal static DateTime MinimumJavaScriptDate; + + static JavaScriptConvert() + { + True = "true"; + False = "false"; + Null = "null"; + Undefined = "undefined"; + PositiveInfinity = "Infinity"; + NegativeInfinity = "-Infinity"; + NaN = "NaN"; + + InitialJavaScriptDateTicks = (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).Ticks; + MinimumJavaScriptDate = new DateTime(100, 1, 1); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(DateTime value) + { + return ToStringInternal(new DateTimeOffset(value), value.Kind); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(DateTimeOffset value) + { + return ToStringInternal(value, DateTimeKind.Local); + } + + internal static string ToStringInternal(DateTimeOffset value, DateTimeKind kind) + { + long javaScriptTicks = ConvertDateTimeToJavaScriptTicks(value); + + string offset; + switch (kind) + { + case DateTimeKind.Local: + case DateTimeKind.Unspecified: + TimeSpan utcOffset = value.Offset; + offset = utcOffset.Hours.ToString("+00;-00", CultureInfo.InvariantCulture) + utcOffset.Minutes.ToString("00;00", CultureInfo.InvariantCulture); + break; + default: + offset = string.Empty; + break; + } + return @"""\/Date(" + javaScriptTicks.ToString(CultureInfo.InvariantCulture) + offset + @")\/"""; + } + + internal static long ConvertDateTimeToJavaScriptTicks(DateTimeOffset dateTime) + { + DateTimeOffset utcDateTime = dateTime.ToUniversalTime(); + + //if (utcDateTime < MinimumJavaScriptDate) + // utcDateTime = MinimumJavaScriptDate; + + long javaScriptTicks = (utcDateTime.Ticks - InitialJavaScriptDateTicks) / (long)10000; + + return javaScriptTicks; + } + + internal static DateTime ConvertJavaScriptTicksToDateTime(long javaScriptTicks) + { + DateTime dateTime = new DateTime((javaScriptTicks * 10000) + InitialJavaScriptDateTicks, DateTimeKind.Utc); + + return dateTime; + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(bool value) + { + return (value) ? True : False; + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(char value) + { + return ToString(char.ToString(value)); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(Enum value) + { + return Enum.Format(value.GetType(), value, "D"); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(int value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(short value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(ushort value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(uint value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(long value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(ulong value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(float value) + { + return value.ToString("R", CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(double value) + { + return value.ToString("R", CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(byte value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(sbyte value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(decimal value) + { + return value.ToString(null, CultureInfo.InvariantCulture); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(Guid value) + { + return '"' + value.ToString("D", CultureInfo.InvariantCulture) + '"'; + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(string value) + { + return ToString(value, '"'); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// The string delimiter character. + /// A Json string representation of the . + public static string ToString(string value, char delimter) + { + return JavaScriptUtils.ToEscapedJavaScriptString(value, delimter, true); + } + + /// + /// Converts the to it's JavaScript string representation. + /// + /// The value to convert. + /// A Json string representation of the . + public static string ToString(object value) + { + if (value == null) + { + return Null; + } + else if (value is IConvertible) + { + IConvertible convertible = value as IConvertible; + + switch (convertible.GetTypeCode()) + { + case TypeCode.String: + return ToString((string)convertible); + case TypeCode.Char: + return ToString((char)convertible); + case TypeCode.Boolean: + return ToString((bool)convertible); + case TypeCode.SByte: + return ToString((sbyte)convertible); + case TypeCode.Int16: + return ToString((short)convertible); + case TypeCode.UInt16: + return ToString((ushort)convertible); + case TypeCode.Int32: + return ToString((int)convertible); + case TypeCode.Byte: + return ToString((byte)convertible); + case TypeCode.UInt32: + return ToString((uint)convertible); + case TypeCode.Int64: + return ToString((long)convertible); + case TypeCode.UInt64: + return ToString((ulong)convertible); + case TypeCode.Single: + return ToString((float)convertible); + case TypeCode.Double: + return ToString((double)convertible); + case TypeCode.DateTime: + return ToString((DateTime)convertible); + case TypeCode.Decimal: + return ToString((decimal)convertible); + } + } + else if (value is DateTimeOffset) + { + return ToString((DateTimeOffset)value); + } + else if (value is Guid) + { + return ToString((Guid)value); + } + + throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType())); + } + + /// + /// Serializes the specified object to a JSON string. + /// + /// The object to serialize. + /// A JSON string representation of the object. + public static string SerializeObject(object value) + { + return SerializeObject(value, null); + } + + /// + /// Serializes the specified object to a JSON string using a collection of . + /// + /// The object to serialize. + /// A collection converters used while serializing. + /// A JSON string representation of the object. + public static string SerializeObject(object value, params JsonConverter[] converters) + { + StringWriter sw = new StringWriter(CultureInfo.InvariantCulture); + JsonSerializer jsonSerializer = new JsonSerializer(); + + if (!CollectionUtils.IsNullOrEmpty(converters)) + { + for (int i = 0; i < converters.Length; i++) + { + jsonSerializer.Converters.Add(converters[i]); + } + } + + using (JsonWriter jsonWriter = new JsonTextWriter(sw)) + { + //jsonWriter.Formatting = Formatting.Indented; + jsonSerializer.Serialize(jsonWriter, value); + } + + return sw.ToString(); + } + + /// + /// Deserializes the specified object to a Json object. + /// + /// The object to deserialize. + /// The deserialized object from the Json string. + public static object DeserializeObject(string value) + { + return DeserializeObject(value, null, null); + } + + /// + /// Deserializes the specified object to a Json object. + /// + /// The object to deserialize. + /// The of object being deserialized. + /// The deserialized object from the Json string. + public static object DeserializeObject(string value, Type type) + { + return DeserializeObject(value, type, null); + } + + /// + /// Deserializes the specified object to a Json object. + /// + /// The type of the object to deserialize. + /// The object to deserialize. + /// The deserialized object from the Json string. + public static T DeserializeObject(string value) + { + return DeserializeObject(value, null); + } + + /// + /// Deserializes the specified JSON to the given anonymous type. + /// + /// + /// The anonymous type to deserialize to. This can't be specified + /// traditionally and must be infered from the anonymous type passed + /// as a parameter. + /// + /// The object to deserialize. + /// The anonymous type object. + /// The deserialized anonymous type from the JSON string. + public static T DeserializeAnonymousType(string value, T anonymousTypeObject) + { + return DeserializeObject(value); + } + + /// + /// Deserializes the JSON string to the specified type. + /// + /// The type of the object to deserialize. + /// The object to deserialize. + /// Converters to use while deserializing. + /// The deserialized object from the JSON string. + public static T DeserializeObject(string value, params JsonConverter[] converters) + { + return (T)DeserializeObject(value, typeof(T), converters); + } + + /// + /// Deserializes the JSON string to the specified type. + /// + /// The object to deserialize. + /// The type of the object to deserialize. + /// Converters to use while deserializing. + /// The deserialized object from the JSON string. + public static object DeserializeObject(string value, Type type, params JsonConverter[] converters) + { + StringReader sr = new StringReader(value); + JsonSerializer jsonSerializer = new JsonSerializer(); + + if (!CollectionUtils.IsNullOrEmpty(converters)) + { + for (int i = 0; i < converters.Length; i++) + { + jsonSerializer.Converters.Add(converters[i]); + } + } + + object deserializedValue; + + using (JsonReader jsonReader = new JsonTextReader(sr)) + { + deserializedValue = jsonSerializer.Deserialize(jsonReader, type); + } + + return deserializedValue; + } + + /// + /// Serializes the XML node to a JSON string. + /// + /// The node to serialize. + /// A JSON string of the XmlNode. + public static string SerializeXmlNode(XmlNode node) + { + XmlNodeConverter converter = new XmlNodeConverter(); + + return SerializeObject(node, converter); + } + + /// + /// Deserializes the XmlNode from a JSON string. + /// + /// The JSON string. + /// The deserialized XmlNode + public static XmlNode DeserializeXmlNode(string value) + { + XmlNodeConverter converter = new XmlNodeConverter(); + + return (XmlDocument)DeserializeObject(value, typeof(XmlDocument), converter); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonConverter.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonConverter.cs new file mode 100644 index 0000000..386c1b5 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonConverter.cs @@ -0,0 +1,62 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json +{ + /// + /// Converts an object to and from JSON. + /// + public abstract class JsonConverter + { + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + public abstract void WriteJson(JsonWriter writer, object value); + + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The object value. + public abstract object ReadJson(JsonReader reader, Type objectType); + + /// + /// Determines whether this instance can convert the specified object type. + /// + /// Type of the object. + /// + /// true if this instance can convert the specified object type; otherwise, false. + /// + public abstract bool CanConvert(Type objectType); + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonConverterCollection.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonConverterCollection.cs new file mode 100644 index 0000000..50f70c5 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonConverterCollection.cs @@ -0,0 +1,39 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections.ObjectModel; + +namespace Newtonsoft.Json +{ + /// + /// Represents a collection of . + /// + public class JsonConverterCollection : Collection + { + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonHandler.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonHandler.cs new file mode 100644 index 0000000..1f81131 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonHandler.cs @@ -0,0 +1,63 @@ +using System; +using System.Web; +using System.Web.Caching; +using System.Xml; +using System.Text; +using System.Security.Principal; + +namespace Newtonsoft.Json +{ + public abstract class JsonHandler : HandlerBase, IHttpHandler + { + public event EventHandler Error; + + protected abstract void WriteResult(JsonWriter writer); + + public static void JsonResponse(HttpResponse response, Action writeAction) + { + response.ClearHeaders(); + response.ClearContent(); + + JsonWriter writer = new JsonWriter(response.Output); + + writeAction(writer); + + writer.Flush(); + } + + protected virtual void OnError(EventArgs e) + { + if (Error != null) + { + Error(this, e); + } + } + + void IHttpHandler.ProcessRequest(HttpContext context) + { + if (context == null) + throw new ArgumentNullException("context"); + + Context = context; + + try + { + JsonHandler.JsonResponse(context.Response, new Action(WriteResult)); + } + catch (Exception exception) + { + context.AddError(exception); + OnError(EventArgs.Empty); + if (context.Error != null) + { + throw new HttpUnhandledException("blah", exception); + } + } + } + + bool IHttpHandler.IsReusable + { + get { return false; } + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonIgnoreAttribute.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonIgnoreAttribute.cs new file mode 100644 index 0000000..e7511a0 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonIgnoreAttribute.cs @@ -0,0 +1,39 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Instructs the not to serialize the public field or public read/write property value. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] + public sealed class JsonIgnoreAttribute : Attribute + { + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonObjectAttribute.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonObjectAttribute.cs new file mode 100644 index 0000000..317e834 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonObjectAttribute.cs @@ -0,0 +1,64 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; + +namespace Newtonsoft.Json +{ + /// + /// Instructs the how to serialize the object. + /// + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] + public sealed class JsonObjectAttribute : Attribute + { + private MemberSerialization _memberSerialization = MemberSerialization.OptOut; + + /// + /// Gets or sets the member serialization. + /// + /// The member serialization. + public MemberSerialization MemberSerialization + { + get { return _memberSerialization; } + set { _memberSerialization = value; } + } + + /// + /// Initializes a new instance of the class. + /// + public JsonObjectAttribute() + { + } + + /// + /// Initializes a new instance of the class with the specified member serialization. + /// + /// The member serialization. + public JsonObjectAttribute(MemberSerialization memberSerialization) + { + MemberSerialization = memberSerialization; + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonPropertyAttribute.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonPropertyAttribute.cs new file mode 100644 index 0000000..f2161e8 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonPropertyAttribute.cs @@ -0,0 +1,39 @@ +using System; + +namespace Newtonsoft.Json +{ + /// + /// Instructs the to always serialize the member with the specified name. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] + public sealed class JsonPropertyAttribute : Attribute + { + private string _propertyName; + + /// + /// Gets or sets the name of the property. + /// + /// The name of the property. + public string PropertyName + { + get { return _propertyName; } + set { _propertyName = value; } + } + + /// + /// Initializes a new instance of the class. + /// + public JsonPropertyAttribute() + { + } + + /// + /// Initializes a new instance of the class with the specified name. + /// + /// Name of the property. + public JsonPropertyAttribute(string propertyName) + { + _propertyName = propertyName; + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonReader.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonReader.cs new file mode 100644 index 0000000..72fe568 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonReader.cs @@ -0,0 +1,404 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using System.Globalization; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json +{ + /// + /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + /// + public abstract class JsonReader : IDisposable + { + /// + /// Specifies the state of the reader. + /// + protected enum State + { + /// + /// The Read method has not been called. + /// + Start, + /// + /// The end of the file has been reached successfully. + /// + Complete, + /// + /// Reader is at a property. + /// + Property, + /// + /// Reader is at the start of an object. + /// + ObjectStart, + /// + /// Reader is in an object. + /// + Object, + /// + /// Reader is at the start of an array. + /// + ArrayStart, + /// + /// Reader is in an array. + /// + Array, + /// + /// The Close method has been called. + /// + Closed, + /// + /// Reader has just read a value. + /// + PostValue, + /// + /// Reader is at the start of a constructor. + /// + ConstructorStart, + /// + /// Reader in a constructor. + /// + Constructor, + /// + /// An error occurred that prevents the read operation from continuing. + /// + Error, + /// + /// The end of the file has been reached successfully. + /// + Finished + } + + // current Token data + private JsonToken _token; + private object _value; + private Type _valueType; + private char _quoteChar; + private State _currentState; + + /// + /// Gets the current reader state. + /// + /// The current reader state. + protected State CurrentState + { + get { return _currentState; } + private set { _currentState = value; } + } + + private int _top; + + private List _stack; + + /// + /// Gets the quotation mark character used to enclose the value of a string. + /// + public char QuoteChar + { + get { return _quoteChar; } + protected set { _quoteChar = value; } + } + + /// + /// Gets the type of the current Json token. + /// + public JsonToken TokenType + { + get { return _token; } + } + + /// + /// Gets the text value of the current Json token. + /// + public object Value + { + get { return _value; } + } + + /// + /// Gets The Common Language Runtime (CLR) type for the current Json token. + /// + public Type ValueType + { + get { return _valueType; } + } + + /// + /// Gets the depth of the current token in the JSON document. + /// + /// The depth of the current token in the JSON document. + public int Depth + { + get + { + int depth = _top - 1; + if (IsStartToken(TokenType)) + return depth - 1; + else + return depth; + } + } + + /// + /// Initializes a new instance of the class with the specified . + /// + public JsonReader() + { + //_testBuffer = new StringBuilder(); + _currentState = State.Start; + _stack = new List(); + _top = 0; + Push(JsonTokenType.None); + } + + private void Push(JsonTokenType value) + { + _stack.Add(value); + _top++; + } + + private JsonTokenType Pop() + { + JsonTokenType value = Peek(); + _stack.RemoveAt(_stack.Count - 1); + _top--; + + return value; + } + + private JsonTokenType Peek() + { + return _stack[_top - 1]; + } + + /// + /// Reads the next Json token from the stream. + /// + /// true if the next token was read successfully; false if there are no more tokens to read. + public abstract bool Read(); + + /// + /// Skips the children of the current token. + /// + public void Skip() + { + if (IsStartToken(TokenType)) + { + int depth = Depth; + + while (Read() && (depth < Depth)) + { + } + } + } + + /// + /// Sets the current token. + /// + /// The new token. + protected void SetToken(JsonToken newToken) + { + SetToken(newToken, null); + } + + /// + /// Sets the current token and value. + /// + /// The new token. + /// The value. + protected virtual void SetToken(JsonToken newToken, object value) + { + _token = newToken; + + switch (newToken) + { + case JsonToken.StartObject: + _currentState = State.ObjectStart; + Push(JsonTokenType.Object); + break; + case JsonToken.StartArray: + _currentState = State.ArrayStart; + Push(JsonTokenType.Array); + break; + case JsonToken.StartConstructor: + _currentState = State.ConstructorStart; + Push(JsonTokenType.Constructor); + break; + case JsonToken.EndObject: + ValidateEnd(JsonToken.EndObject); + _currentState = State.PostValue; + break; + case JsonToken.EndArray: + ValidateEnd(JsonToken.EndArray); + _currentState = State.PostValue; + break; + case JsonToken.EndConstructor: + ValidateEnd(JsonToken.EndConstructor); + _currentState = State.PostValue; + break; + case JsonToken.PropertyName: + _currentState = State.Property; + Push(JsonTokenType.Property); + break; + case JsonToken.Undefined: + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.Boolean: + case JsonToken.Null: + case JsonToken.Date: + case JsonToken.String: + _currentState = State.PostValue; + break; + } + + JsonTokenType current = Peek(); + if (current == JsonTokenType.Property && _currentState == State.PostValue) + Pop(); + + if (value != null) + { + _value = value; + _valueType = value.GetType(); + } + else + { + _value = null; + _valueType = null; + } + } + + private void ValidateEnd(JsonToken endToken) + { + JsonTokenType currentObject = Pop(); + + if (GetTypeForCloseToken(endToken) != currentObject) + throw new JsonReaderException("JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, currentObject)); + } + + /// + /// Sets the state based on current token type. + /// + protected void SetStateBasedOnCurrent() + { + JsonTokenType currentObject = Peek(); + + switch (currentObject) + { + case JsonTokenType.Object: + _currentState = State.Object; + break; + case JsonTokenType.Array: + _currentState = State.Array; + break; + case JsonTokenType.Constructor: + _currentState = State.Constructor; + break; + case JsonTokenType.None: + _currentState = State.Finished; + break; + default: + throw new JsonReaderException("While setting the reader state back to current object an unexpected JsonType was encountered: " + currentObject); + } + } + + private bool IsStartToken(JsonToken token) + { + switch (token) + { + case JsonToken.StartObject: + case JsonToken.StartArray: + case JsonToken.StartConstructor: + case JsonToken.PropertyName: + return true; + case JsonToken.None: + case JsonToken.Comment: + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.String: + case JsonToken.Boolean: + case JsonToken.Null: + case JsonToken.Undefined: + case JsonToken.EndObject: + case JsonToken.EndArray: + case JsonToken.EndConstructor: + case JsonToken.Date: + return false; + default: + throw new ArgumentOutOfRangeException("token", token, "Unexpected JsonToken value."); + } + } + + private JsonTokenType GetTypeForCloseToken(JsonToken token) + { + switch (token) + { + case JsonToken.EndObject: + return JsonTokenType.Object; + case JsonToken.EndArray: + return JsonTokenType.Array; + case JsonToken.EndConstructor: + return JsonTokenType.Constructor; + default: + throw new JsonReaderException("Not a valid close JsonToken: " + token); + } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + void IDisposable.Dispose() + { + Dispose(true); + } + + /// + /// Releases unmanaged and - optionally - managed resources + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + if (_currentState != State.Closed && disposing) + Close(); + } + + /// + /// Changes the to Closed. + /// + public virtual void Close() + { + _currentState = State.Closed; + _token = JsonToken.None; + _value = null; + _valueType = null; + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonReaderException.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonReaderException.cs new file mode 100644 index 0000000..711c450 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonReaderException.cs @@ -0,0 +1,65 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// The exception thrown when an error occurs while reading Json text. + /// + public class JsonReaderException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public JsonReaderException() + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The error message that explains the reason for the exception. + public JsonReaderException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + public JsonReaderException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonSerializationException.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonSerializationException.cs new file mode 100644 index 0000000..758caa4 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonSerializationException.cs @@ -0,0 +1,65 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// The exception thrown when an error occurs during Json serialization or deserialization. + /// + public class JsonSerializationException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public JsonSerializationException() + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The error message that explains the reason for the exception. + public JsonSerializationException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + public JsonSerializationException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonSerializer.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonSerializer.cs new file mode 100644 index 0000000..a182701 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonSerializer.cs @@ -0,0 +1,830 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Collections; +using System.Linq; +using System.Reflection; +using System.ComponentModel; +using Newtonsoft.Json.Utilities; +using System.Globalization; +using Newtonsoft.Json.Linq; +using System.Collections.ObjectModel; + +namespace Newtonsoft.Json +{ + /// + /// Serializes and deserializes objects into and from the Json format. + /// The enables you to control how objects are encoded into Json. + /// + public class JsonSerializer + { + private ReferenceLoopHandling _referenceLoopHandling; + private MissingMemberHandling _missingMemberHandling; + private ObjectCreationHandling _objectCreationHandling; + private NullValueHandling _nullValueHandling; + private int _level; + private JsonConverterCollection _converters; + private Dictionary _typeMemberMappings; + + /// + /// Get or set how reference loops (e.g. a class referencing itself) is handled. + /// + public ReferenceLoopHandling ReferenceLoopHandling + { + get { return _referenceLoopHandling; } + set + { + if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize) + throw new ArgumentOutOfRangeException("value"); + + _referenceLoopHandling = value; + } + } + + /// + /// Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + /// + public MissingMemberHandling MissingMemberHandling + { + get { return _missingMemberHandling; } + set + { + if (value < MissingMemberHandling.Error || value > MissingMemberHandling.Ignore) + throw new ArgumentOutOfRangeException("value"); + + _missingMemberHandling = value; + } + } + + /// + /// Get or set how null values are handled during serialization and deserialization. + /// + public NullValueHandling NullValueHandling + { + get { return _nullValueHandling; } + set + { + if (value < NullValueHandling.Include || value > NullValueHandling.Ignore) + throw new ArgumentOutOfRangeException("value"); + + _nullValueHandling = value; + } + } + + /// + /// Gets or sets how objects are created during deserialization. + /// + /// The object creation handling. + public ObjectCreationHandling ObjectCreationHandling + { + get { return _objectCreationHandling; } + set + { + if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace) + throw new ArgumentOutOfRangeException("value"); + + _objectCreationHandling = value; + } + } + + /// + /// Gets a collection that will be used during serialization. + /// + /// Collection that will be used during serialization. + public JsonConverterCollection Converters + { + get + { + if (_converters == null) + _converters = new JsonConverterCollection(); + + return _converters; + } + } + + /// + /// Initializes a new instance of the class. + /// + public JsonSerializer() + { + _referenceLoopHandling = ReferenceLoopHandling.Error; + _missingMemberHandling = MissingMemberHandling.Error; + _nullValueHandling = NullValueHandling.Include; + _objectCreationHandling = ObjectCreationHandling.Auto; + } + + #region Deserialize + /// + /// Deserializes the Json structure contained by the specified . + /// + /// The that contains the Json structure to deserialize. + /// The being deserialized. + public object Deserialize(JsonReader reader) + { + return Deserialize(reader, null); + } + + /// + /// Deserializes the Json structure contained by the specified + /// into an instance of the specified type. + /// + /// The containing the object. + /// The of object being deserialized. + /// The instance of being deserialized. + public object Deserialize(JsonReader reader, Type objectType) + { + if (reader == null) + throw new ArgumentNullException("reader"); + + if (!reader.Read()) + return null; + + if (objectType != null) + return CreateObject(reader, objectType, null); + else + return CreateJToken(reader); + } + + /// + /// Deserializes the Json structure contained by the specified + /// into an instance of the specified type. + /// + /// The containing the object. + /// The of object being deserialized. + /// The instance of being deserialized. + public object Deserialize(StringReader reader, Type objectType) + { + return Deserialize(new JsonTextReader(reader), objectType); + } + + private JToken CreateJToken(JsonReader reader) + { + JToken token; + using (JsonTokenWriter writer = new JsonTokenWriter()) + { + writer.WriteToken(reader); + token = writer.Token; + } + + return token; + } + + private object CreateObject(JsonReader reader, Type objectType, object existingValue) + { + _level++; + + object value; + JsonConverter converter; + + if (HasMatchingConverter(objectType, out converter)) + { + return converter.ReadJson(reader, objectType); + } + else + { + switch (reader.TokenType) + { + // populate a typed object or generic dictionary/array + // depending upon whether an objectType was supplied + case JsonToken.StartObject: + if (objectType == null) + { + value = CreateJToken(reader); + } + else if (typeof(IDictionary).IsAssignableFrom(objectType) || ReflectionUtils.IsSubClass(objectType, typeof(IDictionary<,>))) + { + if (existingValue == null) + value = CreateAndPopulateDictionary(reader, objectType); + else + value = PopulateDictionary(CollectionUtils.CreateDictionaryWrapper(existingValue), reader); + } + else + { + if (existingValue == null) + value = CreateAndPopulateObject(reader, objectType); + else + value = PopulateObject(existingValue, reader, objectType); + } + break; + case JsonToken.StartArray: + if (objectType != null) + { + if (existingValue == null) + value = CreateAndPopulateList(reader, objectType); + else + value = PopulateList(CollectionUtils.CreateListWrapper(existingValue), ReflectionUtils.GetListItemType(objectType), reader); + } + else + { + value = CreateJToken(reader); + } + break; + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.String: + case JsonToken.Boolean: + case JsonToken.Date: + value = EnsureType(reader.Value, objectType); + break; + case JsonToken.StartConstructor: + case JsonToken.EndConstructor: + string constructorName = reader.Value.ToString(); + + value = constructorName; + break; + case JsonToken.Null: + case JsonToken.Undefined: + if (objectType == typeof(DBNull)) + value = DBNull.Value; + else + value = null; + break; + default: + throw new JsonSerializationException("Unexpected token while deserializing object: " + reader.TokenType); + } + } + + _level--; + + return value; + } + + private object EnsureType(object value, Type targetType) + { + // do something about null value when the targetType is a valuetype? + if (value == null) + return null; + + if (targetType == null) + return value; + + Type valueType = value.GetType(); + + // type of value and type of target don't match + // attempt to convert value's type to target's type + if (valueType != targetType) + { + TypeConverter targetConverter = TypeDescriptor.GetConverter(targetType); + + if (!targetConverter.CanConvertFrom(valueType)) + { + if (targetConverter.CanConvertFrom(typeof(string))) + { + string valueString = TypeDescriptor.GetConverter(value).ConvertToInvariantString(value); + + return targetConverter.ConvertFromInvariantString(valueString); + } + + if (targetType == typeof(DateTimeOffset) && value is DateTime) + return new DateTimeOffset((DateTime)value); + + if (!targetType.IsAssignableFrom(valueType)) + throw new InvalidOperationException("Cannot convert object of type '{0}' to type '{1}'".FormatWith(CultureInfo.InvariantCulture, value.GetType(), targetType)); + + return value; + } + + return targetConverter.ConvertFrom(null, CultureInfo.InvariantCulture, value); + } + else + { + return value; + } + } + + private MemberMappingCollection GetMemberMappings(Type objectType) + { + if (_typeMemberMappings == null) + _typeMemberMappings = new Dictionary(); + + MemberMappingCollection memberMappings; + + if (_typeMemberMappings.TryGetValue(objectType, out memberMappings)) + return memberMappings; + + memberMappings = CreateMemberMappings(objectType); + _typeMemberMappings[objectType] = memberMappings; + + return memberMappings; + } + + private MemberMappingCollection CreateMemberMappings(Type objectType) + { + MemberSerialization memberSerialization = GetObjectMemberSerialization(objectType); + + List members = GetSerializableMembers(objectType); + if (members == null) + throw new JsonSerializationException("Null collection of seralizable members returned."); + + MemberMappingCollection memberMappings = new MemberMappingCollection(); + + foreach (MemberInfo member in members) + { + JsonPropertyAttribute propertyAttribute = ReflectionUtils.GetAttribute(member, true); + bool hasIgnoreAttribute = member.IsDefined(typeof(JsonIgnoreAttribute), true); + + string mappedName = (propertyAttribute != null && propertyAttribute.PropertyName != null) + ? propertyAttribute.PropertyName + : member.Name; + + bool ignored = (hasIgnoreAttribute + || (memberSerialization == MemberSerialization.OptIn && propertyAttribute == null)); + + bool readable = ReflectionUtils.CanReadMemberValue(member); + bool writable = ReflectionUtils.CanSetMemberValue(member); + MemberMapping memberMapping = new MemberMapping(mappedName, member, ignored, readable, writable); + + memberMappings.AddMapping(memberMapping); + } + + return memberMappings; + } + + /// + /// Gets the serializable members for the given . + /// + /// The object to get seralizable members for. + /// Seralizable members for the given type. + protected virtual List GetSerializableMembers(Type objectType) + { + return ReflectionUtils.GetFieldsAndProperties(objectType, BindingFlags.Public | BindingFlags.Instance); + } + + private static MemberSerialization GetObjectMemberSerialization(Type objectType) + { + JsonObjectAttribute objectAttribute = ReflectionUtils.GetAttribute(objectType, true); + + if (objectAttribute == null) + return MemberSerialization.OptOut; + else + return objectAttribute.MemberSerialization; + } + + private void SetObjectMember(JsonReader reader, object target, Type targetType, string memberName) + { + if (!reader.Read()) + throw new JsonSerializationException("Unexpected end when setting {0}'s value.".FormatWith(CultureInfo.InvariantCulture, memberName)); + + MemberMappingCollection memberMappings = GetMemberMappings(targetType); + Type memberType; + object value; + + // test if a member with memberName exists on the type + // otherwise test if target is a dictionary and assign value with the key if it is + if (memberMappings.Contains(memberName)) + { + MemberMapping memberMapping = memberMappings[memberName]; + + if (memberMapping.Ignored) + { + reader.Skip(); + return; + } + + // get the member's underlying type + memberType = ReflectionUtils.GetMemberUnderlyingType(memberMapping.Member); + object currentValue = ReflectionUtils.GetMemberValue(memberMapping.Member, target); + + bool useExistingValue = (currentValue != null + && (_objectCreationHandling == ObjectCreationHandling.Auto || _objectCreationHandling == ObjectCreationHandling.Reuse) + && (reader.TokenType == JsonToken.StartArray || reader.TokenType == JsonToken.StartObject) + && (!memberType.IsArray && !ReflectionUtils.IsSubClass(memberType, typeof(ReadOnlyCollection<>)))); + + if (!memberMapping.Writable && !useExistingValue) + { + reader.Skip(); + return; + } + + value = CreateObject(reader, memberType, (useExistingValue) ? currentValue : null); + + if (_nullValueHandling == NullValueHandling.Ignore && value == null) + return; + + if (!useExistingValue) + ReflectionUtils.SetMemberValue(memberMapping.Member, target, value); + } + else + { + if (_missingMemberHandling == MissingMemberHandling.Error) + throw new JsonSerializationException("Could not find member '{0}' on object of type '{1}'".FormatWith(CultureInfo.InvariantCulture, memberName, targetType.GetType().Name)); + } + } + + private object CreateAndPopulateDictionary(JsonReader reader, Type objectType) + { + IWrappedDictionary dictionary = CollectionUtils.CreateDictionaryWrapper(Activator.CreateInstance(objectType)); + PopulateDictionary(dictionary, reader); + + return dictionary.UnderlyingDictionary; + } + + private IDictionary PopulateDictionary(IWrappedDictionary dictionary, JsonReader reader) + { + Type dictionaryType = dictionary.UnderlyingDictionary.GetType(); + Type dictionaryKeyType = ReflectionUtils.GetDictionaryKeyType(dictionaryType); + Type dictionaryValueType = ReflectionUtils.GetDictionaryValueType(dictionaryType); + + while (reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + object keyValue = EnsureType(reader.Value, dictionaryKeyType); + reader.Read(); + + dictionary.Add(keyValue, CreateObject(reader, dictionaryValueType, null)); + break; + case JsonToken.EndObject: + return dictionary; + default: + throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType); + } + } + + throw new JsonSerializationException("Unexpected end when deserializing object."); + } + + private object CreateAndPopulateList(JsonReader reader, Type objectType) + { + return CollectionUtils.CreateAndPopulateList(objectType, l => PopulateList(l, ReflectionUtils.GetListItemType(objectType), reader)); + } + + private IList PopulateList(IList list, Type listItemType, JsonReader reader) + { + while (reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.EndArray: + return list; + case JsonToken.Comment: + break; + default: + object value = CreateObject(reader, listItemType, null); + + list.Add(value); + break; + } + } + + throw new JsonSerializationException("Unexpected end when deserializing array."); + } + + private object CreateAndPopulateObject(JsonReader reader, Type objectType) + { + object newObject; + + if (ReflectionUtils.HasDefaultConstructor(objectType)) + { + newObject = Activator.CreateInstance(objectType); + + PopulateObject(newObject, reader, objectType); + return newObject; + } + else + { + ConstructorInfo c = objectType.GetConstructors(BindingFlags.Public | BindingFlags.Instance).SingleOrDefault(); + + if (c == null) + throw new JsonSerializationException("Could not find a public constructor for type {0}.".FormatWith(CultureInfo.InvariantCulture, objectType)); + + IDictionary constructorParameters = c.GetParameters().ToDictionary(p => p, p => (object)null); + + bool exit = false; + while (!exit && reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + string memberName = reader.Value.ToString(); + ParameterInfo matchingConstructorParameter = constructorParameters + .Where(kv => kv.Key.Name == memberName) + .Select(kv => kv.Key) + .SingleOrDefault(); + + if (!reader.Read()) + throw new JsonSerializationException("Unexpected end when setting {0}'s value.".FormatWith(CultureInfo.InvariantCulture, memberName)); + + if (matchingConstructorParameter != null) + constructorParameters[matchingConstructorParameter] = CreateObject(reader, matchingConstructorParameter.ParameterType, null); + + break; + case JsonToken.EndObject: + exit = true; + break; + default: + throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType); + } + } + + newObject = Activator.CreateInstance(objectType, constructorParameters.Values.ToArray()); + + return newObject; + } + } + + private object PopulateObject(object newObject, JsonReader reader, Type objectType) + { + while (reader.Read()) + { + switch (reader.TokenType) + { + case JsonToken.PropertyName: + string memberName = reader.Value.ToString(); + + SetObjectMember(reader, newObject, objectType, memberName); + break; + case JsonToken.EndObject: + return newObject; + default: + throw new JsonSerializationException("Unexpected token when deserializing object: " + reader.TokenType); + } + } + + throw new JsonSerializationException("Unexpected end when deserializing object."); + } + #endregion + + #region Serialize + /// + /// Serializes the specified and writes the Json structure + /// to a Stream using the specified . + /// + /// The used to write the Json structure. + /// The to serialize. + public void Serialize(TextWriter textWriter, object value) + { + Serialize(new JsonTextWriter(textWriter), value); + } + + /// + /// Serializes the specified and writes the Json structure + /// to a Stream using the specified . + /// + /// The used to write the Json structure. + /// The to serialize. + public void Serialize(JsonWriter jsonWriter, object value) + { + if (jsonWriter == null) + throw new ArgumentNullException("jsonWriter"); + + if (value is JToken) + ((JToken)value).WriteTo(jsonWriter, (_converters != null) ? _converters.ToArray() : null); + else + SerializeValue(jsonWriter, value); + } + + + private void SerializeValue(JsonWriter writer, object value) + { + JsonConverter converter; + + if (value == null) + { + writer.WriteNull(); + } + else if (HasMatchingConverter(value.GetType(), out converter)) + { + converter.WriteJson(writer, value); + } + else if (value is IConvertible) + { + IConvertible convertible = value as IConvertible; + + switch (convertible.GetTypeCode()) + { + case TypeCode.String: + writer.WriteValue((string)convertible); + break; + case TypeCode.Char: + writer.WriteValue((char)convertible); + break; + case TypeCode.Boolean: + writer.WriteValue((bool)convertible); + break; + case TypeCode.SByte: + writer.WriteValue((sbyte)convertible); + break; + case TypeCode.Int16: + writer.WriteValue((short)convertible); + break; + case TypeCode.UInt16: + writer.WriteValue((ushort)convertible); + break; + case TypeCode.Int32: + writer.WriteValue((int)convertible); + break; + case TypeCode.Byte: + writer.WriteValue((byte)convertible); + break; + case TypeCode.UInt32: + writer.WriteValue((uint)convertible); + break; + case TypeCode.Int64: + writer.WriteValue((long)convertible); + break; + case TypeCode.UInt64: + writer.WriteValue((ulong)convertible); + break; + case TypeCode.Single: + writer.WriteValue((float)convertible); + break; + case TypeCode.Double: + writer.WriteValue((double)convertible); + break; + case TypeCode.DateTime: + writer.WriteValue((DateTime)convertible); + break; + case TypeCode.Decimal: + writer.WriteValue((decimal)convertible); + break; + case TypeCode.DBNull: + writer.WriteNull(); + break; + default: + SerializeObject(writer, value); + break; + } + } + else if (value is DateTimeOffset) + { + writer.WriteValue((DateTimeOffset)value); + } + else if (value is IList) + { + SerializeList(writer, (IList)value); + } + else if (value is IDictionary) + { + SerializeDictionary(writer, (IDictionary)value); + } + else if (value is ICollection) + { + SerializeCollection(writer, (ICollection)value); + } + else if (value is IEnumerable) + { + SerializeEnumerable(writer, (IEnumerable)value); + } + else if (value is Identifier) + { + writer.WriteRaw(value.ToString()); + } + else + { + SerializeObject(writer, value); + } + } + + private bool HasMatchingConverter(Type type, out JsonConverter matchingConverter) + { + return HasMatchingConverter(_converters, type, out matchingConverter); + } + + internal static bool HasMatchingConverter(IList converters, Type type, out JsonConverter matchingConverter) + { + if (converters != null) + { + for (int i = 0; i < converters.Count; i++) + { + JsonConverter converter = converters[i]; + + if (converter.CanConvert(type)) + { + matchingConverter = converter; + return true; + } + } + } + + matchingConverter = null; + return false; + } + + private void WriteMemberInfoProperty(JsonWriter writer, object value, MemberInfo member, string propertyName) + { + if (!ReflectionUtils.IsIndexedProperty(member)) + { + object memberValue = ReflectionUtils.GetMemberValue(member, value); + + if (_nullValueHandling == NullValueHandling.Ignore && memberValue == null) + return; + + if (writer.SerializeStack.IndexOf(memberValue) != -1) + { + switch (_referenceLoopHandling) + { + case ReferenceLoopHandling.Error: + throw new JsonSerializationException("Self referencing loop"); + case ReferenceLoopHandling.Ignore: + // return from method + return; + case ReferenceLoopHandling.Serialize: + // continue + break; + default: + throw new InvalidOperationException("Unexpected ReferenceLoopHandling value: '{0}'".FormatWith(CultureInfo.InvariantCulture, _referenceLoopHandling)); + } + } + + writer.WritePropertyName(propertyName ?? member.Name); + SerializeValue(writer, memberValue); + } + } + + private void SerializeObject(JsonWriter writer, object value) + { + Type objectType = value.GetType(); + + TypeConverter converter = TypeDescriptor.GetConverter(objectType); + + // use the objectType's TypeConverter if it has one and can convert to a string + if (converter != null && !(converter is ComponentConverter) && converter.GetType() != typeof(TypeConverter)) + { + if (converter.CanConvertTo(typeof(string))) + { + writer.WriteValue(converter.ConvertToInvariantString(value)); + return; + } + } + + writer.SerializeStack.Add(value); + + writer.WriteStartObject(); + + MemberMappingCollection memberMappings = GetMemberMappings(objectType); + + foreach (MemberMapping memberMapping in memberMappings) + { + if (!memberMapping.Ignored && memberMapping.Readable) + WriteMemberInfoProperty(writer, value, memberMapping.Member, memberMapping.MappingName); + } + + writer.WriteEndObject(); + + writer.SerializeStack.Remove(value); + } + + private void SerializeEnumerable(JsonWriter writer, IEnumerable values) + { + SerializeList(writer, values.Cast().ToList()); + } + + private void SerializeCollection(JsonWriter writer, ICollection values) + { + SerializeList(writer, values.Cast().ToList()); + } + + private void SerializeList(JsonWriter writer, IList values) + { + writer.WriteStartArray(); + + for (int i = 0; i < values.Count; i++) + { + SerializeValue(writer, values[i]); + } + + writer.WriteEndArray(); + } + + private void SerializeDictionary(JsonWriter writer, IDictionary values) + { + writer.WriteStartObject(); + + foreach (DictionaryEntry entry in values) + { + writer.WritePropertyName(entry.Key.ToString()); + SerializeValue(writer, entry.Value); + } + + writer.WriteEndObject(); + } + #endregion + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonTextReader.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonTextReader.cs new file mode 100644 index 0000000..638e2da --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonTextReader.cs @@ -0,0 +1,811 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using System.Globalization; + +namespace Newtonsoft.Json +{ + /// + /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + /// + public class JsonTextReader : JsonReader + { + private TextReader _reader; + private char _currentChar; + + // current Token data + private StringBuffer _buffer; + + /// + /// Initializes a new instance of the class with the specified . + /// + /// The TextReader containing the XML data to read. + public JsonTextReader(TextReader reader) + { + if (reader == null) + throw new ArgumentNullException("reader"); + + _reader = reader; + _buffer = new StringBuffer(4096); + } + + private void ParseString(char quote) + { + bool stringTerminated = false; + bool hexNumber = false; + int hexCount = 0; + + while (!stringTerminated && MoveNext()) + { + if (hexNumber) + hexCount++; + + switch (_currentChar) + { + case '\\': + if (MoveNext()) + { + switch (_currentChar) + { + case 'b': + _buffer.Append('\b'); + break; + case 't': + _buffer.Append('\t'); + break; + case 'n': + _buffer.Append('\n'); + break; + case 'f': + _buffer.Append('\f'); + break; + case 'r': + _buffer.Append('\r'); + break; + case 'u': + // note the start of a hex character + hexNumber = true; + break; + default: + _buffer.Append(_currentChar); + break; + } + } + else + { + throw new JsonReaderException("Unterminated string. Expected delimiter: " + quote); + } + break; + case '"': + case '\'': + if (_currentChar == quote) + stringTerminated = true; + else + goto default; + break; + default: + _buffer.Append(_currentChar); + break; + } + + if (hexCount == 4) + { + // remove hex characters from buffer, convert to char and then add + string hexString = _buffer.ToString(_buffer.Position - 4, 4); + char hexChar = Convert.ToChar(int.Parse(hexString, NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo)); + + _buffer.Position = _buffer.Position - 4; + _buffer.Append(hexChar); + + hexNumber = false; + hexCount = 0; + } + } + + if (!stringTerminated) + throw new JsonReaderException("Unterminated string. Expected delimiter: " + quote); + + ClearCurrentChar(); + string text = _buffer.ToString(); + _buffer.Position = 0; + + if (text.StartsWith("/Date(", StringComparison.Ordinal) && text.EndsWith(")/", StringComparison.Ordinal)) + { + ParseDate(text); + } + else + { + SetToken(JsonToken.String, text); + QuoteChar = quote; + } + } + + /// + /// Sets the current token and value. + /// + /// The new token. + /// The value. + protected override void SetToken(JsonToken newToken, object value) + { + base.SetToken(newToken, value); + + switch (newToken) + { + case JsonToken.StartObject: + ClearCurrentChar(); + break; + case JsonToken.StartArray: + ClearCurrentChar(); + break; + case JsonToken.StartConstructor: + ClearCurrentChar(); + break; + case JsonToken.EndObject: + ClearCurrentChar(); + break; + case JsonToken.EndArray: + ClearCurrentChar(); + break; + case JsonToken.EndConstructor: + ClearCurrentChar(); + break; + case JsonToken.PropertyName: + ClearCurrentChar(); + break; + } + } + + private void ParseDate(string text) + { + string value = text.Substring(6, text.Length - 8); + DateTimeKind kind = DateTimeKind.Utc; + + int index = value.IndexOf('+', 1); + + if (index == -1) + index = value.IndexOf('-', 1); + + if (index != -1) + { + kind = DateTimeKind.Local; + value = value.Substring(0, index); + } + + long javaScriptTicks = long.Parse(value, CultureInfo.InvariantCulture); + DateTime utcDateTime = JavaScriptConvert.ConvertJavaScriptTicksToDateTime(javaScriptTicks); + DateTime dateTime; + + switch (kind) + { + case DateTimeKind.Unspecified: + dateTime = DateTime.SpecifyKind(utcDateTime.ToLocalTime(), DateTimeKind.Unspecified); + break; + case DateTimeKind.Local: + dateTime = utcDateTime.ToLocalTime(); + break; + default: + dateTime = utcDateTime; + break; + } + + SetToken(JsonToken.Date, dateTime); + } + + private bool MoveNext() + { + int value = _reader.Read(); + + if (value != -1) + { + _currentChar = (char)value; + //_testBuffer.Append(_currentChar); + return true; + } + else + { + return false; + } + } + + private bool HasNext() + { + return (_reader.Peek() != -1); + } + + private char PeekNext() + { + return (char)_reader.Peek(); + } + + private void ClearCurrentChar() + { + _currentChar = '\0'; + } + + private bool MoveTo(char value) + { + while (MoveNext()) + { + if (_currentChar == value) + return true; + } + return false; + } + + /// + /// Reads the next Json token from the stream. + /// + /// + /// true if the next token was read successfully; false if there are no more tokens to read. + /// + public override bool Read() + { + while (true) + { + if (_currentChar == '\0') + { + if (!MoveNext()) + return false; + } + + switch (CurrentState) + { + case State.Start: + case State.Property: + case State.Array: + case State.ArrayStart: + case State.Constructor: + case State.ConstructorStart: + return ParseValue(); + case State.Complete: + break; + case State.Object: + case State.ObjectStart: + return ParseObject(); + case State.PostValue: + // returns true if it hits + // end of object or array + if (ParsePostValue()) + return true; + break; + case State.Closed: + break; + case State.Error: + break; + default: + throw new JsonReaderException("Unexpected state: " + CurrentState); + } + } + } + + private bool ParsePostValue() + { + do + { + switch (_currentChar) + { + case '}': + SetToken(JsonToken.EndObject); + ClearCurrentChar(); + return true; + case ']': + SetToken(JsonToken.EndArray); + ClearCurrentChar(); + return true; + case ')': + SetToken(JsonToken.EndConstructor); + ClearCurrentChar(); + return true; + case '/': + ParseComment(); + return true; + case ',': + // finished paring + SetStateBasedOnCurrent(); + ClearCurrentChar(); + return false; + default: + if (char.IsWhiteSpace(_currentChar)) + { + // eat whitespace + ClearCurrentChar(); + } + else + { + throw new JsonReaderException("After parsing a value an unexpected character was encoutered: " + _currentChar); + } + break; + } + } while (MoveNext()); + + return false; + } + + private bool ParseObject() + { + do + { + switch (_currentChar) + { + case '}': + SetToken(JsonToken.EndObject); + return true; + case '/': + ParseComment(); + return true; + case ',': + SetToken(JsonToken.Undefined); + return true; + default: + if (char.IsWhiteSpace(_currentChar)) + { + // eat + } + else + { + return ParseProperty(); + } + break; + } + } while (MoveNext()); + + return false; + } + + private bool ParseProperty() + { + if (ValidIdentifierChar(_currentChar)) + { + ParseUnquotedProperty(); + } + else if (_currentChar == '"' || _currentChar == '\'') + { + ParseQuotedProperty(_currentChar); + } + else + { + throw new JsonReaderException("Invalid property identifier character: " + _currentChar); + } + + // finished property. move to colon + if (_currentChar != ':') + { + MoveTo(':'); + } + + SetToken(JsonToken.PropertyName, _buffer.ToString()); + _buffer.Position = 0; + + return true; + } + + private void ParseQuotedProperty(char quoteChar) + { + // parse property name until quoted char is hit + while (MoveNext()) + { + if (_currentChar == quoteChar) + { + return; + } + else + { + _buffer.Append(_currentChar); + } + } + + throw new JsonReaderException("Unclosed quoted property. Expected: " + quoteChar); + } + + private bool ValidIdentifierChar(char value) + { + return (char.IsLetterOrDigit(_currentChar) || _currentChar == '_' || _currentChar == '$'); + } + + private void ParseUnquotedProperty() + { + // parse unquoted property name until whitespace or colon + _buffer.Append(_currentChar); + + while (MoveNext()) + { + if (char.IsWhiteSpace(_currentChar) || _currentChar == ':') + { + break; + } + else if (ValidIdentifierChar(_currentChar)) + { + _buffer.Append(_currentChar); + } + else + { + throw new JsonReaderException("Invalid JavaScript property identifier character: " + _currentChar); + } + } + } + + private bool ParseValue() + { + do + { + switch (_currentChar) + { + case '"': + case '\'': + ParseString(_currentChar); + return true; + case 't': + ParseTrue(); + return true; + case 'f': + ParseFalse(); + return true; + case 'n': + if (HasNext()) + { + char next = PeekNext(); + + if (next == 'u') + ParseNull(); + else if (next == 'e') + ParseConstructor(); + else + throw new JsonReaderException("Unexpected character encountered while parsing value: " + _currentChar); + } + else + { + throw new JsonReaderException("Unexpected end"); + } + return true; + case 'N': + ParseNumberNaN(); + return true; + case 'I': + ParseNumberPositiveInfinity(); + return true; + case '-': + if (PeekNext() == 'I') + ParseNumberNegativeInfinity(); + else + ParseNumber(); + return true; + case '/': + ParseComment(); + return true; + case 'u': + ParseUndefined(); + return true; + case '{': + SetToken(JsonToken.StartObject); + return true; + case '[': + SetToken(JsonToken.StartArray); + return true; + case '}': + SetToken(JsonToken.EndObject); + return true; + case ']': + SetToken(JsonToken.EndArray); + return true; + case ',': + SetToken(JsonToken.Undefined); + //ClearCurrentChar(); + return true; + case ')': + SetToken(JsonToken.EndConstructor); + return true; + default: + if (char.IsWhiteSpace(_currentChar)) + { + // eat + } + else if (char.IsNumber(_currentChar) || _currentChar == '-' || _currentChar == '.') + { + ParseNumber(); + return true; + } + else + { + throw new JsonReaderException("Unexpected character encountered while parsing value: " + _currentChar); + } + break; + } + } while (MoveNext()); + + return false; + } + + private bool EatWhitespace(bool oneOrMore) + { + bool whitespace = false; + while (char.IsWhiteSpace(_currentChar)) + { + whitespace = true; + MoveNext(); + } + + return (!oneOrMore || whitespace); + } + + private void ParseConstructor() + { + if (MatchValue("new", true)) + { + if (EatWhitespace(true)) + { + while (char.IsLetter(_currentChar)) + { + _buffer.Append(_currentChar); + MoveNext(); + } + + EatWhitespace(false); + + if (_currentChar != '(') + throw new JsonReaderException("Unexpected character while parsing constructor: " + _currentChar); + + string constructorName = _buffer.ToString(); + _buffer.Position = 0; + + SetToken(JsonToken.StartConstructor, constructorName); + } + } + } + + private void ParseNumber() + { + // parse until seperator character or end + bool end = false; + do + { + if (CurrentIsSeperator()) + end = true; + else + _buffer.Append(_currentChar); + + } while (!end && MoveNext()); + + string number = _buffer.ToString(); + object numberValue; + JsonToken numberType; + + if (number.IndexOf(".", StringComparison.OrdinalIgnoreCase) == -1 + && number.IndexOf("e", StringComparison.OrdinalIgnoreCase) == -1) + { + numberValue = Convert.ToInt64(_buffer.ToString(), CultureInfo.InvariantCulture); + numberType = JsonToken.Integer; + } + else + { + numberValue = Convert.ToDouble(_buffer.ToString(), CultureInfo.InvariantCulture); + numberType = JsonToken.Float; + } + + _buffer.Position = 0; + + SetToken(numberType, numberValue); + } + + private void ParseComment() + { + // should have already parsed / character before reaching this method + + MoveNext(); + + if (_currentChar == '*') + { + while (MoveNext()) + { + if (_currentChar == '*') + { + if (MoveNext()) + { + if (_currentChar == '/') + { + break; + } + else + { + _buffer.Append('*'); + _buffer.Append(_currentChar); + } + } + } + else + { + _buffer.Append(_currentChar); + } + } + } + else + { + throw new JsonReaderException("Error parsing comment. Expected: *"); + } + + SetToken(JsonToken.Comment, _buffer.ToString()); + + _buffer.Position = 0; + + ClearCurrentChar(); + } + + private bool MatchValue(string value) + { + int i = 0; + do + { + if (_currentChar != value[i]) + { + break; + } + i++; + } + while (i < value.Length && MoveNext()); + + return (i == value.Length); + } + + private bool MatchValue(string value, bool noTrailingNonSeperatorCharacters) + { + // will match value and then move to the next character, checking that it is a seperator character + bool match = MatchValue(value); + + if (!noTrailingNonSeperatorCharacters) + return match; + else + return (match && (!MoveNext() || CurrentIsSeperator())); + } + + private bool CurrentIsSeperator() + { + switch (_currentChar) + { + case '}': + case ']': + case ',': + return true; + case '/': + // check next character to see if start of a comment + return (HasNext() && PeekNext() == '*'); + case ')': + if (CurrentState == State.Constructor || CurrentState == State.ConstructorStart) + return true; + break; + default: + if (char.IsWhiteSpace(_currentChar)) + return true; + break; + } + + return false; + } + + private void ParseTrue() + { + // check characters equal 'true' + // and that it is followed by either a seperator character + // or the text ends + if (MatchValue(JavaScriptConvert.True, true)) + { + SetToken(JsonToken.Boolean, true); + } + else + { + throw new JsonReaderException("Error parsing boolean value."); + } + } + + private void ParseNull() + { + if (MatchValue(JavaScriptConvert.Null, true)) + { + SetToken(JsonToken.Null); + } + else + { + throw new JsonReaderException("Error parsing null value."); + } + } + + private void ParseUndefined() + { + if (MatchValue(JavaScriptConvert.Undefined, true)) + { + SetToken(JsonToken.Undefined); + } + else + { + throw new JsonReaderException("Error parsing undefined value."); + } + } + + private void ParseFalse() + { + if (MatchValue(JavaScriptConvert.False, true)) + { + SetToken(JsonToken.Boolean, false); + } + else + { + throw new JsonReaderException("Error parsing boolean value."); + } + } + + private void ParseNumberNegativeInfinity() + { + if (MatchValue(JavaScriptConvert.NegativeInfinity, true)) + { + SetToken(JsonToken.Float, double.NegativeInfinity); + } + else + { + throw new JsonReaderException("Error parsing negative infinity value."); + } + } + + private void ParseNumberPositiveInfinity() + { + if (MatchValue(JavaScriptConvert.PositiveInfinity, true)) + { + SetToken(JsonToken.Float, double.PositiveInfinity); + } + else + { + throw new JsonReaderException("Error parsing positive infinity value."); + } + } + + private void ParseNumberNaN() + { + if (MatchValue(JavaScriptConvert.NaN, true)) + { + SetToken(JsonToken.Float, double.NaN); + } + else + { + throw new JsonReaderException("Error parsing NaN value."); + } + } + + /// + /// Changes the to Closed. + /// + public override void Close() + { + base.Close(); + + if (_reader != null) + _reader.Close(); + + if (_buffer != null) + _buffer.Clear(); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonTextWriter.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonTextWriter.cs new file mode 100644 index 0000000..f15b329 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonTextWriter.cs @@ -0,0 +1,458 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json +{ + /// + /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + /// + public class JsonTextWriter : JsonWriter + { + private TextWriter _writer; + private char _indentChar; + private int _indentation; + private char _quoteChar; + private bool _quoteName; + + /// + /// Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + /// + public int Indentation + { + get { return _indentation; } + set + { + if (value < 0) + throw new ArgumentException("Indentation value must be greater than 0."); + + _indentation = value; + } + } + + /// + /// Gets or sets which character to use to quote attribute values. + /// + public char QuoteChar + { + get { return _quoteChar; } + set + { + if (value != '"' && value != '\'') + throw new ArgumentException(@"Invalid JavaScript string quote character. Valid quote characters are ' and ""."); + + _quoteChar = value; + } + } + + /// + /// Gets or sets which character to use for indenting when is set to Formatting.Indented. + /// + public char IndentChar + { + get { return _indentChar; } + set { _indentChar = value; } + } + + /// + /// Gets or sets a value indicating whether object names will be surrounded with quotes. + /// + public bool QuoteName + { + get { return _quoteName; } + set { _quoteName = value; } + } + + /// + /// Creates an instance of the JsonWriter class using the specified . + /// + /// The TextWriter to write to. + public JsonTextWriter(TextWriter textWriter) + { + if (textWriter == null) + throw new ArgumentNullException("textWriter"); + + _writer = textWriter; + _quoteChar = '"'; + _quoteName = true; + _indentChar = ' '; + _indentation = 2; + } + + /// + /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + /// + public override void Flush() + { + _writer.Flush(); + } + + /// + /// Closes this stream and the underlying stream. + /// + public override void Close() + { + base.Close(); + + _writer.Close(); + } + + /// + /// Writes the beginning of a Json object. + /// + public override void WriteStartObject() + { + base.WriteStartObject(); + + _writer.Write("{"); + } + + /// + /// Writes the beginning of a Json array. + /// + public override void WriteStartArray() + { + base.WriteStartArray(); + + _writer.Write("["); + } + + /// + /// Writes the start of a constructor with the given name. + /// + /// The name of the constructor. + public override void WriteStartConstructor(string name) + { + base.WriteStartConstructor(name); + + _writer.Write("new "); + _writer.Write(name); + _writer.Write("("); + } + + /// + /// Writes the specified end token. + /// + /// The end token to write. + protected override void WriteEnd(JsonToken token) + { + switch (token) + { + case JsonToken.EndObject: + _writer.Write("}"); + break; + case JsonToken.EndArray: + _writer.Write("]"); + break; + case JsonToken.EndConstructor: + _writer.Write(")"); + break; + default: + throw new JsonWriterException("Invalid JsonToken: " + token); + } + } + + /// + /// Writes the property name of a name/value pair on a Json object. + /// + /// The name of the property. + public override void WritePropertyName(string name) + { + base.WritePropertyName(name); + + if (_quoteName) + _writer.Write(_quoteChar); + + _writer.Write(name); + + if (_quoteName) + _writer.Write(_quoteChar); + + _writer.Write(':'); + } + + /// + /// Writes indent characters. + /// + protected override void WriteIndent() + { + if (Formatting == Formatting.Indented) + { + _writer.Write(Environment.NewLine); + // for each level of object... + for (int i = 0; i < Top; i++) + { + // ...write the indent char the specified number of times + for (int j = 0; j < _indentation; j++) + { + _writer.Write(_indentChar); + } + } + } + } + + /// + /// Writes the JSON value delimiter. + /// + protected override void WriteValueDelimiter() + { + _writer.Write(','); + } + + /// + /// Writes an indent space. + /// + protected override void WriteIndentSpace() + { + _writer.Write(' '); + } + + private void WriteValueInternal(string value, JsonToken token) + { + _writer.Write(value); + } + + #region WriteValue methods + /// + /// Writes a null value. + /// + public override void WriteNull() + { + base.WriteNull(); + WriteValueInternal(JavaScriptConvert.Null, JsonToken.Null); + } + + /// + /// Writes an undefined value. + /// + public override void WriteUndefined() + { + base.WriteUndefined(); + WriteValueInternal(JavaScriptConvert.Undefined, JsonToken.Undefined); + } + + /// + /// Writes raw JavaScript manually. + /// + /// The raw JavaScript to write. + public override void WriteRaw(string javaScript) + { + base.WriteRaw(javaScript); + // hack. some 'raw' or 'other' token perhaps? + WriteValueInternal(javaScript, JsonToken.Undefined); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(string value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value, _quoteChar), JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(int value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(uint value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(long value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(ulong value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(float value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(double value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(bool value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Boolean); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(short value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(ushort value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(char value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(byte value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(sbyte value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(decimal value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(DateTime value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Date); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(DateTimeOffset value) + { + base.WriteValue(value); + WriteValueInternal(JavaScriptConvert.ToString(value), JsonToken.Date); + } + #endregion + + /// + /// Writes out a comment /*...*/ containing the specified text. + /// + /// Text to place inside the comment. + public override void WriteComment(string text) + { + base.WriteComment(text); + + _writer.Write("/*"); + _writer.Write(text); + _writer.Write("*/"); + } + + /// + /// Writes out the given white space. + /// + /// The string of white space characters. + public override void WriteWhitespace(string ws) + { + base.WriteWhitespace(ws); + + _writer.Write(ws); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonToken.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonToken.cs new file mode 100644 index 0000000..8d58c9f --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonToken.cs @@ -0,0 +1,102 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Specifies the type of Json token. + /// + public enum JsonToken + { + /// + /// This is returned by the if a method has not been called. + /// + None, + /// + /// An object start token. + /// + StartObject, + /// + /// An array start token. + /// + StartArray, + /// + /// An object property name. + /// + StartConstructor, + /// + /// A constructor end token. + /// + PropertyName, + /// + /// A comment. + /// + Comment, + /// + /// An interger. + /// + Integer, + /// + /// A float. + /// + Float, + /// + /// A string. + /// + String, + /// + /// A boolean. + /// + Boolean, + /// + /// A null token. + /// + Null, + /// + /// An undefined token. + /// + Undefined, + /// + /// An object end token. + /// + EndObject, + /// + /// An array end token. + /// + EndArray, + /// + /// A constructor start token. + /// + EndConstructor, + /// + /// A Date. + /// + Date + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonWriter.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonWriter.cs new file mode 100644 index 0000000..615fc46 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonWriter.cs @@ -0,0 +1,772 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using Newtonsoft.Json.Utilities; +using Newtonsoft.Json.Linq; +using System.Globalization; + +namespace Newtonsoft.Json +{ + /// + /// Specifies the state of the . + /// + public enum WriteState + { + /// + /// An exception has been thrown, which has left the in an invalid state. + /// You may call the method to put the in the Closed state. + /// Any other method calls results in an being thrown. + /// + Error, + /// + /// The method has been called. + /// + Closed, + /// + /// An object is being written. + /// + Object, + /// + /// A array is being written. + /// + Array, + /// + /// A constructor is being written. + /// + Constructor, + /// + /// A property is being written. + /// + Property, + /// + /// A write method has not been called. + /// + Start + } + + /// + /// Specifies formatting options for the . + /// + public enum Formatting + { + /// + /// No special formatting is applied. This is the default. + /// + None, + /// + /// Causes child objects to be indented according to the and settings. + /// + Indented + } + + /// + /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + /// + public abstract class JsonWriter : IDisposable + { + private enum State + { + Start, + Property, + ObjectStart, + Object, + ArrayStart, + Array, + ConstructorStart, + Constructor, + Closed, + Error + } + + // array that gives a new state based on the current state an the token being written + private static readonly State[,] stateArray = { +// Start PropertyName ObjectStart Object ArrayStart Array ConstructorStart Constructor Closed Error +// +/* None */{ State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error }, +/* StartObject */{ State.ObjectStart, State.ObjectStart, State.Error, State.Error, State.ObjectStart, State.ObjectStart, State.ObjectStart, State.ObjectStart, State.Error, State.Error }, +/* StartArray */{ State.ArrayStart, State.ArrayStart, State.Error, State.Error, State.ArrayStart, State.ArrayStart, State.ArrayStart, State.ArrayStart, State.Error, State.Error }, +/* StartConstructor */{ State.ConstructorStart, State.ConstructorStart, State.Error, State.Error, State.ConstructorStart, State.ConstructorStart, State.ConstructorStart, State.ConstructorStart, State.Error, State.Error }, +/* StartProperty */{ State.Property, State.Error, State.Property, State.Property, State.Error, State.Error, State.Error, State.Error, State.Error, State.Error }, +/* Comment */{ State.Start, State.Property, State.ObjectStart, State.Object, State.ArrayStart, State.Array, State.Constructor, State.Constructor, State.Error, State.Error }, +/* Value */{ State.Start, State.Object, State.Error, State.Error, State.Array, State.Array, State.Constructor, State.Constructor, State.Error, State.Error }, + }; + + private int _top; + + private List _stack; + private List _serializeStack; + private State _currentState; + private Formatting _formatting; + + internal List SerializeStack + { + get + { + if (_serializeStack == null) + _serializeStack = new List(); + + return _serializeStack; + } + } + + /// + /// Gets the top. + /// + /// The top. + protected int Top + { + get { return _top; } + } + + /// + /// Gets the state of the writer. + /// + public WriteState WriteState + { + get + { + switch (_currentState) + { + case State.Error: + return WriteState.Error; + case State.Closed: + return WriteState.Closed; + case State.Object: + case State.ObjectStart: + return WriteState.Object; + case State.Array: + case State.ArrayStart: + return WriteState.Array; + case State.Constructor: + case State.ConstructorStart: + return WriteState.Constructor; + case State.Property: + return WriteState.Property; + case State.Start: + return WriteState.Start; + default: + throw new JsonWriterException("Invalid state: " + _currentState); + } + } + } + + /// + /// Indicates how the output is formatted. + /// + public Formatting Formatting + { + get { return _formatting; } + set { _formatting = value; } + } + + /// + /// Creates an instance of the JsonWriter class. + /// + public JsonWriter() + { + _stack = new List(1); + _stack.Add(JsonTokenType.None); + _currentState = State.Start; + _formatting = Formatting.None; + } + + private void Push(JsonTokenType value) + { + _top++; + if (_stack.Count <= _top) + _stack.Add(value); + else + _stack[_top] = value; + } + + private JsonTokenType Pop() + { + JsonTokenType value = Peek(); + _top--; + + return value; + } + + private JsonTokenType Peek() + { + return _stack[_top]; + } + + /// + /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + /// + public abstract void Flush(); + + /// + /// Closes this stream and the underlying stream. + /// + public virtual void Close() + { + AutoCompleteAll(); + } + + /// + /// Writes the beginning of a Json object. + /// + public virtual void WriteStartObject() + { + AutoComplete(JsonToken.StartObject); + Push(JsonTokenType.Object); + } + + /// + /// Writes the end of a Json object. + /// + public void WriteEndObject() + { + AutoCompleteClose(JsonToken.EndObject); + } + + /// + /// Writes the beginning of a Json array. + /// + public virtual void WriteStartArray() + { + AutoComplete(JsonToken.StartArray); + Push(JsonTokenType.Array); + } + + /// + /// Writes the end of an array. + /// + public void WriteEndArray() + { + AutoCompleteClose(JsonToken.EndArray); + } + + /// + /// Writes the start of a constructor with the given name. + /// + /// The name of the constructor. + public virtual void WriteStartConstructor(string name) + { + AutoComplete(JsonToken.StartConstructor); + Push(JsonTokenType.Constructor); + } + + /// + /// Writes the end constructor. + /// + public void WriteEndConstructor() + { + AutoCompleteClose(JsonToken.EndConstructor); + } + + /// + /// Writes the property name of a name/value pair on a Json object. + /// + /// The name of the property. + public virtual void WritePropertyName(string name) + { + AutoComplete(JsonToken.PropertyName); + } + + /// + /// Writes the end of the current Json object or array. + /// + public void WriteEnd() + { + WriteEnd(Peek()); + } + + /// + /// Writes the current token. + /// + /// The to read the token from. + public void WriteToken(JsonReader reader) + { + ValidationUtils.ArgumentNotNull(reader, "reader"); + + int currentDepth = (reader.TokenType == JsonToken.None) ? -1 : reader.Depth; + + do + { + switch (reader.TokenType) + { + case JsonToken.None: + // read to next + break; + case JsonToken.StartObject: + WriteStartObject(); + break; + case JsonToken.StartArray: + WriteStartArray(); + break; + case JsonToken.StartConstructor: + WriteStartConstructor(reader.Value.ToString()); + break; + case JsonToken.PropertyName: + WritePropertyName(reader.Value.ToString()); + break; + case JsonToken.Comment: + WriteComment(reader.Value.ToString()); + break; + case JsonToken.Integer: + WriteValue((long)reader.Value); + break; + case JsonToken.Float: + WriteValue((double)reader.Value); + break; + case JsonToken.String: + WriteValue(reader.Value.ToString()); + break; + case JsonToken.Boolean: + WriteValue((bool)reader.Value); + break; + case JsonToken.Null: + WriteNull(); + break; + case JsonToken.Undefined: + WriteUndefined(); + break; + case JsonToken.EndObject: + WriteEndObject(); + break; + case JsonToken.EndArray: + WriteEndArray(); + break; + case JsonToken.EndConstructor: + WriteEndConstructor(); + break; + case JsonToken.Date: + WriteValue((DateTime)reader.Value); + break; + default: + throw new ArgumentOutOfRangeException("TokenType", reader.TokenType, "Unexpected token type."); + } + } + while (reader.Read() && (currentDepth - 1 < reader.Depth || (currentDepth == reader.Depth && !IsEndToken(reader.TokenType)))); + } + + private bool IsEndToken(JsonToken token) + { + switch (token) + { + case JsonToken.EndObject: + case JsonToken.EndArray: + case JsonToken.EndConstructor: + return true; + default: + return false; + } + } + + private void WriteEnd(JsonTokenType type) + { + switch (type) + { + case JsonTokenType.Object: + WriteEndObject(); + break; + case JsonTokenType.Array: + WriteEndArray(); + break; + case JsonTokenType.Constructor: + WriteEndConstructor(); + break; + default: + throw new JsonWriterException("Unexpected type when writing end: " + type); + } + } + + private void AutoCompleteAll() + { + while (_top > 0) + { + WriteEnd(); + } + } + + private JsonTokenType GetTypeForCloseToken(JsonToken token) + { + switch (token) + { + case JsonToken.EndObject: + return JsonTokenType.Object; + case JsonToken.EndArray: + return JsonTokenType.Array; + case JsonToken.EndConstructor: + return JsonTokenType.Constructor; + default: + throw new JsonWriterException("No type for token: " + token); + } + } + + private JsonToken GetCloseTokenForType(JsonTokenType type) + { + switch (type) + { + case JsonTokenType.Object: + return JsonToken.EndObject; + case JsonTokenType.Array: + return JsonToken.EndArray; + case JsonTokenType.Constructor: + return JsonToken.EndConstructor; + default: + throw new JsonWriterException("No close token for type: " + type); + } + } + + private void AutoCompleteClose(JsonToken tokenBeingClosed) + { + // write closing symbol and calculate new state + + int levelsToComplete = 0; + + for (int i = 0; i < _top; i++) + { + int currentLevel = _top - i; + + if (_stack[currentLevel] == GetTypeForCloseToken(tokenBeingClosed)) + { + levelsToComplete = i + 1; + break; + } + } + + if (levelsToComplete == 0) + throw new JsonWriterException("No token to close."); + + for (int i = 0; i < levelsToComplete; i++) + { + JsonToken token = GetCloseTokenForType(Pop()); + + if (_currentState != State.ObjectStart && _currentState != State.ArrayStart) + WriteIndent(); + + WriteEnd(token); + } + + JsonTokenType currentLevelType = Peek(); + + switch (currentLevelType) + { + case JsonTokenType.Object: + _currentState = State.Object; + break; + case JsonTokenType.Array: + _currentState = State.Array; + break; + case JsonTokenType.None: + _currentState = State.Start; + break; + default: + throw new JsonWriterException("Unknown JsonType: " + currentLevelType); + } + } + + /// + /// Writes the specified end token. + /// + /// The end token to write. + protected virtual void WriteEnd(JsonToken token) + { + } + + /// + /// Writes indent characters. + /// + protected virtual void WriteIndent() + { + } + + /// + /// Writes the JSON value delimiter. + /// + protected virtual void WriteValueDelimiter() + { + } + + /// + /// Writes an indent space. + /// + protected virtual void WriteIndentSpace() + { + } + + private void AutoComplete(JsonToken tokenBeingWritten) + { + int token; + + switch (tokenBeingWritten) + { + default: + token = (int)tokenBeingWritten; + break; + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.String: + case JsonToken.Boolean: + case JsonToken.Null: + case JsonToken.Undefined: + case JsonToken.Date: + // a value is being written + token = 6; + break; + } + + // gets new state based on the current state and what is being written + State newState = stateArray[token, (int)_currentState]; + + if (newState == State.Error) + throw new JsonWriterException("Token {0} in state {1} would result in an invalid JavaScript object.".FormatWith(CultureInfo.InvariantCulture, tokenBeingWritten.ToString(), _currentState.ToString())); + + if ((_currentState == State.Object || _currentState == State.Array || _currentState == State.Constructor) && tokenBeingWritten != JsonToken.Comment) + { + WriteValueDelimiter(); + } + else if (_currentState == State.Property) + { + if (_formatting == Formatting.Indented) + WriteIndentSpace(); + } + + // don't indent a property when it is the first token to be written (i.e. at the start) + if ((tokenBeingWritten == JsonToken.PropertyName && WriteState != WriteState.Start) || + WriteState == WriteState.Array || WriteState == WriteState.Constructor) + { + WriteIndent(); + } + + _currentState = newState; + } + + #region WriteValue methods + /// + /// Writes a null value. + /// + public virtual void WriteNull() + { + AutoComplete(JsonToken.Null); + } + + /// + /// Writes an undefined value. + /// + public virtual void WriteUndefined() + { + AutoComplete(JsonToken.Undefined); + } + + /// + /// Writes raw JavaScript manually. + /// + /// The raw JavaScript to write. + public virtual void WriteRaw(string javaScript) + { + // hack. some 'raw' or 'other' token perhaps? + AutoComplete(JsonToken.Undefined); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(string value) + { + AutoComplete(JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(int value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(uint value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(long value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(ulong value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(float value) + { + AutoComplete(JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(double value) + { + AutoComplete(JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(bool value) + { + AutoComplete(JsonToken.Boolean); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(short value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(ushort value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(char value) + { + AutoComplete(JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(byte value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(sbyte value) + { + AutoComplete(JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(decimal value) + { + AutoComplete(JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(DateTime value) + { + AutoComplete(JsonToken.Date); + } + + /// + /// Writes a value. + /// + /// The value to write. + public virtual void WriteValue(DateTimeOffset value) + { + AutoComplete(JsonToken.Date); + } + #endregion + + /// + /// Writes out a comment /*...*/ containing the specified text. + /// + /// Text to place inside the comment. + public virtual void WriteComment(string text) + { + AutoComplete(JsonToken.Comment); + } + + /// + /// Writes out the given white space. + /// + /// The string of white space characters. + public virtual void WriteWhitespace(string ws) + { + if (ws != null) + { + if (!StringUtils.IsWhiteSpace(ws)) + throw new JsonWriterException("Only white space characters should be used."); + } + } + + + void IDisposable.Dispose() + { + Dispose(true); + } + + private void Dispose(bool disposing) + { + if (WriteState != WriteState.Closed) + Close(); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonWriterException.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonWriterException.cs new file mode 100644 index 0000000..a906f2c --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/JsonWriterException.cs @@ -0,0 +1,65 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// The exception thrown when an error occurs while reading Json text. + /// + public class JsonWriterException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public JsonWriterException() + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The error message that explains the reason for the exception. + public JsonWriterException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + public JsonWriterException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/Extensions.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/Extensions.cs new file mode 100644 index 0000000..f632404 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/Extensions.cs @@ -0,0 +1,251 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Contains the LINQ to JSON extension methods. + /// + public static class Extensions + { + /// + /// Returns a collection of tokens that contains the ancestors of every token in the source collection. + /// + /// The type of the objects in source, constrained to . + /// An of that contains the source collection. + /// An of that contains the ancestors of every node in the source collection. + public static IEnumerable Ancestors(this IEnumerable source) where T : JToken + { + ValidationUtils.ArgumentNotNull(source, "source"); + + return source.SelectMany(j => j.Ancestors()); + } + + //TODO + //public static IEnumerable AncestorsAndSelf(this IEnumerable source) where T : JObject + //{ + // ValidationUtils.ArgumentNotNull(source, "source"); + + // return source.SelectMany(j => j.AncestorsAndSelf()); + //} + + /// + /// Returns a collection of tokens that contains the descendants of every token in the source collection. + /// + /// The type of the objects in source, constrained to . + /// An of that contains the source collection. + /// An of that contains the descendants of every node in the source collection. + public static IEnumerable Descendants(this IEnumerable source) where T : JContainer + { + ValidationUtils.ArgumentNotNull(source, "source"); + + return source.SelectMany(j => j.Descendants()); + } + + //TODO + //public static IEnumerable DescendantsAndSelf(this IEnumerable source) where T : JContainer + //{ + // ValidationUtils.ArgumentNotNull(source, "source"); + + // return source.SelectMany(j => j.DescendantsAndSelf()); + //} + + /// + /// Returns a collection of child properties of every object in the source collection. + /// + /// An of that contains the source collection. + /// An of that contains the properties of every object in the source collection. + public static IEnumerable Properties(this IEnumerable source) + { + ValidationUtils.ArgumentNotNull(source, "source"); + + return source.SelectMany(d => d.Properties()); + } + + /// + /// Returns a collection of child values of every object in the source collection with the given key. + /// + /// An of that contains the source collection. + /// The token key. + /// An of that contains the values of every node in the source collection with the given key. + public static IEnumerable Values(this IEnumerable source, object key) + { + return Values(source, key); + } + + /// + /// Returns a collection of child values of every object in the source collection. + /// + /// An of that contains the source collection. + /// An of that contains the values of every node in the source collection. + public static IEnumerable Values(this IEnumerable source) + { + return Values(source, null); + } + + /// + /// Returns a collection of converted child values of every object in the source collection with the given key. + /// + /// The type to convert the values to. + /// An of that contains the source collection. + /// The token key. + /// An that contains the converted values of every node in the source collection with the given key. + public static IEnumerable Values(this IEnumerable source, object key) + { + return Values(source, key); + } + + /// + /// Returns a collection of converted child values of every object in the source collection. + /// + /// The type to convert the values to. + /// An of that contains the source collection. + /// An that contains the converted values of every node in the source collection. + public static IEnumerable Values(this IEnumerable source) + { + return Values(source, null); + } + + //public static IEnumerable Values(this IEnumerable source, object key) + //{ + // return Values(source, null); + //} + + internal static IEnumerable Values(this IEnumerable source, object key) where T : JToken + { + ValidationUtils.ArgumentNotNull(source, "source"); + + foreach (JToken token in source) + { + if (key == null) + { + foreach (JToken t in token.Children()) + { + yield return t.Convert(); ; + } + } + else + { + JToken value = token[key]; + if (value != null) + yield return value.Convert(); + } + } + + yield break; + + //IEnumerable allChildren = source.SelectMany(d => d.Children()); + //IEnumerable childrenValues = (key != null) ? allChildren.Select(p => p[key]) : allChildren.SelectMany(p => p.Children()); + + //List s = childrenValues.Convert().ToList(); + //return childrenValues.Convert(); + + // return source.SelectMany(d => d.Properties()) + //.Where(p => string.Compare(p.Name, name, StringComparison.Ordinal) == 0) + //.Select(p => p.Value) + //.Convert(); + } + + //TODO + //public static IEnumerable InDocumentOrder(this IEnumerable source) where T : JObject; + + //public static IEnumerable Children(this IEnumerable source) where T : JToken + //{ + // ValidationUtils.ArgumentNotNull(source, "source"); + + // return source.SelectMany(c => c.Children()); + //} + + /// + /// Returns a collection of child tokens of every array in the source collection. + /// + /// An of that contains the source collection. + /// An of that contains the values of every node in the source collection. + public static IEnumerable Children(this IEnumerable source) + { + return Children(source); + } + + /// + /// Returns a collection of converted child tokens of every array in the source collection. + /// + /// An of that contains the source collection. + /// An of that contains the converted values of every node in the source collection. + public static IEnumerable Children(this IEnumerable source) + { + ValidationUtils.ArgumentNotNull(source, "source"); + + return source.SelectMany(c => c.Children()).Convert(); + } + + internal static IEnumerable Convert(this IEnumerable source) where T : JToken + { + ValidationUtils.ArgumentNotNull(source, "source"); + + bool cast = typeof(JToken).IsAssignableFrom(typeof(U)); + + foreach (JToken token in source) + { + yield return Convert(token, cast); + } + } + + internal static U Convert(this T token) where T : JToken + { + bool cast = typeof(JToken).IsAssignableFrom(typeof(U)); + + return Convert(token, cast); + } + + internal static U Convert(this T token, bool cast) where T : JToken + { + if (cast) + { + // HACK + return (U)(object)token; + } + else + { + if (token == null) + return default(U); + + JValue value = token as JValue; + if (value == null) + throw new InvalidCastException("Cannot cast {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, token.GetType(), typeof(T))); + + return (U)System.Convert.ChangeType(value.Value, typeof(U), CultureInfo.InvariantCulture); + } + } + + //TODO + //public static void Remove(this IEnumerable source) where T : JContainer; + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JArray.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JArray.cs new file mode 100644 index 0000000..4daaab8 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JArray.cs @@ -0,0 +1,199 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.IO; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a JSON array. + /// + public class JArray : JContainer + { + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + get { return JsonTokenType.Array; } + } + + /// + /// Initializes a new instance of the class. + /// + public JArray() + { + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JArray(JArray other) + : base(other) + { + } + + /// + /// Initializes a new instance of the class with the specified content. + /// + /// The contents of the array. + public JArray(params object[] content) + : this((object)content) + { + } + + /// + /// Initializes a new instance of the class with the specified content. + /// + /// The contents of the array. + public JArray(object content) + { + Add(content); + } + + internal override bool DeepEquals(JToken node) + { + JArray t = node as JArray; + return (t != null && ContentsEqual(t)); + } + + internal override JToken CloneNode() + { + return new JArray(this); + } + + /// + /// Returns a count of this token's child tokens. + /// + /// A count of this token's child tokens. + public int Count() + { + return Children().Count(); + } + + /// + /// Loads an from a . + /// + /// A that will be read for the content of the . + /// A that contains the XML that was read from the specified . + public static JArray Load(JsonReader reader) + { + if (reader.TokenType == JsonToken.None) + { + if (!reader.Read()) + throw new Exception("Error reading JArray from JsonReader."); + } + if (reader.TokenType != JsonToken.StartArray) + { + throw new Exception("Current JsonReader item is not an object."); + } + else + { + if (!reader.Read()) + throw new Exception("Error reading JArray from JsonReader."); + } + + JArray a = new JArray(); + a.ReadContentFrom(reader); + + return a; + } + + /// + /// Load a from a string that contains JSON. + /// + /// A that contains JSON. + /// A populated from the string that contains JSON. + public static JArray Parse(string json) + { + JsonReader jsonReader = new JsonTextReader(new StringReader(json)); + + return Load(jsonReader); + } + + internal override void ValidateObject(JToken o, JToken previous) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type == JsonTokenType.Property) + throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); + } + + /// + /// Creates a from an object. + /// + /// The object that will be used to create . + /// A with the values of the specified object + public static JArray FromObject(object o) + { + JToken token = FromObjectInternal(o); + + if (token.Type != JsonTokenType.Array) + throw new ArgumentException("Object serialized to {0}. JArray instance expected.".FormatWith(CultureInfo.InvariantCulture, token.Type)); + + return (JArray)token; + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + writer.WriteStartArray(); + + foreach (JToken token in Children()) + { + token.WriteTo(writer, converters); + } + + writer.WriteEndArray(); + } + + /// + /// Gets the with the specified key. + /// + /// The with the specified key. + public override JToken this[object key] + { + get + { + ValidationUtils.ArgumentNotNull(key, "o"); + + if (!(key is int)) + throw new ArgumentException("Accessed JArray values with invalid key value: {0}. Array position index expected.".FormatWith(CultureInfo.InvariantCulture, MiscellaneousUtils.ToString(key))); + + return GetIndex(this, (int)key); + } + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JConstructor.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JConstructor.cs new file mode 100644 index 0000000..cbbcaff --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JConstructor.cs @@ -0,0 +1,161 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a JSON constructor. + /// + public class JConstructor : JContainer + { + private string _name; + + /// + /// Gets or sets the name of this constructor. + /// + /// The constructor name. + public string Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + get { return JsonTokenType.Constructor; } + } + + /// + /// Initializes a new instance of the class. + /// + public JConstructor() + { + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JConstructor(JConstructor other) + : base(other) + { + _name = other.Name; + } + + /// + /// Initializes a new instance of the class with the specified name and content. + /// + /// The constructor name. + /// The contents of the constructor. + public JConstructor(string name, params object[] content) + : this(name, (object)content) + { + } + + /// + /// Initializes a new instance of the class with the specified name and content. + /// + /// The constructor name. + /// The contents of the constructor. + public JConstructor(string name, object content) + : this(name) + { + Add(content); + } + + /// + /// Initializes a new instance of the class with the specified name. + /// + /// The constructor name. + public JConstructor(string name) + { + _name = name; + } + + internal override bool DeepEquals(JToken node) + { + JConstructor c = node as JConstructor; + return (c != null && _name == c.Name && ContentsEqual(c)); + } + + internal override JToken CloneNode() + { + return new JConstructor(this); + } + + internal override void ValidateObject(JToken o, JToken previous) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + switch (o.Type) + { + case JsonTokenType.Property: + throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); + } + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + writer.WriteStartConstructor(_name); + + foreach (JToken token in Children()) + { + token.WriteTo(writer, converters); + } + + writer.WriteEndConstructor(); + } + + /// + /// Gets the with the specified key. + /// + /// The with the specified key. + public override JToken this[object key] + { + get + { + ValidationUtils.ArgumentNotNull(key, "o"); + + if (!(key is int)) + throw new ArgumentException("Accessed JConstructor values with invalid key value: {0}. Argument position index expected.".FormatWith(CultureInfo.InvariantCulture, MiscellaneousUtils.ToString(key))); + + return GetIndex(this, (int)key); + } + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JContainer.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JContainer.cs new file mode 100644 index 0000000..e23a668 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JContainer.cs @@ -0,0 +1,463 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Collections; +using System.Diagnostics; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a token that can contain other tokens. + /// + public abstract class JContainer : JToken + { + private JToken _content; + + internal JToken Content + { + get { return _content; } + set { _content = value; } + } + + internal JContainer() + { + } + + internal JContainer(JContainer other) + { + ValidationUtils.ArgumentNotNull(other, "c"); + + JToken content = other.Last; + if (content != null) + { + do + { + content = content._next; + Add(content.CloneNode()); + } + while (content != other.Last); + } + } + + /// + /// Gets a value indicating whether this token has childen tokens. + /// + /// + /// true if this token has child values; otherwise, false. + /// + public override bool HasValues + { + get { return (_content != null); } + } + + internal bool ContentsEqual(JContainer container) + { + JToken t1 = First; + JToken t2 = container.First; + + if (t1 == t2) + return true; + + do + { + if (t1 == null && t2 == null) + return true; + + if (t1 != null && t2 != null && t1.DeepEquals(t2)) + { + t1 = (t1 != Last) ? t1.Next : null; + t2 = (t2 != container.Last) ? t2.Next : null; + } + else + { + return false; + } + } + while (true); + } + + /// + /// Get the first child token of this token. + /// + /// + /// A containing the first child token of the . + /// + public override JToken First + { + get + { + if (Last == null) + return null; + + return Last._next; + } + } + + /// + /// Get the last child token of this token. + /// + /// + /// A containing the last child token of the . + /// + public override JToken Last + { + [DebuggerStepThrough] + get { return _content; } + } + + /// + /// Returns a collection of the child tokens of this token, in document order. + /// + /// + /// An of containing the child tokens of this , in document order. + /// + public override JEnumerable Children() + { + return new JEnumerable(ChildrenInternal()); + } + + private IEnumerable ChildrenInternal() + { + JToken first = First; + JToken current = first; + if (current == null) + yield break; + + do + { + yield return current; + } + while (current != null + && ((current = current.Next) != null)); + } + + /// + /// Returns a collection of the child values of this token, in document order. + /// + /// + /// + /// A containing the child values of this , in document order. + /// + public override IEnumerable Values() + { + return Children().Convert(); + } + + /// + /// Returns a collection of the descendant tokens for this token in document order. + /// + /// An containing the descendant tokens of the . + public IEnumerable Descendants() + { + foreach (JToken o in Children()) + { + yield return o; + JContainer c = o as JContainer; + if (c != null) + { + foreach (JToken d in c.Descendants()) + { + yield return d; + } + } + } + } + + internal static JToken FromObjectInternal(object o) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + JsonSerializer jsonSerializer = new JsonSerializer(); + + JToken token; + using (JsonTokenWriter jsonWriter = new JsonTokenWriter()) + { + jsonSerializer.Serialize(jsonWriter, o); + token = jsonWriter.Token; + } + + return token; + } + + internal static JToken GetIndex(JContainer c, object o) + { + return c.Children().ElementAt((int)o); + } + + internal bool IsMultiContent(object content) + { + return (content is IEnumerable && !(content is string)); + } + + internal void AddInternal(bool isLast, JToken previous, object content) + { + if (IsMultiContent(content)) + { + IEnumerable enumerable = content as IEnumerable; + + JToken multiPrevious = previous; + foreach (object c in enumerable) + { + AddInternal(isLast, multiPrevious, c); + multiPrevious = (previous != null) ? previous._next : Last; + } + } + else + { + JToken o = CreateFromContent(content); + + ValidateToken(o); + + if (o.Parent != null) + { + o = o.CloneNode(); + } + else + { + JContainer parent = this; + while (parent.Parent != null) + { + parent = parent.Parent; + } + if (o == parent) + { + o = o.CloneNode(); + } + } + + JToken next = (previous != null) ? previous._next : o; + + o.Parent = this; + o.Next = next; + + if (previous != null) + previous.Next = o; + + if (isLast) + _content = o; + } + } + + internal virtual void ValidateToken(JToken o) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type == JsonTokenType.Property) + throw new Exception("Can not add {0} to {1}".FormatWith(CultureInfo.InvariantCulture, o.GetType(), GetType())); + } + + /// + /// Adds the specified content as children of this . + /// + /// The content to be added. + public virtual void Add(object content) + { + AddInternal(true, Last, content); + } + + /// + /// Adds the specified content as the first children of this . + /// + /// The content to be added. + public void AddFirst(object content) + { + AddInternal(false, Last, content); + } + + internal JToken CreateFromContent(object content) + { + if (content is JToken) + return (JToken)content; + else + return new JValue(content); + } + + /// + /// Creates an that can be used to add tokens to the . + /// + /// An that is ready to have content written to it. + public JsonWriter CreateWriter() + { + return new JsonTokenWriter(this); + } + + /// + /// Replaces the children nodes of this token with the specified content. + /// + /// The content. + public void ReplaceAll(object content) + { + RemoveAll(); + Add(content); + } + + /// + /// Removes the child nodes from this token. + /// + public void RemoveAll() + { + while (_content != null) + { + JToken o = _content; + + JToken next = o._next; + if (o != _content || next != o._next) + throw new InvalidOperationException("This operation was corrupted by external code."); + + if (next != o) + o._next = next._next; + else + _content = null; + + next.Parent = null; + next._next = null; + } + } + + internal void Remove(JToken o) + { + if (o.Parent != this) + throw new InvalidOperationException("This operation was corrupted by external code."); + + JToken content = _content; + + while (content._next != o) + { + content = content._next; + } + if (content == o) + { + // token is containers last child + _content = null; + } + else + { + if (_content == o) + { + _content = content; + } + content._next = o._next; + } + o.Parent = null; + o.Next = null; + } + + internal abstract void ValidateObject(JToken o, JToken previous); + + internal void AddObjectSkipNotify(JToken o) + { + ValidateObject(o, this); + + Add(o); + } + + internal void ReadContentFrom(JsonReader r) + { + ValidationUtils.ArgumentNotNull(r, "r"); + + JContainer parent = this; + + do + { + if (parent is JProperty) + { + if (((JProperty)parent).Value != null) + parent = parent.Parent; + } + + switch (r.TokenType) + { + case JsonToken.None: + // new reader. move to actual content + break; + case JsonToken.StartArray: + JArray a = new JArray(); + parent.AddObjectSkipNotify(a); + parent = a; + break; + + case JsonToken.EndArray: + if (parent == this) + return; + + parent = parent.Parent; + break; + case JsonToken.StartObject: + JObject o = new JObject(); + parent.AddObjectSkipNotify(o); + parent = o; + break; + case JsonToken.EndObject: + if (parent == this) + return; + + parent = parent.Parent; + break; + case JsonToken.StartConstructor: + JConstructor constructor = new JConstructor(); + constructor.Name = r.Value.ToString(); + parent.AddObjectSkipNotify(constructor); + parent = constructor; + break; + case JsonToken.EndConstructor: + if (parent == this) + return; + + parent = parent.Parent; + break; + case JsonToken.String: + case JsonToken.Integer: + case JsonToken.Float: + case JsonToken.Date: + case JsonToken.Boolean: + parent.AddObjectSkipNotify(new JValue(r.Value)); + break; + case JsonToken.Comment: + parent.AddObjectSkipNotify(JValue.CreateComment(r.Value.ToString())); + break; + case JsonToken.Null: + parent.AddObjectSkipNotify(new JValue(null, JsonTokenType.Null)); + break; + case JsonToken.Undefined: + parent.AddObjectSkipNotify(new JValue(null, JsonTokenType.Undefined)); + break; + case JsonToken.PropertyName: + JProperty property = new JProperty(r.Value.ToString()); + parent.AddObjectSkipNotify(property); + parent = property; + break; + default: + throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, r.TokenType)); + } + } + while (r.Read()); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JEnumerable.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JEnumerable.cs new file mode 100644 index 0000000..87cd9c8 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JEnumerable.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Collections; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a collection of objects. + /// + /// The type of token + public struct JEnumerable : IEnumerable where T : JToken + { + /// + /// An empty collection of objects. + /// + public static readonly JEnumerable Empty = new JEnumerable(Enumerable.Empty()); + + private IEnumerable _enumerable; + + /// + /// Initializes a new instance of the struct. + /// + /// The enumerable. + public JEnumerable(IEnumerable enumerable) + { + ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); + + _enumerable = enumerable; + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// A that can be used to iterate through the collection. + /// + public IEnumerator GetEnumerator() + { + return _enumerable.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through a collection. + /// + /// + /// An object that can be used to iterate through the collection. + /// + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// + /// Gets the with the specified key. + /// + /// + public IEnumerable this[object key] + { + get { return Extensions.Values(_enumerable, key); } + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JObject.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JObject.cs new file mode 100644 index 0000000..b17709c --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JObject.cs @@ -0,0 +1,234 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a JSON object. + /// + public class JObject : JContainer + { + /// + /// Initializes a new instance of the class. + /// + public JObject() + { + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JObject(JObject other) + : base(other) + { + } + + /// + /// Initializes a new instance of the class with the specified content. + /// + /// The contents of the object. + public JObject(params object[] content) + : this((object)content) + { + } + + /// + /// Initializes a new instance of the class with the specified content. + /// + /// The contents of the object. + public JObject(object content) + { + Add(content); + } + + internal override bool DeepEquals(JToken node) + { + JObject t = node as JObject; + return (t != null && ContentsEqual(t)); + } + + internal override void ValidateToken(JToken o) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type != JsonTokenType.Property) + throw new Exception("Can not add {0} to {1}".FormatWith(CultureInfo.InvariantCulture, o.GetType(), GetType())); + } + + internal override JToken CloneNode() + { + return new JObject(this); + } + + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + get { return JsonTokenType.Object; } + } + + /// + /// Gets an of this object's properties. + /// + /// An of this object's properties. + public IEnumerable Properties() + { + return Children().Cast(); + } + + /// + /// Gets a the specified name. + /// + /// The property name. + /// A with the specified name or null. + public JProperty Property(string name) + { + return Properties() + .Where(p => string.Compare(p.Name, name, StringComparison.Ordinal) == 0) + .SingleOrDefault(); + } + + /// + /// Gets an of this object's property values. + /// + /// An of this object's property values. + public JEnumerable PropertyValues() + { + return new JEnumerable(Properties().Select(p => p.Value)); + } + + /// + /// Gets the with the specified key. + /// + /// The with the specified key. + public override JToken this[object key] + { + get + { + ValidationUtils.ArgumentNotNull(key, "o"); + + string propertyName = key as string; + if (propertyName == null) + throw new ArgumentException("Accessed JObject values with invalid key value: {0}. Object property name expected.".FormatWith(CultureInfo.InvariantCulture, MiscellaneousUtils.ToString(key))); + + JProperty property = Property(propertyName); + + return (property != null) ? property.Value : null; + } + } + + /// + /// Loads an from a . + /// + /// A that will be read for the content of the . + /// A that contains the XML that was read from the specified . + public static JObject Load(JsonReader reader) + { + ValidationUtils.ArgumentNotNull(reader, "reader"); + + if (reader.TokenType == JsonToken.None) + { + if (!reader.Read()) + throw new Exception("Error reading JObject from JsonReader."); + } + if (reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Current JsonReader item is not an object."); + } + else + { + if (!reader.Read()) + throw new Exception("Error reading JObject from JsonReader."); + } + + JObject o = new JObject(); + o.ReadContentFrom(reader); + + return o; + } + + /// + /// Load a from a string that contains JSON. + /// + /// A that contains JSON. + /// A populated from the string that contains JSON. + public static JObject Parse(string json) + { + JsonReader jsonReader = new JsonTextReader(new StringReader(json)); + + return Load(jsonReader); + } + + /// + /// Creates a from an object. + /// + /// The object that will be used to create . + /// A with the values of the specified object + public static JObject FromObject(object o) + { + JToken token = FromObjectInternal(o); + + if (token.Type != JsonTokenType.Object) + throw new ArgumentException("Object serialized to {0}. JObject instance expected.".FormatWith(CultureInfo.InvariantCulture, token.Type)); + + return (JObject)token; + } + + internal override void ValidateObject(JToken o, JToken previous) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type != JsonTokenType.Property) + throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + writer.WriteStartObject(); + + foreach (JProperty property in Properties()) + { + property.WriteTo(writer, converters); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JProperty.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JProperty.cs new file mode 100644 index 0000000..29061aa --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JProperty.cs @@ -0,0 +1,150 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using Newtonsoft.Json.Utilities; +using System.Diagnostics; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a JSON property. + /// + public class JProperty : JContainer + { + private readonly string _name; + + /// + /// Gets the property name. + /// + /// The property name. + public string Name + { + [DebuggerStepThrough] + get { return _name; } + } + + /// + /// Gets or sets the property value. + /// + /// The property value. + public JToken Value + { + [DebuggerStepThrough] + get { return Last; } + set { ReplaceAll(value); } + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JProperty(JProperty other) + : base(other) + { + _name = other.Name; + } + + internal override bool DeepEquals(JToken node) + { + JProperty t = node as JProperty; + return (t != null && _name == t.Name && ContentsEqual(t)); + } + + internal override JToken CloneNode() + { + return new JProperty(this); + } + + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + [DebuggerStepThrough] + get { return JsonTokenType.Property; } + } + + /// + /// Initializes a new instance of the class. + /// + /// The property name. + public JProperty(string name) + { + ValidationUtils.ArgumentNotNull(name, "name"); + + _name = name; + } + + /// + /// Initializes a new instance of the class. + /// + /// The property name. + /// The property value. + public JProperty(string name, object value) + { + ValidationUtils.ArgumentNotNullOrEmpty(name, "name"); + + _name = name; + Value = CreateFromContent(value); + } + + internal override void ValidateObject(JToken o, JToken previous) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + if (o.Type == JsonTokenType.Property) + throw new ArgumentException("An item of type {0} cannot be added to content.".FormatWith(CultureInfo.InvariantCulture, o.Type)); + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + writer.WritePropertyName(_name); + Value.WriteTo(writer, converters); + } + + //public static explicit operator JValue(JProperty property) + //{ + // if (property == null) + // return null; + + // JToken value = property.Value; + // if (value == null) + // return null; + + // if (!(value is JValue)) + // throw new Exception("Could not cast {0} to JValue".FormatWith(CultureInfo.InvariantCulture, value.GetType())); + + // return (JValue)value; + //} + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JToken.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JToken.cs new file mode 100644 index 0000000..f0944a1 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JToken.cs @@ -0,0 +1,697 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Newtonsoft.Json.Utilities; +using System.Diagnostics; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents an abstract JSON token. + /// + public abstract class JToken + { + private JContainer _parent; + internal JToken _next; + + /// + /// Gets or sets the parent. + /// + /// The parent. + public JContainer Parent + { + [DebuggerStepThrough] + get { return _parent; } + internal set { _parent = value; } + } + + /// + /// Gets the root of this . + /// + /// The root of this . + public JToken Root + { + get + { + JContainer parent = Parent; + if (parent == null) + return this; + + while (parent.Parent != null) + { + parent = parent.Parent; + } + + return parent; + } + } + + internal abstract JToken CloneNode(); + internal abstract bool DeepEquals(JToken node); + + /// + /// Gets the node type for this . + /// + /// The type. + public abstract JsonTokenType Type { get; } + + /// + /// Gets a value indicating whether this token has childen tokens. + /// + /// + /// true if this token has child values; otherwise, false. + /// + public abstract bool HasValues { get; } + + /// + /// Compares the values of two tokens, including the values of all descendant tokens. + /// + /// The first to compare. + /// The second to compare. + /// true if the tokens are equal; otherwise false. + public static bool DeepEquals(JToken t1, JToken t2) + { + return (t1 == t2 || (t1 != null && t2 != null && t1.DeepEquals(t2))); + } + + /// + /// Gets the next sibling token of this node. + /// + /// The that contains the next sibling token. + public JToken Next + { + get + { + if (_parent != null && _next != _parent.First) + return _next; + + return null; + } + internal set { _next = value; } + } + + /// + /// Gets the previous sibling token of this node. + /// + /// The that contains the previous sibling token. + public JToken Previous + { + get + { + if (_parent == null) + return null; + + JToken parentNext = ((JToken)_parent.Content)._next; + JToken parentNextBefore = null; + while (parentNext != this) + { + parentNextBefore = parentNext; + parentNext = parentNext.Next; + } + return parentNextBefore; + } + } + + internal JToken() + { + } + + /// + /// Returns a collection of the ancestor tokens of this token. + /// + /// A collection of the ancestor tokens of this token. + public IEnumerable Ancestors() + { + for (JToken parent = Parent; parent != null; parent = parent.Parent) + { + yield return parent; + } + } + + /// + /// Returns a collection of the sibling tokens after this token, in document order. + /// + /// A collection of the sibling tokens after this tokens, in document order. + public IEnumerable AfterSelf() + { + if (Parent == null) + yield break; + + for (JToken o = Next; o != null; o = o.Next) + yield return o; + } + + /// + /// Returns a collection of the sibling tokens before this token, in document order. + /// + /// A collection of the sibling tokens before this token, in document order. + public IEnumerable BeforeSelf() + { + for (JToken o = Parent.First; o != this; o = o.Next) + yield return o; + } + + /// + /// Gets the with the specified key. + /// + /// The with the specified key. + public virtual JToken this[object key] + { + get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); } + } + + /// + /// Gets the with the specified key converted to the specified type. + /// + /// The type to convert the token to. + /// The token key. + /// The converted token value. + public virtual T Value(object key) + { + JToken token = this[key]; + + return Extensions.Convert(token); + } + + /// + /// Get the first child token of this token. + /// + /// A containing the first child token of the . + public virtual JToken First + { + get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); } + } + + /// + /// Get the last child token of this token. + /// + /// A containing the last child token of the . + public virtual JToken Last + { + get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); } + } + + /// + /// Returns a collection of the child tokens of this token, in document order. + /// + /// An of containing the child tokens of this , in document order. + public virtual JEnumerable Children() + { + throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); + } + + /// + /// Returns a collection of the child tokens of this token, in document order. + /// + /// A containing the child tokens of this , in document order. + public JEnumerable Children() where T : JToken + { + return new JEnumerable(Children().OfType()); + } + + /// + /// Returns a collection of the child values of this token, in document order. + /// + /// A containing the child values of this , in document order. + public virtual IEnumerable Values() + { + throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); + } + + /// + /// Removes this token from its parent. + /// + public void Remove() + { + if (_parent == null) + throw new InvalidOperationException("The parent is missing."); + + _parent.Remove(this); + } + + /// + /// Replaces this token with the specified token. + /// + /// The value. + public void Replace(JToken value) + { + if (_parent == null) + throw new InvalidOperationException("The parent is missing."); + + JContainer parent = _parent; + + JToken previous = this; + while (previous._next != this) + { + previous = previous._next; + } + if (previous == this) + previous = null; + + bool isLast = (this == _parent.Last); + + Remove(); + parent.AddInternal(isLast, previous, value); + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public abstract void WriteTo(JsonWriter writer, params JsonConverter[] converters); + + /// + /// Returns the indented JSON for this token. + /// + /// + /// A containing the indented JSON. + /// + public override string ToString() + { + return ToString(null); + } + + /// + /// Returns the indented JSON for this token using any given converters. + /// + /// A collection of which will be used when writing the token. + /// + private string ToString(params JsonConverter[] converters) + { + using (StringWriter sw = new StringWriter(CultureInfo.InvariantCulture)) + { + JsonTextWriter jw = new JsonTextWriter(sw); + jw.Formatting = Formatting.Indented; + + WriteTo(jw); + + return sw.ToString(); + } + } + + private static JValue EnsureValue(JToken value) + { + if (value == null) + throw new ArgumentNullException("value"); + + if (value is JProperty) + value = ((JProperty)value).Value; + + JValue v = value as JValue; + + return v; + } + + private static bool IsNullable(JToken o) + { + return (o.Type == JsonTokenType.Undefined || o.Type == JsonTokenType.Null); + } + + private static bool ValidateFloat(JToken o, bool nullable) + { + return (o.Type == JsonTokenType.Float || o.Type == JsonTokenType.Integer || (nullable && IsNullable(o))); + } + + private static bool ValidateInteger(JToken o, bool nullable) + { + return (o.Type == JsonTokenType.Integer || (nullable && IsNullable(o))); + } + + private static bool ValidateDate(JToken o, bool nullable) + { + return (o.Type == JsonTokenType.Date || (nullable && IsNullable(o))); + } + + private static bool ValidateBoolean(JToken o, bool nullable) + { + return (o.Type == JsonTokenType.Boolean || (nullable && IsNullable(o))); + } + + private static bool ValidateString(JToken o) + { + return (o.Type == JsonTokenType.String || IsNullable(o)); + } + + private static string GetType(JToken t) + { + return (t != null) ? t.Type.ToString() : "{null}"; + } + + #region Cast operators + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator bool(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateBoolean(v, false)) + throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (bool)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator DateTimeOffset(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateDate(v, false)) + throw new ArgumentException("Can not convert {0} to DateTimeOffset.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (DateTimeOffset)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator bool?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateBoolean(v, true)) + throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (bool?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator long(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, false)) + throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (long)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator DateTime?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateDate(v, true)) + throw new ArgumentException("Can not convert {0} to DateTime.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (DateTime?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator DateTimeOffset?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateDate(v, true)) + throw new ArgumentException("Can not convert {0} to DateTimeOffset.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (DateTimeOffset?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator decimal?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, true)) + throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (decimal?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator double?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, true)) + throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (double?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator int(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, false)) + throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return Convert.ToInt32(v.Value, CultureInfo.InvariantCulture); + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator int?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, true)) + throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (v.Value != null) ? (int?)Convert.ToInt32(v.Value, CultureInfo.InvariantCulture) : null; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator DateTime(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateDate(v, false)) + throw new ArgumentException("Can not convert {0} to DateTime.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (DateTime)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator long?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, true)) + throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (long?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator float?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, true)) + throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (float?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator decimal(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, false)) + throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (decimal)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator uint?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, true)) + throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (uint?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator ulong?(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, true)) + throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (ulong?)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator double(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, false)) + throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (double)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator float(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateFloat(v, false)) + throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return Convert.ToSingle(v.Value, CultureInfo.InvariantCulture); + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator string(JToken value) + { + if (value == null) + return null; + + JValue v = EnsureValue(value); + if (v == null || !ValidateString(v)) + throw new ArgumentException("Can not convert {0} to String.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return (string)v.Value; + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator uint(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, false)) + throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return Convert.ToUInt32(v.Value, CultureInfo.InvariantCulture); + } + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator ulong(JToken value) + { + JValue v = EnsureValue(value); + if (v == null || !ValidateInteger(v, false)) + throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(v))); + + return Convert.ToUInt64(v.Value, CultureInfo.InvariantCulture); + } + #endregion + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JValue.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JValue.cs new file mode 100644 index 0000000..7f205d8 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JValue.cs @@ -0,0 +1,291 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a value in JSON (string, integer, date, etc). + /// + public class JValue : JToken + { + private JsonTokenType _valueType; + private object _value; + + internal JValue(object value, JsonTokenType type) + { + _value = value; + _valueType = type; + } + + /// + /// Initializes a new instance of the class from another object. + /// + /// A object to copy from. + public JValue(JValue other) + : this(other.Value, other.Type) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(long value) + : this(value, JsonTokenType.Integer) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(ulong value) + : this(value, JsonTokenType.Integer) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(double value) + : this(value, JsonTokenType.Float) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(DateTime value) + : this(value, JsonTokenType.Date) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(bool value) + : this(value, JsonTokenType.Boolean) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(string value) + : this(value, JsonTokenType.String) + { + } + + /// + /// Initializes a new instance of the class with the given value. + /// + /// The value. + public JValue(object value) + : this(value, GetValueType(null, value)) + { + } + + internal override bool DeepEquals(JToken node) + { + JValue other = node as JValue; + if (other == null) + return false; + + return (this == other || (_valueType == other.Type && Compare(_value, other.Value))); + } + + /// + /// Gets a value indicating whether this token has childen tokens. + /// + /// + /// true if this token has child values; otherwise, false. + /// + public override bool HasValues + { + get { return false; } + } + + private bool Compare(object objA, object objB) + { + if (objA == null && objB == null) + return true; + + switch (_valueType) + { + case JsonTokenType.Integer: + if (objA is ulong || objB is ulong) + return Convert.ToDecimal(objA, CultureInfo.InvariantCulture).Equals(Convert.ToDecimal(objB, CultureInfo.InvariantCulture)); + else + return Convert.ToInt64(objA, CultureInfo.InvariantCulture).Equals(Convert.ToInt64(objB, CultureInfo.InvariantCulture)); + case JsonTokenType.Float: + return Convert.ToDouble(objA, CultureInfo.InvariantCulture).Equals(Convert.ToDouble(objB, CultureInfo.InvariantCulture)); + case JsonTokenType.Comment: + case JsonTokenType.String: + case JsonTokenType.Boolean: + return objA.Equals(objB); + case JsonTokenType.Date: + return objA.Equals(objB); + default: + throw new ArgumentOutOfRangeException("valueType", _valueType, "Unexpected value type: {0}".FormatWith(CultureInfo.InvariantCulture, _valueType)); + } + } + + internal override JToken CloneNode() + { + return new JValue(this); + } + + /// + /// Creates a comment with the given value. + /// + /// The value. + /// A comment with the given value. + public static JValue CreateComment(string value) + { + return new JValue(value, JsonTokenType.Comment); + } + + /// + /// Creates a string with the given value. + /// + /// The value. + /// A string with the given value. + public static JValue CreateString(string value) + { + return new JValue(value, JsonTokenType.String); + } + + private static JsonTokenType GetValueType(JsonTokenType? current, object value) + { + if (value == null) + return JsonTokenType.Null; + else if (value is string) + return (current == JsonTokenType.Comment) ? JsonTokenType.Comment : JsonTokenType.String; + else if (value is long || value is int || value is short || value is sbyte + || value is ulong || value is uint || value is ushort || value is byte) + return JsonTokenType.Integer; + else if (value is double || value is float || value is decimal) + return JsonTokenType.Float; + else if (value is DateTime || value is DateTimeOffset) + return JsonTokenType.Date; + else if (value is bool) + return JsonTokenType.Boolean; + + throw new ArgumentException("Could not determin JSON object type for type {0}.".FormatWith(CultureInfo.InvariantCulture, value.GetType())); + } + + /// + /// Gets the node type for this . + /// + /// The type. + public override JsonTokenType Type + { + get { return _valueType; } + } + + /// + /// Gets or sets the underlying token value. + /// + /// The underlying token value. + public object Value + { + get { return _value; } + set + { + Type currentType = (_value != null) ? _value.GetType() : null; + Type newType = (value != null) ? value.GetType() : null; + + if (currentType != newType) + _valueType = GetValueType(_valueType, value); + + _value = value; + } + } + + private static void WriteConvertableValue(JsonWriter writer, IList converters, Action _defaultWrite, object value) + { + JsonConverter matchingConverter; + + JsonSerializer.HasMatchingConverter(converters, value.GetType(), out matchingConverter); + if (matchingConverter != null) + matchingConverter.WriteJson(writer, value); + else + _defaultWrite(value); + } + + /// + /// Writes this token to a . + /// + /// A into which this method will write. + /// A collection of which will be used when writing the token. + public override void WriteTo(JsonWriter writer, params JsonConverter[] converters) + { + switch (_valueType) + { + case JsonTokenType.Comment: + writer.WriteComment(_value.ToString()); + break; + case JsonTokenType.Integer: + WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToInt64(v, CultureInfo.InvariantCulture)), _value); + break; + case JsonTokenType.Float: + WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToDouble(v, CultureInfo.InvariantCulture)), _value); + break; + case JsonTokenType.String: + WriteConvertableValue(writer, converters, v => writer.WriteValue(v.ToString()), _value); + break; + case JsonTokenType.Boolean: + WriteConvertableValue(writer, converters, v => writer.WriteValue(Convert.ToBoolean(v, CultureInfo.InvariantCulture)), _value); + break; + case JsonTokenType.Date: + WriteConvertableValue(writer, converters, v => + { + if (v is DateTimeOffset) + writer.WriteValue((DateTimeOffset)v); + else + writer.WriteValue(Convert.ToDateTime(v, CultureInfo.InvariantCulture)); + }, _value); + break; + case JsonTokenType.Null: + writer.WriteNull(); + break; + case JsonTokenType.Undefined: + writer.WriteUndefined(); + break; + default: + throw new ArgumentOutOfRangeException("TokenType", _valueType, "Unexpected token type."); + } + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JsonTokenReader.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JsonTokenReader.cs new file mode 100644 index 0000000..42f0696 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JsonTokenReader.cs @@ -0,0 +1,169 @@ +using System; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + /// + public class JsonTokenReader : JsonReader + { + private JToken _root; + private JToken _parent; + private JToken _current; + + /// + /// Initializes a new instance of the class. + /// + /// The token to read from. + public JsonTokenReader(JToken token) + { + ValidationUtils.ArgumentNotNull(token, "token"); + + _root = token; + _current = token; + } + + /// + /// Reads the next Json token from the stream. + /// + /// + /// true if the next token was read successfully; false if there are no more tokens to read. + /// + public override bool Read() + { + if (CurrentState != State.Start) + { + JContainer container = _current as JContainer; + if (container != null && _parent != container) + return ReadInto(container); + else + return ReadOver(_current); + } + + SetToken(_current); + return true; + } + + private bool ReadOver(JToken t) + { + if (t == _root) + return ReadToEnd(); + + JToken next = t.Next; + if ((next == null || next == t) || t == t.Parent.Last) + { + if (t.Parent == null) + return ReadToEnd(); + + return SetEnd(t.Parent); + } + else + { + _current = next; + SetToken(_current); + return true; + } + } + + private bool ReadToEnd() + { + //CurrentState = State.Finished; + return false; + } + + private JsonToken? GetEndToken(JContainer c) + { + switch (c.Type) + { + case JsonTokenType.Object: + return JsonToken.EndObject; + case JsonTokenType.Array: + return JsonToken.EndArray; + case JsonTokenType.Constructor: + return JsonToken.EndConstructor; + case JsonTokenType.Property: + return null; + default: + throw new ArgumentOutOfRangeException("Type", c.Type, "Unexpected JContainer type."); + } + } + + private bool ReadInto(JContainer c) + { + JToken firstChild = c.First; + if (firstChild == null) + { + return SetEnd(c); + } + else + { + SetToken(firstChild); + _current = firstChild; + _parent = c; + return true; + } + } + + private bool SetEnd(JContainer c) + { + JsonToken? endToken = GetEndToken(c); + if (endToken != null) + { + SetToken(endToken.Value); + _current = c; + _parent = c; + return true; + } + else + { + return ReadOver(c); + } + } + + private void SetToken(JToken token) + { + switch (token.Type) + { + case JsonTokenType.Object: + SetToken(JsonToken.StartObject); + break; + case JsonTokenType.Array: + SetToken(JsonToken.StartArray); + break; + case JsonTokenType.Constructor: + SetToken(JsonToken.StartConstructor); + break; + case JsonTokenType.Property: + SetToken(JsonToken.PropertyName, ((JProperty)token).Name); + break; + case JsonTokenType.Comment: + SetToken(JsonToken.Comment, ((JValue)token).Value); + break; + case JsonTokenType.Integer: + SetToken(JsonToken.Integer, ((JValue)token).Value); + break; + case JsonTokenType.Float: + SetToken(JsonToken.Float, ((JValue)token).Value); + break; + case JsonTokenType.String: + SetToken(JsonToken.String, ((JValue)token).Value); + break; + case JsonTokenType.Boolean: + SetToken(JsonToken.Boolean, ((JValue)token).Value); + break; + case JsonTokenType.Null: + SetToken(JsonToken.Null, ((JValue)token).Value); + break; + case JsonTokenType.Undefined: + SetToken(JsonToken.Undefined, ((JValue)token).Value); + break; + case JsonTokenType.Date: + SetToken(JsonToken.Date, ((JValue)token).Value); + break; + default: + throw new ArgumentOutOfRangeException("Type", token.Type, "Unexpected JsonTokenType."); + } + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JsonTokenType.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JsonTokenType.cs new file mode 100644 index 0000000..0c4ad85 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JsonTokenType.cs @@ -0,0 +1,86 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +namespace Newtonsoft.Json.Linq +{ + /// + /// Specifies the type of token. + /// + public enum JsonTokenType + { + /// + /// No token type has been set. + /// + None, + /// + /// A JSON object. + /// + Object, + /// + /// A JSON array. + /// + Array, + /// + /// A JSON constructor. + /// + Constructor, + /// + /// A JSON object property. + /// + Property, + /// + /// A comment. + /// + Comment, + /// + /// An integer value. + /// + Integer, + /// + /// A float value. + /// + Float, + /// + /// A string value. + /// + String, + /// + /// A boolean value. + /// + Boolean, + /// + /// A null value. + /// + Null, + /// + /// An undefined value. + /// + Undefined, + /// + /// A date value. + /// + Date + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JsonTokenWriter.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JsonTokenWriter.cs new file mode 100644 index 0000000..5c72c1d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Linq/JsonTokenWriter.cs @@ -0,0 +1,325 @@ +using System; +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Linq +{ + /// + /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + /// + public class JsonTokenWriter : JsonWriter + { + private JContainer _token; + private JContainer _parent; + + /// + /// Gets the token being writen. + /// + /// The token being writen. + public JContainer Token + { + get { return _token; } + } + + /// + /// Initializes a new instance of the class writing to the given . + /// + /// The container being written to. + public JsonTokenWriter(JContainer container) + { + ValidationUtils.ArgumentNotNull(container, "container"); + + _token = container; + _parent = container; + } + + /// + /// Initializes a new instance of the class. + /// + public JsonTokenWriter() + { + } + + /// + /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + /// + public override void Flush() + { + } + + /// + /// Closes this stream and the underlying stream. + /// + public override void Close() + { + base.Close(); + } + + /// + /// Writes the beginning of a Json object. + /// + public override void WriteStartObject() + { + base.WriteStartObject(); + + AddParent(new JObject()); + } + + private void AddParent(JContainer container) + { + if (_parent == null) + _token = container; + else + _parent.Add(container); + + _parent = container; + } + + private void RemoveParent() + { + _parent = _parent.Parent; + + if (_parent != null && _parent.Type == JsonTokenType.Property) + _parent = _parent.Parent; + } + + /// + /// Writes the beginning of a Json array. + /// + public override void WriteStartArray() + { + base.WriteStartArray(); + + AddParent(new JArray()); + } + + /// + /// Writes the start of a constructor with the given name. + /// + /// The name of the constructor. + public override void WriteStartConstructor(string name) + { + base.WriteStartConstructor(name); + + AddParent(new JConstructor()); + } + + /// + /// Writes the end. + /// + /// The token. + protected override void WriteEnd(JsonToken token) + { + RemoveParent(); + } + + /// + /// Writes the property name of a name/value pair on a Json object. + /// + /// The name of the property. + public override void WritePropertyName(string name) + { + base.WritePropertyName(name); + + AddParent(new JProperty(name)); + } + + private void AddValue(object value, JsonToken token) + { + _parent.Add(new JValue(value)); + + if (_parent.Type == JsonTokenType.Property) + _parent = _parent.Parent; + } + + #region WriteValue methods + /// + /// Writes a null value. + /// + public override void WriteNull() + { + base.WriteNull(); + AddValue(null, JsonToken.Null); + } + + /// + /// Writes an undefined value. + /// + public override void WriteUndefined() + { + base.WriteUndefined(); + AddValue(null, JsonToken.Undefined); + } + + /// + /// Writes raw JavaScript manually. + /// + /// The raw JavaScript to write. + public override void WriteRaw(string javaScript) + { + base.WriteRaw(javaScript); + // hack. some 'raw' or 'other' token perhaps? + AddValue(javaScript, JsonToken.Undefined); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(string value) + { + base.WriteValue(value); + AddValue(value ?? string.Empty, JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(int value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(uint value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(long value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(ulong value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(float value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(double value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(bool value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Boolean); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(short value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(ushort value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(char value) + { + base.WriteValue(value); + AddValue(value.ToString(), JsonToken.String); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(byte value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(sbyte value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Integer); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(decimal value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Float); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(DateTime value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Date); + } + + /// + /// Writes a value. + /// + /// The value to write. + public override void WriteValue(DateTimeOffset value) + { + base.WriteValue(value); + AddValue(value, JsonToken.Date); + } + #endregion + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/LinqBridge.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/LinqBridge.cs new file mode 100644 index 0000000..944ce70 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/LinqBridge.cs @@ -0,0 +1,3099 @@ +#region License, Terms and Author(s) +// +// LINQBridge +// Copyright (c) 2007 Atif Aziz, Joseph Albahari. All rights reserved. +// +// Author(s): +// +// Atif Aziz, http://www.raboof.com +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the New BSD License, a copy of which should have +// been delivered along with this distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +#endregion + +// $Id: Enumerable.cs c08984d432b1 2012/04/17 16:05:19 azizatif $ + +namespace System.Linq +{ + #region Imports + + using System; + using System.Collections; + using System.Collections.Generic; + using System.Diagnostics; + using LinqBridge; + + #endregion + + /// + /// Provides a set of static (Shared in Visual Basic) methods for + /// querying objects that implement . + /// + + static partial class Enumerable + { + /// + /// Returns the input typed as . + /// + + public static IEnumerable AsEnumerable(this IEnumerable source) + { + return source; + } + + /// + /// Returns an empty that has the + /// specified type argument. + /// + + public static IEnumerable Empty() + { + return Sequence.Empty; + } + + /// + /// Converts the elements of an to the + /// specified type. + /// + + public static IEnumerable Cast( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return CastYield(source); + } + + private static IEnumerable CastYield( + IEnumerable source) + { + foreach (var item in source) + yield return (TResult) item; + } + + /// + /// Filters the elements of an based on a specified type. + /// + + public static IEnumerable OfType( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return OfTypeYield(source); + } + + private static IEnumerable OfTypeYield( + IEnumerable source) + { + foreach (var item in source) + if (item is TResult) + yield return (TResult) item; + } + + /// + /// Generates a sequence of integral numbers within a specified range. + /// + /// The value of the first integer in the sequence. + /// The number of sequential integers to generate. + + public static IEnumerable Range(int start, int count) + { + if (count < 0) + throw new ArgumentOutOfRangeException("count", count, null); + + var end = (long) start + count; + if (end - 1 >= int.MaxValue) + throw new ArgumentOutOfRangeException("count", count, null); + + return RangeYield(start, end); + } + + private static IEnumerable RangeYield(int start, long end) + { + for (var i = start; i < end; i++) + yield return i; + } + + /// + /// Generates a sequence that contains one repeated value. + /// + + public static IEnumerable Repeat(TResult element, int count) + { + if (count < 0) throw new ArgumentOutOfRangeException("count", count, null); + + return RepeatYield(element, count); + } + + private static IEnumerable RepeatYield(TResult element, int count) + { + for (var i = 0; i < count; i++) + yield return element; + } + + /// + /// Filters a sequence of values based on a predicate. + /// + + public static IEnumerable Where( + this IEnumerable source, + Func predicate) + { + if (predicate == null) throw new ArgumentNullException("predicate"); + + return source.Where((item, i) => predicate(item)); + } + + /// + /// Filters a sequence of values based on a predicate. + /// Each element's index is used in the logic of the predicate function. + /// + + public static IEnumerable Where( + this IEnumerable source, + Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + return WhereYield(source, predicate); + } + + private static IEnumerable WhereYield( + IEnumerable source, + Func predicate) + { + var i = 0; + foreach (var item in source) + if (predicate(item, i++)) + yield return item; + } + + /// + /// Projects each element of a sequence into a new form. + /// + + public static IEnumerable Select( + this IEnumerable source, + Func selector) + { + if (selector == null) throw new ArgumentNullException("selector"); + + return source.Select((item, i) => selector(item)); + } + + /// + /// Projects each element of a sequence into a new form by + /// incorporating the element's index. + /// + + public static IEnumerable Select( + this IEnumerable source, + Func selector) + { + if (source == null) throw new ArgumentNullException("source"); + if (selector == null) throw new ArgumentNullException("selector"); + + return SelectYield(source, selector); + } + + private static IEnumerable SelectYield( + IEnumerable source, + Func selector) + { + var i = 0; + foreach (var item in source) + yield return selector(item, i++); + } + + /// + /// Projects each element of a sequence to an + /// and flattens the resulting sequences into one sequence. + /// + + public static IEnumerable SelectMany( + this IEnumerable source, + Func> selector) + { + if (selector == null) throw new ArgumentNullException("selector"); + + return source.SelectMany((item, i) => selector(item)); + } + + /// + /// Projects each element of a sequence to an , + /// and flattens the resulting sequences into one sequence. The + /// index of each source element is used in the projected form of + /// that element. + /// + + public static IEnumerable SelectMany( + this IEnumerable source, + Func> selector) + { + if (selector == null) throw new ArgumentNullException("selector"); + + return source.SelectMany(selector, (item, subitem) => subitem); + } + + /// + /// Projects each element of a sequence to an , + /// flattens the resulting sequences into one sequence, and invokes + /// a result selector function on each element therein. + /// + + public static IEnumerable SelectMany( + this IEnumerable source, + Func> collectionSelector, + Func resultSelector) + { + if (collectionSelector == null) throw new ArgumentNullException("collectionSelector"); + + return source.SelectMany((item, i) => collectionSelector(item), resultSelector); + } + + /// + /// Projects each element of a sequence to an , + /// flattens the resulting sequences into one sequence, and invokes + /// a result selector function on each element therein. The index of + /// each source element is used in the intermediate projected form + /// of that element. + /// + + public static IEnumerable SelectMany( + this IEnumerable source, + Func> collectionSelector, + Func resultSelector) + { + if (source == null) throw new ArgumentNullException("source"); + if (collectionSelector == null) throw new ArgumentNullException("collectionSelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + return SelectManyYield(source, collectionSelector, resultSelector); + } + + private static IEnumerable SelectManyYield( + this IEnumerable source, + Func> collectionSelector, + Func resultSelector) + { + var i = 0; + foreach (var item in source) + foreach (var subitem in collectionSelector(item, i++)) + yield return resultSelector(item, subitem); + } + + /// + /// Returns elements from a sequence as long as a specified condition is true. + /// + + public static IEnumerable TakeWhile( + this IEnumerable source, + Func predicate) + { + if (predicate == null) throw new ArgumentNullException("predicate"); + + return source.TakeWhile((item, i) => predicate(item)); + } + + /// + /// Returns elements from a sequence as long as a specified condition is true. + /// The element's index is used in the logic of the predicate function. + /// + + public static IEnumerable TakeWhile( + this IEnumerable source, + Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + return TakeWhileYield(source, predicate); + } + + private static IEnumerable TakeWhileYield( + this IEnumerable source, + Func predicate) + { + var i = 0; + foreach (var item in source) + if (predicate(item, i++)) + yield return item; + else + break; + } + + /// + /// Returns a specified number of contiguous elements from the start + /// of a sequence. + /// + + public static IEnumerable Take( + this IEnumerable source, + int count) + { + return source.TakeWhile((item, i) => i < count); + } + + private static class Futures + { + public static readonly Func Default = () => default(T); + public static readonly Func Undefined = () => { throw new InvalidOperationException(); }; + } + + /// + /// Base implementation of First operator. + /// + + private static TSource FirstImpl( + this IEnumerable source, + Func empty) + { + if (source == null) throw new ArgumentNullException("source"); + Debug.Assert(empty != null); + + var list = source as IList; // optimized case for lists + if (list != null) + return list.Count > 0 ? list[0] : empty(); + + using (var e = source.GetEnumerator()) // fallback for enumeration + return e.MoveNext() ? e.Current : empty(); + } + + /// + /// Returns the first element of a sequence. + /// + + public static TSource First( + this IEnumerable source) + { + return source.FirstImpl(Futures.Undefined); + } + + /// + /// Returns the first element in a sequence that satisfies a specified condition. + /// + + public static TSource First( + this IEnumerable source, + Func predicate) + { + return First(source.Where(predicate)); + } + + /// + /// Returns the first element of a sequence, or a default value if + /// the sequence contains no elements. + /// + + public static TSource FirstOrDefault( + this IEnumerable source) + { + return source.FirstImpl(Futures.Default); + } + + /// + /// Returns the first element of the sequence that satisfies a + /// condition or a default value if no such element is found. + /// + + public static TSource FirstOrDefault( + this IEnumerable source, + Func predicate) + { + return FirstOrDefault(source.Where(predicate)); + } + + /// + /// Base implementation of Last operator. + /// + + private static TSource LastImpl( + this IEnumerable source, + Func empty) + { + if (source == null) throw new ArgumentNullException("source"); + + var list = source as IList; // optimized case for lists + if (list != null) + return list.Count > 0 ? list[list.Count - 1] : empty(); + + using (var e = source.GetEnumerator()) + { + if (!e.MoveNext()) + return empty(); + + var last = e.Current; + while (e.MoveNext()) + last = e.Current; + + return last; + } + } + + /// + /// Returns the last element of a sequence. + /// + public static TSource Last( + this IEnumerable source) + { + return source.LastImpl(Futures.Undefined); + } + + /// + /// Returns the last element of a sequence that satisfies a + /// specified condition. + /// + + public static TSource Last( + this IEnumerable source, + Func predicate) + { + return Last(source.Where(predicate)); + } + + /// + /// Returns the last element of a sequence, or a default value if + /// the sequence contains no elements. + /// + + public static TSource LastOrDefault( + this IEnumerable source) + { + return source.LastImpl(Futures.Default); + } + + /// + /// Returns the last element of a sequence that satisfies a + /// condition or a default value if no such element is found. + /// + + public static TSource LastOrDefault( + this IEnumerable source, + Func predicate) + { + return LastOrDefault(source.Where(predicate)); + } + + /// + /// Base implementation of Single operator. + /// + + private static TSource SingleImpl( + this IEnumerable source, + Func empty) + { + if (source == null) throw new ArgumentNullException("source"); + + using (var e = source.GetEnumerator()) + { + if (e.MoveNext()) + { + var single = e.Current; + if (!e.MoveNext()) + return single; + + throw new InvalidOperationException(); + } + + return empty(); + } + } + + /// + /// Returns the only element of a sequence, and throws an exception + /// if there is not exactly one element in the sequence. + /// + + public static TSource Single( + this IEnumerable source) + { + return source.SingleImpl(Futures.Undefined); + } + + /// + /// Returns the only element of a sequence that satisfies a + /// specified condition, and throws an exception if more than one + /// such element exists. + /// + + public static TSource Single( + this IEnumerable source, + Func predicate) + { + return Single(source.Where(predicate)); + } + + /// + /// Returns the only element of a sequence, or a default value if + /// the sequence is empty; this method throws an exception if there + /// is more than one element in the sequence. + /// + + public static TSource SingleOrDefault( + this IEnumerable source) + { + return source.SingleImpl(Futures.Default); + } + + /// + /// Returns the only element of a sequence that satisfies a + /// specified condition or a default value if no such element + /// exists; this method throws an exception if more than one element + /// satisfies the condition. + /// + + public static TSource SingleOrDefault( + this IEnumerable source, + Func predicate) + { + return SingleOrDefault(source.Where(predicate)); + } + + /// + /// Returns the element at a specified index in a sequence. + /// + + public static TSource ElementAt( + this IEnumerable source, + int index) + { + if (source == null) throw new ArgumentNullException("source"); + + if (index < 0) + throw new ArgumentOutOfRangeException("index", index, null); + + var list = source as IList; + if (list != null) + return list[index]; + + try + { + return source.SkipWhile((item, i) => i < index).First(); + } + catch (InvalidOperationException) // if thrown by First + { + throw new ArgumentOutOfRangeException("index", index, null); + } + } + + /// + /// Returns the element at a specified index in a sequence or a + /// default value if the index is out of range. + /// + + public static TSource ElementAtOrDefault( + this IEnumerable source, + int index) + { + if (source == null) throw new ArgumentNullException("source"); + + if (index < 0) + return default(TSource); + + var list = source as IList; + if (list != null) + return index < list.Count ? list[index] : default(TSource); + + return source.SkipWhile((item, i) => i < index).FirstOrDefault(); + } + + /// + /// Inverts the order of the elements in a sequence. + /// + + public static IEnumerable Reverse( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return ReverseYield(source); + } + + private static IEnumerable ReverseYield(IEnumerable source) + { + var stack = new Stack(); + foreach (var item in source) + stack.Push(item); + + foreach (var item in stack) + yield return item; + } + + /// + /// Bypasses elements in a sequence as long as a specified condition + /// is true and then returns the remaining elements. + /// + + public static IEnumerable SkipWhile( + this IEnumerable source, + Func predicate) + { + if (predicate == null) throw new ArgumentNullException("predicate"); + + return source.SkipWhile((item, i) => predicate(item)); + } + + /// + /// Bypasses elements in a sequence as long as a specified condition + /// is true and then returns the remaining elements. The element's + /// index is used in the logic of the predicate function. + /// + + public static IEnumerable SkipWhile( + this IEnumerable source, + Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + return SkipWhileYield(source, predicate); + } + + private static IEnumerable SkipWhileYield( + IEnumerable source, + Func predicate) + { + using (var e = source.GetEnumerator()) + { + for (var i = 0; ; i++) + { + if (!e.MoveNext()) + yield break; + + if (!predicate(e.Current, i)) + break; + } + + do { yield return e.Current; } while (e.MoveNext()); + } + } + + /// + /// Bypasses a specified number of elements in a sequence and then + /// returns the remaining elements. + /// + + public static IEnumerable Skip( + this IEnumerable source, + int count) + { + return source.SkipWhile((item, i) => i < count); + } + + /// + /// Returns the number of elements in a sequence. + /// + + public static int Count( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + var collection = source as ICollection; + return collection != null + ? collection.Count + : source.Aggregate(0, (count, item) => checked(count + 1)); + } + + /// + /// Returns a number that represents how many elements in the + /// specified sequence satisfy a condition. + /// + + public static int Count( + this IEnumerable source, + Func predicate) + { + return Count(source.Where(predicate)); + } + + /// + /// Returns an that represents the total number + /// of elements in a sequence. + /// + + public static long LongCount( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + var array = source as Array; + return array != null + ? array.LongLength + : source.Aggregate(0L, (count, item) => count + 1); + } + + /// + /// Returns an that represents how many elements + /// in a sequence satisfy a condition. + /// + + public static long LongCount( + this IEnumerable source, + Func predicate) + { + return LongCount(source.Where(predicate)); + } + + /// + /// Concatenates two sequences. + /// + + public static IEnumerable Concat( + this IEnumerable first, + IEnumerable second) + { + if (first == null) throw new ArgumentNullException("first"); + if (second == null) throw new ArgumentNullException("second"); + + return ConcatYield(first, second); + } + + private static IEnumerable ConcatYield( + IEnumerable first, + IEnumerable second) + { + foreach (var item in first) + yield return item; + + foreach (var item in second) + yield return item; + } + + /// + /// Creates a from an . + /// + + public static List ToList( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return new List(source); + } + + /// + /// Creates an array from an . + /// + + public static TSource[] ToArray( + this IEnumerable source) + { + return source.ToList().ToArray(); + } + + /// + /// Returns distinct elements from a sequence by using the default + /// equality comparer to compare values. + /// + + public static IEnumerable Distinct( + this IEnumerable source) + { + return Distinct(source, /* comparer */ null); + } + + /// + /// Returns distinct elements from a sequence by using a specified + /// to compare values. + /// + + public static IEnumerable Distinct( + this IEnumerable source, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + return DistinctYield(source, comparer); + } + + private static IEnumerable DistinctYield( + IEnumerable source, + IEqualityComparer comparer) + { + var set = new Dictionary(comparer); + var gotNull = false; + + foreach (var item in source) + { + if (item == null) + { + if (gotNull) + continue; + gotNull = true; + } + else + { + if (set.ContainsKey(item)) + continue; + set.Add(item, null); + } + + yield return item; + } + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function. + /// + + public static ILookup ToLookup( + this IEnumerable source, + Func keySelector) + { + return ToLookup(source, keySelector, e => e, /* comparer */ null); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function and a key comparer. + /// + + public static ILookup ToLookup( + this IEnumerable source, + Func keySelector, + IEqualityComparer comparer) + { + return ToLookup(source, keySelector, e => e, comparer); + } + + /// + /// Creates a from an + /// according to specified key + /// and element selector functions. + /// + + public static ILookup ToLookup( + this IEnumerable source, + Func keySelector, + Func elementSelector) + { + return ToLookup(source, keySelector, elementSelector, /* comparer */ null); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function, a comparer and an element selector function. + /// + + public static ILookup ToLookup( + this IEnumerable source, + Func keySelector, + Func elementSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (elementSelector == null) throw new ArgumentNullException("elementSelector"); + + var lookup = new Lookup(comparer); + + foreach (var item in source) + { + var key = keySelector(item); + + var grouping = (Grouping) lookup.Find(key); + if (grouping == null) + { + grouping = new Grouping(key); + lookup.Add(grouping); + } + + grouping.Add(elementSelector(item)); + } + + return lookup; + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function. + /// + + public static IEnumerable> GroupBy( + this IEnumerable source, + Func keySelector) + { + return GroupBy(source, keySelector, /* comparer */ null); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and compares the keys by using a specified + /// comparer. + /// + + public static IEnumerable> GroupBy( + this IEnumerable source, + Func keySelector, + IEqualityComparer comparer) + { + return GroupBy(source, keySelector, e => e, comparer); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and projects the elements for each group by + /// using a specified function. + /// + + public static IEnumerable> GroupBy( + this IEnumerable source, + Func keySelector, + Func elementSelector) + { + return GroupBy(source, keySelector, elementSelector, /* comparer */ null); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and creates a result value from each group and + /// its key. + /// + + public static IEnumerable> GroupBy( + this IEnumerable source, + Func keySelector, + Func elementSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (elementSelector == null) throw new ArgumentNullException("elementSelector"); + + return ToLookup(source, keySelector, elementSelector, comparer); + } + + /// + /// Groups the elements of a sequence according to a key selector + /// function. The keys are compared by using a comparer and each + /// group's elements are projected by using a specified function. + /// + + public static IEnumerable GroupBy( + this IEnumerable source, + Func keySelector, + Func, TResult> resultSelector) + { + return GroupBy(source, keySelector, resultSelector, /* comparer */ null); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and creates a result value from each group and + /// its key. The elements of each group are projected by using a + /// specified function. + /// + + public static IEnumerable GroupBy( + this IEnumerable source, + Func keySelector, + Func, TResult> resultSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + return ToLookup(source, keySelector, comparer).Select(g => resultSelector(g.Key, g)); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and creates a result value from each group and + /// its key. The keys are compared by using a specified comparer. + /// + + public static IEnumerable GroupBy( + this IEnumerable source, + Func keySelector, + Func elementSelector, + Func, TResult> resultSelector) + { + return GroupBy(source, keySelector, elementSelector, resultSelector, /* comparer */ null); + } + + /// + /// Groups the elements of a sequence according to a specified key + /// selector function and creates a result value from each group and + /// its key. Key values are compared by using a specified comparer, + /// and the elements of each group are projected by using a + /// specified function. + /// + + public static IEnumerable GroupBy( + this IEnumerable source, + Func keySelector, + Func elementSelector, + Func, TResult> resultSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (elementSelector == null) throw new ArgumentNullException("elementSelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + return ToLookup(source, keySelector, elementSelector, comparer) + .Select(g => resultSelector(g.Key, g)); + } + + /// + /// Applies an accumulator function over a sequence. + /// + + public static TSource Aggregate( + this IEnumerable source, + Func func) + { + if (source == null) throw new ArgumentNullException("source"); + if (func == null) throw new ArgumentNullException("func"); + + using (var e = source.GetEnumerator()) + { + if (!e.MoveNext()) + throw new InvalidOperationException(); + + return e.Renumerable().Skip(1).Aggregate(e.Current, func); + } + } + + /// + /// Applies an accumulator function over a sequence. The specified + /// seed value is used as the initial accumulator value. + /// + + public static TAccumulate Aggregate( + this IEnumerable source, + TAccumulate seed, + Func func) + { + return Aggregate(source, seed, func, r => r); + } + + /// + /// Applies an accumulator function over a sequence. The specified + /// seed value is used as the initial accumulator value, and the + /// specified function is used to select the result value. + /// + + public static TResult Aggregate( + this IEnumerable source, + TAccumulate seed, + Func func, + Func resultSelector) + { + if (source == null) throw new ArgumentNullException("source"); + if (func == null) throw new ArgumentNullException("func"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + var result = seed; + + foreach (var item in source) + result = func(result, item); + + return resultSelector(result); + } + + /// + /// Produces the set union of two sequences by using the default + /// equality comparer. + /// + + public static IEnumerable Union( + this IEnumerable first, + IEnumerable second) + { + return Union(first, second, /* comparer */ null); + } + + /// + /// Produces the set union of two sequences by using a specified + /// . + /// + + public static IEnumerable Union( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer) + { + return first.Concat(second).Distinct(comparer); + } + + /// + /// Returns the elements of the specified sequence or the type + /// parameter's default value in a singleton collection if the + /// sequence is empty. + /// + + public static IEnumerable DefaultIfEmpty( + this IEnumerable source) + { + return source.DefaultIfEmpty(default(TSource)); + } + + /// + /// Returns the elements of the specified sequence or the specified + /// value in a singleton collection if the sequence is empty. + /// + + public static IEnumerable DefaultIfEmpty( + this IEnumerable source, + TSource defaultValue) + { + if (source == null) throw new ArgumentNullException("source"); + + return DefaultIfEmptyYield(source, defaultValue); + } + + private static IEnumerable DefaultIfEmptyYield( + IEnumerable source, + TSource defaultValue) + { + using (var e = source.GetEnumerator()) + { + if (!e.MoveNext()) + yield return defaultValue; + else + do { yield return e.Current; } while (e.MoveNext()); + } + } + + /// + /// Determines whether all elements of a sequence satisfy a condition. + /// + + public static bool All( + this IEnumerable source, + Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + foreach (var item in source) + if (!predicate(item)) + return false; + + return true; + } + + /// + /// Determines whether a sequence contains any elements. + /// + + public static bool Any( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + using (var e = source.GetEnumerator()) + return e.MoveNext(); + } + + /// + /// Determines whether any element of a sequence satisfies a + /// condition. + /// + + public static bool Any( + this IEnumerable source, + Func predicate) + { + return source.Where(predicate).Any(); + } + + /// + /// Determines whether a sequence contains a specified element by + /// using the default equality comparer. + /// + + public static bool Contains( + this IEnumerable source, + TSource value) + { + return source.Contains(value, /* comparer */ null); + } + + /// + /// Determines whether a sequence contains a specified element by + /// using a specified . + /// + + public static bool Contains( + this IEnumerable source, + TSource value, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + if (comparer == null) + { + var collection = source as ICollection; + if (collection != null) + return collection.Contains(value); + } + + comparer = comparer ?? EqualityComparer.Default; + return source.Any(item => comparer.Equals(item, value)); + } + + /// + /// Determines whether two sequences are equal by comparing the + /// elements by using the default equality comparer for their type. + /// + + public static bool SequenceEqual( + this IEnumerable first, + IEnumerable second) + { + return first.SequenceEqual(second, /* comparer */ null); + } + + /// + /// Determines whether two sequences are equal by comparing their + /// elements by using a specified . + /// + + public static bool SequenceEqual( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer) + { + if (first == null) throw new ArgumentNullException("frist"); + if (second == null) throw new ArgumentNullException("second"); + + comparer = comparer ?? EqualityComparer.Default; + + using (IEnumerator lhs = first.GetEnumerator(), + rhs = second.GetEnumerator()) + { + do + { + if (!lhs.MoveNext()) + return !rhs.MoveNext(); + + if (!rhs.MoveNext()) + return false; + } + while (comparer.Equals(lhs.Current, rhs.Current)); + } + + return false; + } + + /// + /// Base implementation for Min/Max operator. + /// + + private static TSource MinMaxImpl( + this IEnumerable source, + Func lesser) + { + if (source == null) throw new ArgumentNullException("source"); + Debug.Assert(lesser != null); + + if (typeof(TSource).IsClass) // ReSharper disable CompareNonConstrainedGenericWithNull + source = source.Where(e => e != null).DefaultIfEmpty(); // ReSharper restore CompareNonConstrainedGenericWithNull + + return source.Aggregate((a, item) => lesser(a, item) ? a : item); + } + + /// + /// Base implementation for Min/Max operator for nullable types. + /// + + private static TSource? MinMaxImpl( + this IEnumerable source, + TSource? seed, Func lesser) where TSource : struct + { + if (source == null) throw new ArgumentNullException("source"); + Debug.Assert(lesser != null); + + return source.Aggregate(seed, (a, item) => lesser(a, item) ? a : item); + // == MinMaxImpl(Repeat(null, 1).Concat(source), lesser); + } + + /// + /// Returns the minimum value in a generic sequence. + /// + + public static TSource Min( + this IEnumerable source) + { + var comparer = Comparer.Default; + return source.MinMaxImpl((x, y) => comparer.Compare(x, y) < 0); + } + + /// + /// Invokes a transform function on each element of a generic + /// sequence and returns the minimum resulting value. + /// + + public static TResult Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a generic sequence. + /// + + public static TSource Max( + this IEnumerable source) + { + var comparer = Comparer.Default; + return source.MinMaxImpl((x, y) => comparer.Compare(x, y) > 0); + } + + /// + /// Invokes a transform function on each element of a generic + /// sequence and returns the maximum resulting value. + /// + + public static TResult Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Makes an enumerator seen as enumerable once more. + /// + /// + /// The supplied enumerator must have been started. The first element + /// returned is the element the enumerator was on when passed in. + /// DO NOT use this method if the caller must be a generator. It is + /// mostly safe among aggregate operations. + /// + + private static IEnumerable Renumerable(this IEnumerator e) + { + Debug.Assert(e != null); + + do { yield return e.Current; } while (e.MoveNext()); + } + + /// + /// Sorts the elements of a sequence in ascending order according to a key. + /// + + public static IOrderedEnumerable OrderBy( + this IEnumerable source, + Func keySelector) + { + return source.OrderBy(keySelector, /* comparer */ null); + } + + /// + /// Sorts the elements of a sequence in ascending order by using a + /// specified comparer. + /// + + public static IOrderedEnumerable OrderBy( + this IEnumerable source, + Func keySelector, + IComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + + return new OrderedEnumerable(source, keySelector, comparer, /* descending */ false); + } + + /// + /// Sorts the elements of a sequence in descending order according to a key. + /// + + public static IOrderedEnumerable OrderByDescending( + this IEnumerable source, + Func keySelector) + { + return source.OrderByDescending(keySelector, /* comparer */ null); + } + + /// + /// Sorts the elements of a sequence in descending order by using a + /// specified comparer. + /// + + public static IOrderedEnumerable OrderByDescending( + this IEnumerable source, + Func keySelector, + IComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (source == null) throw new ArgumentNullException("keySelector"); + + return new OrderedEnumerable(source, keySelector, comparer, /* descending */ true); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in + /// ascending order according to a key. + /// + + public static IOrderedEnumerable ThenBy( + this IOrderedEnumerable source, + Func keySelector) + { + return source.ThenBy(keySelector, /* comparer */ null); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in + /// ascending order by using a specified comparer. + /// + + public static IOrderedEnumerable ThenBy( + this IOrderedEnumerable source, + Func keySelector, + IComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + return source.CreateOrderedEnumerable(keySelector, comparer, /* descending */ false); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in + /// descending order, according to a key. + /// + + public static IOrderedEnumerable ThenByDescending( + this IOrderedEnumerable source, + Func keySelector) + { + return source.ThenByDescending(keySelector, /* comparer */ null); + } + + /// + /// Performs a subsequent ordering of the elements in a sequence in + /// descending order by using a specified comparer. + /// + + public static IOrderedEnumerable ThenByDescending( + this IOrderedEnumerable source, + Func keySelector, + IComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + return source.CreateOrderedEnumerable(keySelector, comparer, /* descending */ true); + } + + /// + /// Base implementation for Intersect and Except operators. + /// + + private static IEnumerable IntersectExceptImpl( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer, + bool flag) + { + if (first == null) throw new ArgumentNullException("first"); + if (second == null) throw new ArgumentNullException("second"); + + var keys = new List>(); + var flags = new Dictionary, bool>(new KeyComparer(comparer)); + + foreach (var item in from item in first + select new Key(item) into item + where !flags.ContainsKey(item) + select item) + { + flags.Add(item, !flag); + keys.Add(item); + } + + foreach (var item in from item in second + select new Key(item) into item + where flags.ContainsKey(item) + select item) + { + flags[item] = flag; + } + + // + // As per docs, "the marked elements are yielded in the order in + // which they were collected. + // + + return from item in keys where flags[item] select item.Value; + } + + /// + /// Produces the set intersection of two sequences by using the + /// default equality comparer to compare values. + /// + + public static IEnumerable Intersect( + this IEnumerable first, + IEnumerable second) + { + return first.Intersect(second, /* comparer */ null); + } + + /// + /// Produces the set intersection of two sequences by using the + /// specified to compare values. + /// + + public static IEnumerable Intersect( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer) + { + return IntersectExceptImpl(first, second, comparer, /* flag */ true); + } + + /// + /// Produces the set difference of two sequences by using the + /// default equality comparer to compare values. + /// + + public static IEnumerable Except( + this IEnumerable first, + IEnumerable second) + { + return first.Except(second, /* comparer */ null); + } + + /// + /// Produces the set difference of two sequences by using the + /// specified to compare values. + /// + + public static IEnumerable Except( + this IEnumerable first, + IEnumerable second, + IEqualityComparer comparer) + { + return IntersectExceptImpl(first, second, comparer, /* flag */ false); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function. + /// + + public static Dictionary ToDictionary( + this IEnumerable source, + Func keySelector) + { + return source.ToDictionary(keySelector, /* comparer */ null); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function and key comparer. + /// + + public static Dictionary ToDictionary( + this IEnumerable source, + Func keySelector, + IEqualityComparer comparer) + { + return source.ToDictionary(keySelector, e => e, comparer); + } + + /// + /// Creates a from an + /// according to specified key + /// selector and element selector functions. + /// + + public static Dictionary ToDictionary( + this IEnumerable source, + Func keySelector, + Func elementSelector) + { + return source.ToDictionary(keySelector, elementSelector, /* comparer */ null); + } + + /// + /// Creates a from an + /// according to a specified key + /// selector function, a comparer, and an element selector function. + /// + + public static Dictionary ToDictionary( + this IEnumerable source, + Func keySelector, + Func elementSelector, + IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + if (elementSelector == null) throw new ArgumentNullException("elementSelector"); + + var dict = new Dictionary(comparer); + + foreach (var item in source) + { + // + // ToDictionary is meant to throw ArgumentNullException if + // keySelector produces a key that is null and + // Argument exception if keySelector produces duplicate keys + // for two elements. Incidentally, the doucmentation for + // IDictionary.Add says that the Add method + // throws the same exceptions under the same circumstances + // so we don't need to do any additional checking or work + // here and let the Add implementation do all the heavy + // lifting. + // + + dict.Add(keySelector(item), elementSelector(item)); + } + + return dict; + } + + /// + /// Correlates the elements of two sequences based on matching keys. + /// The default equality comparer is used to compare keys. + /// + + public static IEnumerable Join( + this IEnumerable outer, + IEnumerable inner, + Func outerKeySelector, + Func innerKeySelector, + Func resultSelector) + { + return outer.Join(inner, outerKeySelector, innerKeySelector, resultSelector, /* comparer */ null); + } + + /// + /// Correlates the elements of two sequences based on matching keys. + /// The default equality comparer is used to compare keys. A + /// specified is used to compare keys. + /// + + public static IEnumerable Join( + this IEnumerable outer, + IEnumerable inner, + Func outerKeySelector, + Func innerKeySelector, + Func resultSelector, + IEqualityComparer comparer) + { + if (outer == null) throw new ArgumentNullException("outer"); + if (inner == null) throw new ArgumentNullException("inner"); + if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); + if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + var lookup = inner.ToLookup(innerKeySelector, comparer); + + return + from o in outer + from i in lookup[outerKeySelector(o)] + select resultSelector(o, i); + } + + /// + /// Correlates the elements of two sequences based on equality of + /// keys and groups the results. The default equality comparer is + /// used to compare keys. + /// + + public static IEnumerable GroupJoin( + this IEnumerable outer, + IEnumerable inner, + Func outerKeySelector, + Func innerKeySelector, + Func, TResult> resultSelector) + { + return outer.GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, /* comparer */ null); + } + + /// + /// Correlates the elements of two sequences based on equality of + /// keys and groups the results. The default equality comparer is + /// used to compare keys. A specified + /// is used to compare keys. + /// + + public static IEnumerable GroupJoin( + this IEnumerable outer, + IEnumerable inner, + Func outerKeySelector, + Func innerKeySelector, + Func, TResult> resultSelector, + IEqualityComparer comparer) + { + if (outer == null) throw new ArgumentNullException("outer"); + if (inner == null) throw new ArgumentNullException("inner"); + if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); + if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); + if (resultSelector == null) throw new ArgumentNullException("resultSelector"); + + var lookup = inner.ToLookup(innerKeySelector, comparer); + return outer.Select(o => resultSelector(o, lookup[outerKeySelector(o)])); + } + + private static class Sequence + { + public static readonly IEnumerable Empty = new T[0]; + } + + private sealed class Grouping : List, IGrouping + { + internal Grouping(K key) + { + Key = key; + } + + public K Key { get; private set; } + } + } +} + +// $Id: Enumerable.g.tt 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System.Linq +{ + #region Imports + + using System; + using System.Collections.Generic; + + #endregion + + // This partial implementation was template-generated: + // Mon, 16 Apr 2012 20:05:53 GMT + + partial class Enumerable + { + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static int Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + int sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static int Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static double Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (int) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (double) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static int? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + int sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static int? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static double? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (int) num; + count++; + } + + if (count == 0) + return null; + + return (double?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static int? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static int? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static int? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static int? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static long Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static long Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static double Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (long) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (double) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static long? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static long? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static double? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + long sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (long) num; + count++; + } + + if (count == 0) + return null; + + return (double?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static long? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static long? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static long? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static long? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static float Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + float sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static float Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static float Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + float sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (float) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (float) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static float Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static float? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + float sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static float? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static float? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + float sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (float) num; + count++; + } + + if (count == 0) + return null; + + return (float?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static float? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static float? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static float? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static float? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static float? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static double Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + double sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static double Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static double Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + double sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (double) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (double) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static double? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + double sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static double? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static double? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + double sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (double) num; + count++; + } + + if (count == 0) + return null; + + return (double?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static double? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static double? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static double? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static double? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static double? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + + /// + /// Computes the sum of a sequence of nullable values. + /// + + public static decimal Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + decimal sum = 0; + foreach (var num in source) + sum = checked(sum + num); + + return sum; + } + + /// + /// Computes the sum of a sequence of nullable + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static decimal Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of nullable values. + /// + + public static decimal Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + decimal sum = 0; + long count = 0; + + foreach (var num in source) + checked + { + sum += (decimal) num; + count++; + } + + if (count == 0) + throw new InvalidOperationException(); + + return (decimal) sum / count; + } + + /// + /// Computes the average of a sequence of nullable values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static decimal Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + + /// + /// Computes the sum of a sequence of values. + /// + + public static decimal? Sum( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + decimal sum = 0; + foreach (var num in source) + sum = checked(sum + (num ?? 0)); + + return sum; + } + + /// + /// Computes the sum of a sequence of + /// values that are obtained by invoking a transform function on + /// each element of the input sequence. + /// + + public static decimal? Sum( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Sum(); + } + + /// + /// Computes the average of a sequence of values. + /// + + public static decimal? Average( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + decimal sum = 0; + long count = 0; + + foreach (var num in source.Where(n => n != null)) + checked + { + sum += (decimal) num; + count++; + } + + if (count == 0) + return null; + + return (decimal?) sum / count; + } + + /// + /// Computes the average of a sequence of values + /// that are obtained by invoking a transform function on each + /// element of the input sequence. + /// + + public static decimal? Average( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Average(); + } + + /// + /// Returns the minimum value in a sequence of nullable + /// values. + /// + + public static decimal? Min( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), null, (min, x) => min < x); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the minimum nullable value. + /// + + public static decimal? Min( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Min(); + } + + /// + /// Returns the maximum value in a sequence of nullable + /// values. + /// + + public static decimal? Max( + this IEnumerable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return MinMaxImpl(source.Where(x => x != null), + null, (max, x) => x == null || (max != null && x.Value < max.Value)); + } + + /// + /// Invokes a transform function on each element of a sequence and + /// returns the maximum nullable value. + /// + + public static decimal? Max( + this IEnumerable source, + Func selector) + { + return source.Select(selector).Max(); + } + } +} + +// $Id: ExtensionAttribute.cs 898b3d493ed6 2012/04/17 20:09:57 azizatif $ + +namespace System.Runtime.CompilerServices +{ + /// + /// This attribute allows us to define extension methods without + /// requiring .NET Framework 3.5. For more information, see the section, + /// Extension Methods in .NET Framework 2.0 Apps, + /// of Basic Instincts: Extension Methods + /// column in MSDN Magazine, + /// issue Nov 2007. + /// + + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] + sealed partial class ExtensionAttribute : Attribute { } +} + +// $Id: Func.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System +{ +#if LINQBRIDGE_LIB + public delegate TResult Func(); + public delegate TResult Func(T a); + public delegate TResult Func(T1 arg1, T2 arg2); + public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3); + public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +#else + delegate TResult Func(); + delegate TResult Func(T a); + delegate TResult Func(T1 arg1, T2 arg2); + delegate TResult Func(T1 arg1, T2 arg2, T3 arg3); + delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +#endif +} + +// $Id: IGrouping.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System.Linq +{ + #region Imports + + using System.Collections.Generic; + + #endregion + + /// + /// Represents a collection of objects that have a common key. + /// + + partial interface IGrouping : IEnumerable + { + /// + /// Gets the key of the . + /// + + TKey Key { get; } + } +} + +// $Id: ILookup.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System.Linq +{ + using System.Collections.Generic; + + /// + /// Defines an indexer, size property, and Boolean search method for + /// data structures that map keys to + /// sequences of values. + /// + + partial interface ILookup : IEnumerable> + { + bool Contains(TKey key); + int Count { get; } + IEnumerable this[TKey key] { get; } + } +} + +// $Id: Internal.cs 1567e00f1a20 2012/04/17 16:09:51 azizatif $ + +namespace LinqBridge +{ + #region Imports + + using System; + using System.Collections.Generic; + + #endregion + + /// + /// This type is not intended to be used directly from user code. + /// It may be removed or changed in a future version without notice. + /// + + sealed class DelegatingComparer : IComparer + { + private readonly Func _comparer; + + public DelegatingComparer(Func comparer) + { + if (comparer == null) throw new ArgumentNullException("comparer"); + _comparer = comparer; + } + + public int Compare(T x, T y) { return _comparer(x, y); } + } + + /// + /// This type is not intended to be used directly from user code. + /// It may be removed or changed in a future version without notice. + /// + + struct Key + { + public Key(T value) : this() { Value = value; } + public T Value { get; private set; } + } + + /// + /// This type is not intended to be used directly from user code. + /// It may be removed or changed in a future version without notice. + /// + + sealed class KeyComparer : IEqualityComparer> + { + private readonly IEqualityComparer _innerComparer; + + public KeyComparer(IEqualityComparer innerComparer) + { + _innerComparer = innerComparer ?? EqualityComparer.Default; + } + + public bool Equals(Key x, Key y) + { + return _innerComparer.Equals(x.Value, y.Value); + } + + public int GetHashCode(Key obj) + { + return obj.Value == null ? 0 : _innerComparer.GetHashCode(obj.Value); + } + } +} + +// $Id: IOrderedEnumerable.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System.Linq +{ + using System.Collections.Generic; + + /// + /// Represents a sorted sequence. + /// + + partial interface IOrderedEnumerable : IEnumerable + { + /// + /// Performs a subsequent ordering on the elements of an + /// according to a key. + /// + + IOrderedEnumerable CreateOrderedEnumerable( + Func keySelector, IComparer comparer, bool descending); + } +} + +// $Id: Lookup.cs c08984d432b1 2012/04/17 16:05:19 azizatif $ + +namespace System.Linq +{ + #region Imports + + using System; + using System.Collections; + using System.Collections.Generic; + using IEnumerable=System.Collections.IEnumerable; + using LinqBridge; + + #endregion + + /// + /// Represents a collection of keys each mapped to one or more values. + /// + + internal sealed class Lookup : ILookup + { + private readonly Dictionary, IGrouping> _map; + private readonly List> _orderedKeys; // remember order of insertion + + internal Lookup(IEqualityComparer comparer) + { + _map = new Dictionary, IGrouping>(new KeyComparer(comparer)); + _orderedKeys = new List>(); + } + + internal void Add(IGrouping item) + { + var key = new Key(item.Key); + _map.Add(key, item); + _orderedKeys.Add(key); + } + + internal IEnumerable Find(TKey key) + { + IGrouping grouping; + return _map.TryGetValue(new Key(key), out grouping) ? grouping : null; + } + + /// + /// Gets the number of key/value collection pairs in the . + /// + + public int Count + { + get { return _map.Count; } + } + + /// + /// Gets the collection of values indexed by the specified key. + /// + + public IEnumerable this[TKey key] + { + get + { + IGrouping result; + return _map.TryGetValue(new Key(key), out result) ? result : Enumerable.Empty(); + } + } + + /// + /// Determines whether a specified key is in the . + /// + + public bool Contains(TKey key) + { + return _map.ContainsKey(new Key(key)); + } + + /// + /// Applies a transform function to each key and its associated + /// values and returns the results. + /// + + public IEnumerable ApplyResultSelector( + Func, TResult> resultSelector) + { + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + foreach (var pair in _map) + yield return resultSelector(pair.Key.Value, pair.Value); + } + + /// + /// Returns a generic enumerator that iterates through the . + /// + + public IEnumerator> GetEnumerator() + { + foreach (var key in _orderedKeys) + yield return _map[key]; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} + +// $Id: OrderedEnumerable.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace LinqBridge +{ + #region Imports + + using System; + using System.Collections; + using System.Collections.Generic; + using System.Diagnostics; + using System.Linq; + + #endregion + + internal sealed class OrderedEnumerable : IOrderedEnumerable + { + private readonly IEnumerable _source; + private readonly Func, IComparer> _comparerComposer; + + public OrderedEnumerable(IEnumerable source, + Func keySelector, IComparer comparer, bool descending) : + this(source, (_, next) => next, keySelector, comparer, descending) {} + + private OrderedEnumerable(IEnumerable source, + Func, IComparer> parent, + Func keySelector, IComparer comparer, bool descending) + { + if (source == null) throw new ArgumentNullException("source"); + if (keySelector == null) throw new ArgumentNullException("keySelector"); + Debug.Assert(parent != null); + + _source = source; + + comparer = comparer ?? Comparer.Default; + var direction = descending ? -1 : 1; + + _comparerComposer = (items, next) => + { + Debug.Assert(items != null); + Debug.Assert(next != null); + + var keys = new K[items.Length]; + for (var i = 0; i < items.Length; i++) + keys[i] = keySelector(items[i]); + + return parent(items, new DelegatingComparer((i, j) => + { + var result = direction * comparer.Compare(keys[i], keys[j]); + return result != 0 ? result : next.Compare(i, j); + })); + }; + } + + public IOrderedEnumerable CreateOrderedEnumerable( + Func keySelector, IComparer comparer, bool descending) + { + return new OrderedEnumerable(_source, _comparerComposer, keySelector, comparer, descending); + } + + public IEnumerator GetEnumerator() + { + // + // Sort using Array.Sort but docs say that it performs an + // unstable sort. LINQ, on the other hand, says OrderBy performs + // a stable sort. Use the item position then as a tie + // breaker when all keys compare equal, thus making the sort + // stable. + // + + var items = _source.ToArray(); + var positionComparer = new DelegatingComparer((i, j) => i.CompareTo(j)); + var comparer = _comparerComposer(items, positionComparer); + var keys = new int[items.Length]; + for (var i = 0; i < keys.Length; i++) + keys[i] = i; + Array.Sort(keys, items, comparer); + return ((IEnumerable) items).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} + +// $Id: Action.cs 71137f497bf2 2012/04/16 20:01:27 azizatif $ + +namespace System +{ +#if LINQBRIDGE_LIB + public delegate void Action(); + public delegate void Action(T1 arg1, T2 arg2); + public delegate void Action(T1 arg1, T2 arg2, T3 arg3); + public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +#else + delegate void Action(); + delegate void Action(T1 arg1, T2 arg2); + delegate void Action(T1 arg1, T2 arg2, T3 arg3); + delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +#endif +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MemberMapping.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MemberMapping.cs new file mode 100644 index 0000000..c1cfe12 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MemberMapping.cs @@ -0,0 +1,75 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Reflection; + +namespace Newtonsoft.Json +{ + internal struct MemberMapping + { + private readonly string _mappingName; + private readonly MemberInfo _member; + private readonly bool _ignored; + private readonly bool _readable; + private readonly bool _writable; + + public MemberMapping(string mappingName, MemberInfo member, bool ignored, bool readable, bool writable) + { + _mappingName = mappingName; + _member = member; + _ignored = ignored; + _readable = readable; + _writable = writable; + } + + public string MappingName + { + get { return _mappingName; } + } + + public MemberInfo Member + { + get { return _member; } + } + + public bool Ignored + { + get { return _ignored; } + } + + public bool Readable + { + get { return _readable; } + } + + public bool Writable + { + get { return _writable; } + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MemberMappingCollection.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MemberMappingCollection.cs new file mode 100644 index 0000000..2c78cec --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MemberMappingCollection.cs @@ -0,0 +1,67 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections.ObjectModel; +using Newtonsoft.Json.Utilities; +using System.Globalization; + +namespace Newtonsoft.Json +{ + internal class MemberMappingCollection : KeyedCollection + { + protected override string GetKeyForItem(MemberMapping item) + { + return item.MappingName; + } + + public void AddMapping(MemberMapping memberMapping) + { + if (Contains(memberMapping.MappingName)) + { + // don't overwrite existing mapping with ignored mapping + if (memberMapping.Ignored) + return; + + MemberMapping existingMemberMapping = this[memberMapping.MappingName]; + + if (!existingMemberMapping.Ignored) + { + throw new JsonSerializationException( + "A member with the name '{0}' already exists on {1}. Use the JsonPropertyAttribute to specify another name.".FormatWith(CultureInfo.InvariantCulture, memberMapping.MappingName, memberMapping.Member.DeclaringType)); + } + else + { + // remove ignored mapping so it can be replaced in collection + Remove(existingMemberMapping); + } + } + + Add(memberMapping); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MemberSerialization.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MemberSerialization.cs new file mode 100644 index 0000000..86b546f --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MemberSerialization.cs @@ -0,0 +1,42 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +namespace Newtonsoft.Json +{ + /// + /// Specifies the member serialization options for the . + /// + public enum MemberSerialization + { + /// + /// All members are serialized by default. Members can be excluded using the . + /// + OptOut, + /// + /// Only members must be marked with the are serialized. + /// + OptIn + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MissingMemberHandling.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MissingMemberHandling.cs new file mode 100644 index 0000000..a5a8def --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/MissingMemberHandling.cs @@ -0,0 +1,46 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Specifies missing member handling options for the . + /// + public enum MissingMemberHandling + { + /// + /// Throw a when a missing member is encountered during deserialization. + /// + Error = 0, + /// + /// Ignore a missing member and do not attempt to deserialize it. + /// + Ignore = 1 + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Newtonsoft.Json.csproj b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Newtonsoft.Json.csproj new file mode 100644 index 0000000..950ff9b --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Newtonsoft.Json.csproj @@ -0,0 +1,151 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {A9AE40FF-1A21-414A-9FE7-3BE13644CC6D} + Library + Properties + Newtonsoft.Json + Newtonsoft.Json + false + + + + + + + + + + + + + 3.5 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + v2.0 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\Newtonsoft.Json.XML + true + -Microsoft.Design#CA1012;-Microsoft.Design#CA2210;-Microsoft.Design#CA1040;-Microsoft.Design#CA1005;-Microsoft.Design#CA1020;-Microsoft.Design#CA1021;-Microsoft.Design#CA1010;-Microsoft.Design#CA1011;-Microsoft.Design#CA1009;-Microsoft.Design#CA1050;-Microsoft.Design#CA1026;-Microsoft.Design#CA1019;-Microsoft.Design#CA1031;-Microsoft.Design#CA1047;-Microsoft.Design#CA1000;-Microsoft.Design#CA1048;-Microsoft.Design#CA1051;-Microsoft.Design#CA1002;-Microsoft.Design#CA1061;-Microsoft.Design#CA1006;-Microsoft.Design#CA1046;-Microsoft.Design#CA1045;-Microsoft.Design#CA1065;-Microsoft.Design#CA1038;-Microsoft.Design#CA1008;-Microsoft.Design#CA1028;-Microsoft.Design#CA1064;-Microsoft.Design#CA1004;-Microsoft.Design#CA1035;-Microsoft.Design#CA1063;-Microsoft.Design#CA1032;-Microsoft.Design#CA1023;-Microsoft.Design#CA1033;-Microsoft.Design#CA1039;-Microsoft.Design#CA1016;-Microsoft.Design#CA1014;-Microsoft.Design#CA1017;-Microsoft.Design#CA1018;-Microsoft.Design#CA1027;-Microsoft.Design#CA1059;-Microsoft.Design#CA1060;-Microsoft.Design#CA1034;-Microsoft.Design#CA1013;-Microsoft.Design#CA1036;-Microsoft.Design#CA1044;-Microsoft.Design#CA1041;-Microsoft.Design#CA1025;-Microsoft.Design#CA1052;-Microsoft.Design#CA1053;-Microsoft.Design#CA1057;-Microsoft.Design#CA1058;-Microsoft.Design#CA1001;-Microsoft.Design#CA1049;-Microsoft.Design#CA1054;-Microsoft.Design#CA1056;-Microsoft.Design#CA1055;-Microsoft.Design#CA1030;-Microsoft.Design#CA1003;-Microsoft.Design#CA1007;-Microsoft.Design#CA1043;-Microsoft.Design#CA1024;-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302;-Microsoft.Globalization#CA1308;-Microsoft.Globalization#CA1306;-Microsoft.Globalization#CA2101;-Microsoft.Globalization#CA1300;-Microsoft.Globalization#CA1307;-Microsoft.Globalization#CA1309;-Microsoft.Interoperability#CA1403;-Microsoft.Interoperability#CA1406;-Microsoft.Interoperability#CA1413;-Microsoft.Interoperability#CA1402;-Microsoft.Interoperability#CA1407;-Microsoft.Interoperability#CA1404;-Microsoft.Interoperability#CA1410;-Microsoft.Interoperability#CA1411;-Microsoft.Interoperability#CA1405;-Microsoft.Interoperability#CA1409;-Microsoft.Interoperability#CA1415;-Microsoft.Interoperability#CA1408;-Microsoft.Interoperability#CA1414;-Microsoft.Interoperability#CA1412;-Microsoft.Interoperability#CA1400;-Microsoft.Interoperability#CA1401;-Microsoft.Maintainability#CA1506;-Microsoft.Maintainability#CA1502;-Microsoft.Maintainability#CA1501;-Microsoft.Maintainability#CA1505;-Microsoft.Maintainability#CA1504;-Microsoft.Maintainability#CA1500;-Microsoft.Mobility#CA1600;-Microsoft.Mobility#CA1601;-Microsoft.Naming#CA1702;-Microsoft.Naming#CA1700;-Microsoft.Naming#CA1712;-Microsoft.Naming#CA1713;-Microsoft.Naming#CA1714;-Microsoft.Naming#CA1709;-Microsoft.Naming#CA1704;-Microsoft.Naming#CA1708;-Microsoft.Naming#CA1715;-Microsoft.Naming#CA1710;-Microsoft.Naming#CA1720;-Microsoft.Naming#CA1707;-Microsoft.Naming#CA1722;-Microsoft.Naming#CA1711;-Microsoft.Naming#CA1716;-Microsoft.Naming#CA1717;-Microsoft.Naming#CA1725;-Microsoft.Naming#CA1719;-Microsoft.Naming#CA1721;-Microsoft.Naming#CA1701;-Microsoft.Naming#CA1703;-Microsoft.Naming#CA1724;-Microsoft.Naming#CA1726;-Microsoft.Performance#CA1809;-Microsoft.Performance#CA1811;-Microsoft.Performance#CA1812;-Microsoft.Performance#CA1813;-Microsoft.Performance#CA1823;-Microsoft.Performance#CA1800;-Microsoft.Performance#CA1805;-Microsoft.Performance#CA1810;-Microsoft.Performance#CA1824;-Microsoft.Performance#CA1822;-Microsoft.Performance#CA1815;-Microsoft.Performance#CA1814;-Microsoft.Performance#CA1819;-Microsoft.Performance#CA1821;-Microsoft.Performance#CA1804;-Microsoft.Performance#CA1820;-Microsoft.Performance#CA1802;-Microsoft.Portability#CA1901;-Microsoft.Portability#CA1900;-Microsoft.Reliability#CA2001;-Microsoft.Reliability#CA2002;-Microsoft.Reliability#CA2003;-Microsoft.Reliability#CA2004;-Microsoft.Reliability#CA2006;-Microsoft.Security#CA2116;-Microsoft.Security#CA2117;-Microsoft.Security#CA2105;-Microsoft.Security#CA2115;-Microsoft.Security#CA2102;-Microsoft.Security#CA2104;-Microsoft.Security#CA2122;-Microsoft.Security#CA2114;-Microsoft.Security#CA2123;-Microsoft.Security#CA2111;-Microsoft.Security#CA2108;-Microsoft.Security#CA2107;-Microsoft.Security#CA2103;-Microsoft.Security#CA2118;-Microsoft.Security#CA2109;-Microsoft.Security#CA2119;-Microsoft.Security#CA2106;-Microsoft.Security#CA2112;-Microsoft.Security#CA2120;-Microsoft.Security#CA2121;-Microsoft.Security#CA2126;-Microsoft.Security#CA2124;-Microsoft.Security#CA2127;-Microsoft.Security#CA2128;-Microsoft.Security#CA2129;-Microsoft.Usage#CA2243;-Microsoft.Usage#CA2236;-Microsoft.Usage#CA1816;-Microsoft.Usage#CA2227;-Microsoft.Usage#CA2213;-Microsoft.Usage#CA2216;-Microsoft.Usage#CA2214;-Microsoft.Usage#CA2222;-Microsoft.Usage#CA1806;-Microsoft.Usage#CA2217;-Microsoft.Usage#CA2212;-Microsoft.Usage#CA2219;-Microsoft.Usage#CA2201;-Microsoft.Usage#CA2228;-Microsoft.Usage#CA2221;-Microsoft.Usage#CA2220;-Microsoft.Usage#CA2240;-Microsoft.Usage#CA2229;-Microsoft.Usage#CA2238;-Microsoft.Usage#CA2207;-Microsoft.Usage#CA2208;-Microsoft.Usage#CA2235;-Microsoft.Usage#CA2237;-Microsoft.Usage#CA2232;-Microsoft.Usage#CA2223;-Microsoft.Usage#CA2211;-Microsoft.Usage#CA2233;-Microsoft.Usage#CA2225;-Microsoft.Usage#CA2226;-Microsoft.Usage#CA2231;-Microsoft.Usage#CA2224;-Microsoft.Usage#CA2218;-Microsoft.Usage#CA2234;-Microsoft.Usage#CA2239;-Microsoft.Usage#CA2200;-Microsoft.Usage#CA1801;-Microsoft.Usage#CA2242;-Microsoft.Usage#CA2205;-Microsoft.Usage#CA2230 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + bin\Release\Newtonsoft.Json.XML + + + + + 3.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/NullValueHandling.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/NullValueHandling.cs new file mode 100644 index 0000000..48f078f --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/NullValueHandling.cs @@ -0,0 +1,42 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +namespace Newtonsoft.Json +{ + /// + /// Specifies null value handling options for the . + /// + public enum NullValueHandling + { + /// + /// Include null values when serializing and deserializing objects. + /// + Include = 0, + /// + /// Ignore null values when serializing and deserializing objects. + /// + Ignore = 1 + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/ObjectCreationHandling.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/ObjectCreationHandling.cs new file mode 100644 index 0000000..a3be502 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/ObjectCreationHandling.cs @@ -0,0 +1,46 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +namespace Newtonsoft.Json +{ + /// + /// Specifies how object creation is handled by the . + /// + public enum ObjectCreationHandling + { + /// + /// Reuse existing objects, create new objects when needed. + /// + Auto = 0, + /// + /// Only reuse existing objects. + /// + Reuse = 1, + /// + /// Always create new objects. + /// + Replace = 2 + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Properties/AssemblyInfo.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..da16764 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -0,0 +1,58 @@ +#region License +// Copyright 2006 James Newton-King +// http://www.newtonsoft.com +// +// This work is licensed under the Creative Commons Attribution 2.5 License +// http://creativecommons.org/licenses/by/2.5/ +// +// You are free: +// * to copy, distribute, display, and perform the work +// * to make derivative works +// * to make commercial use of the work +// +// Under the following conditions: +// * You must attribute the work in the manner specified by the author or licensor: +// - If you find this component useful a link to http://www.newtonsoft.com would be appreciated. +// * For any reuse or distribution, you must make clear to others the license terms of this work. +// * Any of these conditions can be waived if you get permission from the copyright holder. +#endregion + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security; + +// 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("Newtonsoft Json.NET")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Newtonsoft")] +[assembly: AssemblyProduct("Newtonsoft Json.NET")] +[assembly: AssemblyCopyright("Copyright © Newtonsoft 2006")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests")] +[assembly: AllowPartiallyTrustedCallers] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM componenets. 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("9ca358aa-317b-4925-8ada-4a29e943a363")] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.0.0")] \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/ReferenceLoopHandling.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/ReferenceLoopHandling.cs new file mode 100644 index 0000000..122efc6 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/ReferenceLoopHandling.cs @@ -0,0 +1,50 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Specifies reference loop handling options for the . + /// + public enum ReferenceLoopHandling + { + /// + /// Throw a when a loop is encountered. + /// + Error = 0, + /// + /// Ignore loop references and do not serialize. + /// + Ignore = 1, + /// + /// Serialize loop references. + /// + Serialize = 2 + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/StringBuffer.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/StringBuffer.cs new file mode 100644 index 0000000..c12415c --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/StringBuffer.cs @@ -0,0 +1,96 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json +{ + /// + /// Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + /// + internal class StringBuffer + { + private char[] _buffer; + private int _position; + + private static char[] _emptyBuffer = new char[0]; + + public int Position + { + get { return _position; } + set { _position = value; } + } + + public StringBuffer() + { + _buffer = _emptyBuffer; + } + + public StringBuffer(int initalSize) + { + _buffer = new char[initalSize]; + } + + public void Append(char value) + { + // test if the buffer array is large enough to take the value + if (_position + 1 > _buffer.Length) + { + EnsureSize(1); + } + + // set value and increment poisition + _buffer[_position++] = value; + } + + public void Clear() + { + _buffer = _emptyBuffer; + _position = 0; + } + + private void EnsureSize(int appendLength) + { + char[] newBuffer = new char[_position + appendLength * 2]; + + Array.Copy(_buffer, newBuffer, _position); + + _buffer = newBuffer; + } + + public override string ToString() + { + return ToString(0, _position); + } + + public string ToString(int start, int length) + { + // TODO: validation + return new string(_buffer, start, length); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/CollectionUtils.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/CollectionUtils.cs new file mode 100644 index 0000000..9d4d107 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/CollectionUtils.cs @@ -0,0 +1,504 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Collections; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal static class CollectionUtils + { + public static IEnumerable CastValid(this IEnumerable enumerable) + { + ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); + + return enumerable.Cast().Where(o => o is T).Cast(); + } + + public static List CreateList(params T[] values) + { + return new List(values); + } + + /// + /// Determines whether the collection is null or empty. + /// + /// The collection. + /// + /// true if the collection is null or empty; otherwise, false. + /// + public static bool IsNullOrEmpty(ICollection collection) + { + if (collection != null) + { + return (collection.Count == 0); + } + return true; + } + + /// + /// Determines whether the collection is null or empty. + /// + /// The collection. + /// + /// true if the collection is null or empty; otherwise, false. + /// + public static bool IsNullOrEmpty(ICollection collection) + { + if (collection != null) + { + return (collection.Count == 0); + } + return true; + } + + /// + /// Determines whether the collection is null, empty or its contents are uninitialized values. + /// + /// The list. + /// + /// true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + /// + public static bool IsNullOrEmptyOrDefault(IList list) + { + if (IsNullOrEmpty(list)) + return true; + + return ReflectionUtils.ItemsUnitializedValue(list); + } + + /// + /// Makes a slice of the specified list in between the start and end indexes. + /// + /// The list. + /// The start index. + /// The end index. + /// A slice of the list. + public static IList Slice(IList list, int? start, int? end) + { + return Slice(list, start, end, null); + } + + /// + /// Makes a slice of the specified list in between the start and end indexes, + /// getting every so many items based upon the step. + /// + /// The list. + /// The start index. + /// The end index. + /// The step. + /// A slice of the list. + public static IList Slice(IList list, int? start, int? end, int? step) + { + if (list == null) + throw new ArgumentNullException("list"); + + if (step == 0) + throw new ArgumentException("Step cannot be zero.", "step"); + + List slicedList = new List(); + + // nothing to slice + if (list.Count == 0) + return slicedList; + + // set defaults for null arguments + int s = step ?? 1; + int startIndex = start ?? 0; + int endIndex = end ?? list.Count; + + // start from the end of the list if start is negitive + startIndex = (startIndex < 0) ? list.Count + startIndex : startIndex; + + // end from the start of the list if end is negitive + endIndex = (endIndex < 0) ? list.Count + endIndex : endIndex; + + // ensure indexes keep within collection bounds + startIndex = Math.Max(startIndex, 0); + endIndex = Math.Min(endIndex, list.Count - 1); + + // loop between start and end indexes, incrementing by the step + for (int i = startIndex; i < endIndex; i += s) + { + slicedList.Add(list[i]); + } + + return slicedList; + } + + + /// + /// Group the collection using a function which returns the key. + /// + /// The source collection to group. + /// The key selector. + /// A Dictionary with each key relating to a list of objects in a list grouped under it. + public static Dictionary> GroupBy(ICollection source, Func keySelector) + { + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + Dictionary> groupedValues = new Dictionary>(); + + foreach (V value in source) + { + // using delegate to get the value's key + K key = keySelector(value); + List groupedValueList; + + // add a list for grouped values if the key is not already in Dictionary + if (!groupedValues.TryGetValue(key, out groupedValueList)) + { + groupedValueList = new List(); + groupedValues.Add(key, groupedValueList); + } + + groupedValueList.Add(value); + } + + return groupedValues; + } + + /// + /// Adds the elements of the specified collection to the specified generic IList. + /// + /// The list to add to. + /// The collection of elements to add. + public static void AddRange(this IList initial, IEnumerable collection) + { + if (initial == null) + throw new ArgumentNullException("initial"); + + if (collection == null) + return; + + foreach (T value in collection) + { + initial.Add(value); + } + } + + public static void AddRange(this IList initial, IEnumerable collection) + { + ValidationUtils.ArgumentNotNull(initial, "initial"); + + ListWrapper wrapper = new ListWrapper(initial); + wrapper.AddRange(collection.Cast()); + } + + public static List Distinct(List collection) + { + List distinctList = new List(); + + foreach (T value in collection) + { + if (!distinctList.Contains(value)) + distinctList.Add(value); + } + + return distinctList; + } + + public static List> Flatten(params IList[] lists) + { + List> flattened = new List>(); + Dictionary currentList = new Dictionary(); + + Recurse(new List>(lists), 0, currentList, flattened); + + return flattened; + } + + private static void Recurse(IList> global, int current, Dictionary currentSet, List> flattenedResult) + { + IList currentArray = global[current]; + + for (int i = 0; i < currentArray.Count; i++) + { + currentSet[current] = currentArray[i]; + + if (current == global.Count - 1) + { + List items = new List(); + + for (int k = 0; k < currentSet.Count; k++) + { + items.Add(currentSet[k]); + } + + flattenedResult.Add(items); + } + else + { + Recurse(global, current + 1, currentSet, flattenedResult); + } + } + } + + public static List CreateList(ICollection collection) + { + if (collection == null) + throw new ArgumentNullException("collection"); + + T[] array = new T[collection.Count]; + collection.CopyTo(array, 0); + + return new List(array); + } + + public static bool ListEquals(IList a, IList b) + { + if (a == null || b == null) + return (a == null && b == null); + + if (a.Count != b.Count) + return false; + + EqualityComparer comparer = EqualityComparer.Default; + + for (int i = 0; i < a.Count; i++) + { + if (!comparer.Equals(a[i], b[i])) + return false; + } + + return true; + } + + #region GetSingleItem + public static bool TryGetSingleItem(IList list, out T value) + { + return TryGetSingleItem(list, false, out value); + } + + public static bool TryGetSingleItem(IList list, bool returnDefaultIfEmpty, out T value) + { + return MiscellaneousUtils.TryAction(delegate { return GetSingleItem(list, returnDefaultIfEmpty); }, out value); + } + + public static T GetSingleItem(IList list) + { + return GetSingleItem(list, false); + } + + public static T GetSingleItem(IList list, bool returnDefaultIfEmpty) + { + if (list.Count == 1) + return list[0]; + else if (returnDefaultIfEmpty && list.Count == 0) + return default(T); + else + throw new Exception("Expected single {0} in list but got {1}.".FormatWith(CultureInfo.InvariantCulture, typeof(T), list.Count)); + } + #endregion + + public static IList Minus(IList list, IList minus) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + List result = new List(list.Count); + foreach (T t in list) + { + if (minus == null || !minus.Contains(t)) + result.Add(t); + } + + return result; + } + + public static T[] CreateArray(IEnumerable enumerable) + { + ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); + + if (enumerable is T[]) + return (T[])enumerable; + + List tempList = new List(enumerable); + return tempList.ToArray(); + } + + public static IList CreateGenericList(Type listType) + { + ValidationUtils.ArgumentNotNull(listType, "listType"); + + return (IList)ReflectionUtils.CreateGeneric(typeof(List<>), listType); + } + + public static bool IsListType(Type type) + { + ValidationUtils.ArgumentNotNull(type, "listType"); + + if (type.IsArray) + return true; + else if (typeof(IList).IsAssignableFrom(type)) + return true; + else if (ReflectionUtils.IsSubClass(type, typeof(IList<>))) + return true; + else + return false; + } + + public static IWrappedList CreateListWrapper(object list) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + Type listDefinition; + if (ReflectionUtils.IsSubClass(list.GetType(), typeof(IList<>), out listDefinition)) + { + Type listItemType = ReflectionUtils.GetListItemType(listDefinition); + + // Activator.CreateInstance throws AmbiguousMatchException. Manually invoke constructor + Func, object> instanceCreator = (t, a) => + { + ConstructorInfo c = t.GetConstructor(new[] {listDefinition}); + return c.Invoke(new[] { list }); + }; + + return (IWrappedList)ReflectionUtils.CreateGeneric(typeof(ListWrapper<>), new[] { listItemType }, instanceCreator, list); + } + else if (list is IList) + { + return new ListWrapper((IList)list); + } + else + { + throw new Exception("Can not create ListWrapper for type {0}.".FormatWith(CultureInfo.InvariantCulture, list.GetType())); + } + } + + public static IWrappedDictionary CreateDictionaryWrapper(object dictionary) + { + ValidationUtils.ArgumentNotNull(dictionary, "dictionary"); + + Type dictionaryDefinition; + if (ReflectionUtils.IsSubClass(dictionary.GetType(), typeof(IDictionary<,>), out dictionaryDefinition)) + { + Type dictionaryKeyType = ReflectionUtils.GetDictionaryKeyType(dictionaryDefinition); + Type dictionaryValueType = ReflectionUtils.GetDictionaryValueType(dictionaryDefinition); + + // Activator.CreateInstance throws AmbiguousMatchException. Manually invoke constructor + Func, object> instanceCreator = (t, a) => + { + ConstructorInfo c = t.GetConstructor(new[] { dictionaryDefinition }); + return c.Invoke(new[] { dictionary }); + }; + + return (IWrappedDictionary)ReflectionUtils.CreateGeneric(typeof(DictionaryWrapper<,>), new[] { dictionaryKeyType, dictionaryValueType }, instanceCreator, dictionary); + } + else if (dictionary is IDictionary) + { + return new DictionaryWrapper((IDictionary)dictionary); + } + else + { + throw new Exception("Can not create DictionaryWrapper for type {0}.".FormatWith(CultureInfo.InvariantCulture, dictionary.GetType())); + } + } + + public static IList CreateAndPopulateList(Type listType, Action populateList) + { + ValidationUtils.ArgumentNotNull(listType, "listType"); + ValidationUtils.ArgumentNotNull(populateList, "populateList"); + + IList list; + Type collectionType; + bool isReadOnlyOrFixedSize = false; + + if (listType.IsArray) + { + // have to use an arraylist when creating array + // there is no way to know the size until it is finised + list = new ArrayList(); + isReadOnlyOrFixedSize = true; + } + else if (ReflectionUtils.IsSubClass(listType, typeof(ReadOnlyCollection<>), out collectionType)) + { + Type readOnlyCollectionContentsType = collectionType.GetGenericArguments()[0]; + Type genericEnumerable = ReflectionUtils.MakeGenericType(typeof(IEnumerable<>), readOnlyCollectionContentsType); + bool suitableConstructor = false; + + foreach (ConstructorInfo constructor in listType.GetConstructors()) + { + IList parameters = constructor.GetParameters(); + + if (parameters.Count == 1) + { + if (genericEnumerable.IsAssignableFrom(parameters[0].ParameterType)) + { + suitableConstructor = true; + break; + } + } + } + + if (!suitableConstructor) + throw new Exception("Read-only type {0} does not have a public constructor that takes a type that implements {1}.".FormatWith(CultureInfo.InvariantCulture, listType, genericEnumerable)); + + // can't add or modify a readonly list + // use List and convert once populated + list = (IList)CreateGenericList(readOnlyCollectionContentsType); + isReadOnlyOrFixedSize = true; + } + else if (typeof(IList).IsAssignableFrom(listType)) + { + if (ReflectionUtils.IsInstantiatableType(listType)) + list = (IList)Activator.CreateInstance(listType); + else if (listType == typeof(IList)) + list = new List(); + else + list = null; + } + else if (listType.IsGenericType && listType.GetGenericTypeDefinition() == typeof(IList<>)) + { + list = CollectionUtils.CreateGenericList(ReflectionUtils.GetListItemType(listType)); + } + else + { + list = null; + } + + if (list == null) + throw new Exception("Cannot create and populate list type {0}.".FormatWith(CultureInfo.InvariantCulture, listType)); + + populateList(list); + + // create readonly and fixed sized collections using the temporary list + if (isReadOnlyOrFixedSize) + { + if (listType.IsArray) + list = ((ArrayList)list).ToArray(ReflectionUtils.GetListItemType(listType)); + else if (ReflectionUtils.IsSubClass(listType, typeof(ReadOnlyCollection<>))) + list = (IList)Activator.CreateInstance(listType, list); + } + + return list; + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/DateTimeUtils.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/DateTimeUtils.cs new file mode 100644 index 0000000..2167c9d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/DateTimeUtils.cs @@ -0,0 +1,23 @@ +using System; +using System.Xml; + +namespace Newtonsoft.Json.Utilities +{ + internal static class DateTimeUtils + { + public static XmlDateTimeSerializationMode ToSerializationMode(DateTimeKind kind) + { + switch (kind) + { + case DateTimeKind.Local: + return XmlDateTimeSerializationMode.Local; + case DateTimeKind.Unspecified: + return XmlDateTimeSerializationMode.Unspecified; + case DateTimeKind.Utc: + return XmlDateTimeSerializationMode.Utc; + default: + throw new ArgumentOutOfRangeException("kind", kind, "Unexpected DateTimeKind value."); + } + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/DictionaryWrapper.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/DictionaryWrapper.cs new file mode 100644 index 0000000..1d0f81c --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/DictionaryWrapper.cs @@ -0,0 +1,422 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Linq; +using System.Threading; + +namespace Newtonsoft.Json.Utilities +{ + internal interface IWrappedDictionary : IDictionary + { + object UnderlyingDictionary { get; } + } + + internal class DictionaryWrapper : IDictionary, IWrappedDictionary + { + private readonly IDictionary _dictionary; + private readonly IDictionary _genericDictionary; + private object _syncRoot; + + public DictionaryWrapper(IDictionary dictionary) + { + ValidationUtils.ArgumentNotNull(dictionary, "dictionary"); + + _dictionary = dictionary; + } + + public DictionaryWrapper(IDictionary dictionary) + { + ValidationUtils.ArgumentNotNull(dictionary, "dictionary"); + + _genericDictionary = dictionary; + } + + public void Add(TKey key, TValue value) + { + if (_genericDictionary != null) + _genericDictionary.Add(key, value); + else + _dictionary.Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (_genericDictionary != null) + return _genericDictionary.ContainsKey(key); + else + return _dictionary.Contains(key); + } + + public ICollection Keys + { + get + { + if (_genericDictionary != null) + return _genericDictionary.Keys; + else + return _dictionary.Keys.Cast().ToList(); + } + } + + public bool Remove(TKey key) + { + if (_genericDictionary != null) + { + return _genericDictionary.Remove(key); + } + else + { + if (_dictionary.Contains(key)) + { + _dictionary.Remove(key); + return true; + } + else + { + return false; + } + } + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (_genericDictionary != null) + { + return _genericDictionary.TryGetValue(key, out value); + } + else + { + if (!_dictionary.Contains(key)) + { + value = default(TValue); + return false; + } + else + { + value = (TValue)_dictionary[key]; + return true; + } + } + } + + public ICollection Values + { + get + { + if (_genericDictionary != null) + return _genericDictionary.Values; + else + return _dictionary.Values.Cast().ToList(); + } + } + + public TValue this[TKey key] + { + get + { + if (_genericDictionary != null) + return _genericDictionary[key]; + else + return (TValue)_dictionary[key]; + } + set + { + if (_genericDictionary != null) + _genericDictionary[key] = value; + else + _dictionary[key] = value; + } + } + + public void Add(KeyValuePair item) + { + if (_genericDictionary != null) + _genericDictionary.Add(item); + else + ((IList)_dictionary).Add(item); + } + + public void Clear() + { + if (_genericDictionary != null) + _genericDictionary.Clear(); + else + _dictionary.Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (_genericDictionary != null) + return _genericDictionary.Contains(item); + else + return ((IList)_dictionary).Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + if (_genericDictionary != null) + { + _genericDictionary.CopyTo(array, arrayIndex); + } + else + { + foreach (DictionaryEntry item in _dictionary) + { + array[arrayIndex++] = new KeyValuePair((TKey)item.Key, (TValue)item.Value); + } + } + } + + public int Count + { + get + { + if (_genericDictionary != null) + return _genericDictionary.Count; + else + return _dictionary.Count; + } + } + + public bool IsReadOnly + { + get + { + if (_genericDictionary != null) + return _genericDictionary.IsReadOnly; + else + return _dictionary.IsReadOnly; + } + } + + public bool Remove(KeyValuePair item) + { + if (_genericDictionary != null) + { + return _genericDictionary.Remove(item); + } + else + { + if (_dictionary.Contains(item.Key)) + { + object value = _dictionary[item.Key]; + + if (object.Equals(value, item.Value)) + { + _dictionary.Remove(item.Key); + return true; + } + else + { + return false; + } + } + else + { + return true; + } + } + } + + public IEnumerator> GetEnumerator() + { + if (_genericDictionary != null) + { + return _genericDictionary.GetEnumerator(); + } + else + { + var ret = new List>(); + foreach (DictionaryEntry item in _dictionary) + { + ret.Add(new KeyValuePair((TKey)item.Key, (TValue)item.Value)); + } + return ret.GetEnumerator(); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + void IDictionary.Add(object key, object value) + { + if (_genericDictionary != null) + _genericDictionary.Add((TKey)key, (TValue)value); + else + _dictionary.Add(key, value); + } + + bool IDictionary.Contains(object key) + { + if (_genericDictionary != null) + return _genericDictionary.ContainsKey((TKey)key); + else + return _dictionary.Contains(key); + } + + private struct DictionaryEnumerator : IDictionaryEnumerator + { + private IEnumerator _e; + + public DictionaryEnumerator(IEnumerator e) + { + ValidationUtils.ArgumentNotNull(e, "e"); + _e = e; + } + + public DictionaryEntry Entry + { + get { return (DictionaryEntry)Current; } + } + + public object Key + { + get { return Entry.Key; } + } + + public object Value + { + get { return Entry.Value; } + } + + public object Current + { + get { return _e.Current; } + } + + public bool MoveNext() + { + return _e.MoveNext(); + } + + public void Reset() + { + _e.Reset(); + } + } + + IDictionaryEnumerator IDictionary.GetEnumerator() + { + if (_genericDictionary != null) + return new DictionaryEnumerator(_genericDictionary.GetEnumerator()); + else + return _dictionary.GetEnumerator(); + } + + bool IDictionary.IsFixedSize + { + get + { + if (_genericDictionary != null) + return false; + else + return _dictionary.IsFixedSize; + } + } + + ICollection IDictionary.Keys + { + get + { + if (_genericDictionary != null) + { + var keys = new List(); + foreach (var item in _genericDictionary.Keys) + keys.Add(item); + return keys; + } + else + { + return _dictionary.Keys; + } + } + } + + public void Remove(object key) + { + if (_genericDictionary != null) + _genericDictionary.Remove((TKey)key); + else + _dictionary.Remove(key); + } + + ICollection IDictionary.Values + { + get + { + if (_genericDictionary != null) + { + var ret = new List(); + foreach (var item in _genericDictionary.Keys) + ret.Add((item)); + return ret; + } + else + { + return _dictionary.Values; + } + } + } + + object IDictionary.this[object key] + { + get + { + if (_genericDictionary != null) + return _genericDictionary[(TKey)key]; + else + return _dictionary[key]; + } + set + { + if (_genericDictionary != null) + _genericDictionary[(TKey)key] = (TValue)value; + else + _dictionary[key] = value; + } + } + + void ICollection.CopyTo(Array array, int index) + { + if (_genericDictionary != null) + _genericDictionary.CopyTo((KeyValuePair[])array, index); + else + _dictionary.CopyTo(array, index); + } + + bool ICollection.IsSynchronized + { + get + { + if (_genericDictionary != null) + return false; + else + return _dictionary.IsSynchronized; + } + } + + object ICollection.SyncRoot + { + get + { + if (_syncRoot == null) + Interlocked.CompareExchange(ref _syncRoot, new object(), null); + + return _syncRoot; + } + } + + public object UnderlyingDictionary + { + get + { + if (_genericDictionary != null) + return _genericDictionary; + else + return _dictionary; + } + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/JavaScriptUtils.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/JavaScriptUtils.cs new file mode 100644 index 0000000..896dc05 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/JavaScriptUtils.cs @@ -0,0 +1,137 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections; +using System.Globalization; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Web; +using System.Collections.Generic; +using System.Drawing; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Newtonsoft.Json.Utilities +{ + internal static class JavaScriptUtils + { + public static string GetCallbackEventFunction(Page page, Control control) + { + string script = page.ClientScript.GetCallbackEventReference(control, "eventArgument", "eventCallback", "context", "errorCallback", true); + + script = "function(eventArgument,eventCallback,context,errorCallback){" + script + "}"; + + return script; + } + + public static string GetCallbackEventFunction(Page page, Control control, string argument) + { + string script = page.ClientScript.GetCallbackEventReference(control, "'" + argument + "'", "eventCallback", "context", "errorCallback", true); + + script = "function(eventCallback,context,errorCallback){" + script + "}"; + + return script; + } + + public static void WriteEscapedJavaScriptChar(TextWriter writer, char c, char delimiter) + { + switch (c) + { + case '\t': + writer.Write(@"\t"); + break; + case '\n': + writer.Write(@"\n"); + break; + case '\r': + writer.Write(@"\r"); + break; + case '\f': + writer.Write(@"\f"); + break; + case '\b': + writer.Write(@"\b"); + break; + case '\\': + writer.Write(@"\\"); + break; + //case '<': + //case '>': + //case '\'': + // StringUtils.WriteCharAsUnicode(writer, c); + // break; + case '\'': + // only escape if this charater is being used as the delimiter + writer.Write((delimiter == '\'') ? @"\'" : @"'"); + break; + case '"': + // only escape if this charater is being used as the delimiter + writer.Write((delimiter == '"') ? "\\\"" : @""""); + break; + default: + if (c > '\u001f') + writer.Write(c); + else + StringUtils.WriteCharAsUnicode(writer, c); + break; + } + } + + public static void WriteEscapedJavaScriptString(TextWriter writer, string value, char delimiter, bool appendDelimiters) + { + // leading delimiter + if (appendDelimiters) + writer.Write(delimiter); + + if (value != null) + { + for (int i = 0; i < value.Length; i++) + { + WriteEscapedJavaScriptChar(writer, value[i], delimiter); + } + } + + // trailing delimiter + if (appendDelimiters) + writer.Write(delimiter); + } + + public static string ToEscapedJavaScriptString(string value) + { + return ToEscapedJavaScriptString(value, '"', true); + } + + public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters) + { + using (StringWriter w = StringUtils.CreateStringWriter(StringUtils.GetLength(value) ?? 16)) + { + WriteEscapedJavaScriptString(w, value, delimiter, appendDelimiters); + return w.ToString(); + } + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/ListWrapper.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/ListWrapper.cs new file mode 100644 index 0000000..edb4c6f --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/ListWrapper.cs @@ -0,0 +1,286 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal interface IWrappedList : IList + { + object UnderlyingList { get; } + } + + internal class ListWrapper : IList, IWrappedList + { + private readonly IList _list; + private readonly IList _genericList; + private object _syncRoot; + + public ListWrapper(IList list) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + _list = list; + } + + public ListWrapper(IList list) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + _genericList = list; + } + + public int IndexOf(T item) + { + if (_genericList != null) + return _genericList.IndexOf(item); + else + return _list.IndexOf(item); + } + + public void Insert(int index, T item) + { + if (_genericList != null) + _genericList.Insert(index, item); + else + _list.Insert(index, item); + } + + public void RemoveAt(int index) + { + if (_genericList != null) + _genericList.RemoveAt(index); + else + _list.RemoveAt(index); + } + + public T this[int index] + { + get + { + if (_genericList != null) + return _genericList[index]; + else + return (T)_list[index]; + } + set + { + if (_genericList != null) + _genericList[index] = value; + else + _list[index] = value; + } + } + + public void Add(T item) + { + if (_genericList != null) + _genericList.Add(item); + else + _list.Add(item); + } + + public void Clear() + { + if (_genericList != null) + _genericList.Clear(); + else + _list.Clear(); + } + + public bool Contains(T item) + { + if (_genericList != null) + return _genericList.Contains(item); + else + return _list.Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (_genericList != null) + _genericList.CopyTo(array, arrayIndex); + else + _list.CopyTo(array, arrayIndex); + } + + public int Count + { + get + { + if (_genericList != null) + return _genericList.Count; + else + return _list.Count; + } + } + + public bool IsReadOnly + { + get + { + if (_genericList != null) + return _genericList.IsReadOnly; + else + return _list.IsReadOnly; + } + } + + public bool Remove(T item) + { + if (_genericList != null) + { + return _genericList.Remove(item); + } + else + { + bool contains = _list.Contains(item); + + if (contains) + _list.Remove(item); + + return contains; + } + } + + public IEnumerator GetEnumerator() + { + if (_genericList != null) + return _genericList.GetEnumerator(); + + return _list.Cast().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + if (_genericList != null) + return _genericList.GetEnumerator(); + else + return _list.GetEnumerator(); + } + + int IList.Add(object value) + { + VerifyValueType(value); + Add((T)value); + + return (Count - 1); + } + + bool IList.Contains(object value) + { + if (IsCompatibleObject(value)) + return Contains((T)value); + + return false; + } + + int IList.IndexOf(object value) + { + if (IsCompatibleObject(value)) + return IndexOf((T)value); + + return -1; + } + + void IList.Insert(int index, object value) + { + VerifyValueType(value); + Insert(index, (T)value); + } + + bool IList.IsFixedSize + { + get { return false; } + } + + void IList.Remove(object value) + { + if (IsCompatibleObject(value)) + Remove((T)value); + } + + object IList.this[int index] + { + get { return this[index]; } + set + { + VerifyValueType(value); + this[index] = (T)value; + } + } + + void ICollection.CopyTo(Array array, int arrayIndex) + { + CopyTo((T[])array, arrayIndex); + } + + bool ICollection.IsSynchronized + { + get { return false; } + } + + object ICollection.SyncRoot + { + get + { + if (_syncRoot == null) + Interlocked.CompareExchange(ref _syncRoot, new object(), null); + + return _syncRoot; + } + } + + private static void VerifyValueType(object value) + { + if (!IsCompatibleObject(value)) + throw new ArgumentException("The value '{0}' is not of type '{1}' and cannot be used in this generic collection.".FormatWith(CultureInfo.InvariantCulture, value, typeof(T)), "value"); + } + + private static bool IsCompatibleObject(object value) + { + if (!(value is T) && (value != null || typeof(T).IsValueType)) + return false; + + return true; + } + + public object UnderlyingList + { + get + { + if (_genericList != null) + return _genericList; + else + return _list; + } + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/MathUtils.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/MathUtils.cs new file mode 100644 index 0000000..974f44a --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/MathUtils.cs @@ -0,0 +1,60 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Newtonsoft.Json.Utilities +{ + internal class MathUtils + { + public static int HexToInt(char h) + { + if ((h >= '0') && (h <= '9')) + { + return (h - '0'); + } + if ((h >= 'a') && (h <= 'f')) + { + return ((h - 'a') + 10); + } + if ((h >= 'A') && (h <= 'F')) + { + return ((h - 'A') + 10); + } + return -1; + } + + public static char IntToHex(int n) + { + if (n <= 9) + { + return (char)(n + 48); + } + return (char)((n - 10) + 97); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs new file mode 100644 index 0000000..2fa82eb --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Reflection; +using System.Text; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal delegate T Creator(); + + internal static class MiscellaneousUtils + { + public static bool TryAction(Creator creator, out T output) + { + ValidationUtils.ArgumentNotNull(creator, "creator"); + + try + { + output = creator(); + return true; + } + catch + { + output = default(T); + return false; + } + } + + public static bool TryGetDescription(object value, out string description) + { + return TryAction(delegate { return GetDescription(value); }, out description); + } + + public static string GetDescription(object o) + { + ValidationUtils.ArgumentNotNull(o, "o"); + + ICustomAttributeProvider attributeProvider = o as ICustomAttributeProvider; + + // object passed in isn't an attribute provider + // if value is an enum value, get value field member, otherwise get values type + if (attributeProvider == null) + { + Type valueType = o.GetType(); + + if (valueType.IsEnum) + attributeProvider = valueType.GetField(o.ToString()); + else + attributeProvider = valueType; + } + + DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute(attributeProvider); + + if (descriptionAttribute != null) + return descriptionAttribute.Description; + else + throw new Exception("No DescriptionAttribute on '{0}'.".FormatWith(CultureInfo.InvariantCulture, o.GetType())); + } + + public static IList GetDescriptions(IList values) + { + ValidationUtils.ArgumentNotNull(values, "values"); + + string[] descriptions = new string[values.Count]; + + for (int i = 0; i < values.Count; i++) + { + descriptions[i] = GetDescription(values[i]); + } + + return descriptions; + } + + public static string ToString(object value) + { + if (value == null) + return "{null}"; + + return (value is string) ? @"""" + value.ToString() + @"""" : value.ToString(); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/ReflectionUtils.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/ReflectionUtils.cs new file mode 100644 index 0000000..f79f70b --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/ReflectionUtils.cs @@ -0,0 +1,554 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Collections; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal static class ReflectionUtils + { + public static Type GetObjectType(object v) + { + return (v != null) ? v.GetType() : null; + } + + public static bool IsInstantiatableType(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + if (t.IsAbstract || t.IsInterface || t.IsArray || t.IsGenericTypeDefinition || t == typeof(void)) + return false; + + if (!HasDefaultConstructor(t)) + return false; + + return true; + } + + public static bool HasDefaultConstructor(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + if (t.IsValueType) + return true; + + return (t.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null) != null); + } + + public static bool IsNullable(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + if (t.IsValueType) + return IsNullableType(t); + + return true; + } + + public static bool IsNullableType(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + return (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)); + } + + //public static bool IsValueTypeUnitializedValue(ValueType value) + //{ + // if (value == null) + // return true; + + // return value.Equals(CreateUnitializedValue(value.GetType())); + //} + + public static bool IsUnitializedValue(object value) + { + if (value == null) + { + return true; + } + else + { + object unitializedValue = CreateUnitializedValue(value.GetType()); + return value.Equals(unitializedValue); + } + } + + public static object CreateUnitializedValue(Type type) + { + ValidationUtils.ArgumentNotNull(type, "type"); + + if (type.IsGenericTypeDefinition) + throw new ArgumentException("Type {0} is a generic type definition and cannot be instantiated.".FormatWith(CultureInfo.InvariantCulture, type), "type"); + + if (type.IsClass || type.IsInterface || type == typeof(void)) + return null; + else if (type.IsValueType) + return Activator.CreateInstance(type); + else + throw new ArgumentException("Type {0} cannot be instantiated.".FormatWith(CultureInfo.InvariantCulture, type), "type"); + } + + public static bool IsPropertyIndexed(PropertyInfo property) + { + ValidationUtils.ArgumentNotNull(property, "property"); + + return !CollectionUtils.IsNullOrEmpty(property.GetIndexParameters()); + } + + public static bool IsSubClass(Type type, Type check) + { + Type implementingType; + return IsSubClass(type, check, out implementingType); + } + + public static bool IsSubClass(Type type, Type check, out Type implementingType) + { + ValidationUtils.ArgumentNotNull(type, "type"); + ValidationUtils.ArgumentNotNull(check, "check"); + + return IsSubClassInternal(type, type, check, out implementingType); + } + + private static bool IsSubClassInternal(Type initialType, Type currentType, Type check, out Type implementingType) + { + if (currentType == check) + { + implementingType = currentType; + return true; + } + + // don't get interfaces for an interface unless the initial type is an interface + if (check.IsInterface && (initialType.IsInterface || currentType == initialType)) + { + foreach (Type t in currentType.GetInterfaces()) + { + if (IsSubClassInternal(initialType, t, check, out implementingType)) + { + // don't return the interface itself, return it's implementor + if (check == implementingType) + implementingType = currentType; + + return true; + } + } + } + + if (currentType.IsGenericType && !currentType.IsGenericTypeDefinition) + { + if (IsSubClassInternal(initialType, currentType.GetGenericTypeDefinition(), check, out implementingType)) + { + implementingType = currentType; + return true; + } + } + + if (currentType.BaseType == null) + { + implementingType = null; + return false; + } + + return IsSubClassInternal(initialType, currentType.BaseType, check, out implementingType); + } + + /// + /// Gets the type of the typed list's items. + /// + /// The type. + /// The type of the typed list's items. + public static Type GetListItemType(Type type) + { + ValidationUtils.ArgumentNotNull(type, "type"); + Type genericListType; + + if (type.IsArray) + { + return type.GetElementType(); + } + else if (IsSubClass(type, typeof(IList<>), out genericListType)) + { + if (genericListType.IsGenericTypeDefinition) + throw new Exception("Type {0} is not a list.".FormatWith(CultureInfo.InvariantCulture, type)); + + return genericListType.GetGenericArguments()[0]; + } + else if (typeof(IList).IsAssignableFrom(type)) + { + return null; + } + else + { + throw new Exception("Type {0} is not a list.".FormatWith(CultureInfo.InvariantCulture, type)); + } + } + + private static void GetDictionaryKeyValueTypes(Type dictionaryType, out Type keyType, out Type valueType) + { + ValidationUtils.ArgumentNotNull(dictionaryType, "type"); + + Type genericDictionaryType; + if (IsSubClass(dictionaryType, typeof(IDictionary<,>), out genericDictionaryType)) + { + if (genericDictionaryType.IsGenericTypeDefinition) + throw new Exception("Type {0} is not a dictionary.".FormatWith(CultureInfo.InvariantCulture, dictionaryType)); + + Type[] dictionaryGenericArguments = genericDictionaryType.GetGenericArguments(); + + keyType = dictionaryGenericArguments[0]; + valueType = dictionaryGenericArguments[1]; + return; + } + else if (typeof(IDictionary).IsAssignableFrom(dictionaryType)) + { + keyType = null; + valueType = null; + return; + } + else + { + throw new Exception("Type {0} is not a dictionary.".FormatWith(CultureInfo.InvariantCulture, dictionaryType)); + } + } + + public static Type GetDictionaryValueType(Type dictionaryType) + { + Type keyType; + Type valueType; + GetDictionaryKeyValueTypes(dictionaryType, out keyType, out valueType); + + return valueType; + } + + public static Type GetDictionaryKeyType(Type dictionaryType) + { + Type keyType; + Type valueType; + GetDictionaryKeyValueTypes(dictionaryType, out keyType, out valueType); + + return keyType; + } + + /// + /// Tests whether the list's items are their unitialized value. + /// + /// The list. + /// Whether the list's items are their unitialized value + public static bool ItemsUnitializedValue(IList list) + { + ValidationUtils.ArgumentNotNull(list, "list"); + + Type elementType = GetListItemType(list.GetType()); + + if (elementType.IsValueType) + { + object unitializedValue = CreateUnitializedValue(elementType); + + for (int i = 0; i < list.Count; i++) + { + if (!list[i].Equals(unitializedValue)) + return false; + } + } + else if (elementType.IsClass) + { + for (int i = 0; i < list.Count; i++) + { + object value = list[i]; + + if (value != null) + return false; + } + } + else + { + throw new Exception("Type {0} is neither a ValueType or a Class.".FormatWith(CultureInfo.InvariantCulture, elementType)); + } + + return true; + } + + /// + /// Gets the member's underlying type. + /// + /// The member. + /// The underlying type of the member. + public static Type GetMemberUnderlyingType(MemberInfo member) + { + ValidationUtils.ArgumentNotNull(member, "member"); + + switch (member.MemberType) + { + case MemberTypes.Field: + return ((FieldInfo)member).FieldType; + case MemberTypes.Property: + return ((PropertyInfo)member).PropertyType; + case MemberTypes.Event: + return ((EventInfo)member).EventHandlerType; + default: + throw new ArgumentException("MemberInfo must be if type FieldInfo, PropertyInfo or EventInfo", "member"); + } + } + + /// + /// Determines whether the member is an indexed property. + /// + /// The member. + /// + /// true if the member is an indexed property; otherwise, false. + /// + public static bool IsIndexedProperty(MemberInfo member) + { + ValidationUtils.ArgumentNotNull(member, "member"); + + PropertyInfo propertyInfo = member as PropertyInfo; + + if (propertyInfo != null) + return IsIndexedProperty(propertyInfo); + else + return false; + } + + /// + /// Determines whether the property is an indexed property. + /// + /// The property. + /// + /// true if the property is an indexed property; otherwise, false. + /// + public static bool IsIndexedProperty(PropertyInfo property) + { + ValidationUtils.ArgumentNotNull(property, "property"); + + return (property.GetIndexParameters().Length > 0); + } + + public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes) + { + return GetMember(type, name, memberTypes, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); + } + + public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes, BindingFlags bindingAttr) + { + ValidationUtils.ArgumentNotNull(type, "type"); + ValidationUtils.ArgumentNotNull(name, "name"); + + MemberInfo[] result = type.GetMember(name, memberTypes, bindingAttr); + + return CollectionUtils.GetSingleItem(result); + } + + /// + /// Gets the member's value on the object. + /// + /// The member. + /// The target object. + /// The member's value on the object. + public static object GetMemberValue(MemberInfo member, object target) + { + ValidationUtils.ArgumentNotNull(member, "member"); + ValidationUtils.ArgumentNotNull(target, "target"); + + switch (member.MemberType) + { + case MemberTypes.Field: + return ((FieldInfo)member).GetValue(target); + case MemberTypes.Property: + try + { + return ((PropertyInfo)member).GetValue(target, null); + } + catch (TargetParameterCountException e) + { + throw new ArgumentException("MemberInfo '{0}' has index parameters".FormatWith(CultureInfo.InvariantCulture, member.Name), "member", e); + } + default: + throw new ArgumentException("MemberInfo '{0}' is not of type FieldInfo or PropertyInfo".FormatWith(CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, member.Name), "member"); + } + } + + /// + /// Sets the member's value on the target object. + /// + /// The member. + /// The target. + /// The value. + public static void SetMemberValue(MemberInfo member, object target, object value) + { + ValidationUtils.ArgumentNotNull(member, "member"); + ValidationUtils.ArgumentNotNull(target, "target"); + + switch (member.MemberType) + { + case MemberTypes.Field: + ((FieldInfo)member).SetValue(target, value); + break; + case MemberTypes.Property: + ((PropertyInfo)member).SetValue(target, value, null); + break; + default: + throw new ArgumentException("MemberInfo '{0}' must be of type FieldInfo or PropertyInfo".FormatWith(CultureInfo.InvariantCulture, member.Name), "member"); + } + } + + /// + /// Determines whether the specified MemberInfo can be read. + /// + /// The MemberInfo to determine whether can be read. + /// + /// true if the specified MemberInfo can be read; otherwise, false. + /// + public static bool CanReadMemberValue(MemberInfo member) + { + switch (member.MemberType) + { + case MemberTypes.Field: + return true; + case MemberTypes.Property: + return ((PropertyInfo)member).CanRead; + default: + return false; + } + } + + /// + /// Determines whether the specified MemberInfo can be set. + /// + /// The MemberInfo to determine whether can be set. + /// + /// true if the specified MemberInfo can be set; otherwise, false. + /// + public static bool CanSetMemberValue(MemberInfo member) + { + switch (member.MemberType) + { + case MemberTypes.Field: + return true; + case MemberTypes.Property: + return ((PropertyInfo)member).CanWrite; + default: + return false; + } + } + + public static List GetFieldsAndProperties(BindingFlags bindingAttr) + { + return GetFieldsAndProperties(typeof(T), bindingAttr); + } + + public static List GetFieldsAndProperties(Type type, BindingFlags bindingAttr) + { + List targetMembers = new List(); + + targetMembers.AddRange(type.GetFields(bindingAttr)); + targetMembers.AddRange(type.GetProperties(bindingAttr)); + + return targetMembers; + } + + public static T GetAttribute(ICustomAttributeProvider attributeProvider) where T : Attribute + { + return GetAttribute(attributeProvider, true); + } + + public static T GetAttribute(ICustomAttributeProvider attributeProvider, bool inherit) where T : Attribute + { + T[] attributes = GetAttributes(attributeProvider, inherit); + + return CollectionUtils.GetSingleItem(attributes, true); + } + + public static T[] GetAttributes(ICustomAttributeProvider attributeProvider, bool inherit) where T : Attribute + { + ValidationUtils.ArgumentNotNull(attributeProvider, "attributeProvider"); + + return (T[])attributeProvider.GetCustomAttributes(typeof(T), inherit); + } + + public static string GetNameAndAssessmblyName(Type t) + { + ValidationUtils.ArgumentNotNull(t, "t"); + + return t.FullName + ", " + t.Assembly.GetName().Name; + } + + public static List FindMembers(Type targetType, MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria) + { + ValidationUtils.ArgumentNotNull(targetType, "targetType"); + + List memberInfos = new List(targetType.FindMembers(memberType, bindingAttr, filter, filterCriteria)); + + // fix weirdness with FieldInfos only being returned for the current Type + // find base type fields and add them to result + if ((memberType & MemberTypes.Field) != 0 + && (bindingAttr & BindingFlags.NonPublic) != 0) + { + // modify flags to not search for public fields + BindingFlags nonPublicBindingAttr = bindingAttr ^ BindingFlags.Public; + + while ((targetType = targetType.BaseType) != null) + { + memberInfos.AddRange(targetType.FindMembers(MemberTypes.Field, nonPublicBindingAttr, filter, filterCriteria)); + } + } + + return memberInfos; + } + + public static Type MakeGenericType(Type genericTypeDefinition, params Type[] innerTypes) + { + ValidationUtils.ArgumentNotNull(genericTypeDefinition, "genericTypeDefinition"); + ValidationUtils.ArgumentNotNullOrEmpty(innerTypes, "innerTypes"); + ValidationUtils.ArgumentConditionTrue(genericTypeDefinition.IsGenericTypeDefinition, "genericTypeDefinition", "Type {0} is not a generic type definition.".FormatWith(CultureInfo.InvariantCulture, genericTypeDefinition)); + + return genericTypeDefinition.MakeGenericType(innerTypes); + } + + public static object CreateGeneric(Type genericTypeDefinition, Type innerType, params object[] args) + { + return CreateGeneric(genericTypeDefinition, new Type[] { innerType }, args); + } + + public static object CreateGeneric(Type genericTypeDefinition, IList innerTypes, params object[] args) + { + return CreateGeneric(genericTypeDefinition, innerTypes, (t, a) => Activator.CreateInstance(t, a.ToArray()), args); + } + + public static object CreateGeneric(Type genericTypeDefinition, IList innerTypes, Func, object> instanceCreator, params object[] args) + { + ValidationUtils.ArgumentNotNull(genericTypeDefinition, "genericTypeDefinition"); + ValidationUtils.ArgumentNotNullOrEmpty(innerTypes, "innerTypes"); + ValidationUtils.ArgumentNotNull(instanceCreator, "createInstance"); + + Type specificType = MakeGenericType(genericTypeDefinition, CollectionUtils.CreateArray(innerTypes)); + + return instanceCreator(specificType, args); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/StringUtils.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/StringUtils.cs new file mode 100644 index 0000000..5517dee --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/StringUtils.cs @@ -0,0 +1,409 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Data.SqlTypes; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal static class StringUtils + { + public const string CarriageReturnLineFeed = "\r\n"; + public const string Empty = ""; + public const char CarriageReturn = '\r'; + public const char LineFeed = '\n'; + public const char Tab = '\t'; + + //public static string FormatWith(this string format, params object[] args) + //{ + // return FormatWith(format, null, args); + //} + + public static string FormatWith(this string format, IFormatProvider provider, params object[] args) + { + ValidationUtils.ArgumentNotNull(format, "format"); + + return string.Format(provider, format, args); + } + + /// + /// Determines whether the string contains white space. + /// + /// The string to test for white space. + /// + /// true if the string contains white space; otherwise, false. + /// + public static bool ContainsWhiteSpace(string s) + { + if (s == null) + throw new ArgumentNullException("s"); + + for (int i = 0; i < s.Length; i++) + { + if (char.IsWhiteSpace(s[i])) + return true; + } + return false; + } + + /// + /// Determines whether the string is all white space. Empty string will return false. + /// + /// The string to test whether it is all white space. + /// + /// true if the string is all white space; otherwise, false. + /// + public static bool IsWhiteSpace(string s) + { + if (s == null) + throw new ArgumentNullException("s"); + + if (s.Length == 0) + return false; + + for (int i = 0; i < s.Length; i++) + { + if (!char.IsWhiteSpace(s[i])) + return false; + } + + return true; + } + + /// + /// Ensures the target string ends with the specified string. + /// + /// The target. + /// The value. + /// The target string with the value string at the end. + public static string EnsureEndsWith(string target, string value) + { + if (target == null) + throw new ArgumentNullException("target"); + + if (value == null) + throw new ArgumentNullException("value"); + + if (target.Length >= value.Length) + { + if (string.Compare(target, target.Length - value.Length, value, 0, value.Length, StringComparison.OrdinalIgnoreCase) == + 0) + return target; + + string trimmedString = target.TrimEnd(null); + + if (string.Compare(trimmedString, trimmedString.Length - value.Length, value, 0, value.Length, + StringComparison.OrdinalIgnoreCase) == 0) + return target; + } + + return target + value; + } + + /// + /// Determines whether the SqlString is null or empty. + /// + /// The string. + /// + /// true if the SqlString is null or empty; otherwise, false. + /// + public static bool IsNullOrEmpty(SqlString s) + { + if (s.IsNull) + return true; + else + return string.IsNullOrEmpty(s.Value); + } + + public static bool IsNullOrEmptyOrWhiteSpace(string s) + { + if (string.IsNullOrEmpty(s)) + return true; + else if (IsWhiteSpace(s)) + return true; + else + return false; + } + + /// + /// Perform an action if the string is not null or empty. + /// + /// The value. + /// The action to perform. + public static void IfNotNullOrEmpty(string value, Action action) + { + IfNotNullOrEmpty(value, action, null); + } + + private static void IfNotNullOrEmpty(string value, Action trueAction, Action falseAction) + { + if (!string.IsNullOrEmpty(value)) + { + if (trueAction != null) + trueAction(value); + } + else + { + if (falseAction != null) + falseAction(value); + } + } + + /// + /// Indents the specified string. + /// + /// The string to indent. + /// The number of characters to indent by. + /// + public static string Indent(string s, int indentation) + { + return Indent(s, indentation, ' '); + } + + /// + /// Indents the specified string. + /// + /// The string to indent. + /// The number of characters to indent by. + /// The indent character. + /// + public static string Indent(string s, int indentation, char indentChar) + { + if (s == null) + throw new ArgumentNullException("s"); + + if (indentation <= 0) + throw new ArgumentException("Must be greater than zero.", "indentation"); + + StringReader sr = new StringReader(s); + StringWriter sw = new StringWriter(CultureInfo.InvariantCulture); + + ActionTextReaderLine(sr, sw, delegate(TextWriter tw, string line) + { + tw.Write(new string(indentChar, indentation)); + tw.Write(line); + }); + + return sw.ToString(); + } + + private delegate void ActionLine(TextWriter textWriter, string line); + + private static void ActionTextReaderLine(TextReader textReader, TextWriter textWriter, ActionLine lineAction) + { + string line; + bool firstLine = true; + while ((line = textReader.ReadLine()) != null) + { + if (!firstLine) + textWriter.WriteLine(); + else + firstLine = false; + + lineAction(textWriter, line); + } + } + + /// + /// Numbers the lines. + /// + /// The string to number. + /// + public static string NumberLines(string s) + { + if (s == null) + throw new ArgumentNullException("s"); + + StringReader sr = new StringReader(s); + StringWriter sw = new StringWriter(CultureInfo.InvariantCulture); + + int lineNumber = 1; + + ActionTextReaderLine(sr, sw, delegate(TextWriter tw, string line) + { + tw.Write(lineNumber.ToString(CultureInfo.InvariantCulture).PadLeft(4)); + tw.Write(". "); + tw.Write(line); + + lineNumber++; + }); + + return sw.ToString(); + } + + /// + /// Nulls an empty string. + /// + /// The string. + /// Null if the string was null, otherwise the string unchanged. + public static string NullEmptyString(string s) + { + return (string.IsNullOrEmpty(s)) ? null : s; + } + + public static string ReplaceNewLines(string s, string replacement) + { + StringReader sr = new StringReader(s); + StringBuilder sb = new StringBuilder(); + + bool first = true; + + string line; + while ((line = sr.ReadLine()) != null) + { + if (first) + first = false; + else + sb.Append(replacement); + + sb.Append(line); + } + + return sb.ToString(); + } + + public static string RemoveHtml(string s) + { + return RemoveHtmlInternal(s, null); + } + + public static string RemoveHtml(string s, IList removeTags) + { + if (removeTags == null) + throw new ArgumentNullException("removeTags"); + + return RemoveHtmlInternal(s, removeTags); + } + + private static string RemoveHtmlInternal(string s, IList removeTags) + { + List removeTagsUpper = null; + + if (removeTags != null) + { + removeTagsUpper = new List(removeTags.Count); + + foreach (string tag in removeTags) + { + removeTagsUpper.Add(tag.ToUpperInvariant()); + } + } + + Regex anyTag = new Regex(@"<[/]{0,1}\s*(?\w*)\s*(?.*?=['""].*?[""'])*?\s*[/]{0,1}>", RegexOptions.Compiled); + + return anyTag.Replace(s, delegate(Match match) + { + string tag = match.Groups["tag"].Value.ToUpperInvariant(); + + if (removeTagsUpper == null) + return string.Empty; + else if (removeTagsUpper.Contains(tag)) + return string.Empty; + else + return match.Value; + }); + } + + public static string Truncate(string s, int maximumLength) + { + return Truncate(s, maximumLength, "..."); + } + + public static string Truncate(string s, int maximumLength, string suffix) + { + if (suffix == null) + throw new ArgumentNullException("suffix"); + + if (maximumLength <= 0) + throw new ArgumentException("Maximum length must be greater than zero.", "maximumLength"); + + int subStringLength = maximumLength - suffix.Length; + + if (subStringLength <= 0) + throw new ArgumentException("Length of suffix string is greater or equal to maximumLength"); + + if (s != null && s.Length > maximumLength) + { + string truncatedString = s.Substring(0, subStringLength); + // incase the last character is a space + truncatedString = truncatedString.Trim(); + truncatedString += suffix; + + return truncatedString; + } + else + { + return s; + } + } + + public static StringWriter CreateStringWriter(int capacity) + { + StringBuilder sb = new StringBuilder(capacity); + StringWriter sw = new StringWriter(sb, CultureInfo.InvariantCulture); + + return sw; + } + + public static int? GetLength(string value) + { + if (value == null) + return null; + else + return value.Length; + } + + public static string ToCharAsUnicode(char c) + { + using (StringWriter w = new StringWriter(CultureInfo.InvariantCulture)) + { + WriteCharAsUnicode(w, c); + return w.ToString(); + } + } + + public static void WriteCharAsUnicode(TextWriter writer, char c) + { + ValidationUtils.ArgumentNotNull(writer, "writer"); + + char h1 = MathUtils.IntToHex((c >> 12) & '\x000f'); + char h2 = MathUtils.IntToHex((c >> 8) & '\x000f'); + char h3 = MathUtils.IntToHex((c >> 4) & '\x000f'); + char h4 = MathUtils.IntToHex(c & '\x000f'); + + writer.Write('\\'); + writer.Write('u'); + writer.Write(h1); + writer.Write(h2); + writer.Write(h3); + writer.Write(h4); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/ValidationUtils.cs b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/ValidationUtils.cs new file mode 100644 index 0000000..1d4d723 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/Utilities/ValidationUtils.cs @@ -0,0 +1,149 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Globalization; + +namespace Newtonsoft.Json.Utilities +{ + internal static class ValidationUtils + { + public const string EmailAddressRegex = @"^([a-zA-Z0-9_'+*$%\^&!\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9:]{2,4})+$"; + public const string CurrencyRegex = @"(^\$?(?!0,?\d)\d{1,3}(,?\d{3})*(\.\d\d)?)$"; + public const string DateRegex = + @"^(((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00|[048])))$"; + public const string NumericRegex = @"\d*"; + + public static void ArgumentNotNullOrEmpty(string value, string parameterName) + { + if (value == null) + throw new ArgumentNullException(parameterName); + + if (value.Length == 0) + throw new ArgumentException("'{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName), parameterName); + } + + public static void ArgumentNotNullOrEmptyOrWhitespace(string value, string parameterName) + { + ArgumentNotNullOrEmpty(value, parameterName); + + if (StringUtils.IsWhiteSpace(value)) + throw new ArgumentException("'{0}' cannot only be whitespace.".FormatWith(CultureInfo.InvariantCulture, parameterName), parameterName); + } + + public static void ArgumentTypeIsEnum(Type enumType, string parameterName) + { + ArgumentNotNull(enumType, "enumType"); + + if (!enumType.IsEnum) + throw new ArgumentException("Type {0} is not an Enum.".FormatWith(CultureInfo.InvariantCulture, enumType), parameterName); + } + + public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName) + { + ArgumentNotNullOrEmpty(collection, parameterName, "Collection '{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName)); + } + + public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName, string message) + { + if (collection == null) + throw new ArgumentNullException(parameterName); + + if (collection.Count == 0) + throw new ArgumentException(message, parameterName); + } + + public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName) + { + ArgumentNotNullOrEmpty(collection, parameterName, "Collection '{0}' cannot be empty.".FormatWith(CultureInfo.InvariantCulture, parameterName)); + } + + public static void ArgumentNotNullOrEmpty(ICollection collection, string parameterName, string message) + { + if (collection == null) + throw new ArgumentNullException(parameterName); + + if (collection.Count == 0) + throw new ArgumentException(message, parameterName); + } + + public static void ArgumentNotNull(object value, string parameterName) + { + if (value == null) + throw new ArgumentNullException(parameterName); + } + + public static void ArgumentNotNegative(int value, string parameterName) + { + if (value <= 0) + throw new ArgumentOutOfRangeException(parameterName, value, "Argument cannot be negative."); + } + + public static void ArgumentNotNegative(int value, string parameterName, string message) + { + if (value <= 0) + throw new ArgumentOutOfRangeException(parameterName, value, message); + } + + public static void ArgumentNotZero(int value, string parameterName) + { + if (value == 0) + throw new ArgumentOutOfRangeException(parameterName, value, "Argument cannot be zero."); + } + + public static void ArgumentNotZero(int value, string parameterName, string message) + { + if (value == 0) + throw new ArgumentOutOfRangeException(parameterName, value, message); + } + + public static void ArgumentIsPositive(T value, string parameterName) where T : struct, IComparable + { + if (value.CompareTo(default(T)) != 1) + throw new ArgumentOutOfRangeException(parameterName, value, "Positive number required."); + } + + public static void ArgumentIsPositive(int value, string parameterName, string message) + { + if (value > 0) + throw new ArgumentOutOfRangeException(parameterName, value, message); + } + + public static void ObjectNotDisposed(bool disposed, Type objectType) + { + if (disposed) + throw new ObjectDisposedException(objectType.Name); + } + + public static void ArgumentConditionTrue(bool condition, string parameterName, string message) + { + if (!condition) + throw new ArgumentException(message, parameterName); + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.XML b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.XML similarity index 98% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.XML rename to worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.XML index f960454..e84b1b5 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.XML +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.XML @@ -1,3995 +1,3995 @@ - - - - Newtonsoft.Json - - - - - Instructs the how to serialize the object. - - - - - Gets or sets the member serialization. - - The member serialization. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified member serialization. - - The member serialization. - - - - Specifies the member serialization options for the . - - - - - All members are serialized by default. Members can be excluded using the . - - - - - Only members must be marked with the are serialized. - - - - - Specifies how object creation is handled by the . - - - - - Reuse existing objects, create new objects when needed. - - - - - Only reuse existing objects. - - - - - Always create new objects. - - - - - Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). - - - - - Gets or sets the date time styles used when converting a date to and from JSON. - - The date time styles used when converting a date to and from JSON. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. - - - - - The time represented is local time. - - - - - The time represented is UTC. - - - - - The time represented is not specified as either local time or Coordinated Universal Time (UTC). - - - - - Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. - - - - - Converts an to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Checks if the attributeName is a namespace attribute. - - Attribute name to test. - The attribute name prefix if it has one, otherwise an empty string. - True if attribute name is for a namespace attribute, otherwise false. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Converts a object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class with the specified . - - The TextReader containing the XML data to read. - - - - Sets the current token and value. - - The new token. - The value. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Changes the to Closed. - - - - - Instructs the to always serialize the member with the specified name. - - - - - Gets or sets the name of the property. - - The name of the property. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified name. - - Name of the property. - - - - Instructs the not to serialize the public field or public read/write property value. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. - - - - - Gets or sets which character to use to quote attribute values. - - - - - Gets or sets which character to use for indenting when is set to Formatting.Indented. - - - - - Gets or sets a value indicating whether object names will be surrounded with quotes. - - - - - Creates an instance of the JsonWriter class using the specified . - - The TextWriter to write to. - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the specified end token. - - The end token to write. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - - - - - - Gets the name. - - The name. - - - - Initializes a new instance of the class. - - The name. - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - - true if the specified is equal to the current ; otherwise, false. - - The parameter is null. - - - - Equalses the specified function. - - The function. - - - - - Equalses the specified a. - - A. - The b. - - - - - Serves as a hash function for a particular type. - - - A hash code for the current . - - - - - Returns a that represents the current . - - - A that represents the current . - - - - - Implements the operator ==. - - A. - The b. - The result of the operator. - - - - Implements the operator !=. - - A. - The b. - The result of the operator. - - - - Converts an object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Represents a collection of . - - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Specifies the state of the reader. - - - - - The Read method has not been called. - - - - - The end of the file has been reached successfully. - - - - - Reader is at a property. - - - - - Reader is at the start of an object. - - - - - Reader is in an object. - - - - - Reader is at the start of an array. - - - - - Reader is in an array. - - - - - The Close method has been called. - - - - - Reader has just read a value. - - - - - Reader is at the start of a constructor. - - - - - Reader in a constructor. - - - - - An error occurred that prevents the read operation from continuing. - - - - - The end of the file has been reached successfully. - - - - - Gets the current reader state. - - The current reader state. - - - - Gets the quotation mark character used to enclose the value of a string. - - - - - Gets the type of the current Json token. - - - - - Gets the text value of the current Json token. - - - - - Gets The Common Language Runtime (CLR) type for the current Json token. - - - - - Gets the depth of the current token in the JSON document. - - The depth of the current token in the JSON document. - - - - Initializes a new instance of the class with the specified . - - - - - Reads the next Json token from the stream. - - true if the next token was read successfully; false if there are no more tokens to read. - - - - Skips the children of the current token. - - - - - Sets the current token. - - The new token. - - - - Sets the current token and value. - - The new token. - The value. - - - - Sets the state based on current token type. - - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - - - - Releases unmanaged and - optionally - managed resources - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Changes the to Closed. - - - - - Provides methods for converting between common language runtime types and JavaScript types. - - - - - Represents JavaScript's boolean value true as a string. This field is read-only. - - - - - Represents JavaScript's boolean value false as a string. This field is read-only. - - - - - Represents JavaScript's null as a string. This field is read-only. - - - - - Represents JavaScript's undefined as a string. This field is read-only. - - - - - Represents JavaScript's positive infinity as a string. This field is read-only. - - - - - Represents JavaScript's negative infinity as a string. This field is read-only. - - - - - Represents JavaScript's NaN as a string. This field is read-only. - - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - The string delimiter character. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Serializes the specified object to a JSON string. - - The object to serialize. - A JSON string representation of the object. - - - - Serializes the specified object to a JSON string using a collection of . - - The object to serialize. - A collection converters used while serializing. - A JSON string representation of the object. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The of object being deserialized. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The type of the object to deserialize. - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified JSON to the given anonymous type. - - - The anonymous type to deserialize to. This can't be specified - traditionally and must be infered from the anonymous type passed - as a parameter. - - The object to deserialize. - The anonymous type object. - The deserialized anonymous type from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The type of the object to deserialize. - The object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The object to deserialize. - The type of the object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Serializes the XML node to a JSON string. - - The node to serialize. - A JSON string of the XmlNode. - - - - Deserializes the XmlNode from a JSON string. - - The JSON string. - The deserialized XmlNode - - - - The exception thrown when an error occurs during Json serialization or deserialization. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - Serializes and deserializes objects into and from the Json format. - The enables you to control how objects are encoded into Json. - - - - - Get or set how reference loops (e.g. a class referencing itself) is handled. - - - - - Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. - - - - - Get or set how null values are handled during serialization and deserialization. - - - - - Gets or sets how objects are created during deserialization. - - The object creation handling. - - - - Gets a collection that will be used during serialization. - - Collection that will be used during serialization. - - - - Initializes a new instance of the class. - - - - - Deserializes the Json structure contained by the specified . - - The that contains the Json structure to deserialize. - The being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Gets the serializable members for the given . - - The object to get seralizable members for. - Seralizable members for the given type. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Contains the LINQ to JSON extension methods. - - - - - Returns a collection of tokens that contains the ancestors of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the ancestors of every node in the source collection. - - - - Returns a collection of tokens that contains the descendants of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the descendants of every node in the source collection. - - - - Returns a collection of child properties of every object in the source collection. - - An of that contains the source collection. - An of that contains the properties of every object in the source collection. - - - - Returns a collection of child values of every object in the source collection with the given key. - - An of that contains the source collection. - The token key. - An of that contains the values of every node in the source collection with the given key. - - - - Returns a collection of child values of every object in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child values of every object in the source collection with the given key. - - The type to convert the values to. - An of that contains the source collection. - The token key. - An that contains the converted values of every node in the source collection with the given key. - - - - Returns a collection of converted child values of every object in the source collection. - - The type to convert the values to. - An of that contains the source collection. - An that contains the converted values of every node in the source collection. - - - - Returns a collection of child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the converted values of every node in the source collection. - - - - Represents a JSON constructor. - - - - - Gets or sets the name of this constructor. - - The constructor name. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name. - - The constructor name. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a token that can contain other tokens. - - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Get the first child token of this token. - - - A containing the first child token of the . - - - - - Get the last child token of this token. - - - A containing the last child token of the . - - - - - Returns a collection of the child tokens of this token, in document order. - - - An of containing the child tokens of this , in document order. - - - - - Returns a collection of the child values of this token, in document order. - - - - A containing the child values of this , in document order. - - - - - Returns a collection of the descendant tokens for this token in document order. - - An containing the descendant tokens of the . - - - - Adds the specified content as children of this . - - The content to be added. - - - - Adds the specified content as the first children of this . - - The content to be added. - - - - Creates an that can be used to add tokens to the . - - An that is ready to have content written to it. - - - - Replaces the children nodes of this token with the specified content. - - The content. - - - - Removes the child nodes from this token. - - - - - Represents a collection of objects. - - The type of token - - - - An empty collection of objects. - - - - - Initializes a new instance of the struct. - - The enumerable. - - - - Returns an enumerator that iterates through the collection. - - - A that can be used to iterate through the collection. - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Gets the with the specified key. - - - - - - Represents a JSON object. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Gets the node type for this . - - The type. - - - - Gets an of this object's properties. - - An of this object's properties. - - - - Gets a the specified name. - - The property name. - A with the specified name or null. - - - - Gets an of this object's property values. - - An of this object's property values. - - - - Gets the with the specified key. - - The with the specified key. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Represents a JSON array. - - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Returns a count of this token's child tokens. - - A count of this token's child tokens. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class. - - The token to read from. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the token being writen. - - The token being writen. - - - - Initializes a new instance of the class writing to the given . - - The container being written to. - - - - Initializes a new instance of the class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end. - - The token. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Represents an abstract JSON token. - - - - - Gets or sets the parent. - - The parent. - - - - Gets the root of this . - - The root of this . - - - - Gets the node type for this . - - The type. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Compares the values of two tokens, including the values of all descendant tokens. - - The first to compare. - The second to compare. - true if the tokens are equal; otherwise false. - - - - Gets the next sibling token of this node. - - The that contains the next sibling token. - - - - Gets the previous sibling token of this node. - - The that contains the previous sibling token. - - - - Returns a collection of the ancestor tokens of this token. - - A collection of the ancestor tokens of this token. - - - - Returns a collection of the sibling tokens after this token, in document order. - - A collection of the sibling tokens after this tokens, in document order. - - - - Returns a collection of the sibling tokens before this token, in document order. - - A collection of the sibling tokens before this token, in document order. - - - - Gets the with the specified key. - - The with the specified key. - - - - Gets the with the specified key converted to the specified type. - - The type to convert the token to. - The token key. - The converted token value. - - - - Get the first child token of this token. - - A containing the first child token of the . - - - - Get the last child token of this token. - - A containing the last child token of the . - - - - Returns a collection of the child tokens of this token, in document order. - - An of containing the child tokens of this , in document order. - - - - Returns a collection of the child tokens of this token, in document order. - - A containing the child tokens of this , in document order. - - - - Returns a collection of the child values of this token, in document order. - - A containing the child values of this , in document order. - - - - Removes this token from its parent. - - - - - Replaces this token with the specified token. - - The value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Returns the indented JSON for this token. - - - A containing the indented JSON. - - - - - Returns the indented JSON for this token using any given converters. - - A collection of which will be used when writing the token. - - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Represents a JSON property. - - - - - Gets the property name. - - The property name. - - - - Gets or sets the property value. - - The property value. - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - The property name. - - - - Initializes a new instance of the class. - - The property name. - The property value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies the type of token. - - - - - No token type has been set. - - - - - A JSON object. - - - - - A JSON array. - - - - - A JSON constructor. - - - - - A JSON object property. - - - - - A comment. - - - - - An integer value. - - - - - A float value. - - - - - A string value. - - - - - A boolean value. - - - - - A null value. - - - - - An undefined value. - - - - - A date value. - - - - - Represents a value in JSON (string, integer, date, etc). - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Creates a comment with the given value. - - The value. - A comment with the given value. - - - - Creates a string with the given value. - - The value. - A string with the given value. - - - - Gets the node type for this . - - The type. - - - - Gets or sets the underlying token value. - - The underlying token value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies missing member handling options for the . - - - - - Throw a when a missing member is encountered during deserialization. - - - - - Ignore a missing member and do not attempt to deserialize it. - - - - - Specifies null value handling options for the . - - - - - Include null values when serializing and deserializing objects. - - - - - Ignore null values when serializing and deserializing objects. - - - - - Specifies reference loop handling options for the . - - - - - Throw a when a loop is encountered. - - - - - Ignore loop references and do not serialize. - - - - - Serialize loop references. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null, empty or its contents are uninitialized values. - - The list. - - true if the collection is null or empty or its contents are uninitialized values; otherwise, false. - - - - - Makes a slice of the specified list in between the start and end indexes. - - The list. - The start index. - The end index. - A slice of the list. - - - - Makes a slice of the specified list in between the start and end indexes, - getting every so many items based upon the step. - - The list. - The start index. - The end index. - The step. - A slice of the list. - - - - Group the collection using a function which returns the key. - - The source collection to group. - The key selector. - A Dictionary with each key relating to a list of objects in a list grouped under it. - - - - Adds the elements of the specified collection to the specified generic IList. - - The list to add to. - The collection of elements to add. - - - - Gets the type of the typed list's items. - - The type. - The type of the typed list's items. - - - - Tests whether the list's items are their unitialized value. - - The list. - Whether the list's items are their unitialized value - - - - Gets the member's underlying type. - - The member. - The underlying type of the member. - - - - Determines whether the member is an indexed property. - - The member. - - true if the member is an indexed property; otherwise, false. - - - - - Determines whether the property is an indexed property. - - The property. - - true if the property is an indexed property; otherwise, false. - - - - - Gets the member's value on the object. - - The member. - The target object. - The member's value on the object. - - - - Sets the member's value on the target object. - - The member. - The target. - The value. - - - - Determines whether the specified MemberInfo can be read. - - The MemberInfo to determine whether can be read. - - true if the specified MemberInfo can be read; otherwise, false. - - - - - Determines whether the specified MemberInfo can be set. - - The MemberInfo to determine whether can be set. - - true if the specified MemberInfo can be set; otherwise, false. - - - - - Determines whether the string contains white space. - - The string to test for white space. - - true if the string contains white space; otherwise, false. - - - - - Determines whether the string is all white space. Empty string will return false. - - The string to test whether it is all white space. - - true if the string is all white space; otherwise, false. - - - - - Ensures the target string ends with the specified string. - - The target. - The value. - The target string with the value string at the end. - - - - Determines whether the SqlString is null or empty. - - The string. - - true if the SqlString is null or empty; otherwise, false. - - - - - Perform an action if the string is not null or empty. - - The value. - The action to perform. - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - The indent character. - - - - - Numbers the lines. - - The string to number. - - - - - Nulls an empty string. - - The string. - Null if the string was null, otherwise the string unchanged. - - - - Specifies the type of Json token. - - - - - This is returned by the if a method has not been called. - - - - - An object start token. - - - - - An array start token. - - - - - An object property name. - - - - - A constructor end token. - - - - - A comment. - - - - - An interger. - - - - - A float. - - - - - A string. - - - - - A boolean. - - - - - A null token. - - - - - An undefined token. - - - - - An object end token. - - - - - An array end token. - - - - - A constructor start token. - - - - - A Date. - - - - - Specifies the state of the . - - - - - An exception has been thrown, which has left the in an invalid state. - You may call the method to put the in the Closed state. - Any other method calls results in an being thrown. - - - - - The method has been called. - - - - - An object is being written. - - - - - A array is being written. - - - - - A constructor is being written. - - - - - A property is being written. - - - - - A write method has not been called. - - - - - Specifies formatting options for the . - - - - - No special formatting is applied. This is the default. - - - - - Causes child objects to be indented according to the and settings. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the top. - - The top. - - - - Gets the state of the writer. - - - - - Indicates how the output is formatted. - - - - - Creates an instance of the JsonWriter class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the end of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the end of an array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end constructor. - - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes the end of the current Json object or array. - - - - - Writes the current token. - - The to read the token from. - - - - Writes the specified end token. - - The end token to write. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. - - - - - Provides a set of static (Shared in Visual Basic) methods for - querying objects that implement . - - - - - Returns the input typed as . - - - - - Returns an empty that has the - specified type argument. - - - - - Converts the elements of an to the - specified type. - - - - - Filters the elements of an based on a specified type. - - - - - Generates a sequence of integral numbers within a specified range. - - The value of the first integer in the sequence. - The number of sequential integers to generate. - - - - Generates a sequence that contains one repeated value. - - - - - Filters a sequence of values based on a predicate. - - - - - Filters a sequence of values based on a predicate. - Each element's index is used in the logic of the predicate function. - - - - - Projects each element of a sequence into a new form. - - - - - Projects each element of a sequence into a new form by - incorporating the element's index. - - - - - Projects each element of a sequence to an - and flattens the resulting sequences into one sequence. - - - - - Projects each element of a sequence to an , - and flattens the resulting sequences into one sequence. The - index of each source element is used in the projected form of - that element. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. The index of - each source element is used in the intermediate projected form - of that element. - - - - - Returns elements from a sequence as long as a specified condition is true. - - - - - Returns elements from a sequence as long as a specified condition is true. - The element's index is used in the logic of the predicate function. - - - - - Returns a specified number of contiguous elements from the start - of a sequence. - - - - - Base implementation of First operator. - - - - - Returns the first element of a sequence. - - - - - Returns the first element in a sequence that satisfies a specified condition. - - - - - Returns the first element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the first element of the sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Last operator. - - - - - Returns the last element of a sequence. - - - - - Returns the last element of a sequence that satisfies a - specified condition. - - - - - Returns the last element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the last element of a sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Single operator. - - - - - Returns the only element of a sequence, and throws an exception - if there is not exactly one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition, and throws an exception if more than one - such element exists. - - - - - Returns the only element of a sequence, or a default value if - the sequence is empty; this method throws an exception if there - is more than one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition or a default value if no such element - exists; this method throws an exception if more than one element - satisfies the condition. - - - - - Returns the element at a specified index in a sequence. - - - - - Returns the element at a specified index in a sequence or a - default value if the index is out of range. - - - - - Inverts the order of the elements in a sequence. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. The element's - index is used in the logic of the predicate function. - - - - - Bypasses a specified number of elements in a sequence and then - returns the remaining elements. - - - - - Returns the number of elements in a sequence. - - - - - Returns a number that represents how many elements in the - specified sequence satisfy a condition. - - - - - Returns an that represents the total number - of elements in a sequence. - - - - - Returns an that represents how many elements - in a sequence satisfy a condition. - - - - - Concatenates two sequences. - - - - - Creates a from an . - - - - - Creates an array from an . - - - - - Returns distinct elements from a sequence by using the default - equality comparer to compare values. - - - - - Returns distinct elements from a sequence by using a specified - to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and a key comparer. - - - - - Creates a from an - according to specified key - and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer and an element selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function and compares the keys by using a specified - comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and projects the elements for each group by - using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. - - - - - Groups the elements of a sequence according to a key selector - function. The keys are compared by using a comparer and each - group's elements are projected by using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The elements of each group are projected by using a - specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The keys are compared by using a specified comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. Key values are compared by using a specified comparer, - and the elements of each group are projected by using a - specified function. - - - - - Applies an accumulator function over a sequence. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value, and the - specified function is used to select the result value. - - - - - Produces the set union of two sequences by using the default - equality comparer. - - - - - Produces the set union of two sequences by using a specified - . - - - - - Returns the elements of the specified sequence or the type - parameter's default value in a singleton collection if the - sequence is empty. - - - - - Returns the elements of the specified sequence or the specified - value in a singleton collection if the sequence is empty. - - - - - Determines whether all elements of a sequence satisfy a condition. - - - - - Determines whether a sequence contains any elements. - - - - - Determines whether any element of a sequence satisfies a - condition. - - - - - Determines whether a sequence contains a specified element by - using the default equality comparer. - - - - - Determines whether a sequence contains a specified element by - using a specified . - - - - - Determines whether two sequences are equal by comparing the - elements by using the default equality comparer for their type. - - - - - Determines whether two sequences are equal by comparing their - elements by using a specified . - - - - - Base implementation for Min/Max operator. - - - - - Base implementation for Min/Max operator for nullable types. - - - - - Returns the minimum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the minimum resulting value. - - - - - Returns the maximum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the maximum resulting value. - - - - - Makes an enumerator seen as enumerable once more. - - - The supplied enumerator must have been started. The first element - returned is the element the enumerator was on when passed in. - DO NOT use this method if the caller must be a generator. It is - mostly safe among aggregate operations. - - - - - Sorts the elements of a sequence in ascending order according to a key. - - - - - Sorts the elements of a sequence in ascending order by using a - specified comparer. - - - - - Sorts the elements of a sequence in descending order according to a key. - - - - - Sorts the elements of a sequence in descending order by using a - specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order by using a specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order, according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order by using a specified comparer. - - - - - Base implementation for Intersect and Except operators. - - - - - Produces the set intersection of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set intersection of two sequences by using the - specified to compare values. - - - - - Produces the set difference of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set difference of two sequences by using the - specified to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and key comparer. - - - - - Creates a from an - according to specified key - selector and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer, and an element selector function. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. A - specified is used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. A specified - is used to compare keys. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Represents a collection of objects that have a common key. - - - - - Gets the key of the . - - - - - Defines an indexer, size property, and Boolean search method for - data structures that map keys to - sequences of values. - - - - - Represents a sorted sequence. - - - - - Performs a subsequent ordering on the elements of an - according to a key. - - - - - Represents a collection of keys each mapped to one or more values. - - - - - Gets the number of key/value collection pairs in the . - - - - - Gets the collection of values indexed by the specified key. - - - - - Determines whether a specified key is in the . - - - - - Applies a transform function to each key and its associated - values and returns the results. - - - - - Returns a generic enumerator that iterates through the . - - - - - This attribute allows us to define extension methods without - requiring .NET Framework 3.5. For more information, see the section, - Extension Methods in .NET Framework 2.0 Apps, - of Basic Instincts: Extension Methods - column in MSDN Magazine, - issue Nov 2007. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - + + + + Newtonsoft.Json + + + + + Instructs the how to serialize the object. + + + + + Gets or sets the member serialization. + + The member serialization. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Specifies the member serialization options for the . + + + + + All members are serialized by default. Members can be excluded using the . + + + + + Only members must be marked with the are serialized. + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + + + + + The time represented is local time. + + + + + The time represented is UTC. + + + + + The time represented is not specified as either local time or Coordinated Universal Time (UTC). + + + + + Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + + + + + Converts an to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Sets the current token and value. + + The new token. + The value. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Instructs the to always serialize the member with the specified name. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + + + + + + Gets the name. + + The name. + + + + Initializes a new instance of the class. + + The name. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + The parameter is null. + + + + Equalses the specified function. + + The function. + + + + + Equalses the specified a. + + A. + The b. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Implements the operator ==. + + A. + The b. + The result of the operator. + + + + Implements the operator !=. + + A. + The b. + The result of the operator. + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Represents a collection of . + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Gets the type of the current Json token. + + + + + Gets the text value of the current Json token. + + + + + Gets The Common Language Runtime (CLR) type for the current Json token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next Json token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Provides methods for converting between common language runtime types and JavaScript types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + The string delimiter character. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The type of the object to deserialize. + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The object to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The type of the object to deserialize. + The object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The object to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Serializes and deserializes objects into and from the Json format. + The enables you to control how objects are encoded into Json. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Initializes a new instance of the class. + + + + + Deserializes the Json structure contained by the specified . + + The that contains the Json structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Gets the serializable members for the given . + + The object to get seralizable members for. + Seralizable members for the given type. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Returns a collection of child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the converted values of every node in the source collection. + + + + Represents a JSON constructor. + + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a token that can contain other tokens. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets the node type for this . + + The type. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Gets the with the specified key. + + The with the specified key. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Represents a JSON array. + + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Returns a count of this token's child tokens. + + A count of this token's child tokens. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the token being writen. + + The token being writen. + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Represents an abstract JSON token. + + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order. + + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + A containing the indented JSON. + + + + + Returns the indented JSON for this token using any given converters. + + A collection of which will be used when writing the token. + + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Represents a JSON property. + + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + The property name. + + + + Initializes a new instance of the class. + + The property name. + The property value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies missing member handling options for the . + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null, empty or its contents are uninitialized values. + + The list. + + true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + + + + + Makes a slice of the specified list in between the start and end indexes. + + The list. + The start index. + The end index. + A slice of the list. + + + + Makes a slice of the specified list in between the start and end indexes, + getting every so many items based upon the step. + + The list. + The start index. + The end index. + The step. + A slice of the list. + + + + Group the collection using a function which returns the key. + + The source collection to group. + The key selector. + A Dictionary with each key relating to a list of objects in a list grouped under it. + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Gets the type of the typed list's items. + + The type. + The type of the typed list's items. + + + + Tests whether the list's items are their unitialized value. + + The list. + Whether the list's items are their unitialized value + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string contains white space. + + The string to test for white space. + + true if the string contains white space; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Ensures the target string ends with the specified string. + + The target. + The value. + The target string with the value string at the end. + + + + Determines whether the SqlString is null or empty. + + The string. + + true if the SqlString is null or empty; otherwise, false. + + + + + Perform an action if the string is not null or empty. + + The value. + The action to perform. + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + The indent character. + + + + + Numbers the lines. + + The string to number. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + An object property name. + + + + + A constructor end token. + + + + + A comment. + + + + + An interger. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor start token. + + + + + A Date. + + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Indicates how the output is formatted. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Provides a set of static (Shared in Visual Basic) methods for + querying objects that implement . + + + + + Returns the input typed as . + + + + + Returns an empty that has the + specified type argument. + + + + + Converts the elements of an to the + specified type. + + + + + Filters the elements of an based on a specified type. + + + + + Generates a sequence of integral numbers within a specified range. + + The value of the first integer in the sequence. + The number of sequential integers to generate. + + + + Generates a sequence that contains one repeated value. + + + + + Filters a sequence of values based on a predicate. + + + + + Filters a sequence of values based on a predicate. + Each element's index is used in the logic of the predicate function. + + + + + Projects each element of a sequence into a new form. + + + + + Projects each element of a sequence into a new form by + incorporating the element's index. + + + + + Projects each element of a sequence to an + and flattens the resulting sequences into one sequence. + + + + + Projects each element of a sequence to an , + and flattens the resulting sequences into one sequence. The + index of each source element is used in the projected form of + that element. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. The index of + each source element is used in the intermediate projected form + of that element. + + + + + Returns elements from a sequence as long as a specified condition is true. + + + + + Returns elements from a sequence as long as a specified condition is true. + The element's index is used in the logic of the predicate function. + + + + + Returns a specified number of contiguous elements from the start + of a sequence. + + + + + Base implementation of First operator. + + + + + Returns the first element of a sequence. + + + + + Returns the first element in a sequence that satisfies a specified condition. + + + + + Returns the first element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the first element of the sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Last operator. + + + + + Returns the last element of a sequence. + + + + + Returns the last element of a sequence that satisfies a + specified condition. + + + + + Returns the last element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the last element of a sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Single operator. + + + + + Returns the only element of a sequence, and throws an exception + if there is not exactly one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition, and throws an exception if more than one + such element exists. + + + + + Returns the only element of a sequence, or a default value if + the sequence is empty; this method throws an exception if there + is more than one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition or a default value if no such element + exists; this method throws an exception if more than one element + satisfies the condition. + + + + + Returns the element at a specified index in a sequence. + + + + + Returns the element at a specified index in a sequence or a + default value if the index is out of range. + + + + + Inverts the order of the elements in a sequence. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. The element's + index is used in the logic of the predicate function. + + + + + Bypasses a specified number of elements in a sequence and then + returns the remaining elements. + + + + + Returns the number of elements in a sequence. + + + + + Returns a number that represents how many elements in the + specified sequence satisfy a condition. + + + + + Returns an that represents the total number + of elements in a sequence. + + + + + Returns an that represents how many elements + in a sequence satisfy a condition. + + + + + Concatenates two sequences. + + + + + Creates a from an . + + + + + Creates an array from an . + + + + + Returns distinct elements from a sequence by using the default + equality comparer to compare values. + + + + + Returns distinct elements from a sequence by using a specified + to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and a key comparer. + + + + + Creates a from an + according to specified key + and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer and an element selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function and compares the keys by using a specified + comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and projects the elements for each group by + using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. + + + + + Groups the elements of a sequence according to a key selector + function. The keys are compared by using a comparer and each + group's elements are projected by using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The elements of each group are projected by using a + specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The keys are compared by using a specified comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. Key values are compared by using a specified comparer, + and the elements of each group are projected by using a + specified function. + + + + + Applies an accumulator function over a sequence. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value, and the + specified function is used to select the result value. + + + + + Produces the set union of two sequences by using the default + equality comparer. + + + + + Produces the set union of two sequences by using a specified + . + + + + + Returns the elements of the specified sequence or the type + parameter's default value in a singleton collection if the + sequence is empty. + + + + + Returns the elements of the specified sequence or the specified + value in a singleton collection if the sequence is empty. + + + + + Determines whether all elements of a sequence satisfy a condition. + + + + + Determines whether a sequence contains any elements. + + + + + Determines whether any element of a sequence satisfies a + condition. + + + + + Determines whether a sequence contains a specified element by + using the default equality comparer. + + + + + Determines whether a sequence contains a specified element by + using a specified . + + + + + Determines whether two sequences are equal by comparing the + elements by using the default equality comparer for their type. + + + + + Determines whether two sequences are equal by comparing their + elements by using a specified . + + + + + Base implementation for Min/Max operator. + + + + + Base implementation for Min/Max operator for nullable types. + + + + + Returns the minimum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the minimum resulting value. + + + + + Returns the maximum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the maximum resulting value. + + + + + Makes an enumerator seen as enumerable once more. + + + The supplied enumerator must have been started. The first element + returned is the element the enumerator was on when passed in. + DO NOT use this method if the caller must be a generator. It is + mostly safe among aggregate operations. + + + + + Sorts the elements of a sequence in ascending order according to a key. + + + + + Sorts the elements of a sequence in ascending order by using a + specified comparer. + + + + + Sorts the elements of a sequence in descending order according to a key. + + + + + Sorts the elements of a sequence in descending order by using a + specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order by using a specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order, according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order by using a specified comparer. + + + + + Base implementation for Intersect and Except operators. + + + + + Produces the set intersection of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set intersection of two sequences by using the + specified to compare values. + + + + + Produces the set difference of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set difference of two sequences by using the + specified to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and key comparer. + + + + + Creates a from an + according to specified key + selector and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer, and an element selector function. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. A + specified is used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. A specified + is used to compare keys. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Represents a collection of objects that have a common key. + + + + + Gets the key of the . + + + + + Defines an indexer, size property, and Boolean search method for + data structures that map keys to + sequences of values. + + + + + Represents a sorted sequence. + + + + + Performs a subsequent ordering on the elements of an + according to a key. + + + + + Represents a collection of keys each mapped to one or more values. + + + + + Gets the number of key/value collection pairs in the . + + + + + Gets the collection of values indexed by the specified key. + + + + + Determines whether a specified key is in the . + + + + + Applies a transform function to each key and its associated + values and returns the results. + + + + + Returns a generic enumerator that iterates through the . + + + + + This attribute allows us to define extension methods without + requiring .NET Framework 3.5. For more information, see the section, + Extension Methods in .NET Framework 2.0 Apps, + of Basic Instincts: Extension Methods + column in MSDN Magazine, + issue Nov 2007. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll new file mode 100644 index 0000000..0ee4521 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll differ diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.CodeAnalysisLog.xml b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.CodeAnalysisLog.xml new file mode 100644 index 0000000..cf6330b --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.CodeAnalysisLog.xml @@ -0,0 +1,589 @@ + + + + + + + + + + + + + + + + In externally visible method 'Identifier.Equals(Identifier)', validate parameter 'function' before using it. + + + + + + + + + + + Member 'JavaScriptConvert.ConvertDateTimeToJavaScriptTicks(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + In method 'JavaScriptConvert.DeserializeObject(string, Type, params JsonConverter[])', object 'sr' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. + + + In externally visible method 'JavaScriptConvert.DeserializeObject(string, Type, params JsonConverter[])', validate parameter 'converters' before using it. + + + + + + + In method 'JavaScriptConvert.SerializeObject(object, params JsonConverter[])', object 'sw' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'sw' before all references to it are out of scope. + + + In externally visible method 'JavaScriptConvert.SerializeObject(object, params JsonConverter[])', validate parameter 'converters' before using it. + + + + + + + Member 'JavaScriptConvert.ToString(DateTime)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JavaScriptConvert.ToString(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + In externally visible method 'JavaScriptConvert.ToString(Enum)', validate parameter 'value' before using it. + + + + + + + Member 'JavaScriptConvert.ToString(object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JavaScriptConvert.ToStringInternal(DateTimeOffset, DateTimeKind)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Not a valid close JsonToken: "'. + + + + + + + Correct the spelling of the unrecognized token 'JsonType' in the literal '"While setting the reader state back to current object an unexpected JsonType was..."'. + + + + + + + + + + + Correct the spelling of the unrecognized token 'seralizable' in the literal '"Null collection of seralizable members returned."'. + + + + + + + Member 'JsonSerializer.EnsureType(object, Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JsonSerializer.SerializeValue(JsonWriter, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + Correct the spelling of the unrecognized token 'encoutered' in the literal '"After parsing a value an unexpected character was encoutered: "'. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Invalid JsonToken: "'. + + + + + + + Member 'JsonTextWriter.WriteValue(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JsonType' in the literal '"Unknown JsonType: "'. + + + + + + + Member 'JsonWriter.WriteValue(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + + + + + In externally visible method 'HtmlColorConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. + + + + + + + + + + + Member 'IsoDateTimeConverter.CanConvert(Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'IsoDateTimeConverter.ReadJson(JsonReader, Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'IsoDateTimeConverter.ReadJson(JsonReader, Type)', validate parameter 'reader' before using it. + + + + + + + Member 'IsoDateTimeConverter.WriteJson(JsonWriter, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'IsoDateTimeConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. + + + + + + + + + + + Member 'JavaScriptDateTimeConverter.CanConvert(Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JavaScriptDateTimeConverter.ReadJson(JsonReader, Type)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'JavaScriptDateTimeConverter.ReadJson(JsonReader, Type)', validate parameter 'reader' before using it. + + + + + + + Member 'JavaScriptDateTimeConverter.WriteJson(JsonWriter, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'JavaScriptDateTimeConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Unexpected JsonToken when deserializing node: "'. + + + + + + + Correct the spelling of the unrecognized token 'JsonToken' in the literal '"Unexpected JsonToken: "'. + + + Correct the spelling of the unrecognized token 'XmlDeclaration' in the literal '"Unexpected property name encountered while deserializing XmlDeclaration: "'. + + + + + + + Correct the spelling of the unrecognized token 'XmlNodeType' in the literal '"Unexpected XmlNodeType when getting node name: "'. + + + + + + + Correct the spelling of the unrecognized token 'XmlDocuments' in the literal '"XmlNodeConverter only supports deserializing XmlDocuments"'. + + + Correct the spelling of the unrecognized token 'XmlNodeConverter' in the literal '"XmlNodeConverter can only convert JSON that begins with an object."'. + Correct the spelling of the unrecognized token 'XmlNodeConverter' in the literal '"XmlNodeConverter only supports deserializing XmlDocuments"'. + + + In externally visible method 'XmlNodeConverter.ReadJson(JsonReader, Type)', validate parameter 'reader' before using it. + + + + + + + Correct the spelling of the unrecognized token 'XmlNodeType' in the literal '"Unexpected XmlNodeType when serializing nodes: "'. + + + + + + + In externally visible method 'XmlNodeConverter.WriteJson(JsonWriter, object)', validate parameter 'writer' before using it. + + + + + + + + + + + + + + + Correct the spelling of the unrecognized token 'JArray' in the literal '"Error reading JArray from JsonReader."'. + Correct the spelling of the unrecognized token 'JArray' in the literal '"Error reading JArray from JsonReader."'. + + + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Current JsonReader item is not an object."'. + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JArray from JsonReader."'. + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JArray from JsonReader."'. + + + In externally visible method 'JArray.Load(JsonReader)', validate parameter 'reader' before using it. + + + + + + + In method 'JArray.Parse(string)', call System.IDisposable.Dispose on object 'new StringReader(json)' before all references to it are out of scope. + + + + + + + In externally visible method 'JArray.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + In externally visible method 'JConstructor.JConstructor(JConstructor)', validate parameter 'other' before using it. + + + + + + + In externally visible method 'JConstructor.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + Correct the spelling of the unrecognized token 'JObject' in the literal '"Error reading JObject from JsonReader."'. + Correct the spelling of the unrecognized token 'JObject' in the literal '"Error reading JObject from JsonReader."'. + + + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Current JsonReader item is not an object."'. + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JObject from JsonReader."'. + Correct the spelling of the unrecognized token 'JsonReader' in the literal '"Error reading JObject from JsonReader."'. + + + + + + + In method 'JObject.Parse(string)', call System.IDisposable.Dispose on object 'new StringReader(json)' before all references to it are out of scope. + + + + + + + In externally visible method 'JObject.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + In externally visible method 'JProperty.JProperty(JProperty)', validate parameter 'other' before using it. + + + + + + + In externally visible method 'JProperty.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + Member 'JsonTokenWriter.WriteValue(DateTimeOffset)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + Member 'JToken.explicit operator DateTimeOffset(JToken)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JToken.explicit operator DateTimeOffset?(JToken)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + + + + + In externally visible method 'JValue.JValue(JValue)', validate parameter 'other' before using it. + + + + + + + Member 'JValue.GetValueType(JsonTokenType?, object)' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + + + + + Member 'JValue.WriteTo(JsonWriter, params JsonConverter[])' uses type 'DateTimeOffset'. Because this type was introduced in .NET Framework 2.0 Service Pack 1, which was not included in the project's target framework, .NET Framework 2.0, your application may fail to run on systems without this service pack installed. + + + In externally visible method 'JValue.WriteTo(JsonWriter, params JsonConverter[])', validate parameter 'writer' before using it. + + + + + + + + + + + + + + + In externally visible method 'DictionaryWrapper<TKey, TValue>.CopyTo(KeyValuePair<TKey, TValue>[], int)', validate parameter 'array' before using it. + + + + + + + + + + + In method 'StringUtils.Indent(string, int, char)', call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. + In method 'StringUtils.Indent(string, int, char)', call System.IDisposable.Dispose on object 'sw' before all references to it are out of scope. + + + + + + + In method 'StringUtils.NumberLines(string)', call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. + In method 'StringUtils.NumberLines(string)', call System.IDisposable.Dispose on object 'sw' before all references to it are out of scope. + + + + + + + In method 'StringUtils.ReplaceNewLines(string, string)', call System.IDisposable.Dispose on object 'sr' before all references to it are out of scope. + + + + + + + + + + + + + + + Dispose objects before losing scope + If a disposable object is not explicitly disposed before all references to it are out of scope, the object will be disposed at some indeterminate time when the garbage collector runs the finalizer of the object. Because an exceptional event might occur that will prevent the finalizer of the object from running, the object should be explicitly disposed instead. + In method {0}, object {1} is not disposed along all exception paths. Call System.IDisposable.Dispose on object {1} before all references to it are out of scope. + In method {0}, call System.IDisposable.Dispose on object {1} before all references to it are out of scope. + RuleOwner + http://msdn.microsoft.com/library/ms182289.aspx + + Warning + + + + Literals should be spelled correctly + This rule parses the literal string into words, tokenizing compound words, and checks the spelling of each word/token. + Correct the spelling of the unrecognized token '{0}' in the literal '{1}'. + RuleOwner + http://msdn.microsoft.com/library/bb264488.aspx + + Warning + + + + Use only API from targeted framework + + Member {0} uses type {1}. Because this type was introduced in {2}, which was not included in the project's target framework, {3}, your application may fail to run on systems without this service pack installed. + + http://msdn.microsoft.com/library/cc667408(VS.100).aspx + [none] + Error + + + + Validate arguments of public methods + All reference arguments passed to externally visible methods should be checked against null (Nothing in VB). If appropriate, throw a System.ArgumentNullException when the argument is null. + In externally visible method {0}, validate parameter '{1}' before using it. + RuleOwner + http://msdn.microsoft.com/library/ms182182.aspx + + Warning + + + + + Category + Certainty + Collapse All + Check Id + Error + error(s) + Expand All + Help + Line + message(s) + [Location not stored in Pdb] + Project + Resolution + Rule + Rule File + Rule Description + Source + Status + Target + Warning + warning(s) + Code Analysis Report + + diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.lastcodeanalysissucceeded b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.dll.lastcodeanalysissucceeded new file mode 100644 index 0000000..e69de29 diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.pdb new file mode 100644 index 0000000..30faba7 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Debug/Newtonsoft.Json.pdb differ diff --git a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.XML b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Release/Newtonsoft.Json.XML similarity index 98% rename from worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.XML rename to worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Release/Newtonsoft.Json.XML index f960454..e84b1b5 100644 --- a/worldpay-lib-dotnet-2-0/Newtonsoft.Json/bin/Release/Newtonsoft.Json.XML +++ b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Release/Newtonsoft.Json.XML @@ -1,3995 +1,3995 @@ - - - - Newtonsoft.Json - - - - - Instructs the how to serialize the object. - - - - - Gets or sets the member serialization. - - The member serialization. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified member serialization. - - The member serialization. - - - - Specifies the member serialization options for the . - - - - - All members are serialized by default. Members can be excluded using the . - - - - - Only members must be marked with the are serialized. - - - - - Specifies how object creation is handled by the . - - - - - Reuse existing objects, create new objects when needed. - - - - - Only reuse existing objects. - - - - - Always create new objects. - - - - - Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). - - - - - Gets or sets the date time styles used when converting a date to and from JSON. - - The date time styles used when converting a date to and from JSON. - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. - - - - - The time represented is local time. - - - - - The time represented is UTC. - - - - - The time represented is not specified as either local time or Coordinated Universal Time (UTC). - - - - - Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. - - - - - Converts an to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Checks if the attributeName is a namespace attribute. - - Attribute name to test. - The attribute name prefix if it has one, otherwise an empty string. - True if attribute name is for a namespace attribute, otherwise false. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Converts a object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Determines whether this instance can convert the specified value type. - - Type of the value. - - true if this instance can convert the specified value type; otherwise, false. - - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class with the specified . - - The TextReader containing the XML data to read. - - - - Sets the current token and value. - - The new token. - The value. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Changes the to Closed. - - - - - Instructs the to always serialize the member with the specified name. - - - - - Gets or sets the name of the property. - - The name of the property. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class with the specified name. - - Name of the property. - - - - Instructs the not to serialize the public field or public read/write property value. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. - - - - - Gets or sets which character to use to quote attribute values. - - - - - Gets or sets which character to use for indenting when is set to Formatting.Indented. - - - - - Gets or sets a value indicating whether object names will be surrounded with quotes. - - - - - Creates an instance of the JsonWriter class using the specified . - - The TextWriter to write to. - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the specified end token. - - The end token to write. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - The exception thrown when an error occurs while reading Json text. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - - - - - - Gets the name. - - The name. - - - - Initializes a new instance of the class. - - The name. - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - - true if the specified is equal to the current ; otherwise, false. - - The parameter is null. - - - - Equalses the specified function. - - The function. - - - - - Equalses the specified a. - - A. - The b. - - - - - Serves as a hash function for a particular type. - - - A hash code for the current . - - - - - Returns a that represents the current . - - - A that represents the current . - - - - - Implements the operator ==. - - A. - The b. - The result of the operator. - - - - Implements the operator !=. - - A. - The b. - The result of the operator. - - - - Converts an object to and from JSON. - - - - - Writes the JSON representation of the object. - - The to write to. - The value. - - - - Reads the JSON representation of the object. - - The to read from. - Type of the object. - The object value. - - - - Determines whether this instance can convert the specified object type. - - Type of the object. - - true if this instance can convert the specified object type; otherwise, false. - - - - - Represents a collection of . - - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Specifies the state of the reader. - - - - - The Read method has not been called. - - - - - The end of the file has been reached successfully. - - - - - Reader is at a property. - - - - - Reader is at the start of an object. - - - - - Reader is in an object. - - - - - Reader is at the start of an array. - - - - - Reader is in an array. - - - - - The Close method has been called. - - - - - Reader has just read a value. - - - - - Reader is at the start of a constructor. - - - - - Reader in a constructor. - - - - - An error occurred that prevents the read operation from continuing. - - - - - The end of the file has been reached successfully. - - - - - Gets the current reader state. - - The current reader state. - - - - Gets the quotation mark character used to enclose the value of a string. - - - - - Gets the type of the current Json token. - - - - - Gets the text value of the current Json token. - - - - - Gets The Common Language Runtime (CLR) type for the current Json token. - - - - - Gets the depth of the current token in the JSON document. - - The depth of the current token in the JSON document. - - - - Initializes a new instance of the class with the specified . - - - - - Reads the next Json token from the stream. - - true if the next token was read successfully; false if there are no more tokens to read. - - - - Skips the children of the current token. - - - - - Sets the current token. - - The new token. - - - - Sets the current token and value. - - The new token. - The value. - - - - Sets the state based on current token type. - - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - - - - Releases unmanaged and - optionally - managed resources - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Changes the to Closed. - - - - - Provides methods for converting between common language runtime types and JavaScript types. - - - - - Represents JavaScript's boolean value true as a string. This field is read-only. - - - - - Represents JavaScript's boolean value false as a string. This field is read-only. - - - - - Represents JavaScript's null as a string. This field is read-only. - - - - - Represents JavaScript's undefined as a string. This field is read-only. - - - - - Represents JavaScript's positive infinity as a string. This field is read-only. - - - - - Represents JavaScript's negative infinity as a string. This field is read-only. - - - - - Represents JavaScript's NaN as a string. This field is read-only. - - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - The string delimiter character. - A Json string representation of the . - - - - Converts the to it's JavaScript string representation. - - The value to convert. - A Json string representation of the . - - - - Serializes the specified object to a JSON string. - - The object to serialize. - A JSON string representation of the object. - - - - Serializes the specified object to a JSON string using a collection of . - - The object to serialize. - A collection converters used while serializing. - A JSON string representation of the object. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The object to deserialize. - The of object being deserialized. - The deserialized object from the Json string. - - - - Deserializes the specified object to a Json object. - - The type of the object to deserialize. - The object to deserialize. - The deserialized object from the Json string. - - - - Deserializes the specified JSON to the given anonymous type. - - - The anonymous type to deserialize to. This can't be specified - traditionally and must be infered from the anonymous type passed - as a parameter. - - The object to deserialize. - The anonymous type object. - The deserialized anonymous type from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The type of the object to deserialize. - The object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Deserializes the JSON string to the specified type. - - The object to deserialize. - The type of the object to deserialize. - Converters to use while deserializing. - The deserialized object from the JSON string. - - - - Serializes the XML node to a JSON string. - - The node to serialize. - A JSON string of the XmlNode. - - - - Deserializes the XmlNode from a JSON string. - - The JSON string. - The deserialized XmlNode - - - - The exception thrown when an error occurs during Json serialization or deserialization. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class - with a specified error message. - - The error message that explains the reason for the exception. - - - - Initializes a new instance of the class - with a specified error message and a reference to the inner exception that is the cause of this exception. - - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - - Serializes and deserializes objects into and from the Json format. - The enables you to control how objects are encoded into Json. - - - - - Get or set how reference loops (e.g. a class referencing itself) is handled. - - - - - Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. - - - - - Get or set how null values are handled during serialization and deserialization. - - - - - Gets or sets how objects are created during deserialization. - - The object creation handling. - - - - Gets a collection that will be used during serialization. - - Collection that will be used during serialization. - - - - Initializes a new instance of the class. - - - - - Deserializes the Json structure contained by the specified . - - The that contains the Json structure to deserialize. - The being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Deserializes the Json structure contained by the specified - into an instance of the specified type. - - The containing the object. - The of object being deserialized. - The instance of being deserialized. - - - - Gets the serializable members for the given . - - The object to get seralizable members for. - Seralizable members for the given type. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Serializes the specified and writes the Json structure - to a Stream using the specified . - - The used to write the Json structure. - The to serialize. - - - - Contains the LINQ to JSON extension methods. - - - - - Returns a collection of tokens that contains the ancestors of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the ancestors of every node in the source collection. - - - - Returns a collection of tokens that contains the descendants of every token in the source collection. - - The type of the objects in source, constrained to . - An of that contains the source collection. - An of that contains the descendants of every node in the source collection. - - - - Returns a collection of child properties of every object in the source collection. - - An of that contains the source collection. - An of that contains the properties of every object in the source collection. - - - - Returns a collection of child values of every object in the source collection with the given key. - - An of that contains the source collection. - The token key. - An of that contains the values of every node in the source collection with the given key. - - - - Returns a collection of child values of every object in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child values of every object in the source collection with the given key. - - The type to convert the values to. - An of that contains the source collection. - The token key. - An that contains the converted values of every node in the source collection with the given key. - - - - Returns a collection of converted child values of every object in the source collection. - - The type to convert the values to. - An of that contains the source collection. - An that contains the converted values of every node in the source collection. - - - - Returns a collection of child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the values of every node in the source collection. - - - - Returns a collection of converted child tokens of every array in the source collection. - - An of that contains the source collection. - An of that contains the converted values of every node in the source collection. - - - - Represents a JSON constructor. - - - - - Gets or sets the name of this constructor. - - The constructor name. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name and content. - - The constructor name. - The contents of the constructor. - - - - Initializes a new instance of the class with the specified name. - - The constructor name. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a token that can contain other tokens. - - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Get the first child token of this token. - - - A containing the first child token of the . - - - - - Get the last child token of this token. - - - A containing the last child token of the . - - - - - Returns a collection of the child tokens of this token, in document order. - - - An of containing the child tokens of this , in document order. - - - - - Returns a collection of the child values of this token, in document order. - - - - A containing the child values of this , in document order. - - - - - Returns a collection of the descendant tokens for this token in document order. - - An containing the descendant tokens of the . - - - - Adds the specified content as children of this . - - The content to be added. - - - - Adds the specified content as the first children of this . - - The content to be added. - - - - Creates an that can be used to add tokens to the . - - An that is ready to have content written to it. - - - - Replaces the children nodes of this token with the specified content. - - The content. - - - - Removes the child nodes from this token. - - - - - Represents a collection of objects. - - The type of token - - - - An empty collection of objects. - - - - - Initializes a new instance of the struct. - - The enumerable. - - - - Returns an enumerator that iterates through the collection. - - - A that can be used to iterate through the collection. - - - - - Returns an enumerator that iterates through a collection. - - - An object that can be used to iterate through the collection. - - - - - Gets the with the specified key. - - - - - - Represents a JSON object. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Initializes a new instance of the class with the specified content. - - The contents of the object. - - - - Gets the node type for this . - - The type. - - - - Gets an of this object's properties. - - An of this object's properties. - - - - Gets a the specified name. - - The property name. - A with the specified name or null. - - - - Gets an of this object's property values. - - An of this object's property values. - - - - Gets the with the specified key. - - The with the specified key. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Represents a JSON array. - - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Initializes a new instance of the class with the specified content. - - The contents of the array. - - - - Returns a count of this token's child tokens. - - A count of this token's child tokens. - - - - Loads an from a . - - A that will be read for the content of the . - A that contains the XML that was read from the specified . - - - - Load a from a string that contains JSON. - - A that contains JSON. - A populated from the string that contains JSON. - - - - Creates a from an object. - - The object that will be used to create . - A with the values of the specified object - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Gets the with the specified key. - - The with the specified key. - - - - Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. - - - - - Initializes a new instance of the class. - - The token to read from. - - - - Reads the next Json token from the stream. - - - true if the next token was read successfully; false if there are no more tokens to read. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the token being writen. - - The token being writen. - - - - Initializes a new instance of the class writing to the given . - - The container being written to. - - - - Initializes a new instance of the class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end. - - The token. - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Represents an abstract JSON token. - - - - - Gets or sets the parent. - - The parent. - - - - Gets the root of this . - - The root of this . - - - - Gets the node type for this . - - The type. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Compares the values of two tokens, including the values of all descendant tokens. - - The first to compare. - The second to compare. - true if the tokens are equal; otherwise false. - - - - Gets the next sibling token of this node. - - The that contains the next sibling token. - - - - Gets the previous sibling token of this node. - - The that contains the previous sibling token. - - - - Returns a collection of the ancestor tokens of this token. - - A collection of the ancestor tokens of this token. - - - - Returns a collection of the sibling tokens after this token, in document order. - - A collection of the sibling tokens after this tokens, in document order. - - - - Returns a collection of the sibling tokens before this token, in document order. - - A collection of the sibling tokens before this token, in document order. - - - - Gets the with the specified key. - - The with the specified key. - - - - Gets the with the specified key converted to the specified type. - - The type to convert the token to. - The token key. - The converted token value. - - - - Get the first child token of this token. - - A containing the first child token of the . - - - - Get the last child token of this token. - - A containing the last child token of the . - - - - Returns a collection of the child tokens of this token, in document order. - - An of containing the child tokens of this , in document order. - - - - Returns a collection of the child tokens of this token, in document order. - - A containing the child tokens of this , in document order. - - - - Returns a collection of the child values of this token, in document order. - - A containing the child values of this , in document order. - - - - Removes this token from its parent. - - - - - Replaces this token with the specified token. - - The value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Returns the indented JSON for this token. - - - A containing the indented JSON. - - - - - Returns the indented JSON for this token using any given converters. - - A collection of which will be used when writing the token. - - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Performs an explicit conversion from to . - - The value. - The result of the conversion. - - - - Represents a JSON property. - - - - - Gets the property name. - - The property name. - - - - Gets or sets the property value. - - The property value. - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Gets the node type for this . - - The type. - - - - Initializes a new instance of the class. - - The property name. - - - - Initializes a new instance of the class. - - The property name. - The property value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies the type of token. - - - - - No token type has been set. - - - - - A JSON object. - - - - - A JSON array. - - - - - A JSON constructor. - - - - - A JSON object property. - - - - - A comment. - - - - - An integer value. - - - - - A float value. - - - - - A string value. - - - - - A boolean value. - - - - - A null value. - - - - - An undefined value. - - - - - A date value. - - - - - Represents a value in JSON (string, integer, date, etc). - - - - - Initializes a new instance of the class from another object. - - A object to copy from. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Initializes a new instance of the class with the given value. - - The value. - - - - Gets a value indicating whether this token has childen tokens. - - - true if this token has child values; otherwise, false. - - - - - Creates a comment with the given value. - - The value. - A comment with the given value. - - - - Creates a string with the given value. - - The value. - A string with the given value. - - - - Gets the node type for this . - - The type. - - - - Gets or sets the underlying token value. - - The underlying token value. - - - - Writes this token to a . - - A into which this method will write. - A collection of which will be used when writing the token. - - - - Specifies missing member handling options for the . - - - - - Throw a when a missing member is encountered during deserialization. - - - - - Ignore a missing member and do not attempt to deserialize it. - - - - - Specifies null value handling options for the . - - - - - Include null values when serializing and deserializing objects. - - - - - Ignore null values when serializing and deserializing objects. - - - - - Specifies reference loop handling options for the . - - - - - Throw a when a loop is encountered. - - - - - Ignore loop references and do not serialize. - - - - - Serialize loop references. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null or empty. - - The collection. - - true if the collection is null or empty; otherwise, false. - - - - - Determines whether the collection is null, empty or its contents are uninitialized values. - - The list. - - true if the collection is null or empty or its contents are uninitialized values; otherwise, false. - - - - - Makes a slice of the specified list in between the start and end indexes. - - The list. - The start index. - The end index. - A slice of the list. - - - - Makes a slice of the specified list in between the start and end indexes, - getting every so many items based upon the step. - - The list. - The start index. - The end index. - The step. - A slice of the list. - - - - Group the collection using a function which returns the key. - - The source collection to group. - The key selector. - A Dictionary with each key relating to a list of objects in a list grouped under it. - - - - Adds the elements of the specified collection to the specified generic IList. - - The list to add to. - The collection of elements to add. - - - - Gets the type of the typed list's items. - - The type. - The type of the typed list's items. - - - - Tests whether the list's items are their unitialized value. - - The list. - Whether the list's items are their unitialized value - - - - Gets the member's underlying type. - - The member. - The underlying type of the member. - - - - Determines whether the member is an indexed property. - - The member. - - true if the member is an indexed property; otherwise, false. - - - - - Determines whether the property is an indexed property. - - The property. - - true if the property is an indexed property; otherwise, false. - - - - - Gets the member's value on the object. - - The member. - The target object. - The member's value on the object. - - - - Sets the member's value on the target object. - - The member. - The target. - The value. - - - - Determines whether the specified MemberInfo can be read. - - The MemberInfo to determine whether can be read. - - true if the specified MemberInfo can be read; otherwise, false. - - - - - Determines whether the specified MemberInfo can be set. - - The MemberInfo to determine whether can be set. - - true if the specified MemberInfo can be set; otherwise, false. - - - - - Determines whether the string contains white space. - - The string to test for white space. - - true if the string contains white space; otherwise, false. - - - - - Determines whether the string is all white space. Empty string will return false. - - The string to test whether it is all white space. - - true if the string is all white space; otherwise, false. - - - - - Ensures the target string ends with the specified string. - - The target. - The value. - The target string with the value string at the end. - - - - Determines whether the SqlString is null or empty. - - The string. - - true if the SqlString is null or empty; otherwise, false. - - - - - Perform an action if the string is not null or empty. - - The value. - The action to perform. - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - - - - - Indents the specified string. - - The string to indent. - The number of characters to indent by. - The indent character. - - - - - Numbers the lines. - - The string to number. - - - - - Nulls an empty string. - - The string. - Null if the string was null, otherwise the string unchanged. - - - - Specifies the type of Json token. - - - - - This is returned by the if a method has not been called. - - - - - An object start token. - - - - - An array start token. - - - - - An object property name. - - - - - A constructor end token. - - - - - A comment. - - - - - An interger. - - - - - A float. - - - - - A string. - - - - - A boolean. - - - - - A null token. - - - - - An undefined token. - - - - - An object end token. - - - - - An array end token. - - - - - A constructor start token. - - - - - A Date. - - - - - Specifies the state of the . - - - - - An exception has been thrown, which has left the in an invalid state. - You may call the method to put the in the Closed state. - Any other method calls results in an being thrown. - - - - - The method has been called. - - - - - An object is being written. - - - - - A array is being written. - - - - - A constructor is being written. - - - - - A property is being written. - - - - - A write method has not been called. - - - - - Specifies formatting options for the . - - - - - No special formatting is applied. This is the default. - - - - - Causes child objects to be indented according to the and settings. - - - - - Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. - - - - - Gets the top. - - The top. - - - - Gets the state of the writer. - - - - - Indicates how the output is formatted. - - - - - Creates an instance of the JsonWriter class. - - - - - Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. - - - - - Closes this stream and the underlying stream. - - - - - Writes the beginning of a Json object. - - - - - Writes the end of a Json object. - - - - - Writes the beginning of a Json array. - - - - - Writes the end of an array. - - - - - Writes the start of a constructor with the given name. - - The name of the constructor. - - - - Writes the end constructor. - - - - - Writes the property name of a name/value pair on a Json object. - - The name of the property. - - - - Writes the end of the current Json object or array. - - - - - Writes the current token. - - The to read the token from. - - - - Writes the specified end token. - - The end token to write. - - - - Writes indent characters. - - - - - Writes the JSON value delimiter. - - - - - Writes an indent space. - - - - - Writes a null value. - - - - - Writes an undefined value. - - - - - Writes raw JavaScript manually. - - The raw JavaScript to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes a value. - - The value to write. - - - - Writes out a comment /*...*/ containing the specified text. - - Text to place inside the comment. - - - - Writes out the given white space. - - The string of white space characters. - - - - Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. - - - - - Provides a set of static (Shared in Visual Basic) methods for - querying objects that implement . - - - - - Returns the input typed as . - - - - - Returns an empty that has the - specified type argument. - - - - - Converts the elements of an to the - specified type. - - - - - Filters the elements of an based on a specified type. - - - - - Generates a sequence of integral numbers within a specified range. - - The value of the first integer in the sequence. - The number of sequential integers to generate. - - - - Generates a sequence that contains one repeated value. - - - - - Filters a sequence of values based on a predicate. - - - - - Filters a sequence of values based on a predicate. - Each element's index is used in the logic of the predicate function. - - - - - Projects each element of a sequence into a new form. - - - - - Projects each element of a sequence into a new form by - incorporating the element's index. - - - - - Projects each element of a sequence to an - and flattens the resulting sequences into one sequence. - - - - - Projects each element of a sequence to an , - and flattens the resulting sequences into one sequence. The - index of each source element is used in the projected form of - that element. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. - - - - - Projects each element of a sequence to an , - flattens the resulting sequences into one sequence, and invokes - a result selector function on each element therein. The index of - each source element is used in the intermediate projected form - of that element. - - - - - Returns elements from a sequence as long as a specified condition is true. - - - - - Returns elements from a sequence as long as a specified condition is true. - The element's index is used in the logic of the predicate function. - - - - - Returns a specified number of contiguous elements from the start - of a sequence. - - - - - Base implementation of First operator. - - - - - Returns the first element of a sequence. - - - - - Returns the first element in a sequence that satisfies a specified condition. - - - - - Returns the first element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the first element of the sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Last operator. - - - - - Returns the last element of a sequence. - - - - - Returns the last element of a sequence that satisfies a - specified condition. - - - - - Returns the last element of a sequence, or a default value if - the sequence contains no elements. - - - - - Returns the last element of a sequence that satisfies a - condition or a default value if no such element is found. - - - - - Base implementation of Single operator. - - - - - Returns the only element of a sequence, and throws an exception - if there is not exactly one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition, and throws an exception if more than one - such element exists. - - - - - Returns the only element of a sequence, or a default value if - the sequence is empty; this method throws an exception if there - is more than one element in the sequence. - - - - - Returns the only element of a sequence that satisfies a - specified condition or a default value if no such element - exists; this method throws an exception if more than one element - satisfies the condition. - - - - - Returns the element at a specified index in a sequence. - - - - - Returns the element at a specified index in a sequence or a - default value if the index is out of range. - - - - - Inverts the order of the elements in a sequence. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. - - - - - Bypasses elements in a sequence as long as a specified condition - is true and then returns the remaining elements. The element's - index is used in the logic of the predicate function. - - - - - Bypasses a specified number of elements in a sequence and then - returns the remaining elements. - - - - - Returns the number of elements in a sequence. - - - - - Returns a number that represents how many elements in the - specified sequence satisfy a condition. - - - - - Returns an that represents the total number - of elements in a sequence. - - - - - Returns an that represents how many elements - in a sequence satisfy a condition. - - - - - Concatenates two sequences. - - - - - Creates a from an . - - - - - Creates an array from an . - - - - - Returns distinct elements from a sequence by using the default - equality comparer to compare values. - - - - - Returns distinct elements from a sequence by using a specified - to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and a key comparer. - - - - - Creates a from an - according to specified key - and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer and an element selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function. - - - - - Groups the elements of a sequence according to a specified key - selector function and compares the keys by using a specified - comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and projects the elements for each group by - using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. - - - - - Groups the elements of a sequence according to a key selector - function. The keys are compared by using a comparer and each - group's elements are projected by using a specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The elements of each group are projected by using a - specified function. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. The keys are compared by using a specified comparer. - - - - - Groups the elements of a sequence according to a specified key - selector function and creates a result value from each group and - its key. Key values are compared by using a specified comparer, - and the elements of each group are projected by using a - specified function. - - - - - Applies an accumulator function over a sequence. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value. - - - - - Applies an accumulator function over a sequence. The specified - seed value is used as the initial accumulator value, and the - specified function is used to select the result value. - - - - - Produces the set union of two sequences by using the default - equality comparer. - - - - - Produces the set union of two sequences by using a specified - . - - - - - Returns the elements of the specified sequence or the type - parameter's default value in a singleton collection if the - sequence is empty. - - - - - Returns the elements of the specified sequence or the specified - value in a singleton collection if the sequence is empty. - - - - - Determines whether all elements of a sequence satisfy a condition. - - - - - Determines whether a sequence contains any elements. - - - - - Determines whether any element of a sequence satisfies a - condition. - - - - - Determines whether a sequence contains a specified element by - using the default equality comparer. - - - - - Determines whether a sequence contains a specified element by - using a specified . - - - - - Determines whether two sequences are equal by comparing the - elements by using the default equality comparer for their type. - - - - - Determines whether two sequences are equal by comparing their - elements by using a specified . - - - - - Base implementation for Min/Max operator. - - - - - Base implementation for Min/Max operator for nullable types. - - - - - Returns the minimum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the minimum resulting value. - - - - - Returns the maximum value in a generic sequence. - - - - - Invokes a transform function on each element of a generic - sequence and returns the maximum resulting value. - - - - - Makes an enumerator seen as enumerable once more. - - - The supplied enumerator must have been started. The first element - returned is the element the enumerator was on when passed in. - DO NOT use this method if the caller must be a generator. It is - mostly safe among aggregate operations. - - - - - Sorts the elements of a sequence in ascending order according to a key. - - - - - Sorts the elements of a sequence in ascending order by using a - specified comparer. - - - - - Sorts the elements of a sequence in descending order according to a key. - - - - - Sorts the elements of a sequence in descending order by using a - specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - ascending order by using a specified comparer. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order, according to a key. - - - - - Performs a subsequent ordering of the elements in a sequence in - descending order by using a specified comparer. - - - - - Base implementation for Intersect and Except operators. - - - - - Produces the set intersection of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set intersection of two sequences by using the - specified to compare values. - - - - - Produces the set difference of two sequences by using the - default equality comparer to compare values. - - - - - Produces the set difference of two sequences by using the - specified to compare values. - - - - - Creates a from an - according to a specified key - selector function. - - - - - Creates a from an - according to a specified key - selector function and key comparer. - - - - - Creates a from an - according to specified key - selector and element selector functions. - - - - - Creates a from an - according to a specified key - selector function, a comparer, and an element selector function. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. - - - - - Correlates the elements of two sequences based on matching keys. - The default equality comparer is used to compare keys. A - specified is used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. - - - - - Correlates the elements of two sequences based on equality of - keys and groups the results. The default equality comparer is - used to compare keys. A specified - is used to compare keys. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Computes the sum of a sequence of nullable values. - - - - - Computes the sum of a sequence of nullable - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of nullable values. - - - - - Computes the average of a sequence of nullable values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Computes the sum of a sequence of values. - - - - - Computes the sum of a sequence of - values that are obtained by invoking a transform function on - each element of the input sequence. - - - - - Computes the average of a sequence of values. - - - - - Computes the average of a sequence of values - that are obtained by invoking a transform function on each - element of the input sequence. - - - - - Returns the minimum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the minimum nullable value. - - - - - Returns the maximum value in a sequence of nullable - values. - - - - - Invokes a transform function on each element of a sequence and - returns the maximum nullable value. - - - - - Represents a collection of objects that have a common key. - - - - - Gets the key of the . - - - - - Defines an indexer, size property, and Boolean search method for - data structures that map keys to - sequences of values. - - - - - Represents a sorted sequence. - - - - - Performs a subsequent ordering on the elements of an - according to a key. - - - - - Represents a collection of keys each mapped to one or more values. - - - - - Gets the number of key/value collection pairs in the . - - - - - Gets the collection of values indexed by the specified key. - - - - - Determines whether a specified key is in the . - - - - - Applies a transform function to each key and its associated - values and returns the results. - - - - - Returns a generic enumerator that iterates through the . - - - - - This attribute allows us to define extension methods without - requiring .NET Framework 3.5. For more information, see the section, - Extension Methods in .NET Framework 2.0 Apps, - of Basic Instincts: Extension Methods - column in MSDN Magazine, - issue Nov 2007. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - - This type is not intended to be used directly from user code. - It may be removed or changed in a future version without notice. - - - - + + + + Newtonsoft.Json + + + + + Instructs the how to serialize the object. + + + + + Gets or sets the member serialization. + + The member serialization. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Specifies the member serialization options for the . + + + + + All members are serialized by default. Members can be excluded using the . + + + + + Only members must be marked with the are serialized. + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + + + + + The time represented is local time. + + + + + The time represented is UTC. + + + + + The time represented is not specified as either local time or Coordinated Universal Time (UTC). + + + + + Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + + + + + Converts an to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Sets the current token and value. + + The new token. + The value. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Instructs the to always serialize the member with the specified name. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + + + + + + Gets the name. + + The name. + + + + Initializes a new instance of the class. + + The name. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + The parameter is null. + + + + Equalses the specified function. + + The function. + + + + + Equalses the specified a. + + A. + The b. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Implements the operator ==. + + A. + The b. + The result of the operator. + + + + Implements the operator !=. + + A. + The b. + The result of the operator. + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Represents a collection of . + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Gets the type of the current Json token. + + + + + Gets the text value of the current Json token. + + + + + Gets The Common Language Runtime (CLR) type for the current Json token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next Json token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Provides methods for converting between common language runtime types and JavaScript types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + The string delimiter character. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The type of the object to deserialize. + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The object to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The type of the object to deserialize. + The object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The object to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Serializes and deserializes objects into and from the Json format. + The enables you to control how objects are encoded into Json. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Initializes a new instance of the class. + + + + + Deserializes the Json structure contained by the specified . + + The that contains the Json structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Gets the serializable members for the given . + + The object to get seralizable members for. + Seralizable members for the given type. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Returns a collection of child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the converted values of every node in the source collection. + + + + Represents a JSON constructor. + + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a token that can contain other tokens. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets the node type for this . + + The type. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Gets the with the specified key. + + The with the specified key. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Represents a JSON array. + + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Returns a count of this token's child tokens. + + A count of this token's child tokens. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the token being writen. + + The token being writen. + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Represents an abstract JSON token. + + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order. + + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + A containing the indented JSON. + + + + + Returns the indented JSON for this token using any given converters. + + A collection of which will be used when writing the token. + + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Represents a JSON property. + + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + The property name. + + + + Initializes a new instance of the class. + + The property name. + The property value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies missing member handling options for the . + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null, empty or its contents are uninitialized values. + + The list. + + true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + + + + + Makes a slice of the specified list in between the start and end indexes. + + The list. + The start index. + The end index. + A slice of the list. + + + + Makes a slice of the specified list in between the start and end indexes, + getting every so many items based upon the step. + + The list. + The start index. + The end index. + The step. + A slice of the list. + + + + Group the collection using a function which returns the key. + + The source collection to group. + The key selector. + A Dictionary with each key relating to a list of objects in a list grouped under it. + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Gets the type of the typed list's items. + + The type. + The type of the typed list's items. + + + + Tests whether the list's items are their unitialized value. + + The list. + Whether the list's items are their unitialized value + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string contains white space. + + The string to test for white space. + + true if the string contains white space; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Ensures the target string ends with the specified string. + + The target. + The value. + The target string with the value string at the end. + + + + Determines whether the SqlString is null or empty. + + The string. + + true if the SqlString is null or empty; otherwise, false. + + + + + Perform an action if the string is not null or empty. + + The value. + The action to perform. + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + The indent character. + + + + + Numbers the lines. + + The string to number. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + An object property name. + + + + + A constructor end token. + + + + + A comment. + + + + + An interger. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor start token. + + + + + A Date. + + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Indicates how the output is formatted. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Provides a set of static (Shared in Visual Basic) methods for + querying objects that implement . + + + + + Returns the input typed as . + + + + + Returns an empty that has the + specified type argument. + + + + + Converts the elements of an to the + specified type. + + + + + Filters the elements of an based on a specified type. + + + + + Generates a sequence of integral numbers within a specified range. + + The value of the first integer in the sequence. + The number of sequential integers to generate. + + + + Generates a sequence that contains one repeated value. + + + + + Filters a sequence of values based on a predicate. + + + + + Filters a sequence of values based on a predicate. + Each element's index is used in the logic of the predicate function. + + + + + Projects each element of a sequence into a new form. + + + + + Projects each element of a sequence into a new form by + incorporating the element's index. + + + + + Projects each element of a sequence to an + and flattens the resulting sequences into one sequence. + + + + + Projects each element of a sequence to an , + and flattens the resulting sequences into one sequence. The + index of each source element is used in the projected form of + that element. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. The index of + each source element is used in the intermediate projected form + of that element. + + + + + Returns elements from a sequence as long as a specified condition is true. + + + + + Returns elements from a sequence as long as a specified condition is true. + The element's index is used in the logic of the predicate function. + + + + + Returns a specified number of contiguous elements from the start + of a sequence. + + + + + Base implementation of First operator. + + + + + Returns the first element of a sequence. + + + + + Returns the first element in a sequence that satisfies a specified condition. + + + + + Returns the first element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the first element of the sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Last operator. + + + + + Returns the last element of a sequence. + + + + + Returns the last element of a sequence that satisfies a + specified condition. + + + + + Returns the last element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the last element of a sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Single operator. + + + + + Returns the only element of a sequence, and throws an exception + if there is not exactly one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition, and throws an exception if more than one + such element exists. + + + + + Returns the only element of a sequence, or a default value if + the sequence is empty; this method throws an exception if there + is more than one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition or a default value if no such element + exists; this method throws an exception if more than one element + satisfies the condition. + + + + + Returns the element at a specified index in a sequence. + + + + + Returns the element at a specified index in a sequence or a + default value if the index is out of range. + + + + + Inverts the order of the elements in a sequence. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. The element's + index is used in the logic of the predicate function. + + + + + Bypasses a specified number of elements in a sequence and then + returns the remaining elements. + + + + + Returns the number of elements in a sequence. + + + + + Returns a number that represents how many elements in the + specified sequence satisfy a condition. + + + + + Returns an that represents the total number + of elements in a sequence. + + + + + Returns an that represents how many elements + in a sequence satisfy a condition. + + + + + Concatenates two sequences. + + + + + Creates a from an . + + + + + Creates an array from an . + + + + + Returns distinct elements from a sequence by using the default + equality comparer to compare values. + + + + + Returns distinct elements from a sequence by using a specified + to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and a key comparer. + + + + + Creates a from an + according to specified key + and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer and an element selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function and compares the keys by using a specified + comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and projects the elements for each group by + using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. + + + + + Groups the elements of a sequence according to a key selector + function. The keys are compared by using a comparer and each + group's elements are projected by using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The elements of each group are projected by using a + specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The keys are compared by using a specified comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. Key values are compared by using a specified comparer, + and the elements of each group are projected by using a + specified function. + + + + + Applies an accumulator function over a sequence. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value, and the + specified function is used to select the result value. + + + + + Produces the set union of two sequences by using the default + equality comparer. + + + + + Produces the set union of two sequences by using a specified + . + + + + + Returns the elements of the specified sequence or the type + parameter's default value in a singleton collection if the + sequence is empty. + + + + + Returns the elements of the specified sequence or the specified + value in a singleton collection if the sequence is empty. + + + + + Determines whether all elements of a sequence satisfy a condition. + + + + + Determines whether a sequence contains any elements. + + + + + Determines whether any element of a sequence satisfies a + condition. + + + + + Determines whether a sequence contains a specified element by + using the default equality comparer. + + + + + Determines whether a sequence contains a specified element by + using a specified . + + + + + Determines whether two sequences are equal by comparing the + elements by using the default equality comparer for their type. + + + + + Determines whether two sequences are equal by comparing their + elements by using a specified . + + + + + Base implementation for Min/Max operator. + + + + + Base implementation for Min/Max operator for nullable types. + + + + + Returns the minimum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the minimum resulting value. + + + + + Returns the maximum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the maximum resulting value. + + + + + Makes an enumerator seen as enumerable once more. + + + The supplied enumerator must have been started. The first element + returned is the element the enumerator was on when passed in. + DO NOT use this method if the caller must be a generator. It is + mostly safe among aggregate operations. + + + + + Sorts the elements of a sequence in ascending order according to a key. + + + + + Sorts the elements of a sequence in ascending order by using a + specified comparer. + + + + + Sorts the elements of a sequence in descending order according to a key. + + + + + Sorts the elements of a sequence in descending order by using a + specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order by using a specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order, according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order by using a specified comparer. + + + + + Base implementation for Intersect and Except operators. + + + + + Produces the set intersection of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set intersection of two sequences by using the + specified to compare values. + + + + + Produces the set difference of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set difference of two sequences by using the + specified to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and key comparer. + + + + + Creates a from an + according to specified key + selector and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer, and an element selector function. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. A + specified is used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. A specified + is used to compare keys. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Represents a collection of objects that have a common key. + + + + + Gets the key of the . + + + + + Defines an indexer, size property, and Boolean search method for + data structures that map keys to + sequences of values. + + + + + Represents a sorted sequence. + + + + + Performs a subsequent ordering on the elements of an + according to a key. + + + + + Represents a collection of keys each mapped to one or more values. + + + + + Gets the number of key/value collection pairs in the . + + + + + Gets the collection of values indexed by the specified key. + + + + + Determines whether a specified key is in the . + + + + + Applies a transform function to each key and its associated + values and returns the results. + + + + + Returns a generic enumerator that iterates through the . + + + + + This attribute allows us to define extension methods without + requiring .NET Framework 3.5. For more information, see the section, + Extension Methods in .NET Framework 2.0 Apps, + of Basic Instincts: Extension Methods + column in MSDN Magazine, + issue Nov 2007. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Release/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Release/Newtonsoft.Json.dll new file mode 100644 index 0000000..a81b347 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Release/Newtonsoft.Json.dll differ diff --git a/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Release/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Release/Newtonsoft.Json.pdb new file mode 100644 index 0000000..2851c63 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Newtonsoft.Json/bin/Release/Newtonsoft.Json.pdb differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/App.config b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/App.config new file mode 100644 index 0000000..9ade02a --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/App.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/OrderServiceTest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/OrderServiceTest.cs new file mode 100644 index 0000000..bae2852 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/OrderServiceTest.cs @@ -0,0 +1,357 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Test +{ + [TestClass] + public class OrderServiceTest + { + /// + /// Authorization service, for obtaining access tokens + /// + private AuthService _authService; + + /// + /// Order service, for handling interaction with the order API + /// + private OrderService _orderService; + + /// + /// Initialise the service clients + /// + [TestInitialize] + public void Setup() + { + var restClient = new WorldpayRestClient(Configuration.ServiceKey); + _authService = restClient.GetAuthService(); + _orderService = restClient.GetOrderService(); + } + + /// + /// Verify that creating an order works for a valid token + /// + [TestMethod] + public void ShouldCreateOrderForValidToken() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.amount); + Assert.IsNotNull(response.customerIdentifiers); + } + + [TestMethod] + public void ShouldCreateTelephoneOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.orderType = OrderType.MOTO.ToString(); + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.amount); + Assert.IsNotNull(response.customerIdentifiers); + } + + [TestMethod] + public void ShouldCreateAuthorizationRequest() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.authorizeOnly = true; + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.authorizedAmount); + Assert.IsTrue(response.authorizeOnly); + Assert.AreEqual(OrderStatus.AUTHORIZED, response.paymentStatus); + } + + [TestMethod] + public void ShouldCapturePaymentForAuthorizedOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.authorizeOnly = true; + + string orderCode = _orderService.Create(orderRequest).orderCode; + + OrderResponse response = _orderService.CaptureAuthorizedOrder(orderCode); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.authorizedAmount); + Assert.AreEqual(1999, response.amount); + Assert.AreEqual(OrderStatus.SUCCESS, response.paymentStatus); + } + + [TestMethod] + public void ShouldPartiallyCapturePaymentForAuthorizedOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.authorizeOnly = true; + + string orderCode = _orderService.Create(orderRequest).orderCode; + + OrderResponse response = _orderService.CaptureAuthorizedOrder(orderCode, 500); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.authorizedAmount); + Assert.AreEqual(500, response.amount); + Assert.AreEqual(OrderStatus.SUCCESS, response.paymentStatus); + } + + [TestMethod] + public void ShouldCancelPaymentForAuthorizedOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + orderRequest.authorizeOnly = true; + + string orderCode = _orderService.Create(orderRequest).orderCode; + + _orderService.CancelAuthorizedOrder(orderCode); + } + + /// + /// Verify that creating a 3DS order works + /// + [TestMethod] + public void ShouldCreate3DSOrder() + { + OrderRequest orderRequest = create3DSOrderRequest(); + orderRequest.token = CreateToken(); + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.amount); + Assert.IsNotNull(response.oneTime3DsToken); + Assert.IsTrue(response.is3DSOrder); + Assert.AreEqual(OrderStatus.PRE_AUTHORIZED, response.paymentStatus); + } + + /// + /// Verify that creating a APM order works + /// + [TestMethod] + public void ShouldCreateAPMOrder() + { + OrderRequest orderRequest = createAPMOrderRequest(); + orderRequest.token = CreateAPMToken(); + + OrderResponse response = _orderService.Create(orderRequest); + + Assert.IsNotNull(response.redirectURL); + Assert.IsNotNull(response.orderCode); + Assert.AreEqual(1999, response.amount); + Assert.IsFalse(response.is3DSOrder); + + Assert.AreEqual(OrderStatus.PRE_AUTHORIZED, response.paymentStatus); + } + + /// + /// Vefiy that authorize 3DS Order works + /// + [TestMethod] + public void ShouldAuthorize3DSOrder() + { + OrderRequest orderRequest = create3DSOrderRequest(); + orderRequest.token = CreateToken(); + + OrderResponse response = _orderService.Create(orderRequest); + + var threeDSInfo = new ThreeDSecureInfo() + { + shopperIpAddress = "127.0.0.1", + shopperSessionId = "sessionId", + shopperUserAgent = "Mozilla/v1", + shopperAcceptHeader = "application/json" + }; + + var authorizationResponse = _orderService.Authorize(response.orderCode, "IDENTIFIED", threeDSInfo); + + Assert.AreEqual(response.orderCode, authorizationResponse.orderCode); + Assert.AreEqual(1999, authorizationResponse.amount); + Assert.IsTrue(response.is3DSOrder); + Assert.AreEqual(OrderStatus.SUCCESS, authorizationResponse.paymentStatus); + } + + /// + /// Vefiy that authorize APM Order works + /// + [Ignore] + [TestMethod] + public void ShouldAuthorizeAPMOrder() + { + //We need to amend the simulator to auto submit the form and send notifications automatically in order to unit test this + } + + /// + /// Verify that refunding the order works + /// + [TestMethod] + public void ShouldRefundOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + + string orderCode = _orderService.Create(orderRequest).orderCode; + Assert.IsNotNull(orderCode); + + _orderService.Refund(orderCode); + } + + [TestMethod] + public void ShouldGetExistingOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + string orderCode = _orderService.Create(orderRequest).orderCode; + + TransferOrder order = _orderService.FindOrder(orderCode); + + Assert.AreEqual(orderCode, order.orderCode); + } + + [TestMethod] + public void ShouldPartiallyRefundOrder() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = CreateToken(); + + string orderCode = _orderService.Create(orderRequest).orderCode; + Assert.IsNotNull(orderCode); + + _orderService.Refund(orderCode, 500); + } + + /// + /// Verify that an exception is thrown when creating an order with an invalid token + /// + [TestMethod] + public void ShouldThrowExceptionForInvalidToken() + { + OrderRequest orderRequest = createOrderRequest(); + orderRequest.token = "invalid-token"; + + try + { + _orderService.Create(orderRequest); + } + catch (WorldpayException e) + { + Assert.AreEqual("TKN_NOT_FOUND", e.apiError.customCode); + } + } + + private string CreateToken() + { + return TestHelpers.CreateToken(_authService); + } + + private string CreateAPMToken() + { + return TestHelpers.CreateAPMToken(_authService); + } + + /// + /// Create an order request + /// + private OrderRequest createOrderRequest() + { + var orderRequest = new OrderRequest(); + orderRequest.amount = 1999; + orderRequest.currencyCode = CurrencyCode.GBP.ToString(); + orderRequest.name = "test name"; + orderRequest.orderDescription = "test description"; + + var address = new Address(); + address.address1 = "line 1"; + address.address2 = "line 2"; + address.city = "city"; + address.countryCode = CountryCode.GB.ToString(); + address.postalCode = "AB1 2CD"; + orderRequest.billingAddress = address; + + var customerIdentifiers = new Dictionary(); + customerIdentifiers["test key 1"] = "test value 1"; + + orderRequest.customerIdentifiers = customerIdentifiers; + return orderRequest; + } + + /// + /// Create a 3DS order request + /// + private OrderRequest create3DSOrderRequest() + { + var orderRequest = new OrderRequest(); + orderRequest.amount = 1999; + orderRequest.currencyCode = CurrencyCode.GBP.ToString(); + orderRequest.name = "3D"; + orderRequest.orderDescription = "test description"; + + var threeDSInfo = new ThreeDSecureInfo(); + threeDSInfo.shopperIpAddress = "127.0.0.1"; + threeDSInfo.shopperSessionId = "sessionId"; + threeDSInfo.shopperUserAgent = "Mozilla/v1"; + threeDSInfo.shopperAcceptHeader = "application/json"; + orderRequest.threeDSecureInfo = threeDSInfo; + orderRequest.is3DSOrder = true; + + var address = new Address(); + address.address1 = "line 1"; + address.address2 = "line 2"; + address.city = "city"; + address.countryCode = CountryCode.GB.ToString(); + address.postalCode = "AB1 2CD"; + orderRequest.billingAddress = address; + + var customerIdentifiers = new Dictionary(); + customerIdentifiers["test key 1"] = "test value 1"; + + orderRequest.customerIdentifiers = customerIdentifiers; + return orderRequest; + } + + /// + /// Create a APM order request + /// + private OrderRequest createAPMOrderRequest() + { + var orderRequest = new OrderRequest(); + orderRequest.amount = 1999; + orderRequest.successUrl = "http://www.testurl.com/success"; + orderRequest.cancelUrl = "http://www.testurl.com/cancel"; + orderRequest.failureUrl = "http://www.testurl.com/failure"; + orderRequest.pendingUrl = "http://www.testurl.com/pending"; + + orderRequest.currencyCode = CurrencyCode.GBP.ToString(); + orderRequest.name = "Test"; + orderRequest.orderDescription = "test description"; + orderRequest.is3DSOrder = false; + + var address = new Address(); + address.address1 = "line 1"; + address.address2 = "line 2"; + address.city = "city"; + address.countryCode = CountryCode.GB.ToString(); + address.postalCode = "AB1 2CD"; + orderRequest.billingAddress = address; + + var customerIdentifiers = new Dictionary(); + customerIdentifiers["test key 1"] = "test value 1"; + + orderRequest.customerIdentifiers = customerIdentifiers; + return orderRequest; + } + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/Properties/AssemblyInfo.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d1cb43e --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +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("Worldpay.Sdk.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Worldpay.Sdk.Test")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[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("ebd2e2b4-30db-4587-af69-ab905785d5e9")] + +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/SettingsServiceTest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/SettingsServiceTest.cs new file mode 100644 index 0000000..0d13de9 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/SettingsServiceTest.cs @@ -0,0 +1,71 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Test +{ + [TestClass] + public class SettingsServiceTest + { + private SettingsService _settingsService; + + private const string MerchantId = "01346fe3-86b7-40d4-9406-a4646e9fa520"; + + [TestInitialize] + public void Setup() + { + var restClient = new WorldpayRestClient(Configuration.ServiceKey); + _settingsService = restClient.GetSettingsService(); + } + + [TestMethod] + public void TestGetSettings() + { + SettingsResponse settings = _settingsService.GetSettings(MerchantId); + + Assert.IsNotNull(settings); + } + + [Ignore] + [TestMethod] + public void TestUpdateBillingSettings() + { + _settingsService.UpdateRecurringBilling(MerchantId, true); + + SettingsResponse settings = _settingsService.GetSettings(MerchantId); + Assert.AreEqual(true, settings.orderSetting.optInForRecurringBilling); + + _settingsService.UpdateRecurringBilling(MerchantId, true); + + settings = _settingsService.GetSettings(MerchantId); + Assert.AreEqual(false, settings.orderSetting.optInForRecurringBilling); + } + + [TestMethod] + public void TestUpdateRiskSettings() + { + var riskSetting = new RiskSetting() + { + avsEnabled = false, + cvcEnabled = true + }; + + _settingsService.UpdateRiskSettings(MerchantId, riskSetting); + + var settings = _settingsService.GetSettings(MerchantId); + Assert.AreEqual(false, settings.riskSetting.avsEnabled); + Assert.AreEqual(true, settings.riskSetting.cvcEnabled); + + riskSetting = new RiskSetting() + { + avsEnabled = true, + cvcEnabled = false + }; + _settingsService.UpdateRiskSettings(MerchantId, riskSetting); + + settings = _settingsService.GetSettings(MerchantId); + Assert.AreEqual(true, settings.riskSetting.avsEnabled); + Assert.AreEqual(false, settings.riskSetting.cvcEnabled); + } + } +} + diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/TestHelpers.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/TestHelpers.cs new file mode 100644 index 0000000..c89a995 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/TestHelpers.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Test +{ + class TestHelpers + { + /// + /// Test mastercard number + /// + const string TestMastercardNumber = "5555 5555 5555 4444"; + + /// + /// Test Cvv number + /// + const string TestCvv = "123"; + + /// + /// Create an access token + /// + internal static string CreateToken(AuthService authService) + { + var tokenRequest = new TokenRequest(); + tokenRequest.clientKey = Configuration.ClientKey; + + var cardRequest = new CardRequest(); + cardRequest.cardNumber = TestMastercardNumber; + cardRequest.cvc = TestCvv; + cardRequest.name = "csharplib client"; + cardRequest.expiryMonth = 2; + cardRequest.expiryYear = 2018; + cardRequest.type = "Card"; + + tokenRequest.paymentMethod = cardRequest; + + TokenResponse response = authService.GetToken(tokenRequest); + return response.token; + } + + /// + /// Create an APM token + /// + internal static string CreateAPMToken(AuthService authService) + { + var tokenRequest = new TokenRequest(); + tokenRequest.clientKey = Configuration.ClientKey; + + var cardRequest = new APMRequest(); + cardRequest.type = "APM"; + cardRequest.apmName = "PAYPAL"; + cardRequest.shopperCountryCode = "GB"; + cardRequest.apmFields = new Dictionary(); + + tokenRequest.paymentMethod = cardRequest; + + TokenResponse response = authService.GetToken(tokenRequest); + return response.token; + } + + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/TokenServiceTest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/TokenServiceTest.cs new file mode 100644 index 0000000..93c0770 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/TokenServiceTest.cs @@ -0,0 +1,56 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Worldpay.Sdk; +using Worldpay.Sdk.Models; +using Worldpay.Sdk.Test; + +namespace WorldPay.Sdk.Test +{ + [TestClass] + public class TokenServiceTest + { + /// + /// Authorization service, for obtaining access tokens + /// + private AuthService _authService; + + /// + /// Token service, for handling interaction with the token API + /// + private TokenService _tokenService; + + /// + /// Initialise the service clients + /// + [TestInitialize] + public void Setup() + { + var restClient = new WorldpayRestClient(Configuration.ServiceKey); + _authService = restClient.GetAuthService(); + _tokenService = restClient.GetTokenService(); + } + + /// + /// Verify that retrieving an existing token works + /// + [TestMethod] + public void ShouldRetrieveToken() + { + var token = CreateToken(); + + TokenResponse response = _tokenService.Get(token); + + Assert.AreEqual(token, response.token); + Assert.AreEqual("csharplib client", response.paymentMethod.name); + Assert.IsInstanceOfType(response.paymentMethod, typeof(PaymentResponse)); + Assert.AreEqual("**** **** **** 4444", ((PaymentResponse)response.paymentMethod).maskedCardNumber); + } + + /// + /// Create an access token + /// + private string CreateToken() + { + return TestHelpers.CreateToken(_authService); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/TransferServiceTest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/TransferServiceTest.cs new file mode 100644 index 0000000..217e6e8 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/TransferServiceTest.cs @@ -0,0 +1,32 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Worldpay.Sdk.Test +{ + [TestClass] + public class TransferServiceTest + { + private TransferService _transferService; + + [TestInitialize] + public void Setup() + { + var restClient = new WorldpayRestClient(Configuration.ServiceKey); + _transferService = restClient.GetTransferService(); + } + + [TestMethod] + public void TestGetTransfers() + { + var response = _transferService.GetTransfers(Configuration.MerchantId, null); + Assert.IsNotNull(response); + } + + [Ignore] + [TestMethod] + public void TestGetTransfer() + { + var response = _transferService.GetTransfer(Configuration.MerchantId); + Assert.IsNotNull(response); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/WebhookServiceTest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/WebhookServiceTest.cs new file mode 100644 index 0000000..2fb4cf7 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/WebhookServiceTest.cs @@ -0,0 +1,67 @@ +using System; +using System.IO; +using System.Net; +using System.Text; +using System.Web.Script.Serialization; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Test +{ + [TestClass] + public class WebhookServiceTest + { + [Ignore] + [TestMethod] + public void shouldLogOrderStatus() + { + var logFile = new FileInfo(Configuration.OrderLog); + logFile.Delete(); + + var adminCode = "testAdminCode"; + var environment = "test"; + var merchantId = "testMerchant"; + var notificationEventType = "ORDER CHANGED"; + var orderCode = "testCode"; + var status = OrderStatus.SUCCESS; + + var notification = new OrderChangeNotification() + { + adminCode = adminCode, + environment = environment, + merchantId = merchantId, + notificationEventType = notificationEventType, + orderCode = orderCode, + paymentStatus = status + }; + + var request = (HttpWebRequest) HttpWebRequest.Create(Configuration.WebhookUrl); + request.ContentType = "application/json"; + request.Method = "POST"; + + var serializedData = new JavaScriptSerializer().Serialize(notification); + var bytes = Encoding.ASCII.GetBytes(serializedData); + request.ContentLength = bytes.Length; + + using (Stream outputStream = request.GetRequestStream()) + { + outputStream.Write(bytes, 0, bytes.Length); + } + + using (var response = (HttpWebResponse)request.GetResponse()) + { + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + } + + using (var reader = new StreamReader(new FileStream(Configuration.OrderLog, FileMode.Open))) + { + var firstLine = reader.ReadLine(); + Assert.AreEqual(String.Format("{0}: {1} {2}", notificationEventType, orderCode, status.ToString()), firstLine); + + var secondLine = reader.ReadLine(); + Assert.AreEqual(null, secondLine); + } + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj new file mode 100644 index 0000000..f1e2cae --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/Worldpay.Sdk.Test.csproj @@ -0,0 +1,103 @@ + + + + Debug + AnyCPU + {F4C39D0A-B55F-4332-8933-257BA89BADA7} + Library + Properties + WorldPay.Sdk.Test + Worldpay.Sdk.Test + v4.6 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {d2ab0290-8b33-4467-a0df-975372b29e38} + Worldpay.Sdk + + + + + + + + + + False + + + False + + + False + + + False + + + + + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll new file mode 100644 index 0000000..b1a7c1b Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.dll new file mode 100644 index 0000000..a81b347 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.dll differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.pdb new file mode 100644 index 0000000..2851c63 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.pdb differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.xml b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.xml new file mode 100644 index 0000000..e84b1b5 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Newtonsoft.Json.xml @@ -0,0 +1,3995 @@ + + + + Newtonsoft.Json + + + + + Instructs the how to serialize the object. + + + + + Gets or sets the member serialization. + + The member serialization. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Specifies the member serialization options for the . + + + + + All members are serialized by default. Members can be excluded using the . + + + + + Only members must be marked with the are serialized. + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + + + + + The time represented is local time. + + + + + The time represented is UTC. + + + + + The time represented is not specified as either local time or Coordinated Universal Time (UTC). + + + + + Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + + + + + Converts an to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Sets the current token and value. + + The new token. + The value. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Instructs the to always serialize the member with the specified name. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + + + + + + Gets the name. + + The name. + + + + Initializes a new instance of the class. + + The name. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + The parameter is null. + + + + Equalses the specified function. + + The function. + + + + + Equalses the specified a. + + A. + The b. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Implements the operator ==. + + A. + The b. + The result of the operator. + + + + Implements the operator !=. + + A. + The b. + The result of the operator. + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Represents a collection of . + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Gets the type of the current Json token. + + + + + Gets the text value of the current Json token. + + + + + Gets The Common Language Runtime (CLR) type for the current Json token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next Json token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Provides methods for converting between common language runtime types and JavaScript types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + The string delimiter character. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The type of the object to deserialize. + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The object to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The type of the object to deserialize. + The object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The object to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Serializes and deserializes objects into and from the Json format. + The enables you to control how objects are encoded into Json. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Initializes a new instance of the class. + + + + + Deserializes the Json structure contained by the specified . + + The that contains the Json structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Gets the serializable members for the given . + + The object to get seralizable members for. + Seralizable members for the given type. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Returns a collection of child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the converted values of every node in the source collection. + + + + Represents a JSON constructor. + + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a token that can contain other tokens. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets the node type for this . + + The type. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Gets the with the specified key. + + The with the specified key. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Represents a JSON array. + + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Returns a count of this token's child tokens. + + A count of this token's child tokens. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the token being writen. + + The token being writen. + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Represents an abstract JSON token. + + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order. + + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + A containing the indented JSON. + + + + + Returns the indented JSON for this token using any given converters. + + A collection of which will be used when writing the token. + + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Represents a JSON property. + + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + The property name. + + + + Initializes a new instance of the class. + + The property name. + The property value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies missing member handling options for the . + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null, empty or its contents are uninitialized values. + + The list. + + true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + + + + + Makes a slice of the specified list in between the start and end indexes. + + The list. + The start index. + The end index. + A slice of the list. + + + + Makes a slice of the specified list in between the start and end indexes, + getting every so many items based upon the step. + + The list. + The start index. + The end index. + The step. + A slice of the list. + + + + Group the collection using a function which returns the key. + + The source collection to group. + The key selector. + A Dictionary with each key relating to a list of objects in a list grouped under it. + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Gets the type of the typed list's items. + + The type. + The type of the typed list's items. + + + + Tests whether the list's items are their unitialized value. + + The list. + Whether the list's items are their unitialized value + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string contains white space. + + The string to test for white space. + + true if the string contains white space; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Ensures the target string ends with the specified string. + + The target. + The value. + The target string with the value string at the end. + + + + Determines whether the SqlString is null or empty. + + The string. + + true if the SqlString is null or empty; otherwise, false. + + + + + Perform an action if the string is not null or empty. + + The value. + The action to perform. + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + The indent character. + + + + + Numbers the lines. + + The string to number. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + An object property name. + + + + + A constructor end token. + + + + + A comment. + + + + + An interger. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor start token. + + + + + A Date. + + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Indicates how the output is formatted. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Provides a set of static (Shared in Visual Basic) methods for + querying objects that implement . + + + + + Returns the input typed as . + + + + + Returns an empty that has the + specified type argument. + + + + + Converts the elements of an to the + specified type. + + + + + Filters the elements of an based on a specified type. + + + + + Generates a sequence of integral numbers within a specified range. + + The value of the first integer in the sequence. + The number of sequential integers to generate. + + + + Generates a sequence that contains one repeated value. + + + + + Filters a sequence of values based on a predicate. + + + + + Filters a sequence of values based on a predicate. + Each element's index is used in the logic of the predicate function. + + + + + Projects each element of a sequence into a new form. + + + + + Projects each element of a sequence into a new form by + incorporating the element's index. + + + + + Projects each element of a sequence to an + and flattens the resulting sequences into one sequence. + + + + + Projects each element of a sequence to an , + and flattens the resulting sequences into one sequence. The + index of each source element is used in the projected form of + that element. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. The index of + each source element is used in the intermediate projected form + of that element. + + + + + Returns elements from a sequence as long as a specified condition is true. + + + + + Returns elements from a sequence as long as a specified condition is true. + The element's index is used in the logic of the predicate function. + + + + + Returns a specified number of contiguous elements from the start + of a sequence. + + + + + Base implementation of First operator. + + + + + Returns the first element of a sequence. + + + + + Returns the first element in a sequence that satisfies a specified condition. + + + + + Returns the first element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the first element of the sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Last operator. + + + + + Returns the last element of a sequence. + + + + + Returns the last element of a sequence that satisfies a + specified condition. + + + + + Returns the last element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the last element of a sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Single operator. + + + + + Returns the only element of a sequence, and throws an exception + if there is not exactly one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition, and throws an exception if more than one + such element exists. + + + + + Returns the only element of a sequence, or a default value if + the sequence is empty; this method throws an exception if there + is more than one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition or a default value if no such element + exists; this method throws an exception if more than one element + satisfies the condition. + + + + + Returns the element at a specified index in a sequence. + + + + + Returns the element at a specified index in a sequence or a + default value if the index is out of range. + + + + + Inverts the order of the elements in a sequence. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. The element's + index is used in the logic of the predicate function. + + + + + Bypasses a specified number of elements in a sequence and then + returns the remaining elements. + + + + + Returns the number of elements in a sequence. + + + + + Returns a number that represents how many elements in the + specified sequence satisfy a condition. + + + + + Returns an that represents the total number + of elements in a sequence. + + + + + Returns an that represents how many elements + in a sequence satisfy a condition. + + + + + Concatenates two sequences. + + + + + Creates a from an . + + + + + Creates an array from an . + + + + + Returns distinct elements from a sequence by using the default + equality comparer to compare values. + + + + + Returns distinct elements from a sequence by using a specified + to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and a key comparer. + + + + + Creates a from an + according to specified key + and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer and an element selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function and compares the keys by using a specified + comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and projects the elements for each group by + using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. + + + + + Groups the elements of a sequence according to a key selector + function. The keys are compared by using a comparer and each + group's elements are projected by using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The elements of each group are projected by using a + specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The keys are compared by using a specified comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. Key values are compared by using a specified comparer, + and the elements of each group are projected by using a + specified function. + + + + + Applies an accumulator function over a sequence. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value, and the + specified function is used to select the result value. + + + + + Produces the set union of two sequences by using the default + equality comparer. + + + + + Produces the set union of two sequences by using a specified + . + + + + + Returns the elements of the specified sequence or the type + parameter's default value in a singleton collection if the + sequence is empty. + + + + + Returns the elements of the specified sequence or the specified + value in a singleton collection if the sequence is empty. + + + + + Determines whether all elements of a sequence satisfy a condition. + + + + + Determines whether a sequence contains any elements. + + + + + Determines whether any element of a sequence satisfies a + condition. + + + + + Determines whether a sequence contains a specified element by + using the default equality comparer. + + + + + Determines whether a sequence contains a specified element by + using a specified . + + + + + Determines whether two sequences are equal by comparing the + elements by using the default equality comparer for their type. + + + + + Determines whether two sequences are equal by comparing their + elements by using a specified . + + + + + Base implementation for Min/Max operator. + + + + + Base implementation for Min/Max operator for nullable types. + + + + + Returns the minimum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the minimum resulting value. + + + + + Returns the maximum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the maximum resulting value. + + + + + Makes an enumerator seen as enumerable once more. + + + The supplied enumerator must have been started. The first element + returned is the element the enumerator was on when passed in. + DO NOT use this method if the caller must be a generator. It is + mostly safe among aggregate operations. + + + + + Sorts the elements of a sequence in ascending order according to a key. + + + + + Sorts the elements of a sequence in ascending order by using a + specified comparer. + + + + + Sorts the elements of a sequence in descending order according to a key. + + + + + Sorts the elements of a sequence in descending order by using a + specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order by using a specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order, according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order by using a specified comparer. + + + + + Base implementation for Intersect and Except operators. + + + + + Produces the set intersection of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set intersection of two sequences by using the + specified to compare values. + + + + + Produces the set difference of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set difference of two sequences by using the + specified to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and key comparer. + + + + + Creates a from an + according to specified key + selector and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer, and an element selector function. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. A + specified is used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. A specified + is used to compare keys. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Represents a collection of objects that have a common key. + + + + + Gets the key of the . + + + + + Defines an indexer, size property, and Boolean search method for + data structures that map keys to + sequences of values. + + + + + Represents a sorted sequence. + + + + + Performs a subsequent ordering on the elements of an + according to a key. + + + + + Represents a collection of keys each mapped to one or more values. + + + + + Gets the number of key/value collection pairs in the . + + + + + Gets the collection of values indexed by the specified key. + + + + + Determines whether a specified key is in the . + + + + + Applies a transform function to each key and its associated + values and returns the results. + + + + + Returns a generic enumerator that iterates through the . + + + + + This attribute allows us to define extension methods without + requiring .NET Framework 3.5. For more information, see the section, + Extension Methods in .NET Framework 2.0 Apps, + of Basic Instincts: Extension Methods + column in MSDN Magazine, + issue Nov 2007. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll new file mode 100644 index 0000000..34de9a8 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config new file mode 100644 index 0000000..9ade02a --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.dll.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb new file mode 100644 index 0000000..074924e Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.Test.pdb differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll new file mode 100644 index 0000000..2103b11 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.dll differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb new file mode 100644 index 0000000..c2b8b3f Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Debug/Worldpay.Sdk.pdb differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll new file mode 100644 index 0000000..b1a7c1b Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.dll new file mode 100644 index 0000000..a81b347 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.dll differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.pdb new file mode 100644 index 0000000..2851c63 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.pdb differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.xml b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.xml new file mode 100644 index 0000000..e84b1b5 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Newtonsoft.Json.xml @@ -0,0 +1,3995 @@ + + + + Newtonsoft.Json + + + + + Instructs the how to serialize the object. + + + + + Gets or sets the member serialization. + + The member serialization. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Specifies the member serialization options for the . + + + + + All members are serialized by default. Members can be excluded using the . + + + + + Only members must be marked with the are serialized. + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + + + + + The time represented is local time. + + + + + The time represented is UTC. + + + + + The time represented is not specified as either local time or Coordinated Universal Time (UTC). + + + + + Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + + + + + Converts an to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Sets the current token and value. + + The new token. + The value. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Instructs the to always serialize the member with the specified name. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + + + + + + Gets the name. + + The name. + + + + Initializes a new instance of the class. + + The name. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + The parameter is null. + + + + Equalses the specified function. + + The function. + + + + + Equalses the specified a. + + A. + The b. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Implements the operator ==. + + A. + The b. + The result of the operator. + + + + Implements the operator !=. + + A. + The b. + The result of the operator. + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Represents a collection of . + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Gets the type of the current Json token. + + + + + Gets the text value of the current Json token. + + + + + Gets The Common Language Runtime (CLR) type for the current Json token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next Json token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Provides methods for converting between common language runtime types and JavaScript types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + The string delimiter character. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The type of the object to deserialize. + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The object to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The type of the object to deserialize. + The object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The object to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Serializes and deserializes objects into and from the Json format. + The enables you to control how objects are encoded into Json. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Initializes a new instance of the class. + + + + + Deserializes the Json structure contained by the specified . + + The that contains the Json structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Gets the serializable members for the given . + + The object to get seralizable members for. + Seralizable members for the given type. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Returns a collection of child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the converted values of every node in the source collection. + + + + Represents a JSON constructor. + + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a token that can contain other tokens. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets the node type for this . + + The type. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Gets the with the specified key. + + The with the specified key. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Represents a JSON array. + + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Returns a count of this token's child tokens. + + A count of this token's child tokens. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the token being writen. + + The token being writen. + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Represents an abstract JSON token. + + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order. + + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + A containing the indented JSON. + + + + + Returns the indented JSON for this token using any given converters. + + A collection of which will be used when writing the token. + + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Represents a JSON property. + + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + The property name. + + + + Initializes a new instance of the class. + + The property name. + The property value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies missing member handling options for the . + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null, empty or its contents are uninitialized values. + + The list. + + true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + + + + + Makes a slice of the specified list in between the start and end indexes. + + The list. + The start index. + The end index. + A slice of the list. + + + + Makes a slice of the specified list in between the start and end indexes, + getting every so many items based upon the step. + + The list. + The start index. + The end index. + The step. + A slice of the list. + + + + Group the collection using a function which returns the key. + + The source collection to group. + The key selector. + A Dictionary with each key relating to a list of objects in a list grouped under it. + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Gets the type of the typed list's items. + + The type. + The type of the typed list's items. + + + + Tests whether the list's items are their unitialized value. + + The list. + Whether the list's items are their unitialized value + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string contains white space. + + The string to test for white space. + + true if the string contains white space; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Ensures the target string ends with the specified string. + + The target. + The value. + The target string with the value string at the end. + + + + Determines whether the SqlString is null or empty. + + The string. + + true if the SqlString is null or empty; otherwise, false. + + + + + Perform an action if the string is not null or empty. + + The value. + The action to perform. + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + The indent character. + + + + + Numbers the lines. + + The string to number. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + An object property name. + + + + + A constructor end token. + + + + + A comment. + + + + + An interger. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor start token. + + + + + A Date. + + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Indicates how the output is formatted. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Provides a set of static (Shared in Visual Basic) methods for + querying objects that implement . + + + + + Returns the input typed as . + + + + + Returns an empty that has the + specified type argument. + + + + + Converts the elements of an to the + specified type. + + + + + Filters the elements of an based on a specified type. + + + + + Generates a sequence of integral numbers within a specified range. + + The value of the first integer in the sequence. + The number of sequential integers to generate. + + + + Generates a sequence that contains one repeated value. + + + + + Filters a sequence of values based on a predicate. + + + + + Filters a sequence of values based on a predicate. + Each element's index is used in the logic of the predicate function. + + + + + Projects each element of a sequence into a new form. + + + + + Projects each element of a sequence into a new form by + incorporating the element's index. + + + + + Projects each element of a sequence to an + and flattens the resulting sequences into one sequence. + + + + + Projects each element of a sequence to an , + and flattens the resulting sequences into one sequence. The + index of each source element is used in the projected form of + that element. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. The index of + each source element is used in the intermediate projected form + of that element. + + + + + Returns elements from a sequence as long as a specified condition is true. + + + + + Returns elements from a sequence as long as a specified condition is true. + The element's index is used in the logic of the predicate function. + + + + + Returns a specified number of contiguous elements from the start + of a sequence. + + + + + Base implementation of First operator. + + + + + Returns the first element of a sequence. + + + + + Returns the first element in a sequence that satisfies a specified condition. + + + + + Returns the first element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the first element of the sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Last operator. + + + + + Returns the last element of a sequence. + + + + + Returns the last element of a sequence that satisfies a + specified condition. + + + + + Returns the last element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the last element of a sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Single operator. + + + + + Returns the only element of a sequence, and throws an exception + if there is not exactly one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition, and throws an exception if more than one + such element exists. + + + + + Returns the only element of a sequence, or a default value if + the sequence is empty; this method throws an exception if there + is more than one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition or a default value if no such element + exists; this method throws an exception if more than one element + satisfies the condition. + + + + + Returns the element at a specified index in a sequence. + + + + + Returns the element at a specified index in a sequence or a + default value if the index is out of range. + + + + + Inverts the order of the elements in a sequence. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. The element's + index is used in the logic of the predicate function. + + + + + Bypasses a specified number of elements in a sequence and then + returns the remaining elements. + + + + + Returns the number of elements in a sequence. + + + + + Returns a number that represents how many elements in the + specified sequence satisfy a condition. + + + + + Returns an that represents the total number + of elements in a sequence. + + + + + Returns an that represents how many elements + in a sequence satisfy a condition. + + + + + Concatenates two sequences. + + + + + Creates a from an . + + + + + Creates an array from an . + + + + + Returns distinct elements from a sequence by using the default + equality comparer to compare values. + + + + + Returns distinct elements from a sequence by using a specified + to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and a key comparer. + + + + + Creates a from an + according to specified key + and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer and an element selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function and compares the keys by using a specified + comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and projects the elements for each group by + using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. + + + + + Groups the elements of a sequence according to a key selector + function. The keys are compared by using a comparer and each + group's elements are projected by using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The elements of each group are projected by using a + specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The keys are compared by using a specified comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. Key values are compared by using a specified comparer, + and the elements of each group are projected by using a + specified function. + + + + + Applies an accumulator function over a sequence. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value, and the + specified function is used to select the result value. + + + + + Produces the set union of two sequences by using the default + equality comparer. + + + + + Produces the set union of two sequences by using a specified + . + + + + + Returns the elements of the specified sequence or the type + parameter's default value in a singleton collection if the + sequence is empty. + + + + + Returns the elements of the specified sequence or the specified + value in a singleton collection if the sequence is empty. + + + + + Determines whether all elements of a sequence satisfy a condition. + + + + + Determines whether a sequence contains any elements. + + + + + Determines whether any element of a sequence satisfies a + condition. + + + + + Determines whether a sequence contains a specified element by + using the default equality comparer. + + + + + Determines whether a sequence contains a specified element by + using a specified . + + + + + Determines whether two sequences are equal by comparing the + elements by using the default equality comparer for their type. + + + + + Determines whether two sequences are equal by comparing their + elements by using a specified . + + + + + Base implementation for Min/Max operator. + + + + + Base implementation for Min/Max operator for nullable types. + + + + + Returns the minimum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the minimum resulting value. + + + + + Returns the maximum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the maximum resulting value. + + + + + Makes an enumerator seen as enumerable once more. + + + The supplied enumerator must have been started. The first element + returned is the element the enumerator was on when passed in. + DO NOT use this method if the caller must be a generator. It is + mostly safe among aggregate operations. + + + + + Sorts the elements of a sequence in ascending order according to a key. + + + + + Sorts the elements of a sequence in ascending order by using a + specified comparer. + + + + + Sorts the elements of a sequence in descending order according to a key. + + + + + Sorts the elements of a sequence in descending order by using a + specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order by using a specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order, according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order by using a specified comparer. + + + + + Base implementation for Intersect and Except operators. + + + + + Produces the set intersection of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set intersection of two sequences by using the + specified to compare values. + + + + + Produces the set difference of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set difference of two sequences by using the + specified to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and key comparer. + + + + + Creates a from an + according to specified key + selector and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer, and an element selector function. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. A + specified is used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. A specified + is used to compare keys. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Represents a collection of objects that have a common key. + + + + + Gets the key of the . + + + + + Defines an indexer, size property, and Boolean search method for + data structures that map keys to + sequences of values. + + + + + Represents a sorted sequence. + + + + + Performs a subsequent ordering on the elements of an + according to a key. + + + + + Represents a collection of keys each mapped to one or more values. + + + + + Gets the number of key/value collection pairs in the . + + + + + Gets the collection of values indexed by the specified key. + + + + + Determines whether a specified key is in the . + + + + + Applies a transform function to each key and its associated + values and returns the results. + + + + + Returns a generic enumerator that iterates through the . + + + + + This attribute allows us to define extension methods without + requiring .NET Framework 3.5. For more information, see the section, + Extension Methods in .NET Framework 2.0 Apps, + of Basic Instincts: Extension Methods + column in MSDN Magazine, + issue Nov 2007. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll new file mode 100644 index 0000000..a4bab73 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config new file mode 100644 index 0000000..9ade02a --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.dll.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb new file mode 100644 index 0000000..13183a0 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.Test.pdb differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll new file mode 100644 index 0000000..06d517a Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.dll differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb new file mode 100644 index 0000000..7f34d46 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.Test/bin/Release/Worldpay.Sdk.pdb differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk.sln b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.sln new file mode 100644 index 0000000..b16e6de --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worldpay.Sdk", "Worldpay.Sdk\Worldpay.Sdk35.csproj", "{D2AB0290-8B33-4467-A0DF-975372B29E38}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worldpay.Sdk.Test", "Worldpay.Sdk.Test\Worldpay.Sdk.Test.csproj", "{F4C39D0A-B55F-4332-8933-257BA89BADA7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6C59865C-07ED-4BD8-99D8-4A8BAE7BF16C}" + ProjectSection(SolutionItems) = preProject + POM.xml = POM.xml + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D2AB0290-8B33-4467-A0DF-975372B29E38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2AB0290-8B33-4467-A0DF-975372B29E38}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2AB0290-8B33-4467-A0DF-975372B29E38}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2AB0290-8B33-4467-A0DF-975372B29E38}.Release|Any CPU.Build.0 = Release|Any CPU + {F4C39D0A-B55F-4332-8933-257BA89BADA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F4C39D0A-B55F-4332-8933-257BA89BADA7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F4C39D0A-B55F-4332-8933-257BA89BADA7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F4C39D0A-B55F-4332-8933-257BA89BADA7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/AbstractService.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/AbstractService.cs new file mode 100644 index 0000000..0aa37de --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/AbstractService.cs @@ -0,0 +1,12 @@ +namespace Worldpay.Sdk +{ + abstract public class AbstractService + { + protected Http Http; + + protected AbstractService(Http http) + { + this.Http = http; + } + } +} diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/WorldPay.Sdk.dll.config b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/App.config old mode 100755 new mode 100644 similarity index 74% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/WorldPay.Sdk.dll.config rename to worldpay-lib-dotnet-4-6/Worldpay.Sdk/App.config index b58463c..90f1c56 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Release/WorldPay.Sdk.dll.config +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/App.config @@ -1,4 +1,4 @@ - + @@ -9,4 +9,4 @@ - \ No newline at end of file + diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/AuthService.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/AuthService.cs new file mode 100644 index 0000000..21c2b63 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/AuthService.cs @@ -0,0 +1,22 @@ +using Worldpay.Sdk; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Class for interacting with the Worldpay authorization API + /// + public class AuthService : AbstractService + { + public AuthService(Http http) : base(http) { } + + /// + /// Get a temporary access token + /// + public TokenResponse GetToken(TokenRequest tokenRequest) + { + var tokenResponse = Http.Post(Configuration.TokenUrl, tokenRequest); + return tokenResponse; + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Configuration.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Configuration.cs new file mode 100644 index 0000000..a1fa966 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Configuration.cs @@ -0,0 +1,60 @@ +using System; +using System.Configuration; + +namespace Worldpay.Sdk +{ + public class Configuration + { + /// + /// Uri of the token request API + /// + public static string TokenUrl + { + get { return ConfigurationManager.AppSettings["TokenUrl"]; } + } + + /// + /// Base Uri of the service + /// + public static string BaseUrl + { + get { return ConfigurationManager.AppSettings["BaseUrl"]; } + } + + /// + /// The secret key for service authorization + /// + public static string ServiceKey + { + get { return ConfigurationManager.AppSettings["ServiceKey"]; } + } + + /// + /// The merchant id corresponding to the service and client key + /// + public static string MerchantId + { + get { return ConfigurationManager.AppSettings["MerchantId"]; } + } + + /// + /// The client key for service authorization + /// + public static string ClientKey + { + get { return ConfigurationManager.AppSettings["ClientKey"]; } + } + + + public static string OrderLog + { + get { return ConfigurationManager.AppSettings["OrderLog"]; } + } + + + public static string WebhookUrl + { + get { return ConfigurationManager.AppSettings["WebhookUrl"]; } + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/CountryCode.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/CountryCode.cs new file mode 100644 index 0000000..3c3a59e --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/CountryCode.cs @@ -0,0 +1,16 @@ +namespace Worldpay.Sdk.Enums +{ + public enum CountryCode + { + AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT, AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, + BO, BQ, BA, BW, BV, BR, IO, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL, CN, CX, CC, CO, KM, CG, CD, + CK, CR, CI, HR, CU, CW, CY, CZ, DK, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI, FR, GF, PF, + TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, + IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW, KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, + MO, MK, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, MM, NA, NR, NP, + NL, NC, NZ, NI, NE, NG, NU, NF, MP, NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RE, RO, + RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA, SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, + ES, LK, SD, SR, SJ, SZ, SE, CH, SY, TW, TJ, TZ, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, UG, UA, AE, + GB, US, UM, UY, UZ, VU, VE, VN, VG, VI, WF, EH, YE, ZM, ZW + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/CurrencyCode.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/CurrencyCode.cs new file mode 100644 index 0000000..18b734f --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/CurrencyCode.cs @@ -0,0 +1,12 @@ +namespace Worldpay.Sdk.Enums +{ + public enum CurrencyCode + { + ALL, DZD, XCD, ARS, AWG, AUD, AZN, BSD, BHD, BDT, BBD, BZD, BMD, BOB, BWP, BRL, BND, BGN, XOF, MMK, KHR, + XAF, CAD, KYD, CLP, CNY, COP, CRC, HRK, CZK, DKK, DJF, DOP, EGP, SVC, ERN, ETB, EUR, FJD, XPF, GEL, GHS, + GIP, GTQ, HNL, HKD, HUF, ISK, INR, IDR, IRR, ILS, JMD, JPY, JOD, KZT, KES, KWD, LVL, LBP, LSL, LYD, LTL, + MOP, MKD, MYR, MVR, MRO, MUR, MXN, MNT, MAD, MZN, NAD, ANG, NZD, NIO, NGN, NOK, OMR, PKR, PAB, PYG, PEN, + PHP, PLN, QAR, RON, RUB, RWF, SAR, RSD, SCR, SLL, SGD, ZAR, KRW, LKR, SZL, SEK, CHF, SYP, TWD, TZS, THB, + TTD, TND, TRY, UAH, AED, GBP, USD, UYU, UZS, VEF, VND, YER, ZMW + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/Environment.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/Environment.cs new file mode 100644 index 0000000..abdded6 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/Environment.cs @@ -0,0 +1,8 @@ +namespace Worldpay.Sdk.Enums +{ + public enum Environment + { + TEST, + LIVE + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/OrderStatus.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/OrderStatus.cs new file mode 100644 index 0000000..b5ea698 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/OrderStatus.cs @@ -0,0 +1,19 @@ +namespace Worldpay.Sdk.Enums +{ + public enum OrderStatus + { + SUCCESS, + FAILED, + AUTHORIZED, + PRE_AUTHORIZED, + SENT_FOR_REFUND, + PARTIALLY_REFUNDED, + REFUNDED, + SETTLED, + INFORMATION_REQUESTED, + INFORMATION_SUPPLIED, + CHARGED_BACK, + EXPIRED, + CHARGEBACK_REVERSED + } +} \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/OrderType.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/OrderType.cs new file mode 100644 index 0000000..3068d7d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/OrderType.cs @@ -0,0 +1,10 @@ +namespace Worldpay.Sdk.Enums +{ + public enum OrderType + { + ECOM, + RECURRING, + MOTO, + APM + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/RequestMethod.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/RequestMethod.cs new file mode 100644 index 0000000..73a8133 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/RequestMethod.cs @@ -0,0 +1,10 @@ +namespace Worldpay.Sdk.Enums +{ + public enum RequestMethod + { + Delete, + Get, + Post, + Put + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/WarningCode.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/WarningCode.cs new file mode 100644 index 0000000..c1a29f1 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Enums/WarningCode.cs @@ -0,0 +1,13 @@ +namespace Worldpay.Sdk.Enums +{ + public enum WarningCode + { + INVALID_KEY_FORMAT, + INVALID_KEY_VALUE, + INVALID_KEY_VALUE_ENTRY, + INVALID_VALUE_FOR_KEY, + INVALID_KEY, + KEY_VALUE_ENTRIES_LIMIT_EXCEEDED, + DUPLICATE_KEY_VALUE_ENTRIES_REMOVED + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Http.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Http.cs new file mode 100644 index 0000000..da8a860 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Http.cs @@ -0,0 +1,243 @@ +using System; +using System.IO; +using System.Net; +using System.Text; +using System.Web; +using Newtonsoft.Json; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Class for handling generic HTTP API interactions + /// + public class Http + { + /// + /// Connection timeout in milliseconds + /// + private const int ConnectionTimeout = 61000; + + /// + /// JSON header value + /// + private const string ApplicationJson = "application/json"; + + /// + /// Service key + /// + private readonly string _serviceKey; + + /// + /// Authenticated + /// + private readonly bool _authenticated; + + /// + /// Constructor + /// + public Http() + { + _authenticated = false; + } + + /// + /// Constructor + /// + /// The authorization key for the service + public Http(string serviceKey) + { + _serviceKey = serviceKey; + _authenticated = true; + } + + /// + /// Perform a GET request + /// + internal TO Get(string api) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Get, null, _authenticated); + return SendRequest(request); + } + + /// + /// Perform a POST request + /// + internal void Post(string api, object item) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Post, item, _authenticated); + SendRequest(request); + } + + /// + /// Perform a PUT request + /// + internal void Put(string api, object item) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Put, item, _authenticated); + SendRequest(request); + } + + /// + /// Perform a POST request + /// + internal TO Post(string api, TI item) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Post, item, _authenticated); + return SendRequest(request); + } + + /// + /// Perform a POST request + /// + internal TO Put(string api, TI item) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Put, item, _authenticated); + return SendRequest(request); + } + + /// + /// Perform a DELETE request + /// + public void Delete(string api) + { + HttpWebRequest request = CreateRequest(api, RequestMethod.Delete, null, _authenticated); + SendRequest(request); + } + + /// + /// Handle an incoming request + /// + /// + /// + /// + public TO HandleRequest(HttpRequest request) + { + if (request.HttpMethod != "POST") + { + throw new WorldpayException("Invalid request"); + } + + return HandleResponse(request.InputStream); + } + + #region helpers + + private HttpWebRequest CreateRequest(string api, RequestMethod method, object data, bool authorize) + { + var request = (HttpWebRequest)HttpWebRequest.Create(api); + request.Accept = ApplicationJson; + request.Timeout = ConnectionTimeout; + + request.Headers.Add("x-wp-client-user-agent", "NET-Client-4_6"); + + switch (method) + { + case RequestMethod.Get: + request.Method = WebRequestMethods.Http.Get; + break; + case RequestMethod.Post: + request.Method = WebRequestMethods.Http.Post; + break; + case RequestMethod.Put: + request.Method = WebRequestMethods.Http.Put; + break; + case RequestMethod.Delete: + request.Method = "DELETE"; + break; + default: + throw new NotSupportedException(String.Format("Request method {0} not supported", method.ToString())); + } + + if (authorize) + { + request.Headers.Add(HttpRequestHeader.Authorization, _serviceKey); + } + + try + { + if (data != null) + { + request.ContentType = ApplicationJson; + string serializedData = JavaScriptConvert.SerializeObject(data); + byte[] bytes = Encoding.UTF8.GetBytes(serializedData); + request.ContentLength = bytes.Length; + + using (Stream outputStream = request.GetRequestStream()) + { + outputStream.Write(bytes, 0, bytes.Length); + } + } + } + catch (WebException exc) + { + throw new WebException("Error with request " + request.RequestUri, exc); + } + + return request; + } + + private void SendRequest(HttpWebRequest request) + { + try + { + using (var response = request.GetResponse()) + { + // NO action to take + } + } + catch (WebException exc) + { + HandleError(exc); + } + } + + private T SendRequest(HttpWebRequest request) + { + try + { + using (var response = request.GetResponse()) + { + return HandleResponse(response.GetResponseStream()); + } + } + catch (WebException exc) + { + HandleError(exc); + return default(T); + } + } + + private T HandleResponse(Stream responseStream) + { + using (var reader = new StreamReader(responseStream)) + { + var serializer = new JsonSerializer(); + serializer.MissingMemberHandling = MissingMemberHandling.Ignore; + return (T)serializer.Deserialize(new JsonTextReader(reader), typeof(T)); + } + } + + private void HandleError(WebException exc) + { + using (var reader = new StreamReader(exc.Response.GetResponseStream())) + { + ApiError error = null; + try + { + string content = reader.ReadToEnd(); + error = JavaScriptConvert.DeserializeObject(content); + } + catch (Exception) + { + throw exc; + } + throw new WorldpayException(error, "API error: " + error.message); + } + } + + #endregion + + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Json/EntryConvertcs.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Json/EntryConvertcs.cs new file mode 100644 index 0000000..7a717f8 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Json/EntryConvertcs.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Json +{ + public class EntryConverter : JsonConverter + { + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + var list = value as List; + if (list == null) return; + + writer.WriteStartObject(); + foreach (var item in list) + { + writer.WritePropertyName(item.key); + writer.WriteValue(item.value); + } + writer.WriteEndObject(); + } + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + var jsonObject = JObject.Load(reader); + return jsonObject.Properties().Select(property => new Entry(property.Name, Convert.ToString(property.Value))).ToList(); + } + + public override bool CanConvert(Type objectType) + { + return objectType == typeof(List); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/MerchantService.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/MerchantService.cs new file mode 100644 index 0000000..dda8834 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/MerchantService.cs @@ -0,0 +1,57 @@ +using System; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + public class MerchantService : AbstractService + { + private readonly string _baseUrl; + + /// + /// Constructor + /// + public MerchantService(string baseUrl, Http http) : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// + /// + /// + public void Create(BaseMerchant merchant) + { + Http.Post(String.Format("{0}/merchants", _baseUrl), merchant); + } + + /// + /// + /// + /// + public Merchant Get(string merchantId) + { + return Http.Get(String.Format("{0}/merchants/{1}", _baseUrl, merchantId)); + } + + /// + /// + /// + /// + /// + public void Update(string merchantId, Merchant merchant) + { + Http.Post(String.Format("{0}/merchants/{1}", _baseUrl, merchantId), merchant); + } + + /// + /// + /// + /// + /// + public void Put(string merchantId, Merchant merchant) + { + Http.Post(String.Format("{0}/merchants/{1}", _baseUrl, merchantId), merchant); + } + + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/APMRequest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/APMRequest.cs new file mode 100644 index 0000000..91cd4cd --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/APMRequest.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace Worldpay.Sdk.Models +{ + public class APMRequest : AbstractPaymentMethod + { + public APMRequest() + { + this.type = "APM"; + } + + public string apmName { get; set; } + + public string shopperCountryCode { get; set; } + + public Dictionary apmFields { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractCard.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractCard.cs new file mode 100644 index 0000000..9143cfb --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractCard.cs @@ -0,0 +1,17 @@ +namespace Worldpay.Sdk.Models +{ + abstract public class AbstractCard : AbstractPaymentMethod + { + public string name { get; set; } + + public int expiryMonth { get; set; } + + public int expiryYear { get; set; } + + public int? issueNumber { get; set; } + + public int? startMonth { get; set; } + + public int? startYear { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractOrder.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractOrder.cs new file mode 100644 index 0000000..864eee5 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractOrder.cs @@ -0,0 +1,23 @@ +namespace Worldpay.Sdk.Models +{ + public class AbstractOrder + { + public string token { get; set; } + + public string orderDescription { get; set; } + + public int? amount { get; set; } + + public string currencyCode { get; set; } + + public string settlementCurrency { get; set; } + + public string siteCode { get; set; } + + public bool authorizeOnly { get; set; } + + public bool authoriseOnly { get; set; } + + public int? authorizedAmount { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractPaymentMethod.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractPaymentMethod.cs new file mode 100644 index 0000000..b905089 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractPaymentMethod.cs @@ -0,0 +1,7 @@ +namespace Worldpay.Sdk.Models +{ + abstract public class AbstractPaymentMethod + { + public string type { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractPerson.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractPerson.cs new file mode 100644 index 0000000..53f4413 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractPerson.cs @@ -0,0 +1,7 @@ +namespace Worldpay.Sdk.Models +{ + abstract public class AbstractPerson + { + public Name name { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractTokenRequest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractTokenRequest.cs new file mode 100644 index 0000000..351cd17 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/AbstractTokenRequest.cs @@ -0,0 +1,7 @@ +namespace Worldpay.Sdk.Models +{ + abstract public class AbstractTokenRequest + { + public string clientKey { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Account.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Account.cs new file mode 100644 index 0000000..e9cbc80 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Account.cs @@ -0,0 +1,17 @@ +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + public class Account + { + public string bankName { get; set; } + + public string sortCode { get; set; } + + public string accountNumber { get; set; } + + public string accountHolderName { get; set; } + + public CurrencyCode settlementCurrency { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Address.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Address.cs new file mode 100644 index 0000000..232160c --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Address.cs @@ -0,0 +1,25 @@ +using System; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class Address + { + public string address1 { get; set; } + + public string address2 { get; set; } + + public string address3 { get; set; } + + public string postalCode { get; set; } + + public string city { get; set; } + + public string state { get; set; } + + public string countryCode { get; set; } + + public string telephoneNumber { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/ApiError.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/ApiError.cs new file mode 100644 index 0000000..a6fcadd --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/ApiError.cs @@ -0,0 +1,20 @@ +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class ApiError + { + public int httpStatusCode { get; set; } + + public string customCode { get; set; } + + public string message { get; set; } + + public string description { get; set; } + + public string errorHelpUrl { get; set; } + + public string originalRequest { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/BaseMerchant.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/BaseMerchant.cs new file mode 100644 index 0000000..4cc6e30 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/BaseMerchant.cs @@ -0,0 +1,7 @@ +namespace Worldpay.Sdk.Models +{ + public class BaseMerchant + { + public string aggregateMerchantId { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/BusinessProfile.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/BusinessProfile.cs new file mode 100644 index 0000000..6b2cbab --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/BusinessProfile.cs @@ -0,0 +1,33 @@ +namespace Worldpay.Sdk.Models +{ + public class BusinessProfile + { + public string descriptionOfYourGoodsAndServices { get; set; } + + public int anticipatedAverageMonthlyTurnover { get; set; } + + public int anticipatedPeakMonthlyTurnover { get; set; } + + public int daysFromOrderConfirmationToDelivery { get; set; } + + public bool depositInAdvance { get; set; } + + public int percentageOfTotalTurnoverToRelatedBusiness { get; set; } + + public int percentageOfTotalTurnoverTakenAsDeposit { get; set; } + + public int averageDaysBetweenDepositAndFullPayment { get; set; } + + public int averageDaysBetweenFullPaymentAndDelivery { get; set; } + + public int averageDaysInHolidayDuration { get; set; } + + public bool doYouOfferSubscriptionMembershipServices { get; set; } + + public int averageSubscriptionLengthInMonths { get; set; } + + public int percentageOfTotalTurnoverToSubscriptionBusiness { get; set; } + + public int anticipatedTotalTurnoverForSubscription { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/CaptureRequest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/CaptureRequest.cs new file mode 100644 index 0000000..253f2a5 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/CaptureRequest.cs @@ -0,0 +1,8 @@ + +namespace WorldPay.Sdk.Models +{ + public class CaptureRequest + { + public int captureAmount { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/CardRequest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/CardRequest.cs new file mode 100644 index 0000000..ac3202f --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/CardRequest.cs @@ -0,0 +1,14 @@ +namespace Worldpay.Sdk.Models +{ + public class CardRequest : AbstractCard + { + public CardRequest() + { + this.type = "Card"; + } + + public string cardNumber { get; set; } + + public string cvc { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Company.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Company.cs new file mode 100644 index 0000000..8f403e8 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Company.cs @@ -0,0 +1,27 @@ +namespace Worldpay.Sdk.Models +{ + public class Company + { + public string legalName { get; set; } + + public string tradingName { get; set; } + + public Address tradingAddress { get; set; } + + public Address legalAddress { get; set; } + + public string website { get; set; } + + public string companyType { get; set; } + + public string registrationNumber { get; set; } + + public string vatNumber { get; set; } + + public string incorporationMonth { get; set; } + + public string incorporationYear { get; set; } + + public string merchantCategoryPseudoName { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/DeliveryAddress.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/DeliveryAddress.cs new file mode 100644 index 0000000..1f25653 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/DeliveryAddress.cs @@ -0,0 +1,14 @@ +using System; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class DeliveryAddress : Address + { + public string firstName { get; set; } + + public string lastName { get; set; } + + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Entry.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Entry.cs new file mode 100644 index 0000000..ca699c8 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Entry.cs @@ -0,0 +1,23 @@ +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class Entry + { + public string key { get; set; } + + public string value { get; set; } + + public Entry() + { + + } + + public Entry(string key, string value) + { + this.key = key; + this.value = value; + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Merchant.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Merchant.cs new file mode 100644 index 0000000..288ba7d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Merchant.cs @@ -0,0 +1,23 @@ +namespace Worldpay.Sdk.Models +{ + public class Merchant : BaseMerchant + { + public MerchantOrderSetting orderSetting { get; set; } + + public PersonContact mainBusinessRepresentative { get; set; } + + public Company companyDetail { get; set; } + + public Account bankDetail { get; set; } + + public string statementNarrative { get; set; } + + public PersonContact technicalContact { get; set; } + + public BusinessProfile BusinessProfile { get; set; } + + public string priceCode { get; set; } + + public string shoppingCardUsed { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/MerchantOrderSetting.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/MerchantOrderSetting.cs new file mode 100644 index 0000000..8a64b6f --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/MerchantOrderSetting.cs @@ -0,0 +1,7 @@ +namespace Worldpay.Sdk.Models +{ + public class MerchantOrderSetting + { + public string optInForRecurringBilling { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Name.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Name.cs new file mode 100644 index 0000000..cd4f0ee --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Name.cs @@ -0,0 +1,13 @@ +namespace Worldpay.Sdk.Models +{ + public class Name + { + public string title { get; set; } + + public string firstName { get; set; } + + public string middleName { get; set; } + + public string lastName { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderAuthorizationRequest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderAuthorizationRequest.cs new file mode 100644 index 0000000..c506aaa --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderAuthorizationRequest.cs @@ -0,0 +1,38 @@ +namespace Worldpay.Sdk.Models +{ + class OrderAuthorizationRequest + { + public OrderAuthorizationRequest() + { + this.threeDSecureInfo = new ThreeDSecureInfo(); + } + + public string threeDSResponseCode { get; set; } + + public ThreeDSecureInfo threeDSecureInfo { get; set; } + + public string shopperIpAddress + { + get { return threeDSecureInfo.shopperIpAddress; } + set { threeDSecureInfo.shopperIpAddress = value; } + } + + public string shopperSessionId + { + get { return threeDSecureInfo.shopperSessionId; } + set { threeDSecureInfo.shopperSessionId = value; } + } + + public string shopperUserAgent + { + get { return threeDSecureInfo.shopperUserAgent; } + set { threeDSecureInfo.shopperUserAgent = value; } + } + + public string shopperAcceptHeader + { + get { return threeDSecureInfo.shopperAcceptHeader; } + set { threeDSecureInfo.shopperAcceptHeader = value; } + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderChangeNotification.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderChangeNotification.cs new file mode 100644 index 0000000..c23bf72 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderChangeNotification.cs @@ -0,0 +1,21 @@ +using System; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class OrderChangeNotification + { + public string merchantId { get; set; } + + public string notificationEventType { get; set; } + + public string adminCode { get; set; } + + public string orderCode { get; set; } + + public OrderStatus paymentStatus { get; set; } + + public string environment { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderHistory.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderHistory.cs new file mode 100644 index 0000000..ecf925c --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderHistory.cs @@ -0,0 +1,26 @@ +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class OrderHistory + { + public string modificationDate { get; set; } + + public string state { get; set; } + + public int amount { get; set; } + + public string currencyCode { get; set; } + + public int currencyCodeExponent { get; set; } + + public int netAmount { get; set; } + + public string settlementCurrency { get; set; } + + public int settlementCurrencyExponent { get; set; } + + public int commission { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderRequest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderRequest.cs new file mode 100644 index 0000000..c51414d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderRequest.cs @@ -0,0 +1,84 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class OrderRequest : AbstractOrder + { + public OrderRequest() + { + this.threeDSecureInfo = new ThreeDSecureInfo(); + } + + public string name { get; set; } + + public Address billingAddress { get; set; } + + public DeliveryAddress deliveryAddress { get; set; } + + public Dictionary customerIdentifiers { get; set; } + + public string customerOrderCode { get; set; } + + public string orderCodeSuffix { get; set; } + + public string orderCodePrefix { get; set; } + + public string shopperLanguageCode { get; set; } + + public bool reusable { get; set; } + + public AbstractPaymentMethod paymentMethod { get; set; } + + public string orderType { get; set; } + + public ThreeDSecureInfo threeDSecureInfo { get; set; } + + public string shopperIpAddress + { + get { return threeDSecureInfo.shopperIpAddress; } + set { threeDSecureInfo.shopperIpAddress = value; } + } + + public string shopperSessionId + { + get { return threeDSecureInfo.shopperSessionId; } + set { threeDSecureInfo.shopperSessionId = value; } + } + + public string shopperUserAgent + { + get { return threeDSecureInfo.shopperUserAgent; } + set { threeDSecureInfo.shopperUserAgent = value; } + } + + public string shopperAcceptHeader + { + get { return threeDSecureInfo.shopperAcceptHeader; } + set { threeDSecureInfo.shopperAcceptHeader = value; } + } + + [JsonIgnore] + public bool authoriseOnly { + get { return this.authorizeOnly; } + set { this.authorizeOnly = value; } + } + public bool is3DSOrder { get; set; } + + public string successUrl { get; set; } + + public string failureUrl { get; set; } + + public string cancelUrl { get; set; } + + public string pendingUrl { get; set; } + + public string shopperEmailAddress { get; set; } + + public string statementNarrative { get; set; } + + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderResponse.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderResponse.cs new file mode 100644 index 0000000..ce47030 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/OrderResponse.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + public class OrderResponse : AbstractOrder + { + public string orderCode { get; set; } + + public OrderStatus paymentStatus { get; set; } + + public string paymentStatusReason { get; set; } + + public PaymentResponse paymentResponse { get; set; } + + public string customerOrderCode { get; set; } + + public bool is3DSOrder { get; set; } + + public string oneTime3DsToken { get; set; } + + public string redirectURL { get; set; } + + public Dictionary customerIdentifiers { get; set; } + + public Environment environment { get; set; } + + public string shopperEmailAddress { get; set; } + + public DeliveryAddress deliveryAddress { get; set; } + + public string statementNarrative { get; set; } + + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PartialRefundRequest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PartialRefundRequest.cs new file mode 100644 index 0000000..7aaa545 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PartialRefundRequest.cs @@ -0,0 +1,7 @@ +namespace WorldPay.Sdk.Models +{ + class PartialRefundRequest + { + public int refundAmount { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PaymentResponse.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PaymentResponse.cs new file mode 100644 index 0000000..4a4596d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PaymentResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class PaymentResponse : AbstractCard + { + public string cardType { get; set; } + + public string maskedCardNumber { get; set; } + + public Address billingAddress { get; set; } + + public Dictionary apmFields { get; set; } + + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PersonContact.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PersonContact.cs new file mode 100644 index 0000000..7ce275d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PersonContact.cs @@ -0,0 +1,9 @@ +namespace Worldpay.Sdk.Models +{ + public class PersonContact : AbstractPerson + { + public string email { get; set; } + + public string phone { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PersonRecord.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PersonRecord.cs new file mode 100644 index 0000000..20d597b --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/PersonRecord.cs @@ -0,0 +1,19 @@ +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + class PersonRecord : AbstractPerson + { + public int dayOfBirth { get; set; } + + public int monthOfBirth { get; set; } + + public int yearOfBirth { get; set; } + + public int ownershipPercentage { get; set; } + + public Address homeAddress { get; set; } + + public CountryCode nationality { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/RiskSetting.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/RiskSetting.cs new file mode 100644 index 0000000..3bb7d0d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/RiskSetting.cs @@ -0,0 +1,12 @@ +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class RiskSetting + { + public bool cvcEnabled { get; set; } + + public bool avsEnabled { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Setting.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Setting.cs new file mode 100644 index 0000000..db3f141 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Setting.cs @@ -0,0 +1,16 @@ +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class Setting + { + public string keyType { get; set; } + + public string environment { get; set; } + + public bool enabled { get; set; } + + public string key { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/SettingsResponse.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/SettingsResponse.cs new file mode 100644 index 0000000..7cfe594 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/SettingsResponse.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class SettingsResponse + { + public List keys { get; set; } + + public RiskSetting riskSetting { get; set; } + + public MerchantOrderSetting orderSetting { get; set; } + + public List webhooks { get; set; } + + public string webhookKey { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/ThreeDSecureInfo.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/ThreeDSecureInfo.cs new file mode 100644 index 0000000..b38c17e --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/ThreeDSecureInfo.cs @@ -0,0 +1,13 @@ +namespace Worldpay.Sdk.Models +{ + public class ThreeDSecureInfo + { + public string shopperIpAddress { get; set; } + + public string shopperSessionId { get; set; } + + public string shopperAcceptHeader { get; set; } + + public string shopperUserAgent { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TokenRequest.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TokenRequest.cs new file mode 100644 index 0000000..c9b75c8 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TokenRequest.cs @@ -0,0 +1,9 @@ +namespace Worldpay.Sdk.Models +{ + public class TokenRequest : AbstractTokenRequest + { + public AbstractPaymentMethod paymentMethod { get; set; } + + public bool reusable { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TokenResponse.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TokenResponse.cs new file mode 100644 index 0000000..3ad4312 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TokenResponse.cs @@ -0,0 +1,11 @@ +namespace Worldpay.Sdk.Models +{ + public class TokenResponse + { + public string token { get; set; } + + public PaymentResponse paymentMethod { get; set; } + + public bool reusable { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferDetail.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferDetail.cs new file mode 100644 index 0000000..0211021 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferDetail.cs @@ -0,0 +1,12 @@ +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class TransferDetail + { + public string transferId { get; set; } + + public TransferOrder orders { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferOrder.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferOrder.cs new file mode 100644 index 0000000..63746cb --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferOrder.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Worldpay.Sdk.Enums; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class TransferOrder + { + public int netAmount { get; set; } + + public int commission { get; set; } + + public string settlementCurrency { get; set; } + + public int settlementCurrencyExponent { get; set; } + + public int chargedbackAmount { get; set; } + + public int currencyCodeExponent { get; set; } + + public DateTime creationDate { get; set; } + + public string modificationDate { get; set; } + + public List history { get; set; } + + public string environment { get; set; } + + public string paymentStatus { get; set; } + + public string orderCode { get; set; } + + public string customerOrderCode { get; set; } + + public PaymentResponse paymentResponse { get; set; } + + public List warnings { get; set; } + + public Dictionary customerIdentifiers { get; set; } + + public string paymentStatusReason { get; set; } + + public CurrencyCode currencyCode { get; set; } + + public string token { get; set; } + + public string orderDescription { get; set; } + + public int amount { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferResponse.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferResponse.cs new file mode 100644 index 0000000..888fcd9 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferResponse.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class TransferResponse + { + public List transfers { get; set; } + + public int totalPages { get; set; } + + public int numberOfElements { get; set; } + + public int currentPageNumber { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferSummary.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferSummary.cs new file mode 100644 index 0000000..180396e --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/TransferSummary.cs @@ -0,0 +1,22 @@ +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class TransferSummary + { + public int netAmount { get; set; } + + public string settlementCurrency { get; set; } + + public string settlementCurrencyExponent { get; set; } + + public string bankName { get; set; } + + public string transferDate { get; set; } + + public string transferId { get; set; } + + public string batchId { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Warning.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Warning.cs new file mode 100644 index 0000000..4000aeb --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/Warning.cs @@ -0,0 +1,12 @@ +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class Warning + { + public string code { get; set; } + + public string message { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/WebhookSetting.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/WebhookSetting.cs new file mode 100644 index 0000000..8551cad --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Models/WebhookSetting.cs @@ -0,0 +1,16 @@ +using System; + +namespace Worldpay.Sdk.Models +{ + [Serializable] + public class WebhookSetting + { + public string webHookUrl { get; set; } + + public string webHookId { get; set; } + + public string creationDate { get; set; } + + public string[] events { get; set; } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/OrderService.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/OrderService.cs new file mode 100644 index 0000000..2298d9e --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/OrderService.cs @@ -0,0 +1,125 @@ +using System; +using WorldPay.Sdk.Models; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Service for interacting with the Worldpay Order API + /// + [Serializable] + public class OrderService : AbstractService + { + private readonly string _baseUrl; + + /// + /// Constructor + /// + public OrderService(string baseUrl, Http http) + : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// Retrieve an existing order + /// + /// Code of the order to retrieve + /// Details of the existing order + public TransferOrder FindOrder(string orderCode) + { + return Http.Get(String.Format("{0}/orders/{1}", _baseUrl, orderCode)); + } + + /// + /// Create a new order + /// + /// Details of the order to be created + /// Confirmation of the new order + public OrderResponse Create(OrderRequest orderRequest) + { + return Http.Post(_baseUrl + "/orders", orderRequest); + } + + /// + /// Capture entire payment from an authorized order. + /// + /// The code of the authorized order to capture. + /// Confirmation of the captured order + public OrderResponse CaptureAuthorizedOrder(string orderCode) + { + return Http.Post(String.Format("{0}/orders/{1}/capture", _baseUrl, orderCode), null); + } + + /// + /// Partially capture payment from an authorized order. + /// + /// The code of the authorized order to capture. + /// The amount to capture. This must be less than or equal to the amount that was Authorized. + /// Confirmation of the captured order + public OrderResponse CaptureAuthorizedOrder(string orderCode, int amount) + { + if (amount == 0) + { + return CaptureAuthorizedOrder(orderCode); + } + else + { + return Http.Post(String.Format("{0}/orders/{1}/capture", _baseUrl, orderCode),new CaptureRequest { captureAmount = amount }); + } + } + + /// + /// Cancel an authorized order. + /// + /// The code of the authorized order to cancel. + public void CancelAuthorizedOrder(string orderCode) + { + Http.Delete(String.Format("{0}/orders/{1}", _baseUrl, orderCode)); + } + + /// + /// Authorize a 3DS order + /// + /// Order code for the orer to be authorized + /// Authorization Response code from Issuer + /// 3D Secure Information + /// Confirmation of the new order + public OrderResponse Authorize(string orderCode, string responseCode, ThreeDSecureInfo threeDSInfo) + { + return Http.Put(String.Format("{0}/orders/{1}", _baseUrl, orderCode), + new OrderAuthorizationRequest() + { + threeDSResponseCode = responseCode, + threeDSecureInfo = threeDSInfo + }); + } + + /// + /// Refund and existing order + /// + /// The code of the order to be refunded + public void Refund(String orderCode) + { + Http.Post(String.Format("{0}/orders/{1}/refund", _baseUrl, orderCode), null); + } + + /// + /// Partially refund an existing order + /// + /// The code of the order to be partially refunded + /// The amount of the order to be partially refunded + public void Refund(String orderCode, int amount) + { + if (amount == 0) + { + Refund(orderCode); + } + else + { + PartialRefundRequest partialRefundRequest = new PartialRefundRequest { refundAmount = amount }; + Http.Post(String.Format("{0}/orders/{1}/refund", _baseUrl, orderCode), partialRefundRequest); + } + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Properties/AssemblyInfo.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..556c9f1 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +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("Worldpay.Sdk")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Worldpay.Sdk")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[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("e5913d84-e250-4cb9-b780-bdd8786a76e7")] + +// 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("1.2.0.1")] +[assembly: AssemblyFileVersion("1.2.0.1")] diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/SettingsService.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/SettingsService.cs new file mode 100644 index 0000000..119e32d --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/SettingsService.cs @@ -0,0 +1,55 @@ +using System; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Service for interacting with the Worldpay Order API + /// + [Serializable] + public class SettingsService : AbstractService + { + private readonly string _baseUrl; + + /// + /// Constructor + /// + public SettingsService(string baseUrl, Http http) : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// + /// + /// + /// + public SettingsResponse GetSettings(string merchantId) + { + var url = String.Format("{0}/merchants/{1}/settings", _baseUrl, merchantId); + return Http.Get(url); + } + + /// + /// + /// + /// + /// + public void UpdateRiskSettings(string merchantId, RiskSetting riskSettings) + { + var url = String.Format("{0}/merchants/{1}/settings/riskSettings", _baseUrl, merchantId); + Http.Put(url, riskSettings); + } + + /// + /// + /// + /// + /// + public void UpdateRecurringBilling(string merchantId, bool enable) + { + var url = String.Format("{0}/merchants/{1}/settings/orderSettings/recurringBilling/{2}", _baseUrl, merchantId, enable); + Http.Put(url, null); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/TokenService.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/TokenService.cs new file mode 100644 index 0000000..3f245f2 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/TokenService.cs @@ -0,0 +1,27 @@ +using System; +using Worldpay.Sdk; +using Worldpay.Sdk.Models; + +namespace WorldPay.Sdk +{ + public class TokenService : AbstractService + { + private readonly string _baseUrl; + + public TokenService(String baseUrl, Http http) + : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// Retrieve stored card details + /// + /// The token of the card to obtain details for + /// The obfuscated card details associated with the token provided + public TokenResponse Get(string token) + { + return Http.Get(String.Format("{0}/tokens/{1}", _baseUrl, token)); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/TransferService.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/TransferService.cs new file mode 100644 index 0000000..0d6e86e --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/TransferService.cs @@ -0,0 +1,45 @@ +using System; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// + /// + public class TransferService : AbstractService + { + /// + /// + /// + private readonly string _baseUrl; + + /// + /// Constructor + /// + public TransferService(string baseUrl, Http http) + : base(http) + { + _baseUrl = baseUrl; + } + + /// + /// + /// + /// + public TransferResponse GetTransfers(string merchantId, int? pageNumber) + { + var url = String.Format("{0}/transfers?merchantId={1}&pageNumber={2}", _baseUrl, merchantId, pageNumber); + return Http.Get(url); + } + + /// + /// + /// + /// + public TransferResponse GetTransfer(string transferId) + { + var url = String.Format("{0}/transfers", transferId); + return Http.Get(url); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WebhookHandler.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WebhookHandler.cs new file mode 100644 index 0000000..3fc70c4 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WebhookHandler.cs @@ -0,0 +1,6 @@ +namespace Worldpay.Sdk +{ + public class WebhookHandler + { + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WebhookService.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WebhookService.cs new file mode 100644 index 0000000..c499e24 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WebhookService.cs @@ -0,0 +1,26 @@ +using System.Web; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + public class WebhookService : AbstractService + { + /// + /// Constructor + /// + public WebhookService(Http http) : base(http) + { + + } + + /// + /// Handle an order webhook + /// + /// The incoming web request + /// Order response data + public OrderChangeNotification ProcessWebhook(HttpRequest request) + { + return Http.HandleRequest(request); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WorldPayException.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WorldPayException.cs new file mode 100644 index 0000000..ba3cd26 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WorldPayException.cs @@ -0,0 +1,31 @@ +using System; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk +{ + /// + /// Exception thrown when error returned by Worldpay API + /// + public class WorldpayException : Exception + { + /// + /// Details of the API error + /// + public ApiError apiError { get; private set; } + + /// + /// Constructor + /// + public WorldpayException(string message) : this(null, message) + { + } + + /// + /// Constructor + /// + public WorldpayException(ApiError error, string message) : base(message) + { + apiError = error; + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WorldPayRestClient.cs b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WorldPayRestClient.cs new file mode 100644 index 0000000..d5b3080 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/WorldPayRestClient.cs @@ -0,0 +1,104 @@ +using System.IO; +using WorldPay.Sdk; + +namespace Worldpay.Sdk +{ + /// + /// Master client for interacting with Worldpay REST services + /// + public class WorldpayRestClient + { + /// + /// The base url for the REST service + /// + private readonly string _baseUrl; + + /// + /// The service key for authorizing access + /// + private readonly string _serviceKey; + + /// + /// Constructor + /// + public WorldpayRestClient(string baseUrl, string serviceKey) + { + if (baseUrl == null) + { + throw new InvalidDataException("baseUrl cannot be null"); + } + + _baseUrl = baseUrl; + + if (serviceKey == null) + { + throw new InvalidDataException("serviceKey cannot be null"); + } + + _serviceKey = serviceKey; + } + + /// + /// Constructor + /// + public WorldpayRestClient(string serviceKey) : this(Configuration.BaseUrl, serviceKey) { } + + /// + /// Get service for interacting with authorization API + /// + public AuthService GetAuthService() + { + return new AuthService(new Http()); + } + + public TokenService GetTokenService() + { + return new TokenService(_baseUrl, new Http(_serviceKey)); + } + + /// + /// + /// + /// + public MerchantService GetMerchantService() + { + return new MerchantService(_baseUrl, new Http(_serviceKey)); + } + + /// + /// + /// + /// + public OrderService GetOrderService() + { + return new OrderService(_baseUrl, new Http(_serviceKey)); + } + + /// + /// + /// + /// + public SettingsService GetSettingsService() + { + return new SettingsService(_baseUrl, new Http(_serviceKey)); + } + + /// + /// + /// + /// + public WebhookService GetWebhookService() + { + return new WebhookService(new Http(_serviceKey)); + } + + /// + /// + /// + /// + public TransferService GetTransferService() + { + return new TransferService(_baseUrl, new Http(_serviceKey)); + } + } +} diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Worldpay.Sdk.csproj b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Worldpay.Sdk.csproj new file mode 100644 index 0000000..894feab --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Worldpay.Sdk.csproj @@ -0,0 +1,126 @@ + + + + + Debug + AnyCPU + {D2AB0290-8B33-4467-A0DF-975372B29E38} + Library + Properties + Worldpay.Sdk + Worldpay.Sdk + v3.5 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + lib\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Worldpay.Sdk35.csproj b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Worldpay.Sdk20.csproj similarity index 96% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/Worldpay.Sdk35.csproj rename to worldpay-lib-dotnet-4-6/Worldpay.Sdk/Worldpay.Sdk20.csproj index 3588230..43d718e 100644 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/Worldpay.Sdk35.csproj +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Worldpay.Sdk20.csproj @@ -1,122 +1,122 @@ - - - - - Debug - AnyCPU - {D2AB0290-8B33-4467-A0DF-975372B29E38} - Library - Properties - Worldpay.Sdk - Worldpay.Sdk - v3.5 - 512 - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\ - TRACE - prompt - 4 - false - - - - False - ..\Newtonsoft.Json\bin\Release\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - + + + + + Debug + AnyCPU + {D2AB0290-8B33-4467-A0DF-975372B29E38} + Library + Properties + Worldpay.Sdk + Worldpay.Sdk + v2.0 + 512 + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\ + TRACE + prompt + 4 + false + + + + False + ..\Newtonsoft.Json\bin\Release\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Worldpay.Sdk35.csproj b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Worldpay.Sdk35.csproj new file mode 100644 index 0000000..426ee89 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/Worldpay.Sdk35.csproj @@ -0,0 +1,122 @@ + + + + + Debug + AnyCPU + {D2AB0290-8B33-4467-A0DF-975372B29E38} + Library + Properties + Worldpay.Sdk + Worldpay.Sdk + v4.6 + 512 + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\ + TRACE + prompt + 4 + false + + + + False + ..\Newtonsoft.Json\bin\Release\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + + \ No newline at end of file diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Newtonsoft.Json.dll new file mode 100644 index 0000000..a81b347 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Newtonsoft.Json.dll differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Newtonsoft.Json.pdb b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Newtonsoft.Json.pdb new file mode 100644 index 0000000..2851c63 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Newtonsoft.Json.pdb differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Newtonsoft.Json.xml b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Newtonsoft.Json.xml new file mode 100644 index 0000000..e84b1b5 --- /dev/null +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Newtonsoft.Json.xml @@ -0,0 +1,3995 @@ + + + + Newtonsoft.Json + + + + + Instructs the how to serialize the object. + + + + + Gets or sets the member serialization. + + The member serialization. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified member serialization. + + The member serialization. + + + + Specifies the member serialization options for the . + + + + + All members are serialized by default. Members can be excluded using the . + + + + + Only members must be marked with the are serialized. + + + + + Specifies how object creation is handled by the . + + + + + Reuse existing objects, create new objects when needed. + + + + + Only reuse existing objects. + + + + + Always create new objects. + + + + + Converts a to and from the ISO 8601 date format (e.g. 2008-04-12T12:53Z). + + + + + Gets or sets the date time styles used when converting a date to and from JSON. + + The date time styles used when converting a date to and from JSON. + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Converts a to and from a JavaScript date constructor (e.g. new Date(52231943)). + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC. + + + + + The time represented is local time. + + + + + The time represented is UTC. + + + + + The time represented is not specified as either local time or Coordinated Universal Time (UTC). + + + + + Preserves the DateTimeKind field of a date when a DateTime object is converted to a string and the string is then converted back to a DateTime object. + + + + + Converts an to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Checks if the attributeName is a namespace attribute. + + Attribute name to test. + The attribute name prefix if it has one, otherwise an empty string. + True if attribute name is for a namespace attribute, otherwise false. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Converts a object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Determines whether this instance can convert the specified value type. + + Type of the value. + + true if this instance can convert the specified value type; otherwise, false. + + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class with the specified . + + The TextReader containing the XML data to read. + + + + Sets the current token and value. + + The new token. + The value. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Changes the to Closed. + + + + + Instructs the to always serialize the member with the specified name. + + + + + Gets or sets the name of the property. + + The name of the property. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with the specified name. + + Name of the property. + + + + Instructs the not to serialize the public field or public read/write property value. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets or sets how many IndentChars to write for each level in the hierarchy when is set to Formatting.Indented. + + + + + Gets or sets which character to use to quote attribute values. + + + + + Gets or sets which character to use for indenting when is set to Formatting.Indented. + + + + + Gets or sets a value indicating whether object names will be surrounded with quotes. + + + + + Creates an instance of the JsonWriter class using the specified . + + The TextWriter to write to. + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the specified end token. + + The end token to write. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + The exception thrown when an error occurs while reading Json text. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + + + + + + Gets the name. + + The name. + + + + Initializes a new instance of the class. + + The name. + + + + Determines whether the specified is equal to the current . + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + The parameter is null. + + + + Equalses the specified function. + + The function. + + + + + Equalses the specified a. + + A. + The b. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Returns a that represents the current . + + + A that represents the current . + + + + + Implements the operator ==. + + A. + The b. + The result of the operator. + + + + Implements the operator !=. + + A. + The b. + The result of the operator. + + + + Converts an object to and from JSON. + + + + + Writes the JSON representation of the object. + + The to write to. + The value. + + + + Reads the JSON representation of the object. + + The to read from. + Type of the object. + The object value. + + + + Determines whether this instance can convert the specified object type. + + Type of the object. + + true if this instance can convert the specified object type; otherwise, false. + + + + + Represents a collection of . + + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Specifies the state of the reader. + + + + + The Read method has not been called. + + + + + The end of the file has been reached successfully. + + + + + Reader is at a property. + + + + + Reader is at the start of an object. + + + + + Reader is in an object. + + + + + Reader is at the start of an array. + + + + + Reader is in an array. + + + + + The Close method has been called. + + + + + Reader has just read a value. + + + + + Reader is at the start of a constructor. + + + + + Reader in a constructor. + + + + + An error occurred that prevents the read operation from continuing. + + + + + The end of the file has been reached successfully. + + + + + Gets the current reader state. + + The current reader state. + + + + Gets the quotation mark character used to enclose the value of a string. + + + + + Gets the type of the current Json token. + + + + + Gets the text value of the current Json token. + + + + + Gets The Common Language Runtime (CLR) type for the current Json token. + + + + + Gets the depth of the current token in the JSON document. + + The depth of the current token in the JSON document. + + + + Initializes a new instance of the class with the specified . + + + + + Reads the next Json token from the stream. + + true if the next token was read successfully; false if there are no more tokens to read. + + + + Skips the children of the current token. + + + + + Sets the current token. + + The new token. + + + + Sets the current token and value. + + The new token. + The value. + + + + Sets the state based on current token type. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Changes the to Closed. + + + + + Provides methods for converting between common language runtime types and JavaScript types. + + + + + Represents JavaScript's boolean value true as a string. This field is read-only. + + + + + Represents JavaScript's boolean value false as a string. This field is read-only. + + + + + Represents JavaScript's null as a string. This field is read-only. + + + + + Represents JavaScript's undefined as a string. This field is read-only. + + + + + Represents JavaScript's positive infinity as a string. This field is read-only. + + + + + Represents JavaScript's negative infinity as a string. This field is read-only. + + + + + Represents JavaScript's NaN as a string. This field is read-only. + + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + The string delimiter character. + A Json string representation of the . + + + + Converts the to it's JavaScript string representation. + + The value to convert. + A Json string representation of the . + + + + Serializes the specified object to a JSON string. + + The object to serialize. + A JSON string representation of the object. + + + + Serializes the specified object to a JSON string using a collection of . + + The object to serialize. + A collection converters used while serializing. + A JSON string representation of the object. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The object to deserialize. + The of object being deserialized. + The deserialized object from the Json string. + + + + Deserializes the specified object to a Json object. + + The type of the object to deserialize. + The object to deserialize. + The deserialized object from the Json string. + + + + Deserializes the specified JSON to the given anonymous type. + + + The anonymous type to deserialize to. This can't be specified + traditionally and must be infered from the anonymous type passed + as a parameter. + + The object to deserialize. + The anonymous type object. + The deserialized anonymous type from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The type of the object to deserialize. + The object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Deserializes the JSON string to the specified type. + + The object to deserialize. + The type of the object to deserialize. + Converters to use while deserializing. + The deserialized object from the JSON string. + + + + Serializes the XML node to a JSON string. + + The node to serialize. + A JSON string of the XmlNode. + + + + Deserializes the XmlNode from a JSON string. + + The JSON string. + The deserialized XmlNode + + + + The exception thrown when an error occurs during Json serialization or deserialization. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with a specified error message. + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class + with a specified error message and a reference to the inner exception that is the cause of this exception. + + The error message that explains the reason for the exception. + The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + + + + Serializes and deserializes objects into and from the Json format. + The enables you to control how objects are encoded into Json. + + + + + Get or set how reference loops (e.g. a class referencing itself) is handled. + + + + + Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization. + + + + + Get or set how null values are handled during serialization and deserialization. + + + + + Gets or sets how objects are created during deserialization. + + The object creation handling. + + + + Gets a collection that will be used during serialization. + + Collection that will be used during serialization. + + + + Initializes a new instance of the class. + + + + + Deserializes the Json structure contained by the specified . + + The that contains the Json structure to deserialize. + The being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Deserializes the Json structure contained by the specified + into an instance of the specified type. + + The containing the object. + The of object being deserialized. + The instance of being deserialized. + + + + Gets the serializable members for the given . + + The object to get seralizable members for. + Seralizable members for the given type. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Serializes the specified and writes the Json structure + to a Stream using the specified . + + The used to write the Json structure. + The to serialize. + + + + Contains the LINQ to JSON extension methods. + + + + + Returns a collection of tokens that contains the ancestors of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the ancestors of every node in the source collection. + + + + Returns a collection of tokens that contains the descendants of every token in the source collection. + + The type of the objects in source, constrained to . + An of that contains the source collection. + An of that contains the descendants of every node in the source collection. + + + + Returns a collection of child properties of every object in the source collection. + + An of that contains the source collection. + An of that contains the properties of every object in the source collection. + + + + Returns a collection of child values of every object in the source collection with the given key. + + An of that contains the source collection. + The token key. + An of that contains the values of every node in the source collection with the given key. + + + + Returns a collection of child values of every object in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child values of every object in the source collection with the given key. + + The type to convert the values to. + An of that contains the source collection. + The token key. + An that contains the converted values of every node in the source collection with the given key. + + + + Returns a collection of converted child values of every object in the source collection. + + The type to convert the values to. + An of that contains the source collection. + An that contains the converted values of every node in the source collection. + + + + Returns a collection of child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the values of every node in the source collection. + + + + Returns a collection of converted child tokens of every array in the source collection. + + An of that contains the source collection. + An of that contains the converted values of every node in the source collection. + + + + Represents a JSON constructor. + + + + + Gets or sets the name of this constructor. + + The constructor name. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name and content. + + The constructor name. + The contents of the constructor. + + + + Initializes a new instance of the class with the specified name. + + The constructor name. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a token that can contain other tokens. + + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Get the first child token of this token. + + + A containing the first child token of the . + + + + + Get the last child token of this token. + + + A containing the last child token of the . + + + + + Returns a collection of the child tokens of this token, in document order. + + + An of containing the child tokens of this , in document order. + + + + + Returns a collection of the child values of this token, in document order. + + + + A containing the child values of this , in document order. + + + + + Returns a collection of the descendant tokens for this token in document order. + + An containing the descendant tokens of the . + + + + Adds the specified content as children of this . + + The content to be added. + + + + Adds the specified content as the first children of this . + + The content to be added. + + + + Creates an that can be used to add tokens to the . + + An that is ready to have content written to it. + + + + Replaces the children nodes of this token with the specified content. + + The content. + + + + Removes the child nodes from this token. + + + + + Represents a collection of objects. + + The type of token + + + + An empty collection of objects. + + + + + Initializes a new instance of the struct. + + The enumerable. + + + + Returns an enumerator that iterates through the collection. + + + A that can be used to iterate through the collection. + + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Gets the with the specified key. + + + + + + Represents a JSON object. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Initializes a new instance of the class with the specified content. + + The contents of the object. + + + + Gets the node type for this . + + The type. + + + + Gets an of this object's properties. + + An of this object's properties. + + + + Gets a the specified name. + + The property name. + A with the specified name or null. + + + + Gets an of this object's property values. + + An of this object's property values. + + + + Gets the with the specified key. + + The with the specified key. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Represents a JSON array. + + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Initializes a new instance of the class with the specified content. + + The contents of the array. + + + + Returns a count of this token's child tokens. + + A count of this token's child tokens. + + + + Loads an from a . + + A that will be read for the content of the . + A that contains the XML that was read from the specified . + + + + Load a from a string that contains JSON. + + A that contains JSON. + A populated from the string that contains JSON. + + + + Creates a from an object. + + The object that will be used to create . + A with the values of the specified object + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Gets the with the specified key. + + The with the specified key. + + + + Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + + + + + Initializes a new instance of the class. + + The token to read from. + + + + Reads the next Json token from the stream. + + + true if the next token was read successfully; false if there are no more tokens to read. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the token being writen. + + The token being writen. + + + + Initializes a new instance of the class writing to the given . + + The container being written to. + + + + Initializes a new instance of the class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end. + + The token. + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Represents an abstract JSON token. + + + + + Gets or sets the parent. + + The parent. + + + + Gets the root of this . + + The root of this . + + + + Gets the node type for this . + + The type. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Compares the values of two tokens, including the values of all descendant tokens. + + The first to compare. + The second to compare. + true if the tokens are equal; otherwise false. + + + + Gets the next sibling token of this node. + + The that contains the next sibling token. + + + + Gets the previous sibling token of this node. + + The that contains the previous sibling token. + + + + Returns a collection of the ancestor tokens of this token. + + A collection of the ancestor tokens of this token. + + + + Returns a collection of the sibling tokens after this token, in document order. + + A collection of the sibling tokens after this tokens, in document order. + + + + Returns a collection of the sibling tokens before this token, in document order. + + A collection of the sibling tokens before this token, in document order. + + + + Gets the with the specified key. + + The with the specified key. + + + + Gets the with the specified key converted to the specified type. + + The type to convert the token to. + The token key. + The converted token value. + + + + Get the first child token of this token. + + A containing the first child token of the . + + + + Get the last child token of this token. + + A containing the last child token of the . + + + + Returns a collection of the child tokens of this token, in document order. + + An of containing the child tokens of this , in document order. + + + + Returns a collection of the child tokens of this token, in document order. + + A containing the child tokens of this , in document order. + + + + Returns a collection of the child values of this token, in document order. + + A containing the child values of this , in document order. + + + + Removes this token from its parent. + + + + + Replaces this token with the specified token. + + The value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Returns the indented JSON for this token. + + + A containing the indented JSON. + + + + + Returns the indented JSON for this token using any given converters. + + A collection of which will be used when writing the token. + + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Performs an explicit conversion from to . + + The value. + The result of the conversion. + + + + Represents a JSON property. + + + + + Gets the property name. + + The property name. + + + + Gets or sets the property value. + + The property value. + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Gets the node type for this . + + The type. + + + + Initializes a new instance of the class. + + The property name. + + + + Initializes a new instance of the class. + + The property name. + The property value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies the type of token. + + + + + No token type has been set. + + + + + A JSON object. + + + + + A JSON array. + + + + + A JSON constructor. + + + + + A JSON object property. + + + + + A comment. + + + + + An integer value. + + + + + A float value. + + + + + A string value. + + + + + A boolean value. + + + + + A null value. + + + + + An undefined value. + + + + + A date value. + + + + + Represents a value in JSON (string, integer, date, etc). + + + + + Initializes a new instance of the class from another object. + + A object to copy from. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Initializes a new instance of the class with the given value. + + The value. + + + + Gets a value indicating whether this token has childen tokens. + + + true if this token has child values; otherwise, false. + + + + + Creates a comment with the given value. + + The value. + A comment with the given value. + + + + Creates a string with the given value. + + The value. + A string with the given value. + + + + Gets the node type for this . + + The type. + + + + Gets or sets the underlying token value. + + The underlying token value. + + + + Writes this token to a . + + A into which this method will write. + A collection of which will be used when writing the token. + + + + Specifies missing member handling options for the . + + + + + Throw a when a missing member is encountered during deserialization. + + + + + Ignore a missing member and do not attempt to deserialize it. + + + + + Specifies null value handling options for the . + + + + + Include null values when serializing and deserializing objects. + + + + + Ignore null values when serializing and deserializing objects. + + + + + Specifies reference loop handling options for the . + + + + + Throw a when a loop is encountered. + + + + + Ignore loop references and do not serialize. + + + + + Serialize loop references. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null or empty. + + The collection. + + true if the collection is null or empty; otherwise, false. + + + + + Determines whether the collection is null, empty or its contents are uninitialized values. + + The list. + + true if the collection is null or empty or its contents are uninitialized values; otherwise, false. + + + + + Makes a slice of the specified list in between the start and end indexes. + + The list. + The start index. + The end index. + A slice of the list. + + + + Makes a slice of the specified list in between the start and end indexes, + getting every so many items based upon the step. + + The list. + The start index. + The end index. + The step. + A slice of the list. + + + + Group the collection using a function which returns the key. + + The source collection to group. + The key selector. + A Dictionary with each key relating to a list of objects in a list grouped under it. + + + + Adds the elements of the specified collection to the specified generic IList. + + The list to add to. + The collection of elements to add. + + + + Gets the type of the typed list's items. + + The type. + The type of the typed list's items. + + + + Tests whether the list's items are their unitialized value. + + The list. + Whether the list's items are their unitialized value + + + + Gets the member's underlying type. + + The member. + The underlying type of the member. + + + + Determines whether the member is an indexed property. + + The member. + + true if the member is an indexed property; otherwise, false. + + + + + Determines whether the property is an indexed property. + + The property. + + true if the property is an indexed property; otherwise, false. + + + + + Gets the member's value on the object. + + The member. + The target object. + The member's value on the object. + + + + Sets the member's value on the target object. + + The member. + The target. + The value. + + + + Determines whether the specified MemberInfo can be read. + + The MemberInfo to determine whether can be read. + + true if the specified MemberInfo can be read; otherwise, false. + + + + + Determines whether the specified MemberInfo can be set. + + The MemberInfo to determine whether can be set. + + true if the specified MemberInfo can be set; otherwise, false. + + + + + Determines whether the string contains white space. + + The string to test for white space. + + true if the string contains white space; otherwise, false. + + + + + Determines whether the string is all white space. Empty string will return false. + + The string to test whether it is all white space. + + true if the string is all white space; otherwise, false. + + + + + Ensures the target string ends with the specified string. + + The target. + The value. + The target string with the value string at the end. + + + + Determines whether the SqlString is null or empty. + + The string. + + true if the SqlString is null or empty; otherwise, false. + + + + + Perform an action if the string is not null or empty. + + The value. + The action to perform. + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + + + + + Indents the specified string. + + The string to indent. + The number of characters to indent by. + The indent character. + + + + + Numbers the lines. + + The string to number. + + + + + Nulls an empty string. + + The string. + Null if the string was null, otherwise the string unchanged. + + + + Specifies the type of Json token. + + + + + This is returned by the if a method has not been called. + + + + + An object start token. + + + + + An array start token. + + + + + An object property name. + + + + + A constructor end token. + + + + + A comment. + + + + + An interger. + + + + + A float. + + + + + A string. + + + + + A boolean. + + + + + A null token. + + + + + An undefined token. + + + + + An object end token. + + + + + An array end token. + + + + + A constructor start token. + + + + + A Date. + + + + + Specifies the state of the . + + + + + An exception has been thrown, which has left the in an invalid state. + You may call the method to put the in the Closed state. + Any other method calls results in an being thrown. + + + + + The method has been called. + + + + + An object is being written. + + + + + A array is being written. + + + + + A constructor is being written. + + + + + A property is being written. + + + + + A write method has not been called. + + + + + Specifies formatting options for the . + + + + + No special formatting is applied. This is the default. + + + + + Causes child objects to be indented according to the and settings. + + + + + Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + + + + + Gets the top. + + The top. + + + + Gets the state of the writer. + + + + + Indicates how the output is formatted. + + + + + Creates an instance of the JsonWriter class. + + + + + Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + + + + + Closes this stream and the underlying stream. + + + + + Writes the beginning of a Json object. + + + + + Writes the end of a Json object. + + + + + Writes the beginning of a Json array. + + + + + Writes the end of an array. + + + + + Writes the start of a constructor with the given name. + + The name of the constructor. + + + + Writes the end constructor. + + + + + Writes the property name of a name/value pair on a Json object. + + The name of the property. + + + + Writes the end of the current Json object or array. + + + + + Writes the current token. + + The to read the token from. + + + + Writes the specified end token. + + The end token to write. + + + + Writes indent characters. + + + + + Writes the JSON value delimiter. + + + + + Writes an indent space. + + + + + Writes a null value. + + + + + Writes an undefined value. + + + + + Writes raw JavaScript manually. + + The raw JavaScript to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes a value. + + The value to write. + + + + Writes out a comment /*...*/ containing the specified text. + + Text to place inside the comment. + + + + Writes out the given white space. + + The string of white space characters. + + + + Builds a string. Unlike StringBuilder this class lets you reuse it's internal buffer. + + + + + Provides a set of static (Shared in Visual Basic) methods for + querying objects that implement . + + + + + Returns the input typed as . + + + + + Returns an empty that has the + specified type argument. + + + + + Converts the elements of an to the + specified type. + + + + + Filters the elements of an based on a specified type. + + + + + Generates a sequence of integral numbers within a specified range. + + The value of the first integer in the sequence. + The number of sequential integers to generate. + + + + Generates a sequence that contains one repeated value. + + + + + Filters a sequence of values based on a predicate. + + + + + Filters a sequence of values based on a predicate. + Each element's index is used in the logic of the predicate function. + + + + + Projects each element of a sequence into a new form. + + + + + Projects each element of a sequence into a new form by + incorporating the element's index. + + + + + Projects each element of a sequence to an + and flattens the resulting sequences into one sequence. + + + + + Projects each element of a sequence to an , + and flattens the resulting sequences into one sequence. The + index of each source element is used in the projected form of + that element. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. + + + + + Projects each element of a sequence to an , + flattens the resulting sequences into one sequence, and invokes + a result selector function on each element therein. The index of + each source element is used in the intermediate projected form + of that element. + + + + + Returns elements from a sequence as long as a specified condition is true. + + + + + Returns elements from a sequence as long as a specified condition is true. + The element's index is used in the logic of the predicate function. + + + + + Returns a specified number of contiguous elements from the start + of a sequence. + + + + + Base implementation of First operator. + + + + + Returns the first element of a sequence. + + + + + Returns the first element in a sequence that satisfies a specified condition. + + + + + Returns the first element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the first element of the sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Last operator. + + + + + Returns the last element of a sequence. + + + + + Returns the last element of a sequence that satisfies a + specified condition. + + + + + Returns the last element of a sequence, or a default value if + the sequence contains no elements. + + + + + Returns the last element of a sequence that satisfies a + condition or a default value if no such element is found. + + + + + Base implementation of Single operator. + + + + + Returns the only element of a sequence, and throws an exception + if there is not exactly one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition, and throws an exception if more than one + such element exists. + + + + + Returns the only element of a sequence, or a default value if + the sequence is empty; this method throws an exception if there + is more than one element in the sequence. + + + + + Returns the only element of a sequence that satisfies a + specified condition or a default value if no such element + exists; this method throws an exception if more than one element + satisfies the condition. + + + + + Returns the element at a specified index in a sequence. + + + + + Returns the element at a specified index in a sequence or a + default value if the index is out of range. + + + + + Inverts the order of the elements in a sequence. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. + + + + + Bypasses elements in a sequence as long as a specified condition + is true and then returns the remaining elements. The element's + index is used in the logic of the predicate function. + + + + + Bypasses a specified number of elements in a sequence and then + returns the remaining elements. + + + + + Returns the number of elements in a sequence. + + + + + Returns a number that represents how many elements in the + specified sequence satisfy a condition. + + + + + Returns an that represents the total number + of elements in a sequence. + + + + + Returns an that represents how many elements + in a sequence satisfy a condition. + + + + + Concatenates two sequences. + + + + + Creates a from an . + + + + + Creates an array from an . + + + + + Returns distinct elements from a sequence by using the default + equality comparer to compare values. + + + + + Returns distinct elements from a sequence by using a specified + to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and a key comparer. + + + + + Creates a from an + according to specified key + and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer and an element selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function. + + + + + Groups the elements of a sequence according to a specified key + selector function and compares the keys by using a specified + comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and projects the elements for each group by + using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. + + + + + Groups the elements of a sequence according to a key selector + function. The keys are compared by using a comparer and each + group's elements are projected by using a specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The elements of each group are projected by using a + specified function. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. The keys are compared by using a specified comparer. + + + + + Groups the elements of a sequence according to a specified key + selector function and creates a result value from each group and + its key. Key values are compared by using a specified comparer, + and the elements of each group are projected by using a + specified function. + + + + + Applies an accumulator function over a sequence. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value. + + + + + Applies an accumulator function over a sequence. The specified + seed value is used as the initial accumulator value, and the + specified function is used to select the result value. + + + + + Produces the set union of two sequences by using the default + equality comparer. + + + + + Produces the set union of two sequences by using a specified + . + + + + + Returns the elements of the specified sequence or the type + parameter's default value in a singleton collection if the + sequence is empty. + + + + + Returns the elements of the specified sequence or the specified + value in a singleton collection if the sequence is empty. + + + + + Determines whether all elements of a sequence satisfy a condition. + + + + + Determines whether a sequence contains any elements. + + + + + Determines whether any element of a sequence satisfies a + condition. + + + + + Determines whether a sequence contains a specified element by + using the default equality comparer. + + + + + Determines whether a sequence contains a specified element by + using a specified . + + + + + Determines whether two sequences are equal by comparing the + elements by using the default equality comparer for their type. + + + + + Determines whether two sequences are equal by comparing their + elements by using a specified . + + + + + Base implementation for Min/Max operator. + + + + + Base implementation for Min/Max operator for nullable types. + + + + + Returns the minimum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the minimum resulting value. + + + + + Returns the maximum value in a generic sequence. + + + + + Invokes a transform function on each element of a generic + sequence and returns the maximum resulting value. + + + + + Makes an enumerator seen as enumerable once more. + + + The supplied enumerator must have been started. The first element + returned is the element the enumerator was on when passed in. + DO NOT use this method if the caller must be a generator. It is + mostly safe among aggregate operations. + + + + + Sorts the elements of a sequence in ascending order according to a key. + + + + + Sorts the elements of a sequence in ascending order by using a + specified comparer. + + + + + Sorts the elements of a sequence in descending order according to a key. + + + + + Sorts the elements of a sequence in descending order by using a + specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + ascending order by using a specified comparer. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order, according to a key. + + + + + Performs a subsequent ordering of the elements in a sequence in + descending order by using a specified comparer. + + + + + Base implementation for Intersect and Except operators. + + + + + Produces the set intersection of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set intersection of two sequences by using the + specified to compare values. + + + + + Produces the set difference of two sequences by using the + default equality comparer to compare values. + + + + + Produces the set difference of two sequences by using the + specified to compare values. + + + + + Creates a from an + according to a specified key + selector function. + + + + + Creates a from an + according to a specified key + selector function and key comparer. + + + + + Creates a from an + according to specified key + selector and element selector functions. + + + + + Creates a from an + according to a specified key + selector function, a comparer, and an element selector function. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. + + + + + Correlates the elements of two sequences based on matching keys. + The default equality comparer is used to compare keys. A + specified is used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. + + + + + Correlates the elements of two sequences based on equality of + keys and groups the results. The default equality comparer is + used to compare keys. A specified + is used to compare keys. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Computes the sum of a sequence of nullable values. + + + + + Computes the sum of a sequence of nullable + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of nullable values. + + + + + Computes the average of a sequence of nullable values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Computes the sum of a sequence of values. + + + + + Computes the sum of a sequence of + values that are obtained by invoking a transform function on + each element of the input sequence. + + + + + Computes the average of a sequence of values. + + + + + Computes the average of a sequence of values + that are obtained by invoking a transform function on each + element of the input sequence. + + + + + Returns the minimum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the minimum nullable value. + + + + + Returns the maximum value in a sequence of nullable + values. + + + + + Invokes a transform function on each element of a sequence and + returns the maximum nullable value. + + + + + Represents a collection of objects that have a common key. + + + + + Gets the key of the . + + + + + Defines an indexer, size property, and Boolean search method for + data structures that map keys to + sequences of values. + + + + + Represents a sorted sequence. + + + + + Performs a subsequent ordering on the elements of an + according to a key. + + + + + Represents a collection of keys each mapped to one or more values. + + + + + Gets the number of key/value collection pairs in the . + + + + + Gets the collection of values indexed by the specified key. + + + + + Determines whether a specified key is in the . + + + + + Applies a transform function to each key and its associated + values and returns the results. + + + + + Returns a generic enumerator that iterates through the . + + + + + This attribute allows us to define extension methods without + requiring .NET Framework 3.5. For more information, see the section, + Extension Methods in .NET Framework 2.0 Apps, + of Basic Instincts: Extension Methods + column in MSDN Magazine, + issue Nov 2007. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + + This type is not intended to be used directly from user code. + It may be removed or changed in a future version without notice. + + + + diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Worldpay.Sdk.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Worldpay.Sdk.dll new file mode 100644 index 0000000..2103b11 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Worldpay.Sdk.dll differ diff --git a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/WorldPay.Sdk.dll.config b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config old mode 100755 new mode 100644 similarity index 74% rename from worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/WorldPay.Sdk.dll.config rename to worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config index b58463c..90f1c56 --- a/worldpay-lib-dotnet-2-0/Worldpay.Sdk/bin/Debug/WorldPay.Sdk.dll.config +++ b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Worldpay.Sdk.dll.config @@ -1,4 +1,4 @@ - + @@ -9,4 +9,4 @@ - \ No newline at end of file + diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Worldpay.Sdk.pdb b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Worldpay.Sdk.pdb new file mode 100644 index 0000000..c2b8b3f Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/bin/Worldpay.Sdk.pdb differ diff --git a/worldpay-lib-dotnet-4-6/Worldpay.Sdk/lib/Newtonsoft.Json.dll b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/lib/Newtonsoft.Json.dll new file mode 100644 index 0000000..4703b89 Binary files /dev/null and b/worldpay-lib-dotnet-4-6/Worldpay.Sdk/lib/Newtonsoft.Json.dll differ diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.Examples.dll b/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.Examples.dll deleted file mode 100644 index 80cce35..0000000 Binary files a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.Examples.dll and /dev/null differ diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.Examples.pdb b/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.Examples.pdb deleted file mode 100644 index a81cf4c..0000000 Binary files a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.Examples.pdb and /dev/null differ diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll b/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll deleted file mode 100644 index 816ce0d..0000000 Binary files a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll and /dev/null differ diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.pdb b/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.pdb deleted file mode 100644 index a74773a..0000000 Binary files a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.pdb and /dev/null differ diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll b/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll deleted file mode 100755 index 1317955..0000000 Binary files a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll and /dev/null differ diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Global.asax.cs b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Global.asax.cs index cd16d72..e44ed28 100644 --- a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Global.asax.cs +++ b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Global.asax.cs @@ -1,15 +1,17 @@ using System; using System.Configuration; +using System.Net; using Configuration = Worldpay.Sdk.Configuration; namespace Worldpay.Sdk.Examples { public class Global : System.Web.HttpApplication - { + { protected void Application_Start(object sender, EventArgs e) { - + //Specifically use TLS1.2 + ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; } protected void Session_Start(object sender, EventArgs e) diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Web.config b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Web.config index be4fe62..d0d0cfb 100644 --- a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Web.config +++ b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Web.config @@ -4,13 +4,26 @@ http://go.microsoft.com/fwlink/?LinkId=169433 --> + + + +
+ +
+
+
+
+ + + + - + @@ -23,6 +36,64 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj old mode 100755 new mode 100644 diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj index cf63cc0..6749cd8 100644 --- a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj +++ b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj @@ -1,5 +1,5 @@  - + Debug @@ -60,6 +60,10 @@ + + False + bin\Worldpay.Sdk.dll + @@ -224,12 +228,6 @@ - - - {d2ab0290-8b33-4467-a0df-975372b29e38} - Worldpay.Sdk35 - - 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) @@ -242,6 +240,7 @@ AnyCPU prompt MinimumRecommendedRules.ruleset + false diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll index befe9a0..29bbdd7 100644 Binary files a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll and b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll differ diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config index be4fe62..d0d0cfb 100644 --- a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config +++ b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config @@ -4,13 +4,26 @@ http://go.microsoft.com/fwlink/?LinkId=169433 --> + + + +
+ +
+
+
+
+ + + + - + @@ -23,6 +36,64 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb index a74e0ee..d9b1345 100644 Binary files a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb and b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb differ diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.dll b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.dll deleted file mode 100755 index bb73f96..0000000 Binary files a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.dll and /dev/null differ diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.pdb b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.pdb deleted file mode 100755 index 9fc46dd..0000000 Binary files a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.pdb and /dev/null differ diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll index bfca7bd..7443f53 100644 Binary files a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll and b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll differ diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll b/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll old mode 100755 new mode 100644 diff --git a/worldpay-sample-dotnet-4-0/.gitignore b/worldpay-sample-dotnet-4-0/.gitignore new file mode 100644 index 0000000..9d3ff52 --- /dev/null +++ b/worldpay-sample-dotnet-4-0/.gitignore @@ -0,0 +1,4 @@ +TestResults +obj +*.suo +*.user diff --git a/worldpay-sample-dotnet-2-0/.vs/config/applicationhost.config b/worldpay-sample-dotnet-4-0/.vs/config/applicationhost.config similarity index 98% rename from worldpay-sample-dotnet-2-0/.vs/config/applicationhost.config rename to worldpay-sample-dotnet-4-0/.vs/config/applicationhost.config index 0e88eab..f105bcf 100644 --- a/worldpay-sample-dotnet-2-0/.vs/config/applicationhost.config +++ b/worldpay-sample-dotnet-4-0/.vs/config/applicationhost.config @@ -1,1038 +1,1038 @@ - - - - - - - - -
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
- -
-
- -
-
-
- - -
-
-
-
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMCancel.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMCancel.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMCancel.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMCancel.aspx index aa55c18..d9f4df5 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMCancel.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMCancel.aspx @@ -1,13 +1,13 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMCancel.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMCancel" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

.NET Library Create Order Example

- -

Payment Response

-

- - -

+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMCancel.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMCancel" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

.NET Library Create Order Example

+ +

Payment Response

+

+ + +

\ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMCancel.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMCancel.aspx.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMCancel.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMCancel.aspx.cs index a4b7398..b2b3bf4 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMCancel.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMCancel.aspx.cs @@ -1,26 +1,26 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Worldpay.Sdk; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Examples -{ - public partial class APMCancel : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - onAuthorizeOrder(this, null); - } - - protected void onAuthorizeOrder(object sender, CommandEventArgs e) - { - string orderCode = (string)Session["orderCode"]; - OrderResponse.Text = "APM Order " + orderCode + " has been cancelled
"; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class APMCancel : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + string orderCode = (string)Session["orderCode"]; + OrderResponse.Text = "APM Order " + orderCode + " has been cancelled
"; + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMCancel.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMCancel.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMCancel.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMCancel.aspx.designer.cs index f4eaa3c..81c3d7c 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMCancel.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMCancel.aspx.designer.cs @@ -1,33 +1,33 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class APMCancel { - - /// - /// OrderResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal OrderResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class APMCancel { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMFailure.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMFailure.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMFailure.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMFailure.aspx index fcbedcb..2d02a22 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMFailure.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMFailure.aspx @@ -1,13 +1,13 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMFailure.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMFailure" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

.NET Library Create Order Example

- -

Payment Response

-

- - -

+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMFailure.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMFailure" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

.NET Library Create Order Example

+ +

Payment Response

+

+ + +

\ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMFailure.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMFailure.aspx.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMFailure.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMFailure.aspx.cs index 44b57a5..a4f8c5d 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMFailure.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMFailure.aspx.cs @@ -1,26 +1,26 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Worldpay.Sdk; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Examples -{ - public partial class APMFailure : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - onAuthorizeOrder(this, null); - } - - protected void onAuthorizeOrder(object sender, CommandEventArgs e) - { - string orderCode = (string)Session["orderCode"]; - OrderResponse.Text = "There was an error authorizing the APM Order " + orderCode + "
"; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class APMFailure : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + string orderCode = (string)Session["orderCode"]; + OrderResponse.Text = "There was an error authorizing the APM Order " + orderCode + "
"; + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMFailure.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMFailure.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMFailure.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMFailure.aspx.designer.cs index 83b31ff..16a4525 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMFailure.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMFailure.aspx.designer.cs @@ -1,33 +1,33 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class APMFailure { - - /// - /// OrderResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal OrderResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class APMFailure { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMPending.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMPending.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMPending.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMPending.aspx index 0adab86..f33b685 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMPending.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMPending.aspx @@ -1,13 +1,13 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMPending.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMPending" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

.NET Library Create Order Example

- -

Payment Response

-

- - -

+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMPending.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMPending" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

.NET Library Create Order Example

+ +

Payment Response

+

+ + +

\ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMPending.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMPending.aspx.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMPending.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMPending.aspx.cs index ee906bf..268c8c9 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMPending.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMPending.aspx.cs @@ -1,26 +1,26 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Worldpay.Sdk; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Examples -{ - public partial class APMPending : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - onAuthorizeOrder(this, null); - } - - protected void onAuthorizeOrder(object sender, CommandEventArgs e) - { - string orderCode = (string)Session["orderCode"]; - OrderResponse.Text = "APM Order " + orderCode + " has been marked as pending
"; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class APMPending : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + string orderCode = (string)Session["orderCode"]; + OrderResponse.Text = "APM Order " + orderCode + " has been marked as pending
"; + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMPending.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMPending.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMPending.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMPending.aspx.designer.cs index d800408..44b3072 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMPending.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMPending.aspx.designer.cs @@ -1,33 +1,33 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class APMPending { - - /// - /// OrderResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal OrderResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class APMPending { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMSuccess.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMSuccess.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMSuccess.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMSuccess.aspx index a381d41..7734f11 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMSuccess.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMSuccess.aspx @@ -1,13 +1,13 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMSuccess.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMSuccess" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

.NET Library Create Order Example

- -

Payment Response

-

- - -

+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMSuccess.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMSuccess" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

.NET Library Create Order Example

+ +

Payment Response

+

+ + +

\ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMSuccess.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMSuccess.aspx.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMSuccess.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMSuccess.aspx.cs index 24deec2..d27d7cc 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMSuccess.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMSuccess.aspx.cs @@ -1,26 +1,26 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Worldpay.Sdk; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Examples -{ - public partial class APMSuccess : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - onAuthorizeOrder(this, null); - } - - protected void onAuthorizeOrder(object sender, CommandEventArgs e) - { - string orderCode = (string)Session["orderCode"]; - OrderResponse.Text = "APM Order " + orderCode + " has been authorized
"; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class APMSuccess : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + string orderCode = (string)Session["orderCode"]; + OrderResponse.Text = "APM Order " + orderCode + " has been authorized
"; + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMSuccess.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMSuccess.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMSuccess.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMSuccess.aspx.designer.cs index 44d1934..deddb14 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/APMSuccess.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/APMSuccess.aspx.designer.cs @@ -1,33 +1,33 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class APMSuccess { - - /// - /// OrderResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal OrderResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class APMSuccess { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx index f67cde0..2173a7f 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx @@ -1,13 +1,13 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AuthorizeOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.AuthorizeOrder" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

.NET Library Create Order Example

- -

Payment Response

-

- - -

+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AuthorizeOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.AuthorizeOrder" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

.NET Library Create Order Example

+ +

Payment Response

+

+ + +

\ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.cs index d44bc26..d374156 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Worldpay.Sdk; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Examples -{ - public partial class AuthorizeOrder : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - onAuthorizeOrder(this, null); - } - - protected void onAuthorizeOrder(object sender, CommandEventArgs e) - { - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - - string orderCode = (string)Session["orderCode"]; - var responseCode = HttpContext.Current.Request.Form["PaRes"]; - var httpRequest = HttpContext.Current.Request; - ThreeDSecureInfo threeDSInfo = new ThreeDSecureInfo() - { - shopperIpAddress = httpRequest.UserHostAddress, - shopperSessionId = HttpContext.Current.Session.SessionID, - shopperUserAgent = httpRequest.UserAgent, - shopperAcceptHeader = String.Join(";", httpRequest.AcceptTypes) - }; - - try - { - var response = client.GetOrderService().Authorize(orderCode, responseCode, threeDSInfo); - OrderResponse.Text = "Order code:" + response.orderCode + "
Payment Status: " + - response.paymentStatus + "
Environment: " + response.environment; - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - catch (Exception exc) - { - throw new InvalidOperationException("Error sending request with order code " + orderCode, exc); - } - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class AuthorizeOrder : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + string orderCode = (string)Session["orderCode"]; + var responseCode = HttpContext.Current.Request.Form["PaRes"]; + var httpRequest = HttpContext.Current.Request; + ThreeDSecureInfo threeDSInfo = new ThreeDSecureInfo() + { + shopperIpAddress = httpRequest.UserHostAddress, + shopperSessionId = HttpContext.Current.Session.SessionID, + shopperUserAgent = httpRequest.UserAgent, + shopperAcceptHeader = String.Join(";", httpRequest.AcceptTypes) + }; + + try + { + var response = client.GetOrderService().Authorize(orderCode, responseCode, threeDSInfo); + OrderResponse.Text = "Order code:" + response.orderCode + "
Payment Status: " + + response.paymentStatus + "
Environment: " + response.environment; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request with order code " + orderCode, exc); + } + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.designer.cs index 3111253..1e2fdfd 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.designer.cs @@ -1,33 +1,33 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class AuthorizeOrder { - - /// - /// OrderResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal OrderResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class AuthorizeOrder { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx similarity index 98% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx index 05c1eab..cfe49a3 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx @@ -1,25 +1,25 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CancelAuthorizedOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.CancelAuthorizedOrder" MasterPageFile="Master.Master" %> -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

.NET Library Cancel Authorized Order Example

- - -
-
-
- - -
- - -
- - -

Response

-

-
- - - +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CancelAuthorizedOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.CancelAuthorizedOrder" MasterPageFile="Master.Master" %> +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

.NET Library Cancel Authorized Order Example

+ + +
+
+
+ + +
+ + +
+ + +

Response

+

+
+ + +
\ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.cs index 12c220c..fea0c51 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.cs @@ -1,38 +1,38 @@ -using System; -using System.Web; -using System.Web.UI.WebControls; - -namespace Worldpay.Sdk.Examples -{ - public partial class CancelAuthorizedOrder : System.Web.UI.Page - { - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - DataBind(); - } - - protected void OnCancelOrder(object sender, CommandEventArgs e) - { - var form = HttpContext.Current.Request.Form; - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - - var orderCode = form["orderCode"]; - - try - { - client.GetOrderService().CancelAuthorizedOrder(orderCode); - ServerResponse.Text = String.Format("Authorized order {0} has been cancelled", orderCode); - SuccessPanel.Visible = true; - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - catch (Exception exc) - { - throw new InvalidOperationException("Error sending request ", exc); - } - } - } +using System; +using System.Web; +using System.Web.UI.WebControls; + +namespace Worldpay.Sdk.Examples +{ + public partial class CancelAuthorizedOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnCancelOrder(object sender, CommandEventArgs e) + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + var orderCode = form["orderCode"]; + + try + { + client.GetOrderService().CancelAuthorizedOrder(orderCode); + ServerResponse.Text = String.Format("Authorized order {0} has been cancelled", orderCode); + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request ", exc); + } + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.designer.cs index 3b0817b..0ae3b24 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.designer.cs @@ -1,69 +1,69 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class CancelAuthorizedOrder { - - /// - /// RequestPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel RequestPanel; - - /// - /// CancelAuthorizedOrderForm control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlForm CancelAuthorizedOrderForm; - - /// - /// CancelOrder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button CancelOrder; - - /// - /// SuccessPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SuccessPanel; - - /// - /// ServerResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ServerResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class CancelAuthorizedOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// CancelAuthorizedOrderForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm CancelAuthorizedOrderForm; + + /// + /// CancelOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button CancelOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx index ef697ca..d43d583 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx @@ -1,29 +1,29 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CaptureAuthorizedOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.CaptureAuthorizedOrder" MasterPageFile="Master.Master" %> -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

.NET Library Capture Authorized Order Example

- - -
-
-
- - -
-
- - -
- - -
- - -

Response

-

-
- - - +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CaptureAuthorizedOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.CaptureAuthorizedOrder" MasterPageFile="Master.Master" %> +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

.NET Library Capture Authorized Order Example

+ + +
+
+
+ + +
+
+ + +
+ + +
+ + +

Response

+

+
+ + +
\ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.cs index 2202472..ac5a534 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.cs @@ -1,47 +1,47 @@ -using System; -using System.Web; -using System.Web.UI.WebControls; - -namespace Worldpay.Sdk.Examples -{ - public partial class CaptureAuthorizedOrder : System.Web.UI.Page - { - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - DataBind(); - } - - protected void OnCaptureOrder(object sender, CommandEventArgs e) - { - var form = HttpContext.Current.Request.Form; - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - - var orderCode = form["orderCode"]; - int amount = 0; - try - { - amount = (int)(Convert.ToDecimal(form["amount"]) * 100); - } - catch (Exception excAmount) { } - - try - { - var response = client.GetOrderService().CaptureAuthorizedOrder(orderCode, amount); - - ServerResponse.Text = "Order code:" + response.orderCode + - "
Payment Status: " + response.paymentStatus + - "
Environment: " + response.environment; - SuccessPanel.Visible = true; - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - catch (Exception exc) - { - throw new InvalidOperationException("Error sending request ", exc); - } - } - } +using System; +using System.Web; +using System.Web.UI.WebControls; + +namespace Worldpay.Sdk.Examples +{ + public partial class CaptureAuthorizedOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnCaptureOrder(object sender, CommandEventArgs e) + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + var orderCode = form["orderCode"]; + int amount = 0; + try + { + amount = (int)(Convert.ToDecimal(form["amount"]) * 100); + } + catch (Exception excAmount) { } + + try + { + var response = client.GetOrderService().CaptureAuthorizedOrder(orderCode, amount); + + ServerResponse.Text = "Order code:" + response.orderCode + + "
Payment Status: " + response.paymentStatus + + "
Environment: " + response.environment; + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request ", exc); + } + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.designer.cs index 98e3b6d..1be08eb 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.designer.cs @@ -1,69 +1,69 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class CaptureAuthorizedOrder { - - /// - /// RequestPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel RequestPanel; - - /// - /// CaptureAuthorizedOrderForm control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlForm CaptureAuthorizedOrderForm; - - /// - /// CaptureOrder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button CaptureOrder; - - /// - /// SuccessPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SuccessPanel; - - /// - /// ServerResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ServerResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class CaptureAuthorizedOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// CaptureAuthorizedOrderForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm CaptureAuthorizedOrderForm; + + /// + /// CaptureOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button CaptureOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ConfigurationService.asmx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ConfigurationService.asmx similarity index 99% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ConfigurationService.asmx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ConfigurationService.asmx index dcc5b48..97d5e9c 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ConfigurationService.asmx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ConfigurationService.asmx @@ -1 +1 @@ -<%@ WebService Language="C#" CodeBehind="ConfigurationService.asmx.cs" Class="Worldpay.Sdk.Examples.ConfigurationService" %> +<%@ WebService Language="C#" CodeBehind="ConfigurationService.asmx.cs" Class="Worldpay.Sdk.Examples.ConfigurationService" %> diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ConfigurationService.asmx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ConfigurationService.asmx.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ConfigurationService.asmx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ConfigurationService.asmx.cs index 3975c41..9bb54c4 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ConfigurationService.asmx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ConfigurationService.asmx.cs @@ -1,21 +1,21 @@ -using System.Web.Services; - -namespace Worldpay.Sdk.Examples -{ - /// - /// Service exposing the sample application's configuration for modification, e.g. API URL, keys. - /// - public class ConfigurationService : WebService - { - [WebMethod(EnableSession = true)] - public string Test(string apiEndpoint, string jsEndpoint, string serviceKey, string clientKey) - { - Session["apiEndpoint"] = apiEndpoint; - Session["js_endpoint"] = jsEndpoint; - Session["service_key"] = serviceKey; - Session["client_key"] = clientKey; - Session["mode"] = clientKey.StartsWith("L_C") ? "live" : "test"; - return ""; // Required to prevent a console error in FF. See https://bugzilla.mozilla.org/show_bug.cgi?id=884693 - } - } -} +using System.Web.Services; + +namespace Worldpay.Sdk.Examples +{ + /// + /// Service exposing the sample application's configuration for modification, e.g. API URL, keys. + /// + public class ConfigurationService : WebService + { + [WebMethod(EnableSession = true)] + public string Test(string apiEndpoint, string jsEndpoint, string serviceKey, string clientKey) + { + Session["apiEndpoint"] = apiEndpoint; + Session["js_endpoint"] = jsEndpoint; + Session["service_key"] = serviceKey; + Session["client_key"] = clientKey; + Session["mode"] = clientKey.StartsWith("L_C") ? "live" : "test"; + return ""; // Required to prevent a console error in FF. See https://bugzilla.mozilla.org/show_bug.cgi?id=884693 + } + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CreateOrder.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CreateOrder.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CreateOrder.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CreateOrder.aspx index 7ff9a9f..d8da820 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CreateOrder.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CreateOrder.aspx @@ -1,525 +1,525 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CreateOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.CreateOrder" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - - -
-

.NET Library Create Order Example

- - -
-
Checkout
- -
- - -
- -
- - -
- - - -
- - -
- -
- - -
- - - - - - - - - -
- - -
- - -
- - -
- -
- - - / - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
Billing address
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
Delivery address
-
- - -
-
- - -
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
Other
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - - - - -
- - -
- -
- - -
- -
-
- - -

Response

-

Order Code:

-

Token:

-

Payment Status:

-
- -
- - - - -
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CreateOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.CreateOrder" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + + +
+

.NET Library Create Order Example

+ + +
+
Checkout
+ +
+ + +
+ +
+ + +
+ + + +
+ + +
+ +
+ + +
+ + + + + + + + + +
+ + +
+ + +
+ + +
+ +
+ + + / + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
Billing address
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
Delivery address
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
Other
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + + +
+ + +
+ +
+ + +
+ +
+
+ + +

Response

+

Order Code:

+

Token:

+

Payment Status:

+
+ +
+ + + + +
diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CreateOrder.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CreateOrder.aspx.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CreateOrder.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CreateOrder.aspx.cs index c7164dd..1d66e39 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CreateOrder.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CreateOrder.aspx.cs @@ -1,368 +1,368 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Web; -using System.Web.UI.WebControls; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; -using Newtonsoft.Json; - -namespace Worldpay.Sdk.Examples -{ - public partial class CreateOrder : System.Web.UI.Page - { - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - if (IsPostBack) - { - RequestPanel.Visible = false; - OnCreateOrder(this, null); - } - } - - protected void OnCreateOrder(object sender, CommandEventArgs e) - { - var form = HttpContext.Current.Request.Form; - var orderType = (OrderType)Enum.Parse(typeof(OrderType), form["orderType"]); - - if (orderType == OrderType.APM) - { - createAPMOrder(); - return; - } - else - { - createOrder(); - return; - } - } - - private void createOrder() - { - var form = HttpContext.Current.Request.Form; - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - var orderType = (OrderType)Enum.Parse(typeof(OrderType), form["orderType"]); - - var cardRequest = new CardRequest(); - cardRequest.cardNumber = form["number"]; - cardRequest.cvc = form["cvc"]; - cardRequest.name = form["name"]; - cardRequest.expiryMonth = Convert.ToInt32(form["exp-month"]); - cardRequest.expiryYear = Convert.ToInt32(form["exp-year"]); - cardRequest.type = form["cardType"]; - int? _amount = 0; - var _currencyCode = ""; - Dictionary custIdentifiers = new Dictionary(); - - try - { - custIdentifiers = JavaScriptConvert.DeserializeObject>(form["customer-identifiers"]); - - } - catch (Exception exc) { } - - try - { - if (!string.IsNullOrEmpty(form["amount"])) - { - double n; - bool isNumeric = double.TryParse(form["amount"], out n); - _amount = isNumeric ? (int)(Convert.ToDecimal(form["amount"]) * 100) : -1; - } - } - catch (Exception excAmount) { } - - try - { - _currencyCode = Enum.Parse(typeof(CurrencyCode), form["currency"]).ToString(); - } - catch (Exception excCurrency) { } - - var billingAddress = new Address() - { - address1 = form["address1"], - address2 = form["address2"], - address3 = form["address3"], - postalCode = form["postcode"], - city = form["city"], - telephoneNumber = form["telephone-number"], - state = "", - countryCode = Enum.Parse(typeof(CountryCode), form["countryCode"]).ToString() - }; - - var deliveryAddress = new DeliveryAddress() - { - firstName = form["delivery-firstName"], - lastName = form["delivery-lastName"], - address1 = form["delivery-address1"], - address2 = form["delivery-address2"], - address3 = form["delivery-address3"], - postalCode = form["delivery-postcode"], - city = form["delivery-city"], - telephoneNumber = form["delivery-telephone-number"], - state = "", - countryCode = Enum.Parse(typeof(CountryCode), form["delivery-countryCode"]).ToString() - }; - - var is3DS = form["3ds"] == "on" ? true : false; - ThreeDSecureInfo threeDSInfo = null; - if (is3DS) - { - var httpRequest = HttpContext.Current.Request; - threeDSInfo = new ThreeDSecureInfo() - { - shopperIpAddress = httpRequest.UserHostAddress, - shopperSessionId = HttpContext.Current.Session.SessionID, - shopperUserAgent = httpRequest.UserAgent, - shopperAcceptHeader = String.Join(";", httpRequest.AcceptTypes) - }; - } - - var request = new OrderRequest() - { - token = form["token"], - orderDescription = form["description"], - amount = _amount, - currencyCode = _currencyCode, - name = is3DS && Session["mode"].Equals("test") ? "3D" : form["name"], - shopperEmailAddress = form["shopper-email"], - statementNarrative = form["statement-narrative"], - billingAddress = billingAddress, - deliveryAddress = deliveryAddress, - threeDSecureInfo = is3DS ? threeDSInfo : new ThreeDSecureInfo(), - is3DSOrder = is3DS, - authorizeOnly = form["authorizeOnly"] == "on", - orderType = orderType.ToString(), - customerIdentifiers = custIdentifiers, - customerOrderCode = form["customer-order-code"], - orderCodePrefix = form["order-code-prefix"], - orderCodeSuffix = form["order-code-suffix"] - }; - - var directOrder = form["direct-order"] == "1"; - if (directOrder) - { - request.shopperLanguageCode = form["language-code"]; - request.reusable = form["chkReusable"] == "on"; - request.paymentMethod = new CardRequest() - { - name = form["name"], - expiryMonth = Convert.ToInt32(form["exp-month"]), - expiryYear = Convert.ToInt32(form["exp-year"]), - cardNumber = form["number"], - cvc = form["cvc"] - }; - } - - if (!string.IsNullOrEmpty(form["settlement-currency"])) - { - request.settlementCurrency = form["settlement-currency"]; - } - if (!string.IsNullOrEmpty(form["site-code"])) - { - request.siteCode = form["site-code"]; - } - - try - { - var response = client.GetOrderService().Create(request); - - HandleSuccessResponse(response); - - SuccessPanel.Visible = true; - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - catch (Exception exc) - { - throw new InvalidOperationException("Error sending request with token " + request.token, exc); - } - } - - private void createAPMOrder() - { - var form = HttpContext.Current.Request.Form; - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - int? _amount = 0; - var _currencyCode = ""; - Dictionary custIdentifiers = new Dictionary(); - - try - { - custIdentifiers = JavaScriptConvert.DeserializeObject>(form["customer-identifiers"]); - - } - catch (Exception exc) { } - - try - { - if (!string.IsNullOrEmpty(form["amount"])) - { - double n; - bool isNumeric = double.TryParse(form["amount"], out n); - _amount = isNumeric ? (int)(Convert.ToDecimal(form["amount"]) * 100) : -1; - } - } - catch (Exception excAmount) { } - - try - { - _currencyCode = Enum.Parse(typeof(CurrencyCode), form["currency"]).ToString(); - } - catch (Exception excCurrency) { } - - var billingAddress = new Address() - { - address1 = form["address1"], - address2 = form["address2"], - address3 = form["address3"], - postalCode = form["postcode"], - city = form["city"], - telephoneNumber = form["telephone-number"], - state = "", - countryCode = Enum.Parse(typeof(CountryCode), form["countryCode"]).ToString() - }; - - var deliveryAddress = new DeliveryAddress() - { - firstName = form["delivery-firstName"], - lastName = form["delivery-lastName"], - address1 = form["delivery-address1"], - address2 = form["delivery-address2"], - address3 = form["delivery-address3"], - postalCode = form["delivery-postcode"], - city = form["delivery-city"], - telephoneNumber = form["delivery-telephone-number"], - state = "", - countryCode = Enum.Parse(typeof(CountryCode), form["delivery-countryCode"]).ToString() - }; - - var request = new OrderRequest() - { - token = form["token"], - name = form["name"], - shopperEmailAddress = form["shopper-email"], - statementNarrative = form["statement-narrative"], - orderDescription = form["description"], - amount = _amount, - currencyCode = _currencyCode, - billingAddress = billingAddress, - deliveryAddress = deliveryAddress, - customerIdentifiers = custIdentifiers, - customerOrderCode = form["customer-order-code"], - orderCodePrefix = form["order-code-prefix"], - orderCodeSuffix = form["order-code-suffix"], - successUrl = form["success-url"], - failureUrl = form["failure-url"], - pendingUrl = form["pending-url"], - cancelUrl = form["cancel-url"] - }; - - var directOrder = form["direct-order"] == "1"; - if (directOrder) - { - var _apmFields = new Dictionary(); - if (!string.IsNullOrEmpty(form["swiftCode"])) - { - _apmFields.Add("swiftCode", form["swiftCode"]); - } - if (!string.IsNullOrEmpty(form["shopperBankCode"])) - { - _apmFields.Add("shopperBankCode", form["shopperBankCode"]); - } - - request.shopperLanguageCode = form["language-code"]; - request.reusable = form["chkReusable"] == "on"; - request.paymentMethod = new APMRequest() - { - apmName = form["apm-name"], - shopperCountryCode = form["countryCode"], - apmFields = _apmFields - }; - } - - if (!string.IsNullOrEmpty(form["settlement-currency"])) - { - request.settlementCurrency = form["settlement-currency"]; - } - - try - { - var response = client.GetOrderService().Create(request); - - HandleSuccessResponse(response); - - SuccessPanel.Visible = true; - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - catch (Exception exc) - { - throw new InvalidOperationException("Error sending request with token " + request.token, exc); - } - } - - private void HandleSuccessResponse(OrderResponse response) - { - if (response.paymentStatus == OrderStatus.PRE_AUTHORIZED && response.paymentResponse.type == OrderType.APM.ToString()) - { - HandleAPMResponse(response); - return; - } - if (response.paymentStatus == OrderStatus.PRE_AUTHORIZED && response.is3DSOrder) - { - Handle3DSResponse(response); - return; - } - - ResponseOrderCode.Text = response.orderCode; - ResponseToken.Text = response.token; - ResponsePaymentStatus.Text = response.paymentStatus.ToString(); - ResponseJson.Text = JavaScriptConvert.SerializeObject(response); - } - - private void HandleAPMResponse(OrderResponse response) - { - Session["orderCode"] = response.orderCode; - Response.Clear(); - - StringBuilder sb = new StringBuilder(); - sb.Append(""); - sb.Append(""); - sb.AppendFormat("", response.redirectURL); - sb.Append(""); - sb.Append(""); - - Response.Write(sb.ToString()); - HttpContext.Current.ApplicationInstance.CompleteRequest(); - } - - private void Handle3DSResponse(OrderResponse response) - { - Session["orderCode"] = response.orderCode; - Response.Clear(); - - StringBuilder sb = new StringBuilder(); - sb.Append(""); - sb.AppendFormat(@""); - sb.AppendFormat("
", response.redirectURL); - sb.AppendFormat("", response.oneTime3DsToken); - sb.AppendFormat("", response.redirectURL); - sb.Append(""); - sb.Append("
"); - sb.Append(""); - sb.Append(""); - - Response.Write(sb.ToString()); - HttpContext.Current.ApplicationInstance.CompleteRequest(); - } - } +using System; +using System.Collections.Generic; +using System.Text; +using System.Web; +using System.Web.UI.WebControls; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; +using Newtonsoft.Json; + +namespace Worldpay.Sdk.Examples +{ + public partial class CreateOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + if (IsPostBack) + { + RequestPanel.Visible = false; + OnCreateOrder(this, null); + } + } + + protected void OnCreateOrder(object sender, CommandEventArgs e) + { + var form = HttpContext.Current.Request.Form; + var orderType = (OrderType)Enum.Parse(typeof(OrderType), form["orderType"]); + + if (orderType == OrderType.APM) + { + createAPMOrder(); + return; + } + else + { + createOrder(); + return; + } + } + + private void createOrder() + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + var orderType = (OrderType)Enum.Parse(typeof(OrderType), form["orderType"]); + + var cardRequest = new CardRequest(); + cardRequest.cardNumber = form["number"]; + cardRequest.cvc = form["cvc"]; + cardRequest.name = form["name"]; + cardRequest.expiryMonth = Convert.ToInt32(form["exp-month"]); + cardRequest.expiryYear = Convert.ToInt32(form["exp-year"]); + cardRequest.type = form["cardType"]; + int? _amount = 0; + var _currencyCode = ""; + Dictionary custIdentifiers = new Dictionary(); + + try + { + custIdentifiers = JavaScriptConvert.DeserializeObject>(form["customer-identifiers"]); + + } + catch (Exception exc) { } + + try + { + if (!string.IsNullOrEmpty(form["amount"])) + { + double n; + bool isNumeric = double.TryParse(form["amount"], out n); + _amount = isNumeric ? (int)(Convert.ToDecimal(form["amount"]) * 100) : -1; + } + } + catch (Exception excAmount) { } + + try + { + _currencyCode = Enum.Parse(typeof(CurrencyCode), form["currency"]).ToString(); + } + catch (Exception excCurrency) { } + + var billingAddress = new Address() + { + address1 = form["address1"], + address2 = form["address2"], + address3 = form["address3"], + postalCode = form["postcode"], + city = form["city"], + telephoneNumber = form["telephone-number"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["countryCode"]).ToString() + }; + + var deliveryAddress = new DeliveryAddress() + { + firstName = form["delivery-firstName"], + lastName = form["delivery-lastName"], + address1 = form["delivery-address1"], + address2 = form["delivery-address2"], + address3 = form["delivery-address3"], + postalCode = form["delivery-postcode"], + city = form["delivery-city"], + telephoneNumber = form["delivery-telephone-number"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["delivery-countryCode"]).ToString() + }; + + var is3DS = form["3ds"] == "on" ? true : false; + ThreeDSecureInfo threeDSInfo = null; + if (is3DS) + { + var httpRequest = HttpContext.Current.Request; + threeDSInfo = new ThreeDSecureInfo() + { + shopperIpAddress = httpRequest.UserHostAddress, + shopperSessionId = HttpContext.Current.Session.SessionID, + shopperUserAgent = httpRequest.UserAgent, + shopperAcceptHeader = String.Join(";", httpRequest.AcceptTypes) + }; + } + + var request = new OrderRequest() + { + token = form["token"], + orderDescription = form["description"], + amount = _amount, + currencyCode = _currencyCode, + name = is3DS && Session["mode"].Equals("test") ? "3D" : form["name"], + shopperEmailAddress = form["shopper-email"], + statementNarrative = form["statement-narrative"], + billingAddress = billingAddress, + deliveryAddress = deliveryAddress, + threeDSecureInfo = is3DS ? threeDSInfo : new ThreeDSecureInfo(), + is3DSOrder = is3DS, + authorizeOnly = form["authorizeOnly"] == "on", + orderType = orderType.ToString(), + customerIdentifiers = custIdentifiers, + customerOrderCode = form["customer-order-code"], + orderCodePrefix = form["order-code-prefix"], + orderCodeSuffix = form["order-code-suffix"] + }; + + var directOrder = form["direct-order"] == "1"; + if (directOrder) + { + request.shopperLanguageCode = form["language-code"]; + request.reusable = form["chkReusable"] == "on"; + request.paymentMethod = new CardRequest() + { + name = form["name"], + expiryMonth = Convert.ToInt32(form["exp-month"]), + expiryYear = Convert.ToInt32(form["exp-year"]), + cardNumber = form["number"], + cvc = form["cvc"] + }; + } + + if (!string.IsNullOrEmpty(form["settlement-currency"])) + { + request.settlementCurrency = form["settlement-currency"]; + } + if (!string.IsNullOrEmpty(form["site-code"])) + { + request.siteCode = form["site-code"]; + } + + try + { + var response = client.GetOrderService().Create(request); + + HandleSuccessResponse(response); + + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request with token " + request.token, exc); + } + } + + private void createAPMOrder() + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + int? _amount = 0; + var _currencyCode = ""; + Dictionary custIdentifiers = new Dictionary(); + + try + { + custIdentifiers = JavaScriptConvert.DeserializeObject>(form["customer-identifiers"]); + + } + catch (Exception exc) { } + + try + { + if (!string.IsNullOrEmpty(form["amount"])) + { + double n; + bool isNumeric = double.TryParse(form["amount"], out n); + _amount = isNumeric ? (int)(Convert.ToDecimal(form["amount"]) * 100) : -1; + } + } + catch (Exception excAmount) { } + + try + { + _currencyCode = Enum.Parse(typeof(CurrencyCode), form["currency"]).ToString(); + } + catch (Exception excCurrency) { } + + var billingAddress = new Address() + { + address1 = form["address1"], + address2 = form["address2"], + address3 = form["address3"], + postalCode = form["postcode"], + city = form["city"], + telephoneNumber = form["telephone-number"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["countryCode"]).ToString() + }; + + var deliveryAddress = new DeliveryAddress() + { + firstName = form["delivery-firstName"], + lastName = form["delivery-lastName"], + address1 = form["delivery-address1"], + address2 = form["delivery-address2"], + address3 = form["delivery-address3"], + postalCode = form["delivery-postcode"], + city = form["delivery-city"], + telephoneNumber = form["delivery-telephone-number"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["delivery-countryCode"]).ToString() + }; + + var request = new OrderRequest() + { + token = form["token"], + name = form["name"], + shopperEmailAddress = form["shopper-email"], + statementNarrative = form["statement-narrative"], + orderDescription = form["description"], + amount = _amount, + currencyCode = _currencyCode, + billingAddress = billingAddress, + deliveryAddress = deliveryAddress, + customerIdentifiers = custIdentifiers, + customerOrderCode = form["customer-order-code"], + orderCodePrefix = form["order-code-prefix"], + orderCodeSuffix = form["order-code-suffix"], + successUrl = form["success-url"], + failureUrl = form["failure-url"], + pendingUrl = form["pending-url"], + cancelUrl = form["cancel-url"] + }; + + var directOrder = form["direct-order"] == "1"; + if (directOrder) + { + var _apmFields = new Dictionary(); + if (!string.IsNullOrEmpty(form["swiftCode"])) + { + _apmFields.Add("swiftCode", form["swiftCode"]); + } + if (!string.IsNullOrEmpty(form["shopperBankCode"])) + { + _apmFields.Add("shopperBankCode", form["shopperBankCode"]); + } + + request.shopperLanguageCode = form["language-code"]; + request.reusable = form["chkReusable"] == "on"; + request.paymentMethod = new APMRequest() + { + apmName = form["apm-name"], + shopperCountryCode = form["countryCode"], + apmFields = _apmFields + }; + } + + if (!string.IsNullOrEmpty(form["settlement-currency"])) + { + request.settlementCurrency = form["settlement-currency"]; + } + + try + { + var response = client.GetOrderService().Create(request); + + HandleSuccessResponse(response); + + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request with token " + request.token, exc); + } + } + + private void HandleSuccessResponse(OrderResponse response) + { + if (response.paymentStatus == OrderStatus.PRE_AUTHORIZED && response.paymentResponse.type == OrderType.APM.ToString()) + { + HandleAPMResponse(response); + return; + } + if (response.paymentStatus == OrderStatus.PRE_AUTHORIZED && response.is3DSOrder) + { + Handle3DSResponse(response); + return; + } + + ResponseOrderCode.Text = response.orderCode; + ResponseToken.Text = response.token; + ResponsePaymentStatus.Text = response.paymentStatus.ToString(); + ResponseJson.Text = JavaScriptConvert.SerializeObject(response); + } + + private void HandleAPMResponse(OrderResponse response) + { + Session["orderCode"] = response.orderCode; + Response.Clear(); + + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.Append(""); + sb.AppendFormat("", response.redirectURL); + sb.Append(""); + sb.Append(""); + + Response.Write(sb.ToString()); + HttpContext.Current.ApplicationInstance.CompleteRequest(); + } + + private void Handle3DSResponse(OrderResponse response) + { + Session["orderCode"] = response.orderCode; + Response.Clear(); + + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.AppendFormat(@""); + sb.AppendFormat("
", response.redirectURL); + sb.AppendFormat("", response.oneTime3DsToken); + sb.AppendFormat("", response.redirectURL); + sb.Append(""); + sb.Append("
"); + sb.Append(""); + sb.Append(""); + + Response.Write(sb.ToString()); + HttpContext.Current.ApplicationInstance.CompleteRequest(); + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CreateOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CreateOrder.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CreateOrder.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CreateOrder.aspx.designer.cs index b28079e..ec358c2 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/CreateOrder.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/CreateOrder.aspx.designer.cs @@ -1,105 +1,105 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class CreateOrder { - - /// - /// aspnetForm control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlForm aspnetForm; - - /// - /// RequestPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel RequestPanel; - - /// - /// PlaceOrder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button PlaceOrder; - - /// - /// SuccessPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SuccessPanel; - - /// - /// ResponseOrderCode control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResponseOrderCode; - - /// - /// ResponseToken control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResponseToken; - - /// - /// ResponsePaymentStatus control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResponsePaymentStatus; - - /// - /// ResponseJson control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResponseJson; - - /// - /// OrderResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal OrderResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class CreateOrder { + + /// + /// aspnetForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm aspnetForm; + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// PlaceOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button PlaceOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ResponseOrderCode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseOrderCode; + + /// + /// ResponseToken control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseToken; + + /// + /// ResponsePaymentStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponsePaymentStatus; + + /// + /// ResponseJson control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseJson; + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ErrorControl.ascx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ErrorControl.ascx similarity index 98% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ErrorControl.ascx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ErrorControl.ascx index dbc9e49..506d1c8 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ErrorControl.ascx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ErrorControl.ascx @@ -1,8 +1,8 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ErrorControl.ascx.cs" Inherits="Worldpay.Sdk.Examples.ErrorControl" %> - - -

Error Code:

-

HTTP Status:

-

Error Description:

-

Error Message:

+<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ErrorControl.ascx.cs" Inherits="Worldpay.Sdk.Examples.ErrorControl" %> + + +

Error Code:

+

HTTP Status:

+

Error Description:

+

Error Message:

\ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ErrorControl.ascx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ErrorControl.ascx.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ErrorControl.ascx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ErrorControl.ascx.cs index f13e9d3..30fdf4b 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ErrorControl.ascx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ErrorControl.ascx.cs @@ -1,27 +1,27 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Examples -{ - public partial class ErrorControl : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) - { - - } - - public void DisplayError(ApiError apiError) - { - ErrorPanel.Visible = true; - ErrorCode.Text = apiError.customCode; - HttpStatus.Text = apiError.httpStatusCode.ToString(); - ErrorDescription.Text = apiError.description; - ErrorMessage.Text = apiError.message; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class ErrorControl : System.Web.UI.UserControl + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + public void DisplayError(ApiError apiError) + { + ErrorPanel.Visible = true; + ErrorCode.Text = apiError.customCode; + HttpStatus.Text = apiError.httpStatusCode.ToString(); + ErrorDescription.Text = apiError.description; + ErrorMessage.Text = apiError.message; + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ErrorControl.ascx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ErrorControl.ascx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ErrorControl.ascx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ErrorControl.ascx.designer.cs index b90c925..9c8ea00 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/ErrorControl.ascx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/ErrorControl.ascx.designer.cs @@ -1,60 +1,60 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class ErrorControl { - - /// - /// ErrorPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel ErrorPanel; - - /// - /// ErrorCode control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ErrorCode; - - /// - /// HttpStatus control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal HttpStatus; - - /// - /// ErrorDescription control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ErrorDescription; - - /// - /// ErrorMessage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ErrorMessage; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class ErrorControl { + + /// + /// ErrorPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel ErrorPanel; + + /// + /// ErrorCode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorCode; + + /// + /// HttpStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal HttpStatus; + + /// + /// ErrorDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorDescription; + + /// + /// ErrorMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorMessage; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/GetOrder.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/GetOrder.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/GetOrder.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/GetOrder.aspx index 0da4c1f..11f0026 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/GetOrder.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/GetOrder.aspx @@ -1,25 +1,25 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.GetOrder" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

.NET Library Get Order Example

- - -
-
-
- - -
- - -
- - -

Response

-
-
- - -
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.GetOrder" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

.NET Library Get Order Example

+ + +
+
+
+ + +
+ + +
+ + +

Response

+
+
+ + +
diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/GetOrder.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/GetOrder.aspx.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/GetOrder.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/GetOrder.aspx.cs index cdbaff5..d8cfb12 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/GetOrder.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/GetOrder.aspx.cs @@ -1,40 +1,40 @@ -using System; -using System.Web.UI; -using System.Web.UI.WebControls; -using Newtonsoft.Json; -using Worldpay.Sdk; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Examples -{ - public partial class GetOrder : Page - { - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - DataBind(); - } - - protected void OnGetOrder(object sender, CommandEventArgs e) - { - string orderCode = Request["orderCode"]; - if (orderCode == null) - { - throw new WorldpayException("Order code must be specified"); - } - - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - - try - { - var response = client.GetOrderService().FindOrder(orderCode); - ServerResponse.Text = JavaScriptConvert.SerializeObject(response); - SuccessPanel.Visible = true; - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - } - } +using System; +using System.Web.UI; +using System.Web.UI.WebControls; +using Newtonsoft.Json; +using Worldpay.Sdk; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class GetOrder : Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnGetOrder(object sender, CommandEventArgs e) + { + string orderCode = Request["orderCode"]; + if (orderCode == null) + { + throw new WorldpayException("Order code must be specified"); + } + + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + try + { + var response = client.GetOrderService().FindOrder(orderCode); + ServerResponse.Text = JavaScriptConvert.SerializeObject(response); + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/GetOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/GetOrder.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/GetOrder.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/GetOrder.aspx.designer.cs index 56136aa..c1526cb 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/GetOrder.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/GetOrder.aspx.designer.cs @@ -1,60 +1,60 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class GetOrder { - - /// - /// RequestPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel RequestPanel; - - /// - /// BtnRefundOrder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button BtnRefundOrder; - - /// - /// SuccessPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SuccessPanel; - - /// - /// ServerResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ServerResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class GetOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// BtnRefundOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button BtnRefundOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Global.asax b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Global.asax similarity index 99% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Global.asax rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Global.asax index 3d59e3f..55af080 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Global.asax +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Global.asax @@ -1 +1 @@ -<%@ Application Codebehind="Global.asax.cs" Inherits="Worldpay.Sdk.Examples.Global" Language="C#" %> +<%@ Application Codebehind="Global.asax.cs" Inherits="Worldpay.Sdk.Examples.Global" Language="C#" %> diff --git a/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Global.asax.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Global.asax.cs new file mode 100644 index 0000000..2499e3c --- /dev/null +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Global.asax.cs @@ -0,0 +1,51 @@ +using System; +using System.Configuration; +using System.Net; +using Configuration = Worldpay.Sdk.Configuration; + +namespace Worldpay.Sdk.Examples +{ + public class Global : System.Web.HttpApplication + { + + protected void Application_Start(object sender, EventArgs e) + { + //Specifically use TLS1.2 + ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; + } + + protected void Session_Start(object sender, EventArgs e) + { + // Set configuration to default values + Session["apiendpoint"] = Configuration.BaseUrl; + Session["js_endpoint"] = ConfigurationManager.AppSettings["JsEndpoint"]; + Session["service_key"] = Configuration.ServiceKey; + Session["client_key"] = Configuration.ClientKey; + } + + protected void Application_BeginRequest(object sender, EventArgs e) + { + + } + + protected void Application_AuthenticateRequest(object sender, EventArgs e) + { + + } + + protected void Application_Error(object sender, EventArgs e) + { + + } + + protected void Session_End(object sender, EventArgs e) + { + + } + + protected void Application_End(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/JsonUtils.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/JsonUtils.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/JsonUtils.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/JsonUtils.cs index 2b556fd..e68c362 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/JsonUtils.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/JsonUtils.cs @@ -1,31 +1,31 @@ -using System.Globalization; -using System.IO; -using Newtonsoft.Json; - -namespace Worldpay.Sdk.Examples -{ - /// - /// Utilities recreating functionality available in Newtonsoft.Json for .NET 3.5 - /// - public static class JsonUtils - { - /// - /// Serialize an object to JSON using pretty-print to make the response human-readable - /// - /// Object to serialize - /// JSON representing the object with indented formatting - public static string SerializeObject(object value) - { - var sw = new StringWriter(CultureInfo.InvariantCulture); - var jsonSerializer = new JsonSerializer(); - - using (JsonWriter jsonWriter = new JsonTextWriter(sw)) - { - jsonWriter.Formatting = Formatting.Indented; - jsonSerializer.Serialize(jsonWriter, value); - } - - return sw.ToString(); - } - } +using System.Globalization; +using System.IO; +using Newtonsoft.Json; + +namespace Worldpay.Sdk.Examples +{ + /// + /// Utilities recreating functionality available in Newtonsoft.Json for .NET 3.5 + /// + public static class JsonUtils + { + /// + /// Serialize an object to JSON using pretty-print to make the response human-readable + /// + /// Object to serialize + /// JSON representing the object with indented formatting + public static string SerializeObject(object value) + { + var sw = new StringWriter(CultureInfo.InvariantCulture); + var jsonSerializer = new JsonSerializer(); + + using (JsonWriter jsonWriter = new JsonTextWriter(sw)) + { + jsonWriter.Formatting = Formatting.Indented; + jsonSerializer.Serialize(jsonWriter, value); + } + + return sw.ToString(); + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Master.Master b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Master.Master similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Master.Master rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Master.Master index e3e6a36..eaeade4 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Master.Master +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Master.Master @@ -1,117 +1,117 @@ -<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Master.master.cs" Inherits="Worldpay.Sdk.Examples.Master" %> - - - - - - .NET Library - - - - -
- - - - - -
-
-
-

Library Version:

-
- +<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Master.master.cs" Inherits="Worldpay.Sdk.Examples.Master" %> + + + + + + .NET Library + + + + +
+ + + + + +
+
+
+

Library Version:

+
+ \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Master.Master.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Master.Master.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Master.Master.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Master.Master.cs index 4b13d35..4f3de4b 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Master.Master.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Master.Master.cs @@ -1,15 +1,15 @@ -using System; -using System.Diagnostics; -using System.Reflection; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Examples -{ - public partial class Master : System.Web.UI.MasterPage - { - protected void Page_Load(object sender, EventArgs e) - { - LibraryVersion.Text = FileVersionInfo.GetVersionInfo(Assembly.GetAssembly(typeof(OrderRequest)).Location).ProductVersion; - } - } +using System; +using System.Diagnostics; +using System.Reflection; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class Master : System.Web.UI.MasterPage + { + protected void Page_Load(object sender, EventArgs e) + { + LibraryVersion.Text = FileVersionInfo.GetVersionInfo(Assembly.GetAssembly(typeof(OrderRequest)).Location).ProductVersion; + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Master.Master.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Master.Master.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Master.Master.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Master.Master.designer.cs index e0c0d78..fab3be7 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Master.Master.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Master.Master.designer.cs @@ -1,33 +1,33 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class Master { - - /// - /// ContentPlaceHolder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ContentPlaceHolder ContentPlaceHolder; - - /// - /// LibraryVersion control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal LibraryVersion; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class Master { + + /// + /// ContentPlaceHolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ContentPlaceHolder ContentPlaceHolder; + + /// + /// LibraryVersion control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal LibraryVersion; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Navbar.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Navbar.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Navbar.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Navbar.aspx index ce8694a..752e45e 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Navbar.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Navbar.aspx @@ -1,99 +1,99 @@ - - - -
-
-
- - " class='config_input'/> -
-
- - " class='config_input'/> -
-
-
-
- - " class='config_input'/> -
-
- - " class='config_input'/> -
-
- - -
-
    -
  • Create Order
  • -
  • Create Order (CardOnFile)
  • -
  • Capture Authorized Order
  • -
  • Cancel Authorized Order
  • -
  • Refund
  • -
  • Partial Refund
  • -
    -
  • Stored Cards
  • -
  • Get Order
  • + + + +
    +
    +
    + + " class='config_input'/> +
    +
    + + " class='config_input'/> +
    +
    +
    +
    + + " class='config_input'/> +
    +
    + + " class='config_input'/> +
    +
    + + +
    + \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx index bcc082d..e1ec00d 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx @@ -1,28 +1,28 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PartiallyRefundOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.PartiallyRefundOrder" MasterPageFile="Master.Master" %> -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

    .NET Library Partial Refund Example

    - - -
    -
    -
    - - -
    -
    - - -
    - - -
    - - -

    Response

    -

    -
    - - +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PartiallyRefundOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.PartiallyRefundOrder" MasterPageFile="Master.Master" %> +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Partial Refund Example

    + + +
    +
    +
    + + +
    +
    + + +
    + + +
    + + +

    Response

    +

    +
    + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.cs index aa46927..4c6599a 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.cs @@ -1,50 +1,50 @@ -using System; -using System.Web.UI.WebControls; - -namespace Worldpay.Sdk.Examples -{ - public partial class PartiallyRefundOrder : System.Web.UI.Page - { - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - DataBind(); - } - - protected void OnPartialRefund(object sender, CommandEventArgs e) - { - int refundAmount = 0; - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - string orderCode = Request["orderCode"]; - - if (orderCode == null) - { - throw new WorldpayException("Order code must be specified"); - } - - try - { - refundAmount = Int32.Parse(Request["amount"]); - } - catch (Exception exc) { } - - try - { - client.GetOrderService().Refund(orderCode, refundAmount); - if (refundAmount == 0) - { - ServerResponse.Text = String.Format("Order {0} has been refunded for the full amount", orderCode); - } - else - { - ServerResponse.Text = String.Format("Order {0} has been refunded for {1}", orderCode, refundAmount); - } - SuccessPanel.Visible = true; - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - } - } -} +using System; +using System.Web.UI.WebControls; + +namespace Worldpay.Sdk.Examples +{ + public partial class PartiallyRefundOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnPartialRefund(object sender, CommandEventArgs e) + { + int refundAmount = 0; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + string orderCode = Request["orderCode"]; + + if (orderCode == null) + { + throw new WorldpayException("Order code must be specified"); + } + + try + { + refundAmount = Int32.Parse(Request["amount"]); + } + catch (Exception exc) { } + + try + { + client.GetOrderService().Refund(orderCode, refundAmount); + if (refundAmount == 0) + { + ServerResponse.Text = String.Format("Order {0} has been refunded for the full amount", orderCode); + } + else + { + ServerResponse.Text = String.Format("Order {0} has been refunded for {1}", orderCode, refundAmount); + } + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + } + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.designer.cs index 2284044..0f8f7db 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.designer.cs @@ -1,60 +1,60 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class PartiallyRefundOrder { - - /// - /// RequestPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel RequestPanel; - - /// - /// RefundOrder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button RefundOrder; - - /// - /// SuccessPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SuccessPanel; - - /// - /// ServerResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ServerResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class PartiallyRefundOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// RefundOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button RefundOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Properties/AssemblyInfo.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Properties/AssemblyInfo.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Properties/AssemblyInfo.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Properties/AssemblyInfo.cs index 99ee7dd..6d34d43 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Properties/AssemblyInfo.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Properties/AssemblyInfo.cs @@ -1,35 +1,35 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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("Worldpay.Sdk.Examples")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Worldpay.Sdk.Examples")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[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("b88c4d54-24a7-4190-a09d-684ba569176d")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +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("Worldpay.Sdk.Examples")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Worldpay.Sdk.Examples")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[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("b88c4d54-24a7-4190-a09d-684ba569176d")] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Properties/PublishProfiles/local.pubxml b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Properties/PublishProfiles/local.pubxml similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Properties/PublishProfiles/local.pubxml rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Properties/PublishProfiles/local.pubxml index ce46f39..f0eb257 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Properties/PublishProfiles/local.pubxml +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Properties/PublishProfiles/local.pubxml @@ -1,22 +1,22 @@ - - - - - MSDeploy - http://localhost/Worldpay - localhost - Default Web Site/Worldpay - - True - InProc - - <_SavePWD>False - - - - - + + + + + MSDeploy + http://localhost/Worldpay + localhost + Default Web Site/Worldpay + + True + InProc + + <_SavePWD>False + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RecurringPayment.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RecurringPayment.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RecurringPayment.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RecurringPayment.aspx index c00ff3c..f7cb515 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RecurringPayment.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RecurringPayment.aspx @@ -1,260 +1,260 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RecurringPayment.aspx.cs" Inherits="Worldpay.Sdk.Examples.RecurringPayment" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - - -
    -

    .NET Library
    Recurring Payment Example

    - - -
    -
    Checkout
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    Billing address
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    Delivery address
    - -
    - - -
    -
    - - -
    -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    Other
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - -
    -
    - - -

    Response

    -

    Order Code:

    -

    Token:

    -

    Payment Status:

    -
    - -
    - - - - - +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RecurringPayment.aspx.cs" Inherits="Worldpay.Sdk.Examples.RecurringPayment" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + + +
    +

    .NET Library
    Recurring Payment Example

    + + +
    +
    Checkout
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    Billing address
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    Delivery address
    + +
    + + +
    +
    + + +
    +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    Other
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + +
    +
    + + +

    Response

    +

    Order Code:

    +

    Token:

    +

    Payment Status:

    +
    + +
    + + + + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.cs index 0b5595f..c0fd7c8 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.cs @@ -1,182 +1,182 @@ -using System; -using System.Text; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Worldpay.Sdk; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace Worldpay.Sdk.Examples -{ - public partial class RecurringPayment : Page - { - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - DataBind(); - - if (IsPostBack) - { - RequestPanel.Visible = false; - OnCreateOrder(this, null); - } - } - - protected void OnCreateOrder(object sender, CommandEventArgs e) - { - var form = HttpContext.Current.Request.Form; - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - var orderType = (OrderType)Enum.Parse(typeof(OrderType), form["orderType"]); - int? _amount = 0; - var _currencyCode = ""; - Dictionary custIdentifiers = new Dictionary(); - - try - { - if (!string.IsNullOrEmpty(form["amount"])) - { - double n; - bool isNumeric = double.TryParse(form["amount"], out n); - _amount = isNumeric ? (int)(Convert.ToDecimal(form["amount"]) * 100) : -1; - } - } - catch (Exception excAmount) { } - - try - { - _currencyCode = Enum.Parse(typeof(CurrencyCode), form["currency"]).ToString(); - } - catch (Exception excCurrency) { } - - try - { - custIdentifiers = JavaScriptConvert.DeserializeObject>(form["customer-identifiers"]); - - } - catch (Exception exc) { } - - var billingAddress = new Address() - { - address1 = form["address1"], - address2 = form["address2"], - address3 = form["address3"], - postalCode = form["postcode"], - city = form["city"], - state = "", - countryCode = Enum.Parse(typeof(CountryCode), form["countryCode"]).ToString() - }; - - var deliveryAddress = new DeliveryAddress() - { - firstName = form["delivery-firstName"], - lastName = form["delivery-lastName"], - address1 = form["delivery-address1"], - address2 = form["delivery-address2"], - address3 = form["delivery-address3"], - postalCode = form["delivery-postcode"], - city = form["delivery-city"], - state = "", - countryCode = Enum.Parse(typeof(CountryCode), form["delivery-countryCode"]).ToString() - }; - - var is3DS = form["3ds"] == "on" ? true : false; - ThreeDSecureInfo threeDSInfo = null; - if (is3DS) - { - var httpRequest = HttpContext.Current.Request; - threeDSInfo = new ThreeDSecureInfo() - { - shopperIpAddress = httpRequest.UserHostAddress, - shopperSessionId = HttpContext.Current.Session.SessionID, - shopperUserAgent = httpRequest.UserAgent, - shopperAcceptHeader = String.Join(";", httpRequest.AcceptTypes) - }; - } - - var request = new OrderRequest - { - token = form["token"], - orderDescription = form["description"], - statementNarrative = form["statement-narrative"], - billingAddress = billingAddress, - deliveryAddress = deliveryAddress, - amount = _amount, - currencyCode = _currencyCode, - name = is3DS && Session["mode"].Equals("test") ? "3D" : form["name"], - threeDSecureInfo = is3DS ? threeDSInfo : new ThreeDSecureInfo(), - is3DSOrder = is3DS, - customerOrderCode = form["customer-order-code"], - orderCodePrefix = form["order-code-prefix"], - orderCodeSuffix = form["order-code-suffix"], - shopperEmailAddress = form["shopper-email"], - customerIdentifiers = custIdentifiers, - authorizeOnly = form["authorizeOnly"] == "on", - orderType = orderType.ToString() - }; - - if (!string.IsNullOrEmpty(form["settlement-currency"])) - { - request.settlementCurrency = form["settlement-currency"]; - } - if (!string.IsNullOrEmpty(form["site-code"])) - { - request.siteCode = form["site-code"]; - } - - try - { - var response = client.GetOrderService().Create(request); - HandleSuccessResponse(response); - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - catch (Exception exc) - { - throw new InvalidOperationException("Error sending request with token " + request.token, exc); - } - } - - private void HandleSuccessResponse(OrderResponse response) - { - if (response.paymentStatus == OrderStatus.PRE_AUTHORIZED && response.is3DSOrder) - { - Handle3DSResponse(response); - return; - } - - ResponseOrderCode.Text = response.orderCode; - ResponseToken.Text = response.token; - ResponsePaymentStatus.Text = response.paymentStatus.ToString(); - ResponseJson.Text = JavaScriptConvert.SerializeObject(response); - SuccessPanel.Visible = true; - } - - private void Handle3DSResponse(OrderResponse response) - { - Session["orderCode"] = response.orderCode; - Response.Clear(); - - StringBuilder sb = new StringBuilder(); - sb.Append(""); - sb.AppendFormat(@""); - sb.AppendFormat("
    ", response.redirectURL); - sb.AppendFormat("", response.oneTime3DsToken); - sb.AppendFormat("", response.redirectURL); - sb.Append(""); - sb.Append("
    "); - sb.Append(""); - sb.Append(""); - - Response.Write(sb.ToString()); - HttpContext.Current.ApplicationInstance.CompleteRequest(); - } - } +using System; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Worldpay.Sdk.Examples +{ + public partial class RecurringPayment : Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + + if (IsPostBack) + { + RequestPanel.Visible = false; + OnCreateOrder(this, null); + } + } + + protected void OnCreateOrder(object sender, CommandEventArgs e) + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + var orderType = (OrderType)Enum.Parse(typeof(OrderType), form["orderType"]); + int? _amount = 0; + var _currencyCode = ""; + Dictionary custIdentifiers = new Dictionary(); + + try + { + if (!string.IsNullOrEmpty(form["amount"])) + { + double n; + bool isNumeric = double.TryParse(form["amount"], out n); + _amount = isNumeric ? (int)(Convert.ToDecimal(form["amount"]) * 100) : -1; + } + } + catch (Exception excAmount) { } + + try + { + _currencyCode = Enum.Parse(typeof(CurrencyCode), form["currency"]).ToString(); + } + catch (Exception excCurrency) { } + + try + { + custIdentifiers = JavaScriptConvert.DeserializeObject>(form["customer-identifiers"]); + + } + catch (Exception exc) { } + + var billingAddress = new Address() + { + address1 = form["address1"], + address2 = form["address2"], + address3 = form["address3"], + postalCode = form["postcode"], + city = form["city"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["countryCode"]).ToString() + }; + + var deliveryAddress = new DeliveryAddress() + { + firstName = form["delivery-firstName"], + lastName = form["delivery-lastName"], + address1 = form["delivery-address1"], + address2 = form["delivery-address2"], + address3 = form["delivery-address3"], + postalCode = form["delivery-postcode"], + city = form["delivery-city"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["delivery-countryCode"]).ToString() + }; + + var is3DS = form["3ds"] == "on" ? true : false; + ThreeDSecureInfo threeDSInfo = null; + if (is3DS) + { + var httpRequest = HttpContext.Current.Request; + threeDSInfo = new ThreeDSecureInfo() + { + shopperIpAddress = httpRequest.UserHostAddress, + shopperSessionId = HttpContext.Current.Session.SessionID, + shopperUserAgent = httpRequest.UserAgent, + shopperAcceptHeader = String.Join(";", httpRequest.AcceptTypes) + }; + } + + var request = new OrderRequest + { + token = form["token"], + orderDescription = form["description"], + statementNarrative = form["statement-narrative"], + billingAddress = billingAddress, + deliveryAddress = deliveryAddress, + amount = _amount, + currencyCode = _currencyCode, + name = is3DS && Session["mode"].Equals("test") ? "3D" : form["name"], + threeDSecureInfo = is3DS ? threeDSInfo : new ThreeDSecureInfo(), + is3DSOrder = is3DS, + customerOrderCode = form["customer-order-code"], + orderCodePrefix = form["order-code-prefix"], + orderCodeSuffix = form["order-code-suffix"], + shopperEmailAddress = form["shopper-email"], + customerIdentifiers = custIdentifiers, + authorizeOnly = form["authorizeOnly"] == "on", + orderType = orderType.ToString() + }; + + if (!string.IsNullOrEmpty(form["settlement-currency"])) + { + request.settlementCurrency = form["settlement-currency"]; + } + if (!string.IsNullOrEmpty(form["site-code"])) + { + request.siteCode = form["site-code"]; + } + + try + { + var response = client.GetOrderService().Create(request); + HandleSuccessResponse(response); + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request with token " + request.token, exc); + } + } + + private void HandleSuccessResponse(OrderResponse response) + { + if (response.paymentStatus == OrderStatus.PRE_AUTHORIZED && response.is3DSOrder) + { + Handle3DSResponse(response); + return; + } + + ResponseOrderCode.Text = response.orderCode; + ResponseToken.Text = response.token; + ResponsePaymentStatus.Text = response.paymentStatus.ToString(); + ResponseJson.Text = JavaScriptConvert.SerializeObject(response); + SuccessPanel.Visible = true; + } + + private void Handle3DSResponse(OrderResponse response) + { + Session["orderCode"] = response.orderCode; + Response.Clear(); + + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.AppendFormat(@""); + sb.AppendFormat("
    ", response.redirectURL); + sb.AppendFormat("", response.oneTime3DsToken); + sb.AppendFormat("", response.redirectURL); + sb.Append(""); + sb.Append("
    "); + sb.Append(""); + sb.Append(""); + + Response.Write(sb.ToString()); + HttpContext.Current.ApplicationInstance.CompleteRequest(); + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.designer.cs index 7226f18..1bbedc5 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RecurringPayment.aspx.designer.cs @@ -1,105 +1,105 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class RecurringPayment { - - /// - /// aspnetForm control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlForm aspnetForm; - - /// - /// RequestPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel RequestPanel; - - /// - /// PlaceOrder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button PlaceOrder; - - /// - /// SuccessPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SuccessPanel; - - /// - /// ResponseOrderCode control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResponseOrderCode; - - /// - /// ResponseToken control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResponseToken; - - /// - /// ResponsePaymentStatus control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResponsePaymentStatus; - - /// - /// ResponseJson control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResponseJson; - - /// - /// OrderResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal OrderResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class RecurringPayment { + + /// + /// aspnetForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm aspnetForm; + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// PlaceOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button PlaceOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ResponseOrderCode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseOrderCode; + + /// + /// ResponseToken control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseToken; + + /// + /// ResponsePaymentStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponsePaymentStatus; + + /// + /// ResponseJson control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseJson; + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RefundOrder.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RefundOrder.aspx similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RefundOrder.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RefundOrder.aspx index 6cd7f4f..b283bc8 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RefundOrder.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RefundOrder.aspx @@ -1,25 +1,25 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RefundOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.RefundOrder" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

    .NET Library Refund Example

    - - -
    -
    -
    - - -
    - - -
    - - -

    Response

    -

    -
    - - +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RefundOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.RefundOrder" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Refund Example

    + + +
    +
    +
    + + +
    + + +
    + + +

    Response

    +

    +
    + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RefundOrder.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RefundOrder.aspx.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RefundOrder.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RefundOrder.aspx.cs index fca7b25..2a232a8 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RefundOrder.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RefundOrder.aspx.cs @@ -1,36 +1,36 @@ -using System; -using System.Web.UI.WebControls; - -namespace Worldpay.Sdk.Examples -{ - public partial class RefundOrder : System.Web.UI.Page - { - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - DataBind(); - } - - protected void OnRefund(object sender, CommandEventArgs e) - { - string orderCode = Request["orderCode"]; - if (orderCode == null) - { - throw new WorldpayException("Order code must be specified"); - } - - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - - try - { - client.GetOrderService().Refund(orderCode); - ServerResponse.Text = String.Format("Order {0} has been refunded!", orderCode); - SuccessPanel.Visible = true; - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - } - } -} +using System; +using System.Web.UI.WebControls; + +namespace Worldpay.Sdk.Examples +{ + public partial class RefundOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnRefund(object sender, CommandEventArgs e) + { + string orderCode = Request["orderCode"]; + if (orderCode == null) + { + throw new WorldpayException("Order code must be specified"); + } + + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + try + { + client.GetOrderService().Refund(orderCode); + ServerResponse.Text = String.Format("Order {0} has been refunded!", orderCode); + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + } + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RefundOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RefundOrder.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RefundOrder.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RefundOrder.aspx.designer.cs index 43ee458..dc9dc66 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/RefundOrder.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/RefundOrder.aspx.designer.cs @@ -1,60 +1,60 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class RefundOrder { - - /// - /// RequestPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel RequestPanel; - - /// - /// BtnRefundOrder control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button BtnRefundOrder; - - /// - /// SuccessPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SuccessPanel; - - /// - /// ServerResponse control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ServerResponse; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class RefundOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// BtnRefundOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button BtnRefundOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/StoredCard.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/StoredCard.aspx similarity index 98% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/StoredCard.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/StoredCard.aspx index c62142f..9961ed0 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/StoredCard.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/StoredCard.aspx @@ -1,30 +1,30 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StoredCard.aspx.cs" Inherits="Worldpay.Sdk.Examples.StoredCard" MasterPageFile="Master.Master" %> - -<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> - - -

    .NET Library Stored Card Details Example

    - - -
    -
    -
    - - -
    - - -
    - - -

    Response

    -

    Name:

    -

    Expiry Month:

    -

    Expiry Year:

    -

    Card Type:

    -

    Masked Card Number:

    -
    -
    - - +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StoredCard.aspx.cs" Inherits="Worldpay.Sdk.Examples.StoredCard" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Stored Card Details Example

    + + +
    +
    +
    + + +
    + + +
    + + +

    Response

    +

    Name:

    +

    Expiry Month:

    +

    Expiry Year:

    +

    Card Type:

    +

    Masked Card Number:

    +
    +
    + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/StoredCard.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/StoredCard.aspx.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/StoredCard.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/StoredCard.aspx.cs index 95eeb94..171b748 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/StoredCard.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/StoredCard.aspx.cs @@ -1,44 +1,44 @@ -using System; -using System.Web.UI.WebControls; -using Worldpay.Sdk.Examples; -using Worldpay.Sdk.Models; -using Newtonsoft.Json; - -namespace Worldpay.Sdk.Examples -{ - public partial class StoredCard : System.Web.UI.Page - { - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - DataBind(); - } - - protected void OnShowCardDetails(object sender, CommandEventArgs e) - { - var token = Request["token"]; - var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); - - try - { - var details = client.GetTokenService().Get(token); - HandleSuccessResponse(details); - } - catch (WorldpayException exc) - { - ErrorControl.DisplayError(exc.apiError); - } - } - - private void HandleSuccessResponse(TokenResponse details) - { - ResultName.Text = details.paymentMethod.name; - ResultMonth.Text = details.paymentMethod.expiryMonth.ToString(); - ResultYear.Text = details.paymentMethod.expiryYear.ToString(); - ResultType.Text = details.paymentMethod.cardType; - ResultCardNumber.Text = details.paymentMethod.maskedCardNumber; - ResponseJson.Text = JavaScriptConvert.SerializeObject(details); - SuccessPanel.Visible = true; - } - } -} +using System; +using System.Web.UI.WebControls; +using Worldpay.Sdk.Examples; +using Worldpay.Sdk.Models; +using Newtonsoft.Json; + +namespace Worldpay.Sdk.Examples +{ + public partial class StoredCard : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnShowCardDetails(object sender, CommandEventArgs e) + { + var token = Request["token"]; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + try + { + var details = client.GetTokenService().Get(token); + HandleSuccessResponse(details); + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + } + + private void HandleSuccessResponse(TokenResponse details) + { + ResultName.Text = details.paymentMethod.name; + ResultMonth.Text = details.paymentMethod.expiryMonth.ToString(); + ResultYear.Text = details.paymentMethod.expiryYear.ToString(); + ResultType.Text = details.paymentMethod.cardType; + ResultCardNumber.Text = details.paymentMethod.maskedCardNumber; + ResponseJson.Text = JavaScriptConvert.SerializeObject(details); + SuccessPanel.Visible = true; + } + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/StoredCard.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/StoredCard.aspx.designer.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/StoredCard.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/StoredCard.aspx.designer.cs index dea74c1..660b298 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/StoredCard.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/StoredCard.aspx.designer.cs @@ -1,105 +1,105 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples { - - - public partial class StoredCard { - - /// - /// RequestPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel RequestPanel; - - /// - /// ShowCard control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button ShowCard; - - /// - /// SuccessPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SuccessPanel; - - /// - /// ResultName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResultName; - - /// - /// ResultMonth control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResultMonth; - - /// - /// ResultYear control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResultYear; - - /// - /// ResultType control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResultType; - - /// - /// ResultCardNumber control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResultCardNumber; - - /// - /// ResponseJson control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal ResponseJson; - - /// - /// ErrorControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class StoredCard { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// ShowCard control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button ShowCard; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ResultName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultName; + + /// + /// ResultMonth control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultMonth; + + /// + /// ResultYear control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultYear; + + /// + /// ResultType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultType; + + /// + /// ResultCardNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultCardNumber; + + /// + /// ResponseJson control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseJson; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Web.Debug.config b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Web.Debug.config similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Web.Debug.config rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Web.Debug.config index 24f336c..2e302f9 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Web.Debug.config +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Web.Debug.config @@ -1,30 +1,30 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Web.Release.config b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Web.Release.config similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Web.Release.config rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Web.Release.config index a657981..c358444 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Web.Release.config +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Web.Release.config @@ -1,31 +1,31 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Web.config b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Web.config similarity index 84% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Web.config rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Web.config index be4fe62..ec45cae 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Web.config +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Web.config @@ -1,28 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Webhook.aspx b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Webhook.aspx similarity index 95% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Webhook.aspx rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Webhook.aspx index 360f47b..d2eea0f 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Webhook.aspx +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Webhook.aspx @@ -1,16 +1,16 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Webhook.aspx.cs" Inherits="Worldpay.Sdk.Examples.Webhook" %> - - - - - - - - -
    -
    - -
    -
    - - +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Webhook.aspx.cs" Inherits="Worldpay.Sdk.Examples.Webhook" %> + + + + + + + + +
    +
    + +
    +
    + + diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Webhook.aspx.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Webhook.aspx.cs similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Webhook.aspx.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Webhook.aspx.cs index f958d0b..e698ce7 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Webhook.aspx.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Webhook.aspx.cs @@ -1,86 +1,86 @@ -using System; -using System.IO; -using System.Web; -using Worldpay.Sdk.Enums; -using Worldpay.Sdk.Models; - -namespace Worldpay.Sdk.Examples -{ - public partial class Webhook : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - try - { - var client = new WorldpayRestClient("your service key"); - var response = client.GetWebhookService().ProcessWebhook(HttpContext.Current.Request); - - switch (response.paymentStatus) - { - case OrderStatus.SUCCESS: - // The order has been successful - Record(response.notificationEventType, response.orderCode, response.paymentStatus); - break; - case OrderStatus.REFUNDED: - // The order has been refunded - Record(response.notificationEventType, response.orderCode, response.paymentStatus); - break; - case OrderStatus.FAILED: - // The order has failed - Record(response.notificationEventType, response.orderCode, response.paymentStatus); - break; - case OrderStatus.SETTLED: - // The order has been settled - Record(response.notificationEventType, response.orderCode, response.paymentStatus); - break; - case OrderStatus.CHARGED_BACK: - // The order has been charged back - Record(response.notificationEventType, response.orderCode, response.paymentStatus); - break; - case OrderStatus.INFORMATION_REQUESTED: - // Information requested about the order - Record(response.notificationEventType, response.orderCode, response.paymentStatus); - break; - case OrderStatus.INFORMATION_SUPPLIED: - // Information has been supplied about the order - Record(response.notificationEventType, response.orderCode, response.paymentStatus); - break; - case OrderStatus.CHARGEBACK_REVERSED: - // The order's charge back has been reversed - Record(response.notificationEventType, response.orderCode, response.paymentStatus); - break; - case OrderStatus.EXPIRED: - // The order is expired - Record(response.notificationEventType, response.orderCode, response.paymentStatus); - break; - } - - Response.StatusCode = 200; - } - catch (WorldpayException exc) - { - RecordError(exc); - Response.StatusCode = 500; - Response.StatusDescription = exc.Message; - Response.End(); - } - } - - private void Record(string notificationType, string code, OrderStatus status) - { - using (var writer = new StreamWriter(new FileStream(Configuration.OrderLog, FileMode.Append))) - { - writer.WriteLine("{0}: {1} {2}", notificationType, code, status); - } - } - - private void RecordError(Exception exc) - { - using (var writer = new StreamWriter(new FileStream(Configuration.OrderLog, FileMode.Append))) - { - writer.WriteLine(exc.ToString()); - } - } - - } +using System; +using System.IO; +using System.Web; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class Webhook : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + try + { + var client = new WorldpayRestClient("your service key"); + var response = client.GetWebhookService().ProcessWebhook(HttpContext.Current.Request); + + switch (response.paymentStatus) + { + case OrderStatus.SUCCESS: + // The order has been successful + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.REFUNDED: + // The order has been refunded + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.FAILED: + // The order has failed + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.SETTLED: + // The order has been settled + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.CHARGED_BACK: + // The order has been charged back + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.INFORMATION_REQUESTED: + // Information requested about the order + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.INFORMATION_SUPPLIED: + // Information has been supplied about the order + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.CHARGEBACK_REVERSED: + // The order's charge back has been reversed + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.EXPIRED: + // The order is expired + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + } + + Response.StatusCode = 200; + } + catch (WorldpayException exc) + { + RecordError(exc); + Response.StatusCode = 500; + Response.StatusDescription = exc.Message; + Response.End(); + } + } + + private void Record(string notificationType, string code, OrderStatus status) + { + using (var writer = new StreamWriter(new FileStream(Configuration.OrderLog, FileMode.Append))) + { + writer.WriteLine("{0}: {1} {2}", notificationType, code, status); + } + } + + private void RecordError(Exception exc) + { + using (var writer = new StreamWriter(new FileStream(Configuration.OrderLog, FileMode.Append))) + { + writer.WriteLine(exc.ToString()); + } + } + + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Webhook.aspx.designer.cs b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Webhook.aspx.designer.cs similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Webhook.aspx.designer.cs rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Webhook.aspx.designer.cs index 8e34ca4..0115c7b 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Webhook.aspx.designer.cs +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Webhook.aspx.designer.cs @@ -1,26 +1,26 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Worldpay.Sdk.Examples -{ - - - public partial class Webhook - { - - /// - /// form1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlForm form1; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples +{ + + + public partial class Webhook + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + } +} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj old mode 100755 new mode 100644 similarity index 96% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj index d263e2d..ace7a09 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj @@ -11,9 +11,9 @@ {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties - Worldpay.Sdk.Examples - Worldpay.Sdk.Examples - v2.0 + WorldPay.Sdk.Examples + WorldPay.Sdk.Examples + v4.0 true @@ -31,6 +31,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -39,6 +40,7 @@ TRACE prompt 4 + false @@ -53,6 +55,7 @@ + @@ -69,24 +72,22 @@ - - - - + - + + - - + Designer + @@ -118,20 +119,6 @@ APMSuccess.aspx - - AuthorizeOrder.aspx - ASPXCodeBehind - - - AuthorizeOrder.aspx - - - CancelAuthorizedOrder.aspx - ASPXCodeBehind - - - CancelAuthorizedOrder.aspx - CaptureAuthorizedOrder.aspx ASPXCodeBehind @@ -139,16 +126,12 @@ CaptureAuthorizedOrder.aspx - - ConfigurationService.asmx - Component - - - CreateOrder.aspx + + CancelAuthorizedOrder.aspx ASPXCodeBehind - - CreateOrder.aspx + + CancelAuthorizedOrder.aspx ErrorControl.ascx @@ -167,7 +150,6 @@ Global.asax - Master.Master ASPXCodeBehind @@ -175,21 +157,35 @@ Master.Master + + RecurringPayment.aspx + ASPXCodeBehind + + + RecurringPayment.aspx + + + StoredCard.aspx + ASPXCodeBehind + PartiallyRefundOrder.aspx ASPXCodeBehind + + StoredCard.aspx + PartiallyRefundOrder.aspx - - - RecurringPayment.aspx + + CreateOrder.aspx ASPXCodeBehind - - RecurringPayment.aspx + + CreateOrder.aspx + RefundOrder.aspx ASPXCodeBehind @@ -197,12 +193,16 @@ RefundOrder.aspx - - StoredCard.aspx + + AuthorizeOrder.aspx ASPXCodeBehind - - StoredCard.aspx + + AuthorizeOrder.aspx + + + ConfigurationService.asmx + Component Webhook.aspx @@ -214,6 +214,7 @@ + @@ -224,6 +225,7 @@ + diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples20.csproj b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples20.csproj similarity index 97% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples20.csproj rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples20.csproj index dba0687..5675b77 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples20.csproj +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples20.csproj @@ -1,272 +1,272 @@ - - - - - Debug - AnyCPU - - - 2.0 - {C1E26FE7-56C2-446D-A65A-830D8747758B} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Worldpay.Sdk.Examples - Worldpay.Sdk.Examples - v2.0 - true - - - - - True - - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - - False - lib\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - - - APMCancel.aspx - ASPXCodeBehind - - - APMCancel.aspx - - - APMFailure.aspx - ASPXCodeBehind - - - APMFailure.aspx - - - APMPending.aspx - ASPXCodeBehind - - - APMPending.aspx - - - APMSuccess.aspx - ASPXCodeBehind - - - APMSuccess.aspx - - - AuthorizeOrder.aspx - ASPXCodeBehind - - - AuthorizeOrder.aspx - - - CancelAuthorizedOrder.aspx - ASPXCodeBehind - - - CancelAuthorizedOrder.aspx - - - CaptureAuthorizedOrder.aspx - ASPXCodeBehind - - - CaptureAuthorizedOrder.aspx - - - ConfigurationService.asmx - Component - - - CreateOrder.aspx - ASPXCodeBehind - - - CreateOrder.aspx - - - ErrorControl.ascx - ASPXCodeBehind - - - ErrorControl.ascx - - - GetOrder.aspx - ASPXCodeBehind - - - GetOrder.aspx - - - Global.asax - - - - Master.Master - ASPXCodeBehind - - - Master.Master - - - PartiallyRefundOrder.aspx - ASPXCodeBehind - - - PartiallyRefundOrder.aspx - - - - RecurringPayment.aspx - ASPXCodeBehind - - - RecurringPayment.aspx - - - RefundOrder.aspx - ASPXCodeBehind - - - RefundOrder.aspx - - - StoredCard.aspx - ASPXCodeBehind - - - StoredCard.aspx - - - Webhook.aspx - ASPXCodeBehind - - - Webhook.aspx - - - - - - - - Web.config - - - Web.config - - - - - - - - {d2ab0290-8b33-4467-a0df-975372b29e38} - Worldpay.Sdk20 - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - bin\20\ - TRACE - true - pdbonly - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - - - - - - - True - True - 0 - / - http://localhost:59977/ - False - False - - - False - - - - - + + + + + Debug + AnyCPU + + + 2.0 + {C1E26FE7-56C2-446D-A65A-830D8747758B} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Worldpay.Sdk.Examples + Worldpay.Sdk.Examples + v2.0 + true + + + + + True + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + False + lib\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + APMCancel.aspx + ASPXCodeBehind + + + APMCancel.aspx + + + APMFailure.aspx + ASPXCodeBehind + + + APMFailure.aspx + + + APMPending.aspx + ASPXCodeBehind + + + APMPending.aspx + + + APMSuccess.aspx + ASPXCodeBehind + + + APMSuccess.aspx + + + AuthorizeOrder.aspx + ASPXCodeBehind + + + AuthorizeOrder.aspx + + + CancelAuthorizedOrder.aspx + ASPXCodeBehind + + + CancelAuthorizedOrder.aspx + + + CaptureAuthorizedOrder.aspx + ASPXCodeBehind + + + CaptureAuthorizedOrder.aspx + + + ConfigurationService.asmx + Component + + + CreateOrder.aspx + ASPXCodeBehind + + + CreateOrder.aspx + + + ErrorControl.ascx + ASPXCodeBehind + + + ErrorControl.ascx + + + GetOrder.aspx + ASPXCodeBehind + + + GetOrder.aspx + + + Global.asax + + + + Master.Master + ASPXCodeBehind + + + Master.Master + + + PartiallyRefundOrder.aspx + ASPXCodeBehind + + + PartiallyRefundOrder.aspx + + + + RecurringPayment.aspx + ASPXCodeBehind + + + RecurringPayment.aspx + + + RefundOrder.aspx + ASPXCodeBehind + + + RefundOrder.aspx + + + StoredCard.aspx + ASPXCodeBehind + + + StoredCard.aspx + + + Webhook.aspx + ASPXCodeBehind + + + Webhook.aspx + + + + + + + + Web.config + + + Web.config + + + + + + + + {d2ab0290-8b33-4467-a0df-975372b29e38} + Worldpay.Sdk20 + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + bin\20\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + + + + + + + True + True + 0 + / + http://localhost:59977/ + False + False + + + False + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj similarity index 94% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj index cf63cc0..084c152 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj @@ -1,274 +1,274 @@ - - - - - Debug - AnyCPU - - - 2.0 - {C1E26FE7-56C2-446D-A65A-830D8747758B} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - WorldPay.Sdk.Examples - WorldPay.Sdk.Examples - v3.5 - true - - - - - True - - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\ - TRACE - prompt - 4 - false - - - - False - lib\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - - - - APMCancel.aspx - ASPXCodeBehind - - - APMCancel.aspx - - - APMFailure.aspx - ASPXCodeBehind - - - APMFailure.aspx - - - APMPending.aspx - ASPXCodeBehind - - - APMPending.aspx - - - APMSuccess.aspx - ASPXCodeBehind - - - APMSuccess.aspx - - - CaptureAuthorizedOrder.aspx - ASPXCodeBehind - - - CaptureAuthorizedOrder.aspx - - - CancelAuthorizedOrder.aspx - ASPXCodeBehind - - - CancelAuthorizedOrder.aspx - - - ErrorControl.ascx - ASPXCodeBehind - - - ErrorControl.ascx - - - GetOrder.aspx - ASPXCodeBehind - - - GetOrder.aspx - - - Global.asax - - - Master.Master - ASPXCodeBehind - - - Master.Master - - - RecurringPayment.aspx - ASPXCodeBehind - - - RecurringPayment.aspx - - - StoredCard.aspx - ASPXCodeBehind - - - PartiallyRefundOrder.aspx - ASPXCodeBehind - - - StoredCard.aspx - - - PartiallyRefundOrder.aspx - - - CreateOrder.aspx - ASPXCodeBehind - - - CreateOrder.aspx - - - - RefundOrder.aspx - ASPXCodeBehind - - - RefundOrder.aspx - - - AuthorizeOrder.aspx - ASPXCodeBehind - - - AuthorizeOrder.aspx - - - ConfigurationService.asmx - Component - - - Webhook.aspx - ASPXCodeBehind - - - Webhook.aspx - - - - - - - - - Web.config - Designer - - - Web.config - Designer - - - - - - - - - {d2ab0290-8b33-4467-a0df-975372b29e38} - Worldpay.Sdk35 - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - bin\35\ - TRACE - true - pdbonly - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - - - - - - - True - True - 0 - / - http://localhost:59977/ - False - False - - - False - - - - - + + + + + Debug + AnyCPU + + + 2.0 + {C1E26FE7-56C2-446D-A65A-830D8747758B} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + WorldPay.Sdk.Examples + WorldPay.Sdk.Examples + v4.0 + true + + + + + True + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\ + TRACE + prompt + 4 + false + + + + False + lib\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + False + bin\Worldpay.Sdk.dll + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + + APMCancel.aspx + ASPXCodeBehind + + + APMCancel.aspx + + + APMFailure.aspx + ASPXCodeBehind + + + APMFailure.aspx + + + APMPending.aspx + ASPXCodeBehind + + + APMPending.aspx + + + APMSuccess.aspx + ASPXCodeBehind + + + APMSuccess.aspx + + + CaptureAuthorizedOrder.aspx + ASPXCodeBehind + + + CaptureAuthorizedOrder.aspx + + + CancelAuthorizedOrder.aspx + ASPXCodeBehind + + + CancelAuthorizedOrder.aspx + + + ErrorControl.ascx + ASPXCodeBehind + + + ErrorControl.ascx + + + GetOrder.aspx + ASPXCodeBehind + + + GetOrder.aspx + + + Global.asax + + + Master.Master + ASPXCodeBehind + + + Master.Master + + + RecurringPayment.aspx + ASPXCodeBehind + + + RecurringPayment.aspx + + + StoredCard.aspx + ASPXCodeBehind + + + PartiallyRefundOrder.aspx + ASPXCodeBehind + + + StoredCard.aspx + + + PartiallyRefundOrder.aspx + + + CreateOrder.aspx + ASPXCodeBehind + + + CreateOrder.aspx + + + + RefundOrder.aspx + ASPXCodeBehind + + + RefundOrder.aspx + + + AuthorizeOrder.aspx + ASPXCodeBehind + + + AuthorizeOrder.aspx + + + ConfigurationService.asmx + Component + + + Webhook.aspx + ASPXCodeBehind + + + Webhook.aspx + + + + + + + + + Web.config + Designer + + + Web.config + Designer + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + bin\35\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + false + + + + + + + + + True + True + 0 + / + http://localhost:59977/ + False + False + + + False + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Newtonsoft.Json.dll b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/Newtonsoft.Json.dll similarity index 100% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Newtonsoft.Json.dll rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/Newtonsoft.Json.dll diff --git a/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll new file mode 100644 index 0000000..88992ed Binary files /dev/null and b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll differ diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.Examples.dll.config b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config similarity index 84% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.Examples.dll.config rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config index be4fe62..ec45cae 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.Examples.dll.config +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config @@ -1,28 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb new file mode 100644 index 0000000..902b380 Binary files /dev/null and b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb differ diff --git a/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll new file mode 100644 index 0000000..de9b6e1 Binary files /dev/null and b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll differ diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/lib/Newtonsoft.Json.dll b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/lib/Newtonsoft.Json.dll similarity index 100% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/lib/Newtonsoft.Json.dll rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/lib/Newtonsoft.Json.dll diff --git a/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll new file mode 100644 index 0000000..ea5cd4a Binary files /dev/null and b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll differ diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/resources/style/bootstrap-combined.min.css b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/resources/style/bootstrap-combined.min.css similarity index 99% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/resources/style/bootstrap-combined.min.css rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/resources/style/bootstrap-combined.min.css index a7aebd0..f005e97 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/resources/style/bootstrap-combined.min.css +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/resources/style/bootstrap-combined.min.css @@ -1,873 +1,873 @@ -/*! - * Bootstrap v2.3.0 - * - * Copyright 2012 Twitter, Inc - * Licensed under the Apache License v2.0 - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Designed and built with all the love in the world @twitter by @mdo and @fat. - */ -.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0;} -.clearfix:after{clear:both;} -.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;} -.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} -article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;} -audio,canvas,video{display:inline-block;*display:inline;*zoom:1;} -audio:not([controls]){display:none;} -html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;} -a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} -a:hover,a:active{outline:0;} -sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline;} -sup{top:-0.5em;} -sub{bottom:-0.25em;} -img{max-width:100%;width:auto\9;height:auto;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic;} -#map_canvas img,.google-maps img{max-width:none;} -button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle;} -button,input{*overflow:visible;line-height:normal;} -button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0;} -button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;} -label,select,button,input[type="button"],input[type="reset"],input[type="submit"],input[type="radio"],input[type="checkbox"]{cursor:pointer;} -input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield;} -input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none;} -textarea{overflow:auto;vertical-align:top;} -@media print{*{text-shadow:none !important;color:#000 !important;background:transparent !important;box-shadow:none !important;} a,a:visited{text-decoration:underline;} a[href]:after{content:" (" attr(href) ")";} abbr[title]:after{content:" (" attr(title) ")";} .ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:"";} pre,blockquote{border:1px solid #999;page-break-inside:avoid;} thead{display:table-header-group;} tr,img{page-break-inside:avoid;} img{max-width:100% !important;} @page {margin:0.5cm;}p,h2,h3{orphans:3;widows:3;} h2,h3{page-break-after:avoid;}}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333333;background-color:#ffffff;} -a{color:#0088cc;text-decoration:none;} -a:hover,a:focus{color:#005580;text-decoration:underline;} -.img-rounded{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} -.img-polaroid{padding:4px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);} -.img-circle{-webkit-border-radius:500px;-moz-border-radius:500px;border-radius:500px;} -.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";line-height:0;} -.row:after{clear:both;} -[class*="span"]{float:left;min-height:1px;margin-left:20px;} -.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px;} -.span12{width:940px;} -.span11{width:860px;} -.span10{width:780px;} -.span9{width:700px;} -.span8{width:620px;} -.span7{width:540px;} -.span6{width:460px;} -.span5{width:380px;} -.span4{width:300px;} -.span3{width:220px;} -.span2{width:140px;} -.span1{width:60px;} -.offset12{margin-left:980px;} -.offset11{margin-left:900px;} -.offset10{margin-left:820px;} -.offset9{margin-left:740px;} -.offset8{margin-left:660px;} -.offset7{margin-left:580px;} -.offset6{margin-left:500px;} -.offset5{margin-left:420px;} -.offset4{margin-left:340px;} -.offset3{margin-left:260px;} -.offset2{margin-left:180px;} -.offset1{margin-left:100px;} -.row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";line-height:0;} -.row-fluid:after{clear:both;} -.row-fluid [class*="span"]{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.127659574468085%;*margin-left:2.074468085106383%;} -.row-fluid [class*="span"]:first-child{margin-left:0;} -.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.127659574468085%;} -.row-fluid .span12{width:100%;*width:99.94680851063829%;} -.row-fluid .span11{width:91.48936170212765%;*width:91.43617021276594%;} -.row-fluid .span10{width:82.97872340425532%;*width:82.92553191489361%;} -.row-fluid .span9{width:74.46808510638297%;*width:74.41489361702126%;} -.row-fluid .span8{width:65.95744680851064%;*width:65.90425531914893%;} -.row-fluid .span7{width:57.44680851063829%;*width:57.39361702127659%;} -.row-fluid .span6{width:48.93617021276595%;*width:48.88297872340425%;} -.row-fluid .span5{width:40.42553191489362%;*width:40.37234042553192%;} -.row-fluid .span4{width:31.914893617021278%;*width:31.861702127659576%;} -.row-fluid .span3{width:23.404255319148934%;*width:23.351063829787233%;} -.row-fluid .span2{width:14.893617021276595%;*width:14.840425531914894%;} -.row-fluid .span1{width:6.382978723404255%;*width:6.329787234042553%;} -.row-fluid .offset12{margin-left:104.25531914893617%;*margin-left:104.14893617021275%;} -.row-fluid .offset12:first-child{margin-left:102.12765957446808%;*margin-left:102.02127659574467%;} -.row-fluid .offset11{margin-left:95.74468085106382%;*margin-left:95.6382978723404%;} -.row-fluid .offset11:first-child{margin-left:93.61702127659574%;*margin-left:93.51063829787232%;} -.row-fluid .offset10{margin-left:87.23404255319149%;*margin-left:87.12765957446807%;} -.row-fluid .offset10:first-child{margin-left:85.1063829787234%;*margin-left:84.99999999999999%;} -.row-fluid .offset9{margin-left:78.72340425531914%;*margin-left:78.61702127659572%;} -.row-fluid .offset9:first-child{margin-left:76.59574468085106%;*margin-left:76.48936170212764%;} -.row-fluid .offset8{margin-left:70.2127659574468%;*margin-left:70.10638297872339%;} -.row-fluid .offset8:first-child{margin-left:68.08510638297872%;*margin-left:67.9787234042553%;} -.row-fluid .offset7{margin-left:61.70212765957446%;*margin-left:61.59574468085106%;} -.row-fluid .offset7:first-child{margin-left:59.574468085106375%;*margin-left:59.46808510638297%;} -.row-fluid .offset6{margin-left:53.191489361702125%;*margin-left:53.085106382978715%;} -.row-fluid .offset6:first-child{margin-left:51.063829787234035%;*margin-left:50.95744680851063%;} -.row-fluid .offset5{margin-left:44.68085106382979%;*margin-left:44.57446808510638%;} -.row-fluid .offset5:first-child{margin-left:42.5531914893617%;*margin-left:42.4468085106383%;} -.row-fluid .offset4{margin-left:36.170212765957444%;*margin-left:36.06382978723405%;} -.row-fluid .offset4:first-child{margin-left:34.04255319148936%;*margin-left:33.93617021276596%;} -.row-fluid .offset3{margin-left:27.659574468085104%;*margin-left:27.5531914893617%;} -.row-fluid .offset3:first-child{margin-left:25.53191489361702%;*margin-left:25.425531914893618%;} -.row-fluid .offset2{margin-left:19.148936170212764%;*margin-left:19.04255319148936%;} -.row-fluid .offset2:first-child{margin-left:17.02127659574468%;*margin-left:16.914893617021278%;} -.row-fluid .offset1{margin-left:10.638297872340425%;*margin-left:10.53191489361702%;} -.row-fluid .offset1:first-child{margin-left:8.51063829787234%;*margin-left:8.404255319148938%;} -[class*="span"].hide,.row-fluid [class*="span"].hide{display:none;} -[class*="span"].pull-right,.row-fluid [class*="span"].pull-right{float:right;} -.container{margin-right:auto;margin-left:auto;*zoom:1;}.container:before,.container:after{display:table;content:"";line-height:0;} -.container:after{clear:both;} -.container-fluid{padding-right:20px;padding-left:20px;*zoom:1;}.container-fluid:before,.container-fluid:after{display:table;content:"";line-height:0;} -.container-fluid:after{clear:both;} -p{margin:0 0 10px;} -.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px;} -small{font-size:85%;} -strong{font-weight:bold;} -em{font-style:italic;} -cite{font-style:normal;} -.muted{color:#999999;} -a.muted:hover,a.muted:focus{color:#808080;} -.text-warning{color:#c09853;} -a.text-warning:hover,a.text-warning:focus{color:#a47e3c;} -.text-error{color:#b94a48;} -a.text-error:hover,a.text-error:focus{color:#953b39;} -.text-info{color:#3a87ad;} -a.text-info:hover,a.text-info:focus{color:#2d6987;} -.text-success{color:#468847;} -a.text-success:hover,a.text-success:focus{color:#356635;} -.text-left{text-align:left;} -.text-right{text-align:right;} -.text-center{text-align:center;} -h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:20px;color:inherit;text-rendering:optimizelegibility;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;line-height:1;color:#999999;} -h1,h2,h3{line-height:40px;} -h1{font-size:38.5px;} -h2{font-size:31.5px;} -h3{font-size:24.5px;} -h4{font-size:17.5px;} -h5{font-size:14px;} -h6{font-size:11.9px;} -h1 small{font-size:24.5px;} -h2 small{font-size:17.5px;} -h3 small{font-size:14px;} -h4 small{font-size:14px;} -.page-header{padding-bottom:9px;margin:20px 0 30px;border-bottom:1px solid #eeeeee;} -ul,ol{padding:0;margin:0 0 10px 25px;} -ul ul,ul ol,ol ol,ol ul{margin-bottom:0;} -li{line-height:20px;} -ul.unstyled,ol.unstyled{margin-left:0;list-style:none;} -ul.inline,ol.inline{margin-left:0;list-style:none;}ul.inline>li,ol.inline>li{display:inline-block;*display:inline;*zoom:1;padding-left:5px;padding-right:5px;} -dl{margin-bottom:20px;} -dt,dd{line-height:20px;} -dt{font-weight:bold;} -dd{margin-left:10px;} -.dl-horizontal{*zoom:1;}.dl-horizontal:before,.dl-horizontal:after{display:table;content:"";line-height:0;} -.dl-horizontal:after{clear:both;} -.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} -.dl-horizontal dd{margin-left:180px;} -hr{margin:20px 0;border:0;border-top:1px solid #eeeeee;border-bottom:1px solid #ffffff;} -abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999999;} -abbr.initialism{font-size:90%;text-transform:uppercase;} -blockquote{padding:0 0 0 15px;margin:0 0 20px;border-left:5px solid #eeeeee;}blockquote p{margin-bottom:0;font-size:17.5px;font-weight:300;line-height:1.25;} -blockquote small{display:block;line-height:20px;color:#999999;}blockquote small:before{content:'\2014 \00A0';} -blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eeeeee;border-left:0;}blockquote.pull-right p,blockquote.pull-right small{text-align:right;} -blockquote.pull-right small:before{content:'';} -blockquote.pull-right small:after{content:'\00A0 \2014';} -q:before,q:after,blockquote:before,blockquote:after{content:"";} -address{display:block;margin-bottom:20px;font-style:normal;line-height:20px;} -code,pre{padding:0 3px 2px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;color:#333333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} -code{padding:2px 4px;color:#d14;background-color:#f7f7f9;border:1px solid #e1e1e8;white-space:nowrap;} -pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}pre.prettyprint{margin-bottom:20px;} -pre code{padding:0;color:inherit;white-space:pre;white-space:pre-wrap;background-color:transparent;border:0;} -.pre-scrollable{max-height:340px;overflow-y:scroll;} -.label,.badge{display:inline-block;padding:2px 4px;font-size:11.844px;font-weight:bold;line-height:14px;color:#ffffff;vertical-align:baseline;white-space:nowrap;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#999999;} -.label{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} -.badge{padding-left:9px;padding-right:9px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;} -.label:empty,.badge:empty{display:none;} -a.label:hover,a.label:focus,a.badge:hover,a.badge:focus{color:#ffffff;text-decoration:none;cursor:pointer;} -.label-important,.badge-important{background-color:#b94a48;} -.label-important[href],.badge-important[href]{background-color:#953b39;} -.label-warning,.badge-warning{background-color:#f89406;} -.label-warning[href],.badge-warning[href]{background-color:#c67605;} -.label-success,.badge-success{background-color:#468847;} -.label-success[href],.badge-success[href]{background-color:#356635;} -.label-info,.badge-info{background-color:#3a87ad;} -.label-info[href],.badge-info[href]{background-color:#2d6987;} -.label-inverse,.badge-inverse{background-color:#333333;} -.label-inverse[href],.badge-inverse[href]{background-color:#1a1a1a;} -.btn .label,.btn .badge{position:relative;top:-1px;} -.btn-mini .label,.btn-mini .badge{top:0;} -table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0;} -.table{width:100%;margin-bottom:20px;}.table th,.table td{padding:8px;line-height:20px;text-align:left;vertical-align:top;border-top:1px solid #dddddd;} -.table th{font-weight:bold;} -.table thead th{vertical-align:bottom;} -.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0;} -.table tbody+tbody{border-top:2px solid #dddddd;} -.table .table{background-color:#ffffff;} -.table-condensed th,.table-condensed td{padding:4px 5px;} -.table-bordered{border:1px solid #dddddd;border-collapse:separate;*border-collapse:collapse;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.table-bordered th,.table-bordered td{border-left:1px solid #dddddd;} -.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0;} -.table-bordered thead:first-child tr:first-child>th:first-child,.table-bordered tbody:first-child tr:first-child>td:first-child,.table-bordered tbody:first-child tr:first-child>th:first-child{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;} -.table-bordered thead:first-child tr:first-child>th:last-child,.table-bordered tbody:first-child tr:first-child>td:last-child,.table-bordered tbody:first-child tr:first-child>th:last-child{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;} -.table-bordered thead:last-child tr:last-child>th:first-child,.table-bordered tbody:last-child tr:last-child>td:first-child,.table-bordered tbody:last-child tr:last-child>th:first-child,.table-bordered tfoot:last-child tr:last-child>td:first-child,.table-bordered tfoot:last-child tr:last-child>th:first-child{-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} -.table-bordered thead:last-child tr:last-child>th:last-child,.table-bordered tbody:last-child tr:last-child>td:last-child,.table-bordered tbody:last-child tr:last-child>th:last-child,.table-bordered tfoot:last-child tr:last-child>td:last-child,.table-bordered tfoot:last-child tr:last-child>th:last-child{-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} -.table-bordered tfoot+tbody:last-child tr:last-child td:first-child{-webkit-border-bottom-left-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;} -.table-bordered tfoot+tbody:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:0;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;} -.table-bordered caption+thead tr:first-child th:first-child,.table-bordered caption+tbody tr:first-child td:first-child,.table-bordered colgroup+thead tr:first-child th:first-child,.table-bordered colgroup+tbody tr:first-child td:first-child{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;} -.table-bordered caption+thead tr:first-child th:last-child,.table-bordered caption+tbody tr:first-child td:last-child,.table-bordered colgroup+thead tr:first-child th:last-child,.table-bordered colgroup+tbody tr:first-child td:last-child{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;} -.table-striped tbody>tr:nth-child(odd)>td,.table-striped tbody>tr:nth-child(odd)>th{background-color:#f9f9f9;} -.table-hover tbody tr:hover>td,.table-hover tbody tr:hover>th{background-color:#f5f5f5;} -table td[class*="span"],table th[class*="span"],.row-fluid table td[class*="span"],.row-fluid table th[class*="span"]{display:table-cell;float:none;margin-left:0;} -.table td.span1,.table th.span1{float:none;width:44px;margin-left:0;} -.table td.span2,.table th.span2{float:none;width:124px;margin-left:0;} -.table td.span3,.table th.span3{float:none;width:204px;margin-left:0;} -.table td.span4,.table th.span4{float:none;width:284px;margin-left:0;} -.table td.span5,.table th.span5{float:none;width:364px;margin-left:0;} -.table td.span6,.table th.span6{float:none;width:444px;margin-left:0;} -.table td.span7,.table th.span7{float:none;width:524px;margin-left:0;} -.table td.span8,.table th.span8{float:none;width:604px;margin-left:0;} -.table td.span9,.table th.span9{float:none;width:684px;margin-left:0;} -.table td.span10,.table th.span10{float:none;width:764px;margin-left:0;} -.table td.span11,.table th.span11{float:none;width:844px;margin-left:0;} -.table td.span12,.table th.span12{float:none;width:924px;margin-left:0;} -.table tbody tr.success>td{background-color:#dff0d8;} -.table tbody tr.error>td{background-color:#f2dede;} -.table tbody tr.warning>td{background-color:#fcf8e3;} -.table tbody tr.info>td{background-color:#d9edf7;} -.table-hover tbody tr.success:hover>td{background-color:#d0e9c6;} -.table-hover tbody tr.error:hover>td{background-color:#ebcccc;} -.table-hover tbody tr.warning:hover>td{background-color:#faf2cc;} -.table-hover tbody tr.info:hover>td{background-color:#c4e3f3;} -form{margin:0 0 20px;} -fieldset{padding:0;margin:0;border:0;} -legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333333;border:0;border-bottom:1px solid #e5e5e5;}legend small{font-size:15px;color:#999999;} -label,input,button,select,textarea{font-size:14px;font-weight:normal;line-height:20px;} -input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;} -label{display:block;margin-bottom:5px;} -select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:20px;padding:4px 6px;margin-bottom:10px;font-size:14px;line-height:20px;color:#555555;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;vertical-align:middle;} -input,textarea,.uneditable-input{width:206px;} -textarea{height:auto;} -textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#ffffff;border:1px solid #cccccc;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-webkit-transition:border linear .2s, box-shadow linear .2s;-moz-transition:border linear .2s, box-shadow linear .2s;-o-transition:border linear .2s, box-shadow linear .2s;transition:border linear .2s, box-shadow linear .2s;}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82, 168, 236, 0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);} -input[type="radio"],input[type="checkbox"]{margin:4px 0 0;*margin-top:0;margin-top:1px \9;line-height:normal;} -input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto;} -select,input[type="file"]{height:30px;*margin-top:4px;line-height:30px;} -select{width:220px;border:1px solid #cccccc;background-color:#ffffff;} -select[multiple],select[size]{height:auto;} -select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} -.uneditable-input,.uneditable-textarea{color:#999999;background-color:#fcfcfc;border-color:#cccccc;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;} -.uneditable-input{overflow:hidden;white-space:nowrap;} -.uneditable-textarea{width:auto;height:auto;} -input:-moz-placeholder,textarea:-moz-placeholder{color:#999999;} -input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#999999;} -input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#999999;} -.radio,.checkbox{min-height:20px;padding-left:20px;} -.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-20px;} -.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px;} -.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle;} -.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px;} -.input-mini{width:60px;} -.input-small{width:90px;} -.input-medium{width:150px;} -.input-large{width:210px;} -.input-xlarge{width:270px;} -.input-xxlarge{width:530px;} -input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0;} -.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block;} -input,textarea,.uneditable-input{margin-left:0;} -.controls-row [class*="span"]+[class*="span"]{margin-left:20px;} -input.span12,textarea.span12,.uneditable-input.span12{width:926px;} -input.span11,textarea.span11,.uneditable-input.span11{width:846px;} -input.span10,textarea.span10,.uneditable-input.span10{width:766px;} -input.span9,textarea.span9,.uneditable-input.span9{width:686px;} -input.span8,textarea.span8,.uneditable-input.span8{width:606px;} -input.span7,textarea.span7,.uneditable-input.span7{width:526px;} -input.span6,textarea.span6,.uneditable-input.span6{width:446px;} -input.span5,textarea.span5,.uneditable-input.span5{width:366px;} -input.span4,textarea.span4,.uneditable-input.span4{width:286px;} -input.span3,textarea.span3,.uneditable-input.span3{width:206px;} -input.span2,textarea.span2,.uneditable-input.span2{width:126px;} -input.span1,textarea.span1,.uneditable-input.span1{width:46px;} -.controls-row{*zoom:1;}.controls-row:before,.controls-row:after{display:table;content:"";line-height:0;} -.controls-row:after{clear:both;} -.controls-row [class*="span"],.row-fluid .controls-row [class*="span"]{float:left;} -.controls-row .checkbox[class*="span"],.controls-row .radio[class*="span"]{padding-top:5px;} -input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eeeeee;} -input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent;} -.control-group.warning .control-label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853;} -.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853;} -.control-group.warning input,.control-group.warning select,.control-group.warning textarea{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;} -.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853;} -.control-group.error .control-label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48;} -.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48;} -.control-group.error input,.control-group.error select,.control-group.error textarea{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;} -.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48;} -.control-group.success .control-label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847;} -.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847;} -.control-group.success input,.control-group.success select,.control-group.success textarea{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;} -.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847;} -.control-group.info .control-label,.control-group.info .help-block,.control-group.info .help-inline{color:#3a87ad;} -.control-group.info .checkbox,.control-group.info .radio,.control-group.info input,.control-group.info select,.control-group.info textarea{color:#3a87ad;} -.control-group.info input,.control-group.info select,.control-group.info textarea{border-color:#3a87ad;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.info input:focus,.control-group.info select:focus,.control-group.info textarea:focus{border-color:#2d6987;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7ab5d3;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7ab5d3;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7ab5d3;} -.control-group.info .input-prepend .add-on,.control-group.info .input-append .add-on{color:#3a87ad;background-color:#d9edf7;border-color:#3a87ad;} -input:focus:invalid,textarea:focus:invalid,select:focus:invalid{color:#b94a48;border-color:#ee5f5b;}input:focus:invalid:focus,textarea:focus:invalid:focus,select:focus:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7;} -.form-actions{padding:19px 20px 20px;margin-top:20px;margin-bottom:20px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1;}.form-actions:before,.form-actions:after{display:table;content:"";line-height:0;} -.form-actions:after{clear:both;} -.help-block,.help-inline{color:#595959;} -.help-block{display:block;margin-bottom:10px;} -.help-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;padding-left:5px;} -.input-append,.input-prepend{display:inline-block;margin-bottom:10px;vertical-align:middle;font-size:0;white-space:nowrap;}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input,.input-append .dropdown-menu,.input-prepend .dropdown-menu,.input-append .popover,.input-prepend .popover{font-size:14px;} -.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;vertical-align:top;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2;} -.input-append .add-on,.input-prepend .add-on{display:inline-block;width:auto;height:20px;min-width:16px;padding:4px 5px;font-size:14px;font-weight:normal;line-height:20px;text-align:center;text-shadow:0 1px 0 #ffffff;background-color:#eeeeee;border:1px solid #ccc;} -.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn,.input-append .btn-group>.dropdown-toggle,.input-prepend .btn-group>.dropdown-toggle{vertical-align:top;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} -.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546;} -.input-prepend .add-on,.input-prepend .btn{margin-right:-1px;} -.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} -.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;}.input-append input+.btn-group .btn:last-child,.input-append select+.btn-group .btn:last-child,.input-append .uneditable-input+.btn-group .btn:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} -.input-append .add-on,.input-append .btn,.input-append .btn-group{margin-left:-1px;} -.input-append .add-on:last-child,.input-append .btn:last-child,.input-append .btn-group:last-child>.dropdown-toggle{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} -.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}.input-prepend.input-append input+.btn-group .btn,.input-prepend.input-append select+.btn-group .btn,.input-prepend.input-append .uneditable-input+.btn-group .btn{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} -.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} -.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} -.input-prepend.input-append .btn-group:first-child{margin-left:0;} -input.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} -.form-search .input-append .search-query,.form-search .input-prepend .search-query{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} -.form-search .input-append .search-query{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px;} -.form-search .input-append .btn{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0;} -.form-search .input-prepend .search-query{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0;} -.form-search .input-prepend .btn{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px;} -.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;*zoom:1;margin-bottom:0;vertical-align:middle;} -.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none;} -.form-search label,.form-inline label,.form-search .btn-group,.form-inline .btn-group{display:inline-block;} -.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0;} -.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle;} -.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0;} -.control-group{margin-bottom:10px;} -legend+.control-group{margin-top:20px;-webkit-margin-top-collapse:separate;} -.form-horizontal .control-group{margin-bottom:20px;*zoom:1;}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;content:"";line-height:0;} -.form-horizontal .control-group:after{clear:both;} -.form-horizontal .control-label{float:left;width:160px;padding-top:5px;text-align:right;} -.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:180px;*margin-left:0;}.form-horizontal .controls:first-child{*padding-left:180px;} -.form-horizontal .help-block{margin-bottom:0;} -.form-horizontal input+.help-block,.form-horizontal select+.help-block,.form-horizontal textarea+.help-block,.form-horizontal .uneditable-input+.help-block,.form-horizontal .input-prepend+.help-block,.form-horizontal .input-append+.help-block{margin-top:10px;} -.form-horizontal .form-actions{padding-left:180px;} -.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333333;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top, #ffffff, #e6e6e6);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));background-image:-webkit-linear-gradient(top, #ffffff, #e6e6e6);background-image:-o-linear-gradient(top, #ffffff, #e6e6e6);background-image:linear-gradient(to bottom, #ffffff, #e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);border:1px solid #cccccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333333;background-color:#e6e6e6;*background-color:#d9d9d9;} -.btn:active,.btn.active{background-color:#cccccc \9;} -.btn:first-child{*margin-left:0;} -.btn:hover,.btn:focus{color:#333333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position 0.1s linear;-moz-transition:background-position 0.1s linear;-o-transition:background-position 0.1s linear;transition:background-position 0.1s linear;} -.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} -.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} -.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:0.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} -.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} -.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px;} -.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} -.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0;} -.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px;} -.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} -.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} -.btn-block+.btn-block{margin-top:5px;} -input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%;} -.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255, 255, 255, 0.75);} -.btn-primary{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#006dcc;background-image:-moz-linear-gradient(top, #0088cc, #0044cc);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));background-image:-webkit-linear-gradient(top, #0088cc, #0044cc);background-image:-o-linear-gradient(top, #0088cc, #0044cc);background-image:linear-gradient(to bottom, #0088cc, #0044cc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);border-color:#0044cc #0044cc #002a80;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#0044cc;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#ffffff;background-color:#0044cc;*background-color:#003bb3;} -.btn-primary:active,.btn-primary.active{background-color:#003399 \9;} -.btn-warning{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(to bottom, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{color:#ffffff;background-color:#f89406;*background-color:#df8505;} -.btn-warning:active,.btn-warning.active{background-color:#c67605 \9;} -.btn-danger{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#da4f49;background-image:-moz-linear-gradient(top, #ee5f5b, #bd362f);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));background-image:-webkit-linear-gradient(top, #ee5f5b, #bd362f);background-image:-o-linear-gradient(top, #ee5f5b, #bd362f);background-image:linear-gradient(to bottom, #ee5f5b, #bd362f);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);border-color:#bd362f #bd362f #802420;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#bd362f;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{color:#ffffff;background-color:#bd362f;*background-color:#a9302a;} -.btn-danger:active,.btn-danger.active{background-color:#942a25 \9;} -.btn-success{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#5bb75b;background-image:-moz-linear-gradient(top, #62c462, #51a351);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));background-image:-webkit-linear-gradient(top, #62c462, #51a351);background-image:-o-linear-gradient(top, #62c462, #51a351);background-image:linear-gradient(to bottom, #62c462, #51a351);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0);border-color:#51a351 #51a351 #387038;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#51a351;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{color:#ffffff;background-color:#51a351;*background-color:#499249;} -.btn-success:active,.btn-success.active{background-color:#408140 \9;} -.btn-info{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#49afcd;background-image:-moz-linear-gradient(top, #5bc0de, #2f96b4);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4));background-image:-webkit-linear-gradient(top, #5bc0de, #2f96b4);background-image:-o-linear-gradient(top, #5bc0de, #2f96b4);background-image:linear-gradient(to bottom, #5bc0de, #2f96b4);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f96b4', GradientType=0);border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#2f96b4;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{color:#ffffff;background-color:#2f96b4;*background-color:#2a85a0;} -.btn-info:active,.btn-info.active{background-color:#24748c \9;} -.btn-inverse{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#363636;background-image:-moz-linear-gradient(top, #444444, #222222);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#444444), to(#222222));background-image:-webkit-linear-gradient(top, #444444, #222222);background-image:-o-linear-gradient(top, #444444, #222222);background-image:linear-gradient(to bottom, #444444, #222222);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444', endColorstr='#ff222222', GradientType=0);border-color:#222222 #222222 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#222222;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-inverse:hover,.btn-inverse:focus,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{color:#ffffff;background-color:#222222;*background-color:#151515;} -.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9;} -button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px;}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0;} -button.btn.btn-large,input[type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px;} -button.btn.btn-small,input[type="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px;} -button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px;} -.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} -.btn-link{border-color:transparent;cursor:pointer;color:#0088cc;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} -.btn-link:hover,.btn-link:focus{color:#005580;text-decoration:underline;background-color:transparent;} -.btn-link[disabled]:hover,.btn-link[disabled]:focus{color:#333333;text-decoration:none;} -[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat;margin-top:1px;} -.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:focus>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>li>a:focus>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:focus>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"],.dropdown-submenu:focus>a>[class*=" icon-"]{background-image:url("../img/glyphicons-halflings-white.png");} -.icon-glass{background-position:0 0;} -.icon-music{background-position:-24px 0;} -.icon-search{background-position:-48px 0;} -.icon-envelope{background-position:-72px 0;} -.icon-heart{background-position:-96px 0;} -.icon-star{background-position:-120px 0;} -.icon-star-empty{background-position:-144px 0;} -.icon-user{background-position:-168px 0;} -.icon-film{background-position:-192px 0;} -.icon-th-large{background-position:-216px 0;} -.icon-th{background-position:-240px 0;} -.icon-th-list{background-position:-264px 0;} -.icon-ok{background-position:-288px 0;} -.icon-remove{background-position:-312px 0;} -.icon-zoom-in{background-position:-336px 0;} -.icon-zoom-out{background-position:-360px 0;} -.icon-off{background-position:-384px 0;} -.icon-signal{background-position:-408px 0;} -.icon-cog{background-position:-432px 0;} -.icon-trash{background-position:-456px 0;} -.icon-home{background-position:0 -24px;} -.icon-file{background-position:-24px -24px;} -.icon-time{background-position:-48px -24px;} -.icon-road{background-position:-72px -24px;} -.icon-download-alt{background-position:-96px -24px;} -.icon-download{background-position:-120px -24px;} -.icon-upload{background-position:-144px -24px;} -.icon-inbox{background-position:-168px -24px;} -.icon-play-circle{background-position:-192px -24px;} -.icon-repeat{background-position:-216px -24px;} -.icon-refresh{background-position:-240px -24px;} -.icon-list-alt{background-position:-264px -24px;} -.icon-lock{background-position:-287px -24px;} -.icon-flag{background-position:-312px -24px;} -.icon-headphones{background-position:-336px -24px;} -.icon-volume-off{background-position:-360px -24px;} -.icon-volume-down{background-position:-384px -24px;} -.icon-volume-up{background-position:-408px -24px;} -.icon-qrcode{background-position:-432px -24px;} -.icon-barcode{background-position:-456px -24px;} -.icon-tag{background-position:0 -48px;} -.icon-tags{background-position:-25px -48px;} -.icon-book{background-position:-48px -48px;} -.icon-bookmark{background-position:-72px -48px;} -.icon-print{background-position:-96px -48px;} -.icon-camera{background-position:-120px -48px;} -.icon-font{background-position:-144px -48px;} -.icon-bold{background-position:-167px -48px;} -.icon-italic{background-position:-192px -48px;} -.icon-text-height{background-position:-216px -48px;} -.icon-text-width{background-position:-240px -48px;} -.icon-align-left{background-position:-264px -48px;} -.icon-align-center{background-position:-288px -48px;} -.icon-align-right{background-position:-312px -48px;} -.icon-align-justify{background-position:-336px -48px;} -.icon-list{background-position:-360px -48px;} -.icon-indent-left{background-position:-384px -48px;} -.icon-indent-right{background-position:-408px -48px;} -.icon-facetime-video{background-position:-432px -48px;} -.icon-picture{background-position:-456px -48px;} -.icon-pencil{background-position:0 -72px;} -.icon-map-marker{background-position:-24px -72px;} -.icon-adjust{background-position:-48px -72px;} -.icon-tint{background-position:-72px -72px;} -.icon-edit{background-position:-96px -72px;} -.icon-share{background-position:-120px -72px;} -.icon-check{background-position:-144px -72px;} -.icon-move{background-position:-168px -72px;} -.icon-step-backward{background-position:-192px -72px;} -.icon-fast-backward{background-position:-216px -72px;} -.icon-backward{background-position:-240px -72px;} -.icon-play{background-position:-264px -72px;} -.icon-pause{background-position:-288px -72px;} -.icon-stop{background-position:-312px -72px;} -.icon-forward{background-position:-336px -72px;} -.icon-fast-forward{background-position:-360px -72px;} -.icon-step-forward{background-position:-384px -72px;} -.icon-eject{background-position:-408px -72px;} -.icon-chevron-left{background-position:-432px -72px;} -.icon-chevron-right{background-position:-456px -72px;} -.icon-plus-sign{background-position:0 -96px;} -.icon-minus-sign{background-position:-24px -96px;} -.icon-remove-sign{background-position:-48px -96px;} -.icon-ok-sign{background-position:-72px -96px;} -.icon-question-sign{background-position:-96px -96px;} -.icon-info-sign{background-position:-120px -96px;} -.icon-screenshot{background-position:-144px -96px;} -.icon-remove-circle{background-position:-168px -96px;} -.icon-ok-circle{background-position:-192px -96px;} -.icon-ban-circle{background-position:-216px -96px;} -.icon-arrow-left{background-position:-240px -96px;} -.icon-arrow-right{background-position:-264px -96px;} -.icon-arrow-up{background-position:-289px -96px;} -.icon-arrow-down{background-position:-312px -96px;} -.icon-share-alt{background-position:-336px -96px;} -.icon-resize-full{background-position:-360px -96px;} -.icon-resize-small{background-position:-384px -96px;} -.icon-plus{background-position:-408px -96px;} -.icon-minus{background-position:-433px -96px;} -.icon-asterisk{background-position:-456px -96px;} -.icon-exclamation-sign{background-position:0 -120px;} -.icon-gift{background-position:-24px -120px;} -.icon-leaf{background-position:-48px -120px;} -.icon-fire{background-position:-72px -120px;} -.icon-eye-open{background-position:-96px -120px;} -.icon-eye-close{background-position:-120px -120px;} -.icon-warning-sign{background-position:-144px -120px;} -.icon-plane{background-position:-168px -120px;} -.icon-calendar{background-position:-192px -120px;} -.icon-random{background-position:-216px -120px;width:16px;} -.icon-comment{background-position:-240px -120px;} -.icon-magnet{background-position:-264px -120px;} -.icon-chevron-up{background-position:-288px -120px;} -.icon-chevron-down{background-position:-313px -119px;} -.icon-retweet{background-position:-336px -120px;} -.icon-shopping-cart{background-position:-360px -120px;} -.icon-folder-close{background-position:-384px -120px;width:16px;} -.icon-folder-open{background-position:-408px -120px;width:16px;} -.icon-resize-vertical{background-position:-432px -119px;} -.icon-resize-horizontal{background-position:-456px -118px;} -.icon-hdd{background-position:0 -144px;} -.icon-bullhorn{background-position:-24px -144px;} -.icon-bell{background-position:-48px -144px;} -.icon-certificate{background-position:-72px -144px;} -.icon-thumbs-up{background-position:-96px -144px;} -.icon-thumbs-down{background-position:-120px -144px;} -.icon-hand-right{background-position:-144px -144px;} -.icon-hand-left{background-position:-168px -144px;} -.icon-hand-up{background-position:-192px -144px;} -.icon-hand-down{background-position:-216px -144px;} -.icon-circle-arrow-right{background-position:-240px -144px;} -.icon-circle-arrow-left{background-position:-264px -144px;} -.icon-circle-arrow-up{background-position:-288px -144px;} -.icon-circle-arrow-down{background-position:-312px -144px;} -.icon-globe{background-position:-336px -144px;} -.icon-wrench{background-position:-360px -144px;} -.icon-tasks{background-position:-384px -144px;} -.icon-filter{background-position:-408px -144px;} -.icon-briefcase{background-position:-432px -144px;} -.icon-fullscreen{background-position:-456px -144px;} -.btn-group{position:relative;display:inline-block;*display:inline;*zoom:1;font-size:0;vertical-align:middle;white-space:nowrap;*margin-left:.3em;}.btn-group:first-child{*margin-left:0;} -.btn-group+.btn-group{margin-left:5px;} -.btn-toolbar{font-size:0;margin-top:10px;margin-bottom:10px;}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group{margin-left:5px;} -.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} -.btn-group>.btn+.btn{margin-left:-1px;} -.btn-group>.btn,.btn-group>.dropdown-menu,.btn-group>.popover{font-size:14px;} -.btn-group>.btn-mini{font-size:10.5px;} -.btn-group>.btn-small{font-size:11.9px;} -.btn-group>.btn-large{font-size:17.5px;} -.btn-group>.btn:first-child{margin-left:0;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} -.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} -.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-top-left-radius:6px;-moz-border-radius-topleft:6px;border-top-left-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomleft:6px;border-bottom-left-radius:6px;} -.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;-moz-border-radius-bottomright:6px;border-bottom-right-radius:6px;} -.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2;} -.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0;} -.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);*padding-top:5px;*padding-bottom:5px;} -.btn-group>.btn-mini+.dropdown-toggle{padding-left:5px;padding-right:5px;*padding-top:2px;*padding-bottom:2px;} -.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px;} -.btn-group>.btn-large+.dropdown-toggle{padding-left:12px;padding-right:12px;*padding-top:7px;*padding-bottom:7px;} -.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} -.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6;} -.btn-group.open .btn-primary.dropdown-toggle{background-color:#0044cc;} -.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406;} -.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f;} -.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351;} -.btn-group.open .btn-info.dropdown-toggle{background-color:#2f96b4;} -.btn-group.open .btn-inverse.dropdown-toggle{background-color:#222222;} -.btn .caret{margin-top:8px;margin-left:0;} -.btn-large .caret{margin-top:6px;} -.btn-large .caret{border-left-width:5px;border-right-width:5px;border-top-width:5px;} -.btn-mini .caret,.btn-small .caret{margin-top:8px;} -.dropup .btn-large .caret{border-bottom-width:5px;} -.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} -.btn-group-vertical{display:inline-block;*display:inline;*zoom:1;} -.btn-group-vertical>.btn{display:block;float:none;max-width:100%;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} -.btn-group-vertical>.btn+.btn{margin-left:0;margin-top:-1px;} -.btn-group-vertical>.btn:first-child{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;} -.btn-group-vertical>.btn:last-child{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;} -.btn-group-vertical>.btn-large:first-child{-webkit-border-radius:6px 6px 0 0;-moz-border-radius:6px 6px 0 0;border-radius:6px 6px 0 0;} -.btn-group-vertical>.btn-large:last-child{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;} -.nav{margin-left:0;margin-bottom:20px;list-style:none;} -.nav>li>a{display:block;} -.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eeeeee;} -.nav>li>a>img{max-width:none;} -.nav>.pull-right{float:right;} -.nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:20px;color:#999999;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);text-transform:uppercase;} -.nav li+.nav-header{margin-top:9px;} -.nav-list{padding-left:15px;padding-right:15px;margin-bottom:0;} -.nav-list>li>a,.nav-list .nav-header{margin-left:-15px;margin-right:-15px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);} -.nav-list>li>a{padding:3px 15px;} -.nav-list>.active>a,.nav-list>.active>a:hover,.nav-list>.active>a:focus{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.2);background-color:#0088cc;} -.nav-list [class^="icon-"],.nav-list [class*=" icon-"]{margin-right:2px;} -.nav-list .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #ffffff;} -.nav-tabs,.nav-pills{*zoom:1;}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;content:"";line-height:0;} -.nav-tabs:after,.nav-pills:after{clear:both;} -.nav-tabs>li,.nav-pills>li{float:left;} -.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px;} -.nav-tabs{border-bottom:1px solid #ddd;} -.nav-tabs>li{margin-bottom:-1px;} -.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:20px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;}.nav-tabs>li>a:hover,.nav-tabs>li>a:focus{border-color:#eeeeee #eeeeee #dddddd;} -.nav-tabs>.active>a,.nav-tabs>.active>a:hover,.nav-tabs>.active>a:focus{color:#555555;background-color:#ffffff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default;} -.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;} -.nav-pills>.active>a,.nav-pills>.active>a:hover,.nav-pills>.active>a:focus{color:#ffffff;background-color:#0088cc;} -.nav-stacked>li{float:none;} -.nav-stacked>li>a{margin-right:0;} -.nav-tabs.nav-stacked{border-bottom:0;} -.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} -.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;} -.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} -.nav-tabs.nav-stacked>li>a:hover,.nav-tabs.nav-stacked>li>a:focus{border-color:#ddd;z-index:2;} -.nav-pills.nav-stacked>li>a{margin-bottom:3px;} -.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px;} -.nav-tabs .dropdown-menu{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;} -.nav-pills .dropdown-menu{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} -.nav .dropdown-toggle .caret{border-top-color:#0088cc;border-bottom-color:#0088cc;margin-top:6px;} -.nav .dropdown-toggle:hover .caret,.nav .dropdown-toggle:focus .caret{border-top-color:#005580;border-bottom-color:#005580;} -.nav-tabs .dropdown-toggle .caret{margin-top:8px;} -.nav .active .dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff;} -.nav-tabs .active .dropdown-toggle .caret{border-top-color:#555555;border-bottom-color:#555555;} -.nav>.dropdown.active>a:hover,.nav>.dropdown.active>a:focus{cursor:pointer;} -.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover,.nav>li.dropdown.open.active>a:focus{color:#ffffff;background-color:#999999;border-color:#999999;} -.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret,.nav li.dropdown.open a:focus .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;opacity:1;filter:alpha(opacity=100);} -.tabs-stacked .open>a:hover,.tabs-stacked .open>a:focus{border-color:#999999;} -.tabbable{*zoom:1;}.tabbable:before,.tabbable:after{display:table;content:"";line-height:0;} -.tabbable:after{clear:both;} -.tab-content{overflow:auto;} -.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0;} -.tab-content>.tab-pane,.pill-content>.pill-pane{display:none;} -.tab-content>.active,.pill-content>.active{display:block;} -.tabs-below>.nav-tabs{border-top:1px solid #ddd;} -.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0;} -.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;}.tabs-below>.nav-tabs>li>a:hover,.tabs-below>.nav-tabs>li>a:focus{border-bottom-color:transparent;border-top-color:#ddd;} -.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover,.tabs-below>.nav-tabs>.active>a:focus{border-color:transparent #ddd #ddd #ddd;} -.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none;} -.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px;} -.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd;} -.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} -.tabs-left>.nav-tabs>li>a:hover,.tabs-left>.nav-tabs>li>a:focus{border-color:#eeeeee #dddddd #eeeeee #eeeeee;} -.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover,.tabs-left>.nav-tabs .active>a:focus{border-color:#ddd transparent #ddd #ddd;*border-right-color:#ffffff;} -.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd;} -.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} -.tabs-right>.nav-tabs>li>a:hover,.tabs-right>.nav-tabs>li>a:focus{border-color:#eeeeee #eeeeee #eeeeee #dddddd;} -.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover,.tabs-right>.nav-tabs .active>a:focus{border-color:#ddd #ddd #ddd transparent;*border-left-color:#ffffff;} -.nav>.disabled>a{color:#999999;} -.nav>.disabled>a:hover,.nav>.disabled>a:focus{text-decoration:none;background-color:transparent;cursor:default;} -.navbar{overflow:visible;margin-bottom:20px;*position:relative;*z-index:2;} -.navbar-inner{min-height:40px;padding-left:20px;padding-right:20px;background-color:#fafafa;background-image:-moz-linear-gradient(top, #ffffff, #f2f2f2);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2));background-image:-webkit-linear-gradient(top, #ffffff, #f2f2f2);background-image:-o-linear-gradient(top, #ffffff, #f2f2f2);background-image:linear-gradient(to bottom, #ffffff, #f2f2f2);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);border:1px solid #d4d4d4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.065);-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.065);box-shadow:0 1px 4px rgba(0, 0, 0, 0.065);*zoom:1;}.navbar-inner:before,.navbar-inner:after{display:table;content:"";line-height:0;} -.navbar-inner:after{clear:both;} -.navbar .container{width:auto;} -.nav-collapse.collapse{height:auto;overflow:visible;} -.navbar .brand{float:left;display:block;padding:10px 20px 10px;margin-left:-20px;font-size:20px;font-weight:200;color:#777777;text-shadow:0 1px 0 #ffffff;}.navbar .brand:hover,.navbar .brand:focus{text-decoration:none;} -.navbar-text{margin-bottom:0;line-height:40px;color:#777777;} -.navbar-link{color:#777777;}.navbar-link:hover,.navbar-link:focus{color:#333333;} -.navbar .divider-vertical{height:40px;margin:0 9px;border-left:1px solid #f2f2f2;border-right:1px solid #ffffff;} -.navbar .btn,.navbar .btn-group{margin-top:5px;} -.navbar .btn-group .btn,.navbar .input-prepend .btn,.navbar .input-append .btn,.navbar .input-prepend .btn-group,.navbar .input-append .btn-group{margin-top:0;} -.navbar-form{margin-bottom:0;*zoom:1;}.navbar-form:before,.navbar-form:after{display:table;content:"";line-height:0;} -.navbar-form:after{clear:both;} -.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px;} -.navbar-form input,.navbar-form select,.navbar-form .btn{display:inline-block;margin-bottom:0;} -.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px;} -.navbar-form .input-append,.navbar-form .input-prepend{margin-top:5px;white-space:nowrap;}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0;} -.navbar-search{position:relative;float:left;margin-top:5px;margin-bottom:0;}.navbar-search .search-query{margin-bottom:0;padding:4px 14px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} -.navbar-static-top{position:static;margin-bottom:0;}.navbar-static-top .navbar-inner{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} -.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0;} -.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{border-width:0 0 1px;} -.navbar-fixed-bottom .navbar-inner{border-width:1px 0 0;} -.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-left:0;padding-right:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} -.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px;} -.navbar-fixed-top{top:0;} -.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{-webkit-box-shadow:0 1px 10px rgba(0,0,0,.1);-moz-box-shadow:0 1px 10px rgba(0,0,0,.1);box-shadow:0 1px 10px rgba(0,0,0,.1);} -.navbar-fixed-bottom{bottom:0;}.navbar-fixed-bottom .navbar-inner{-webkit-box-shadow:0 -1px 10px rgba(0,0,0,.1);-moz-box-shadow:0 -1px 10px rgba(0,0,0,.1);box-shadow:0 -1px 10px rgba(0,0,0,.1);} -.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0;} -.navbar .nav.pull-right{float:right;margin-right:0;} -.navbar .nav>li{float:left;} -.navbar .nav>li>a{float:none;padding:10px 15px 10px;color:#777777;text-decoration:none;text-shadow:0 1px 0 #ffffff;} -.navbar .nav .dropdown-toggle .caret{margin-top:8px;} -.navbar .nav>li>a:focus,.navbar .nav>li>a:hover{background-color:transparent;color:#333333;text-decoration:none;} -.navbar .nav>.active>a,.navbar .nav>.active>a:hover,.navbar .nav>.active>a:focus{color:#555555;text-decoration:none;background-color:#e5e5e5;-webkit-box-shadow:inset 0 3px 8px rgba(0, 0, 0, 0.125);-moz-box-shadow:inset 0 3px 8px rgba(0, 0, 0, 0.125);box-shadow:inset 0 3px 8px rgba(0, 0, 0, 0.125);} -.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-left:5px;margin-right:5px;color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#ededed;background-image:-moz-linear-gradient(top, #f2f2f2, #e5e5e5);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f2f2f2), to(#e5e5e5));background-image:-webkit-linear-gradient(top, #f2f2f2, #e5e5e5);background-image:-o-linear-gradient(top, #f2f2f2, #e5e5e5);background-image:linear-gradient(to bottom, #f2f2f2, #e5e5e5);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffe5e5e5', GradientType=0);border-color:#e5e5e5 #e5e5e5 #bfbfbf;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#e5e5e5;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);}.navbar .btn-navbar:hover,.navbar .btn-navbar:focus,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{color:#ffffff;background-color:#e5e5e5;*background-color:#d9d9d9;} -.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#cccccc \9;} -.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);-moz-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);} -.btn-navbar .icon-bar+.icon-bar{margin-top:3px;} -.navbar .nav>li>.dropdown-menu:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0, 0, 0, 0.2);position:absolute;top:-7px;left:9px;} -.navbar .nav>li>.dropdown-menu:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #ffffff;position:absolute;top:-6px;left:10px;} -.navbar-fixed-bottom .nav>li>.dropdown-menu:before{border-top:7px solid #ccc;border-top-color:rgba(0, 0, 0, 0.2);border-bottom:0;bottom:-7px;top:auto;} -.navbar-fixed-bottom .nav>li>.dropdown-menu:after{border-top:6px solid #ffffff;border-bottom:0;bottom:-6px;top:auto;} -.navbar .nav li.dropdown>a:hover .caret,.navbar .nav li.dropdown>a:focus .caret{border-top-color:#333333;border-bottom-color:#333333;} -.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{background-color:#e5e5e5;color:#555555;} -.navbar .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#777777;border-bottom-color:#777777;} -.navbar .nav li.dropdown.open>.dropdown-toggle .caret,.navbar .nav li.dropdown.active>.dropdown-toggle .caret,.navbar .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#555555;border-bottom-color:#555555;} -.navbar .pull-right>li>.dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right{left:auto;right:0;}.navbar .pull-right>li>.dropdown-menu:before,.navbar .nav>li>.dropdown-menu.pull-right:before{left:auto;right:12px;} -.navbar .pull-right>li>.dropdown-menu:after,.navbar .nav>li>.dropdown-menu.pull-right:after{left:auto;right:13px;} -.navbar .pull-right>li>.dropdown-menu .dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right .dropdown-menu{left:auto;right:100%;margin-left:0;margin-right:-1px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;} -.navbar-inverse .navbar-inner{background-color:#1b1b1b;background-image:-moz-linear-gradient(top, #222222, #111111);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111));background-image:-webkit-linear-gradient(top, #222222, #111111);background-image:-o-linear-gradient(top, #222222, #111111);background-image:linear-gradient(to bottom, #222222, #111111);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);border-color:#252525;} -.navbar-inverse .brand,.navbar-inverse .nav>li>a{color:#999999;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);}.navbar-inverse .brand:hover,.navbar-inverse .nav>li>a:hover,.navbar-inverse .brand:focus,.navbar-inverse .nav>li>a:focus{color:#ffffff;} -.navbar-inverse .brand{color:#999999;} -.navbar-inverse .navbar-text{color:#999999;} -.navbar-inverse .nav>li>a:focus,.navbar-inverse .nav>li>a:hover{background-color:transparent;color:#ffffff;} -.navbar-inverse .nav .active>a,.navbar-inverse .nav .active>a:hover,.navbar-inverse .nav .active>a:focus{color:#ffffff;background-color:#111111;} -.navbar-inverse .navbar-link{color:#999999;}.navbar-inverse .navbar-link:hover,.navbar-inverse .navbar-link:focus{color:#ffffff;} -.navbar-inverse .divider-vertical{border-left-color:#111111;border-right-color:#222222;} -.navbar-inverse .nav li.dropdown.open>.dropdown-toggle,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{background-color:#111111;color:#ffffff;} -.navbar-inverse .nav li.dropdown>a:hover .caret,.navbar-inverse .nav li.dropdown>a:focus .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} -.navbar-inverse .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#999999;border-bottom-color:#999999;} -.navbar-inverse .nav li.dropdown.open>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} -.navbar-inverse .navbar-search .search-query{color:#ffffff;background-color:#515151;border-color:#111111;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none;}.navbar-inverse .navbar-search .search-query:-moz-placeholder{color:#cccccc;} -.navbar-inverse .navbar-search .search-query:-ms-input-placeholder{color:#cccccc;} -.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder{color:#cccccc;} -.navbar-inverse .navbar-search .search-query:focus,.navbar-inverse .navbar-search .search-query.focused{padding:5px 15px;color:#333333;text-shadow:0 1px 0 #ffffff;background-color:#ffffff;border:0;-webkit-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);box-shadow:0 0 3px rgba(0, 0, 0, 0.15);outline:0;} -.navbar-inverse .btn-navbar{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#0e0e0e;background-image:-moz-linear-gradient(top, #151515, #040404);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#151515), to(#040404));background-image:-webkit-linear-gradient(top, #151515, #040404);background-image:-o-linear-gradient(top, #151515, #040404);background-image:linear-gradient(to bottom, #151515, #040404);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515', endColorstr='#ff040404', GradientType=0);border-color:#040404 #040404 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#040404;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.navbar-inverse .btn-navbar:hover,.navbar-inverse .btn-navbar:focus,.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active,.navbar-inverse .btn-navbar.disabled,.navbar-inverse .btn-navbar[disabled]{color:#ffffff;background-color:#040404;*background-color:#000000;} -.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active{background-color:#000000 \9;} -.breadcrumb{padding:8px 15px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.breadcrumb>li{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 0 #ffffff;}.breadcrumb>li>.divider{padding:0 5px;color:#ccc;} -.breadcrumb>.active{color:#999999;} -.pagination{margin:20px 0;} -.pagination ul{display:inline-block;*display:inline;*zoom:1;margin-left:0;margin-bottom:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);} -.pagination ul>li{display:inline;} -.pagination ul>li>a,.pagination ul>li>span{float:left;padding:4px 12px;line-height:20px;text-decoration:none;background-color:#ffffff;border:1px solid #dddddd;border-left-width:0;} -.pagination ul>li>a:hover,.pagination ul>li>a:focus,.pagination ul>.active>a,.pagination ul>.active>span{background-color:#f5f5f5;} -.pagination ul>.active>a,.pagination ul>.active>span{color:#999999;cursor:default;} -.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover,.pagination ul>.disabled>a:focus{color:#999999;background-color:transparent;cursor:default;} -.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{border-left-width:1px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} -.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} -.pagination-centered{text-align:center;} -.pagination-right{text-align:right;} -.pagination-large ul>li>a,.pagination-large ul>li>span{padding:11px 19px;font-size:17.5px;} -.pagination-large ul>li:first-child>a,.pagination-large ul>li:first-child>span{-webkit-border-top-left-radius:6px;-moz-border-radius-topleft:6px;border-top-left-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomleft:6px;border-bottom-left-radius:6px;} -.pagination-large ul>li:last-child>a,.pagination-large ul>li:last-child>span{-webkit-border-top-right-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;-moz-border-radius-bottomright:6px;border-bottom-right-radius:6px;} -.pagination-mini ul>li:first-child>a,.pagination-small ul>li:first-child>a,.pagination-mini ul>li:first-child>span,.pagination-small ul>li:first-child>span{-webkit-border-top-left-radius:3px;-moz-border-radius-topleft:3px;border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-moz-border-radius-bottomleft:3px;border-bottom-left-radius:3px;} -.pagination-mini ul>li:last-child>a,.pagination-small ul>li:last-child>a,.pagination-mini ul>li:last-child>span,.pagination-small ul>li:last-child>span{-webkit-border-top-right-radius:3px;-moz-border-radius-topright:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-bottomright:3px;border-bottom-right-radius:3px;} -.pagination-small ul>li>a,.pagination-small ul>li>span{padding:2px 10px;font-size:11.9px;} -.pagination-mini ul>li>a,.pagination-mini ul>li>span{padding:0 6px;font-size:10.5px;} -.pager{margin:20px 0;list-style:none;text-align:center;*zoom:1;}.pager:before,.pager:after{display:table;content:"";line-height:0;} -.pager:after{clear:both;} -.pager li{display:inline;} -.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} -.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#f5f5f5;} -.pager .next>a,.pager .next>span{float:right;} -.pager .previous>a,.pager .previous>span{float:left;} -.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999999;background-color:#fff;cursor:default;} -.thumbnails{margin-left:-20px;list-style:none;*zoom:1;}.thumbnails:before,.thumbnails:after{display:table;content:"";line-height:0;} -.thumbnails:after{clear:both;} -.row-fluid .thumbnails{margin-left:0;} -.thumbnails>li{float:left;margin-bottom:20px;margin-left:20px;} -.thumbnail{display:block;padding:4px;line-height:20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.055);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.055);box-shadow:0 1px 3px rgba(0, 0, 0, 0.055);-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-o-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;} -a.thumbnail:hover,a.thumbnail:focus{border-color:#0088cc;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);} -.thumbnail>img{display:block;max-width:100%;margin-left:auto;margin-right:auto;} -.thumbnail .caption{padding:9px;color:#555555;} -.alert{padding:8px 35px 8px 14px;margin-bottom:20px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} -.alert,.alert h4{color:#c09853;} -.alert h4{margin:0;} -.alert .close{position:relative;top:-2px;right:-21px;line-height:20px;} -.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#468847;} -.alert-success h4{color:#468847;} -.alert-danger,.alert-error{background-color:#f2dede;border-color:#eed3d7;color:#b94a48;} -.alert-danger h4,.alert-error h4{color:#b94a48;} -.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#3a87ad;} -.alert-info h4{color:#3a87ad;} -.alert-block{padding-top:14px;padding-bottom:14px;} -.alert-block>p,.alert-block>ul{margin-bottom:0;} -.alert-block p+p{margin-top:5px;} -@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-ms-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-o-keyframes progress-bar-stripes{from{background-position:0 0;} to{background-position:40px 0;}}@keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}.progress{overflow:hidden;height:20px;margin-bottom:20px;background-color:#f7f7f7;background-image:-moz-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9));background-image:-webkit-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-o-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:linear-gradient(to bottom, #f5f5f5, #f9f9f9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} -.progress .bar{width:0%;height:100%;color:#ffffff;float:left;font-size:12px;text-align:center;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top, #149bdf, #0480be);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be));background-image:-webkit-linear-gradient(top, #149bdf, #0480be);background-image:-o-linear-gradient(top, #149bdf, #0480be);background-image:linear-gradient(to bottom, #149bdf, #0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width 0.6s ease;-moz-transition:width 0.6s ease;-o-transition:width 0.6s ease;transition:width 0.6s ease;} -.progress .bar+.bar{-webkit-box-shadow:inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);-moz-box-shadow:inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);} -.progress-striped .bar{background-color:#149bdf;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);-webkit-background-size:40px 40px;-moz-background-size:40px 40px;-o-background-size:40px 40px;background-size:40px 40px;} -.progress.active .bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-moz-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite;} -.progress-danger .bar,.progress .bar-danger{background-color:#dd514c;background-image:-moz-linear-gradient(top, #ee5f5b, #c43c35);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35));background-image:-webkit-linear-gradient(top, #ee5f5b, #c43c35);background-image:-o-linear-gradient(top, #ee5f5b, #c43c35);background-image:linear-gradient(to bottom, #ee5f5b, #c43c35);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffc43c35', GradientType=0);} -.progress-danger.progress-striped .bar,.progress-striped .bar-danger{background-color:#ee5f5b;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} -.progress-success .bar,.progress .bar-success{background-color:#5eb95e;background-image:-moz-linear-gradient(top, #62c462, #57a957);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957));background-image:-webkit-linear-gradient(top, #62c462, #57a957);background-image:-o-linear-gradient(top, #62c462, #57a957);background-image:linear-gradient(to bottom, #62c462, #57a957);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff57a957', GradientType=0);} -.progress-success.progress-striped .bar,.progress-striped .bar-success{background-color:#62c462;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} -.progress-info .bar,.progress .bar-info{background-color:#4bb1cf;background-image:-moz-linear-gradient(top, #5bc0de, #339bb9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9));background-image:-webkit-linear-gradient(top, #5bc0de, #339bb9);background-image:-o-linear-gradient(top, #5bc0de, #339bb9);background-image:linear-gradient(to bottom, #5bc0de, #339bb9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff339bb9', GradientType=0);} -.progress-info.progress-striped .bar,.progress-striped .bar-info{background-color:#5bc0de;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} -.progress-warning .bar,.progress .bar-warning{background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(to bottom, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);} -.progress-warning.progress-striped .bar,.progress-striped .bar-warning{background-color:#fbb450;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} -.hero-unit{padding:60px;margin-bottom:30px;font-size:18px;font-weight:200;line-height:30px;color:inherit;background-color:#eeeeee;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;color:inherit;letter-spacing:-1px;} -.hero-unit li{line-height:30px;} -.media,.media-body{overflow:hidden;*overflow:visible;zoom:1;} -.media,.media .media{margin-top:15px;} -.media:first-child{margin-top:0;} -.media-object{display:block;} -.media-heading{margin:0 0 5px;} -.media>.pull-left{margin-right:10px;} -.media>.pull-right{margin-left:10px;} -.media-list{margin-left:0;list-style:none;} -.tooltip{position:absolute;z-index:1030;display:block;visibility:visible;font-size:11px;line-height:1.4;opacity:0;filter:alpha(opacity=0);}.tooltip.in{opacity:0.8;filter:alpha(opacity=80);} -.tooltip.top{margin-top:-3px;padding:5px 0;} -.tooltip.right{margin-left:3px;padding:0 5px;} -.tooltip.bottom{margin-top:3px;padding:5px 0;} -.tooltip.left{margin-left:-3px;padding:0 5px;} -.tooltip-inner{max-width:200px;padding:8px;color:#ffffff;text-align:center;text-decoration:none;background-color:#000000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} -.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid;} -.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000000;} -.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000000;} -.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000000;} -.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000000;} -.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;background-color:#ffffff;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);white-space:normal;}.popover.top{margin-top:-10px;} -.popover.right{margin-left:10px;} -.popover.bottom{margin-top:10px;} -.popover.left{margin-left:-10px;} -.popover-title{margin:0;padding:8px 14px;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;}.popover-title:empty{display:none;} -.popover-content{padding:9px 14px;} -.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid;} -.popover .arrow{border-width:11px;} -.popover .arrow:after{border-width:10px;content:"";} -.popover.top .arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0, 0, 0, 0.25);bottom:-11px;}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#ffffff;} -.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0, 0, 0, 0.25);}.popover.right .arrow:after{left:1px;bottom:-10px;border-left-width:0;border-right-color:#ffffff;} -.popover.bottom .arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0, 0, 0, 0.25);top:-11px;}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#ffffff;} -.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0, 0, 0, 0.25);}.popover.left .arrow:after{right:1px;border-right-width:0;border-left-color:#ffffff;bottom:-10px;} -.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000000;}.modal-backdrop.fade{opacity:0;} -.modal-backdrop,.modal-backdrop.fade.in{opacity:0.8;filter:alpha(opacity=80);} -.modal{position:fixed;top:10%;left:50%;z-index:1050;width:560px;margin-left:-280px;background-color:#ffffff;border:1px solid #999;border:1px solid rgba(0, 0, 0, 0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;outline:none;}.modal.fade{-webkit-transition:opacity .3s linear, top .3s ease-out;-moz-transition:opacity .3s linear, top .3s ease-out;-o-transition:opacity .3s linear, top .3s ease-out;transition:opacity .3s linear, top .3s ease-out;top:-25%;} -.modal.fade.in{top:10%;} -.modal-header{padding:9px 15px;border-bottom:1px solid #eee;}.modal-header .close{margin-top:2px;} -.modal-header h3{margin:0;line-height:30px;} -.modal-body{position:relative;overflow-y:auto;max-height:400px;padding:15px;} -.modal-form{margin-bottom:0;} -.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;*zoom:1;}.modal-footer:before,.modal-footer:after{display:table;content:"";line-height:0;} -.modal-footer:after{clear:both;} -.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0;} -.modal-footer .btn-group .btn+.btn{margin-left:-1px;} -.modal-footer .btn-block+.btn-block{margin-left:0;} -.dropup,.dropdown{position:relative;} -.dropdown-toggle{*margin-bottom:-3px;} -.dropdown-toggle:active,.open .dropdown-toggle{outline:0;} -.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000000;border-right:4px solid transparent;border-left:4px solid transparent;content:"";} -.dropdown .caret{margin-top:8px;margin-left:2px;} -.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#ffffff;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;}.dropdown-menu.pull-right{right:0;left:auto;} -.dropdown-menu .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #ffffff;} -.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333333;white-space:nowrap;} -.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-submenu:hover>a,.dropdown-submenu:focus>a{text-decoration:none;color:#ffffff;background-color:#0081c2;background-image:-moz-linear-gradient(top, #0088cc, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image:-webkit-linear-gradient(top, #0088cc, #0077b3);background-image:-o-linear-gradient(top, #0088cc, #0077b3);background-image:linear-gradient(to bottom, #0088cc, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);} -.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#ffffff;text-decoration:none;outline:0;background-color:#0081c2;background-image:-moz-linear-gradient(top, #0088cc, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image:-webkit-linear-gradient(top, #0088cc, #0077b3);background-image:-o-linear-gradient(top, #0088cc, #0077b3);background-image:linear-gradient(to bottom, #0088cc, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);} -.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999999;} -.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);cursor:default;} -.open{*z-index:1000;}.open>.dropdown-menu{display:block;} -.pull-right>.dropdown-menu{right:0;left:auto;} -.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000000;content:"";} -.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px;} -.dropdown-submenu{position:relative;} -.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;} -.dropdown-submenu:hover>.dropdown-menu{display:block;} -.dropup .dropdown-submenu>.dropdown-menu{top:auto;bottom:0;margin-top:0;margin-bottom:-2px;-webkit-border-radius:5px 5px 5px 0;-moz-border-radius:5px 5px 5px 0;border-radius:5px 5px 5px 0;} -.dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#cccccc;margin-top:5px;margin-right:-10px;} -.dropdown-submenu:hover>a:after{border-left-color:#ffffff;} -.dropdown-submenu.pull-left{float:none;}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;} -.dropdown .dropdown-menu .nav-header{padding-left:20px;padding-right:20px;} -.typeahead{z-index:1051;margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} -.accordion{margin-bottom:20px;} -.accordion-group{margin-bottom:2px;border:1px solid #e5e5e5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} -.accordion-heading{border-bottom:0;} -.accordion-heading .accordion-toggle{display:block;padding:8px 15px;} -.accordion-toggle{cursor:pointer;} -.accordion-inner{padding:9px 15px;border-top:1px solid #e5e5e5;} -.carousel{position:relative;margin-bottom:20px;line-height:1;} -.carousel-inner{overflow:hidden;width:100%;position:relative;} -.carousel-inner>.item{display:none;position:relative;-webkit-transition:0.6s ease-in-out left;-moz-transition:0.6s ease-in-out left;-o-transition:0.6s ease-in-out left;transition:0.6s ease-in-out left;}.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;line-height:1;} -.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block;} -.carousel-inner>.active{left:0;} -.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%;} -.carousel-inner>.next{left:100%;} -.carousel-inner>.prev{left:-100%;} -.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0;} -.carousel-inner>.active.left{left:-100%;} -.carousel-inner>.active.right{left:100%;} -.carousel-control{position:absolute;top:40%;left:15px;width:40px;height:40px;margin-top:-20px;font-size:60px;font-weight:100;line-height:30px;color:#ffffff;text-align:center;background:#222222;border:3px solid #ffffff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:0.5;filter:alpha(opacity=50);}.carousel-control.right{left:auto;right:15px;} -.carousel-control:hover,.carousel-control:focus{color:#ffffff;text-decoration:none;opacity:0.9;filter:alpha(opacity=90);} -.carousel-indicators{position:absolute;top:15px;right:15px;z-index:5;margin:0;list-style:none;}.carousel-indicators li{display:block;float:left;width:10px;height:10px;margin-left:5px;text-indent:-999px;background-color:#ccc;background-color:rgba(255, 255, 255, 0.25);border-radius:5px;} -.carousel-indicators .active{background-color:#fff;} -.carousel-caption{position:absolute;left:0;right:0;bottom:0;padding:15px;background:#333333;background:rgba(0, 0, 0, 0.75);} -.carousel-caption h4,.carousel-caption p{color:#ffffff;line-height:20px;} -.carousel-caption h4{margin:0 0 5px;} -.carousel-caption p{margin-bottom:0;} -.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);} -.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} -.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} -.close{float:right;font-size:20px;font-weight:bold;line-height:20px;color:#000000;text-shadow:0 1px 0 #ffffff;opacity:0.2;filter:alpha(opacity=20);}.close:hover,.close:focus{color:#000000;text-decoration:none;cursor:pointer;opacity:0.4;filter:alpha(opacity=40);} -button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none;} -.pull-right{float:right;} -.pull-left{float:left;} -.hide{display:none;} -.show{display:block;} -.invisible{visibility:hidden;} -.affix{position:fixed;} -.fade{opacity:0;-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;}.fade.in{opacity:1;} -.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height 0.35s ease;-moz-transition:height 0.35s ease;-o-transition:height 0.35s ease;transition:height 0.35s ease;}.collapse.in{height:auto;} -@-ms-viewport{width:device-width;}.hidden{display:none;visibility:hidden;} -.visible-phone{display:none !important;} -.visible-tablet{display:none !important;} -.hidden-desktop{display:none !important;} -.visible-desktop{display:inherit !important;} -@media (min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit !important;} .visible-desktop{display:none !important ;} .visible-tablet{display:inherit !important;} .hidden-tablet{display:none !important;}}@media (max-width:767px){.hidden-desktop{display:inherit !important;} .visible-desktop{display:none !important;} .visible-phone{display:inherit !important;} .hidden-phone{display:none !important;}}.visible-print{display:none !important;} -@media print{.visible-print{display:inherit !important;} .hidden-print{display:none !important;}}@media (max-width:767px){body{padding-left:20px;padding-right:20px;} .navbar-fixed-top,.navbar-fixed-bottom,.navbar-static-top{margin-left:-20px;margin-right:-20px;} .container-fluid{padding:0;} .dl-horizontal dt{float:none;clear:none;width:auto;text-align:left;} .dl-horizontal dd{margin-left:0;} .container{width:auto;} .row-fluid{width:100%;} .row,.thumbnails{margin-left:0;} .thumbnails>li{float:none;margin-left:0;} [class*="span"],.uneditable-input[class*="span"],.row-fluid [class*="span"]{float:none;display:block;width:100%;margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} .span12,.row-fluid .span12{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} .row-fluid [class*="offset"]:first-child{margin-left:0;} .input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} .input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto;} .controls-row [class*="span"]+[class*="span"]{margin-left:0;} .modal{position:fixed;top:20px;left:20px;right:20px;width:auto;margin:0;}.modal.fade{top:-100px;} .modal.fade.in{top:20px;}}@media (max-width:480px){.nav-collapse{-webkit-transform:translate3d(0, 0, 0);} .page-header h1 small{display:block;line-height:20px;} input[type="checkbox"],input[type="radio"]{border:1px solid #ccc;} .form-horizontal .control-label{float:none;width:auto;padding-top:0;text-align:left;} .form-horizontal .controls{margin-left:0;} .form-horizontal .control-list{padding-top:0;} .form-horizontal .form-actions{padding-left:10px;padding-right:10px;} .media .pull-left,.media .pull-right{float:none;display:block;margin-bottom:10px;} .media-object{margin-right:0;margin-left:0;} .modal{top:10px;left:10px;right:10px;} .modal-header .close{padding:10px;margin:-10px;} .carousel-caption{position:static;}}@media (min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";line-height:0;} .row:after{clear:both;} [class*="span"]{float:left;min-height:1px;margin-left:20px;} .container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px;} .span12{width:724px;} .span11{width:662px;} .span10{width:600px;} .span9{width:538px;} .span8{width:476px;} .span7{width:414px;} .span6{width:352px;} .span5{width:290px;} .span4{width:228px;} .span3{width:166px;} .span2{width:104px;} .span1{width:42px;} .offset12{margin-left:764px;} .offset11{margin-left:702px;} .offset10{margin-left:640px;} .offset9{margin-left:578px;} .offset8{margin-left:516px;} .offset7{margin-left:454px;} .offset6{margin-left:392px;} .offset5{margin-left:330px;} .offset4{margin-left:268px;} .offset3{margin-left:206px;} .offset2{margin-left:144px;} .offset1{margin-left:82px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";line-height:0;} .row-fluid:after{clear:both;} .row-fluid [class*="span"]{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.7624309392265194%;*margin-left:2.709239449864817%;} .row-fluid [class*="span"]:first-child{margin-left:0;} .row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.7624309392265194%;} .row-fluid .span12{width:100%;*width:99.94680851063829%;} .row-fluid .span11{width:91.43646408839778%;*width:91.38327259903608%;} .row-fluid .span10{width:82.87292817679558%;*width:82.81973668743387%;} .row-fluid .span9{width:74.30939226519337%;*width:74.25620077583166%;} .row-fluid .span8{width:65.74585635359117%;*width:65.69266486422946%;} .row-fluid .span7{width:57.18232044198895%;*width:57.12912895262725%;} .row-fluid .span6{width:48.61878453038674%;*width:48.56559304102504%;} .row-fluid .span5{width:40.05524861878453%;*width:40.00205712942283%;} .row-fluid .span4{width:31.491712707182323%;*width:31.43852121782062%;} .row-fluid .span3{width:22.92817679558011%;*width:22.87498530621841%;} .row-fluid .span2{width:14.3646408839779%;*width:14.311449394616199%;} .row-fluid .span1{width:5.801104972375691%;*width:5.747913483013988%;} .row-fluid .offset12{margin-left:105.52486187845304%;*margin-left:105.41847889972962%;} .row-fluid .offset12:first-child{margin-left:102.76243093922652%;*margin-left:102.6560479605031%;} .row-fluid .offset11{margin-left:96.96132596685082%;*margin-left:96.8549429881274%;} .row-fluid .offset11:first-child{margin-left:94.1988950276243%;*margin-left:94.09251204890089%;} .row-fluid .offset10{margin-left:88.39779005524862%;*margin-left:88.2914070765252%;} .row-fluid .offset10:first-child{margin-left:85.6353591160221%;*margin-left:85.52897613729868%;} .row-fluid .offset9{margin-left:79.8342541436464%;*margin-left:79.72787116492299%;} .row-fluid .offset9:first-child{margin-left:77.07182320441989%;*margin-left:76.96544022569647%;} .row-fluid .offset8{margin-left:71.2707182320442%;*margin-left:71.16433525332079%;} .row-fluid .offset8:first-child{margin-left:68.50828729281768%;*margin-left:68.40190431409427%;} .row-fluid .offset7{margin-left:62.70718232044199%;*margin-left:62.600799341718584%;} .row-fluid .offset7:first-child{margin-left:59.94475138121547%;*margin-left:59.838368402492065%;} .row-fluid .offset6{margin-left:54.14364640883978%;*margin-left:54.037263430116376%;} .row-fluid .offset6:first-child{margin-left:51.38121546961326%;*margin-left:51.27483249088986%;} .row-fluid .offset5{margin-left:45.58011049723757%;*margin-left:45.47372751851417%;} .row-fluid .offset5:first-child{margin-left:42.81767955801105%;*margin-left:42.71129657928765%;} .row-fluid .offset4{margin-left:37.01657458563536%;*margin-left:36.91019160691196%;} .row-fluid .offset4:first-child{margin-left:34.25414364640884%;*margin-left:34.14776066768544%;} .row-fluid .offset3{margin-left:28.45303867403315%;*margin-left:28.346655695309746%;} .row-fluid .offset3:first-child{margin-left:25.69060773480663%;*margin-left:25.584224756083227%;} .row-fluid .offset2{margin-left:19.88950276243094%;*margin-left:19.783119783707537%;} .row-fluid .offset2:first-child{margin-left:17.12707182320442%;*margin-left:17.02068884448102%;} .row-fluid .offset1{margin-left:11.32596685082873%;*margin-left:11.219583872105325%;} .row-fluid .offset1:first-child{margin-left:8.56353591160221%;*margin-left:8.457152932878806%;} input,textarea,.uneditable-input{margin-left:0;} .controls-row [class*="span"]+[class*="span"]{margin-left:20px;} input.span12,textarea.span12,.uneditable-input.span12{width:710px;} input.span11,textarea.span11,.uneditable-input.span11{width:648px;} input.span10,textarea.span10,.uneditable-input.span10{width:586px;} input.span9,textarea.span9,.uneditable-input.span9{width:524px;} input.span8,textarea.span8,.uneditable-input.span8{width:462px;} input.span7,textarea.span7,.uneditable-input.span7{width:400px;} input.span6,textarea.span6,.uneditable-input.span6{width:338px;} input.span5,textarea.span5,.uneditable-input.span5{width:276px;} input.span4,textarea.span4,.uneditable-input.span4{width:214px;} input.span3,textarea.span3,.uneditable-input.span3{width:152px;} input.span2,textarea.span2,.uneditable-input.span2{width:90px;} input.span1,textarea.span1,.uneditable-input.span1{width:28px;}}@media (min-width:1200px){.row{margin-left:-30px;*zoom:1;}.row:before,.row:after{display:table;content:"";line-height:0;} .row:after{clear:both;} [class*="span"]{float:left;min-height:1px;margin-left:30px;} .container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px;} .span12{width:1170px;} .span11{width:1070px;} .span10{width:970px;} .span9{width:870px;} .span8{width:770px;} .span7{width:670px;} .span6{width:570px;} .span5{width:470px;} .span4{width:370px;} .span3{width:270px;} .span2{width:170px;} .span1{width:70px;} .offset12{margin-left:1230px;} .offset11{margin-left:1130px;} .offset10{margin-left:1030px;} .offset9{margin-left:930px;} .offset8{margin-left:830px;} .offset7{margin-left:730px;} .offset6{margin-left:630px;} .offset5{margin-left:530px;} .offset4{margin-left:430px;} .offset3{margin-left:330px;} .offset2{margin-left:230px;} .offset1{margin-left:130px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";line-height:0;} .row-fluid:after{clear:both;} .row-fluid [class*="span"]{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.564102564102564%;*margin-left:2.5109110747408616%;} .row-fluid [class*="span"]:first-child{margin-left:0;} .row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.564102564102564%;} .row-fluid .span12{width:100%;*width:99.94680851063829%;} .row-fluid .span11{width:91.45299145299145%;*width:91.39979996362975%;} .row-fluid .span10{width:82.90598290598291%;*width:82.8527914166212%;} .row-fluid .span9{width:74.35897435897436%;*width:74.30578286961266%;} .row-fluid .span8{width:65.81196581196582%;*width:65.75877432260411%;} .row-fluid .span7{width:57.26495726495726%;*width:57.21176577559556%;} .row-fluid .span6{width:48.717948717948715%;*width:48.664757228587014%;} .row-fluid .span5{width:40.17094017094017%;*width:40.11774868157847%;} .row-fluid .span4{width:31.623931623931625%;*width:31.570740134569924%;} .row-fluid .span3{width:23.076923076923077%;*width:23.023731587561375%;} .row-fluid .span2{width:14.52991452991453%;*width:14.476723040552828%;} .row-fluid .span1{width:5.982905982905983%;*width:5.929714493544281%;} .row-fluid .offset12{margin-left:105.12820512820512%;*margin-left:105.02182214948171%;} .row-fluid .offset12:first-child{margin-left:102.56410256410257%;*margin-left:102.45771958537915%;} .row-fluid .offset11{margin-left:96.58119658119658%;*margin-left:96.47481360247316%;} .row-fluid .offset11:first-child{margin-left:94.01709401709402%;*margin-left:93.91071103837061%;} .row-fluid .offset10{margin-left:88.03418803418803%;*margin-left:87.92780505546462%;} .row-fluid .offset10:first-child{margin-left:85.47008547008548%;*margin-left:85.36370249136206%;} .row-fluid .offset9{margin-left:79.48717948717949%;*margin-left:79.38079650845607%;} .row-fluid .offset9:first-child{margin-left:76.92307692307693%;*margin-left:76.81669394435352%;} .row-fluid .offset8{margin-left:70.94017094017094%;*margin-left:70.83378796144753%;} .row-fluid .offset8:first-child{margin-left:68.37606837606839%;*margin-left:68.26968539734497%;} .row-fluid .offset7{margin-left:62.393162393162385%;*margin-left:62.28677941443899%;} .row-fluid .offset7:first-child{margin-left:59.82905982905982%;*margin-left:59.72267685033642%;} .row-fluid .offset6{margin-left:53.84615384615384%;*margin-left:53.739770867430444%;} .row-fluid .offset6:first-child{margin-left:51.28205128205128%;*margin-left:51.175668303327875%;} .row-fluid .offset5{margin-left:45.299145299145295%;*margin-left:45.1927623204219%;} .row-fluid .offset5:first-child{margin-left:42.73504273504273%;*margin-left:42.62865975631933%;} .row-fluid .offset4{margin-left:36.75213675213675%;*margin-left:36.645753773413354%;} .row-fluid .offset4:first-child{margin-left:34.18803418803419%;*margin-left:34.081651209310785%;} .row-fluid .offset3{margin-left:28.205128205128204%;*margin-left:28.0987452264048%;} .row-fluid .offset3:first-child{margin-left:25.641025641025642%;*margin-left:25.53464266230224%;} .row-fluid .offset2{margin-left:19.65811965811966%;*margin-left:19.551736679396257%;} .row-fluid .offset2:first-child{margin-left:17.094017094017094%;*margin-left:16.98763411529369%;} .row-fluid .offset1{margin-left:11.11111111111111%;*margin-left:11.004728132387708%;} .row-fluid .offset1:first-child{margin-left:8.547008547008547%;*margin-left:8.440625568285142%;} input,textarea,.uneditable-input{margin-left:0;} .controls-row [class*="span"]+[class*="span"]{margin-left:30px;} input.span12,textarea.span12,.uneditable-input.span12{width:1156px;} input.span11,textarea.span11,.uneditable-input.span11{width:1056px;} input.span10,textarea.span10,.uneditable-input.span10{width:956px;} input.span9,textarea.span9,.uneditable-input.span9{width:856px;} input.span8,textarea.span8,.uneditable-input.span8{width:756px;} input.span7,textarea.span7,.uneditable-input.span7{width:656px;} input.span6,textarea.span6,.uneditable-input.span6{width:556px;} input.span5,textarea.span5,.uneditable-input.span5{width:456px;} input.span4,textarea.span4,.uneditable-input.span4{width:356px;} input.span3,textarea.span3,.uneditable-input.span3{width:256px;} input.span2,textarea.span2,.uneditable-input.span2{width:156px;} input.span1,textarea.span1,.uneditable-input.span1{width:56px;} .thumbnails{margin-left:-30px;} .thumbnails>li{margin-left:30px;} .row-fluid .thumbnails{margin-left:0;}}@media (max-width:979px){body{padding-top:0;} .navbar-fixed-top,.navbar-fixed-bottom{position:static;} .navbar-fixed-top{margin-bottom:20px;} .navbar-fixed-bottom{margin-top:20px;} .navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px;} .navbar .container{width:auto;padding:0;} .navbar .brand{padding-left:10px;padding-right:10px;margin:0 0 0 -5px;} .nav-collapse{clear:both;} .nav-collapse .nav{float:none;margin:0 0 10px;} .nav-collapse .nav>li{float:none;} .nav-collapse .nav>li>a{margin-bottom:2px;} .nav-collapse .nav>.divider-vertical{display:none;} .nav-collapse .nav .nav-header{color:#777777;text-shadow:none;} .nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:9px 15px;font-weight:bold;color:#777777;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} .nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} .nav-collapse .dropdown-menu li+li a{margin-bottom:2px;} .nav-collapse .nav>li>a:hover,.nav-collapse .nav>li>a:focus,.nav-collapse .dropdown-menu a:hover,.nav-collapse .dropdown-menu a:focus{background-color:#f2f2f2;} .navbar-inverse .nav-collapse .nav>li>a,.navbar-inverse .nav-collapse .dropdown-menu a{color:#999999;} .navbar-inverse .nav-collapse .nav>li>a:hover,.navbar-inverse .nav-collapse .nav>li>a:focus,.navbar-inverse .nav-collapse .dropdown-menu a:hover,.navbar-inverse .nav-collapse .dropdown-menu a:focus{background-color:#111111;} .nav-collapse.in .btn-group{margin-top:5px;padding:0;} .nav-collapse .dropdown-menu{position:static;top:auto;left:auto;float:none;display:none;max-width:none;margin:0 15px;padding:0;background-color:transparent;border:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} .nav-collapse .open>.dropdown-menu{display:block;} .nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none;} .nav-collapse .dropdown-menu .divider{display:none;} .nav-collapse .nav>li>.dropdown-menu:before,.nav-collapse .nav>li>.dropdown-menu:after{display:none;} .nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:10px 15px;margin:10px 0;border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);} .navbar-inverse .nav-collapse .navbar-form,.navbar-inverse .nav-collapse .navbar-search{border-top-color:#111111;border-bottom-color:#111111;} .navbar .nav-collapse .nav.pull-right{float:none;margin-left:0;} .nav-collapse,.nav-collapse.collapse{overflow:hidden;height:0;} .navbar .btn-navbar{display:block;} .navbar-static .navbar-inner{padding-left:10px;padding-right:10px;}}@media (min-width:980px){.nav-collapse.collapse{height:auto !important;overflow:visible !important;}} +/*! + * Bootstrap v2.3.0 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ +.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0;} +.clearfix:after{clear:both;} +.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;} +.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;} +audio,canvas,video{display:inline-block;*display:inline;*zoom:1;} +audio:not([controls]){display:none;} +html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;} +a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +a:hover,a:active{outline:0;} +sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline;} +sup{top:-0.5em;} +sub{bottom:-0.25em;} +img{max-width:100%;width:auto\9;height:auto;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic;} +#map_canvas img,.google-maps img{max-width:none;} +button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle;} +button,input{*overflow:visible;line-height:normal;} +button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0;} +button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;} +label,select,button,input[type="button"],input[type="reset"],input[type="submit"],input[type="radio"],input[type="checkbox"]{cursor:pointer;} +input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield;} +input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none;} +textarea{overflow:auto;vertical-align:top;} +@media print{*{text-shadow:none !important;color:#000 !important;background:transparent !important;box-shadow:none !important;} a,a:visited{text-decoration:underline;} a[href]:after{content:" (" attr(href) ")";} abbr[title]:after{content:" (" attr(title) ")";} .ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:"";} pre,blockquote{border:1px solid #999;page-break-inside:avoid;} thead{display:table-header-group;} tr,img{page-break-inside:avoid;} img{max-width:100% !important;} @page {margin:0.5cm;}p,h2,h3{orphans:3;widows:3;} h2,h3{page-break-after:avoid;}}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333333;background-color:#ffffff;} +a{color:#0088cc;text-decoration:none;} +a:hover,a:focus{color:#005580;text-decoration:underline;} +.img-rounded{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.img-polaroid{padding:4px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);} +.img-circle{-webkit-border-radius:500px;-moz-border-radius:500px;border-radius:500px;} +.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";line-height:0;} +.row:after{clear:both;} +[class*="span"]{float:left;min-height:1px;margin-left:20px;} +.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px;} +.span12{width:940px;} +.span11{width:860px;} +.span10{width:780px;} +.span9{width:700px;} +.span8{width:620px;} +.span7{width:540px;} +.span6{width:460px;} +.span5{width:380px;} +.span4{width:300px;} +.span3{width:220px;} +.span2{width:140px;} +.span1{width:60px;} +.offset12{margin-left:980px;} +.offset11{margin-left:900px;} +.offset10{margin-left:820px;} +.offset9{margin-left:740px;} +.offset8{margin-left:660px;} +.offset7{margin-left:580px;} +.offset6{margin-left:500px;} +.offset5{margin-left:420px;} +.offset4{margin-left:340px;} +.offset3{margin-left:260px;} +.offset2{margin-left:180px;} +.offset1{margin-left:100px;} +.row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";line-height:0;} +.row-fluid:after{clear:both;} +.row-fluid [class*="span"]{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.127659574468085%;*margin-left:2.074468085106383%;} +.row-fluid [class*="span"]:first-child{margin-left:0;} +.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.127659574468085%;} +.row-fluid .span12{width:100%;*width:99.94680851063829%;} +.row-fluid .span11{width:91.48936170212765%;*width:91.43617021276594%;} +.row-fluid .span10{width:82.97872340425532%;*width:82.92553191489361%;} +.row-fluid .span9{width:74.46808510638297%;*width:74.41489361702126%;} +.row-fluid .span8{width:65.95744680851064%;*width:65.90425531914893%;} +.row-fluid .span7{width:57.44680851063829%;*width:57.39361702127659%;} +.row-fluid .span6{width:48.93617021276595%;*width:48.88297872340425%;} +.row-fluid .span5{width:40.42553191489362%;*width:40.37234042553192%;} +.row-fluid .span4{width:31.914893617021278%;*width:31.861702127659576%;} +.row-fluid .span3{width:23.404255319148934%;*width:23.351063829787233%;} +.row-fluid .span2{width:14.893617021276595%;*width:14.840425531914894%;} +.row-fluid .span1{width:6.382978723404255%;*width:6.329787234042553%;} +.row-fluid .offset12{margin-left:104.25531914893617%;*margin-left:104.14893617021275%;} +.row-fluid .offset12:first-child{margin-left:102.12765957446808%;*margin-left:102.02127659574467%;} +.row-fluid .offset11{margin-left:95.74468085106382%;*margin-left:95.6382978723404%;} +.row-fluid .offset11:first-child{margin-left:93.61702127659574%;*margin-left:93.51063829787232%;} +.row-fluid .offset10{margin-left:87.23404255319149%;*margin-left:87.12765957446807%;} +.row-fluid .offset10:first-child{margin-left:85.1063829787234%;*margin-left:84.99999999999999%;} +.row-fluid .offset9{margin-left:78.72340425531914%;*margin-left:78.61702127659572%;} +.row-fluid .offset9:first-child{margin-left:76.59574468085106%;*margin-left:76.48936170212764%;} +.row-fluid .offset8{margin-left:70.2127659574468%;*margin-left:70.10638297872339%;} +.row-fluid .offset8:first-child{margin-left:68.08510638297872%;*margin-left:67.9787234042553%;} +.row-fluid .offset7{margin-left:61.70212765957446%;*margin-left:61.59574468085106%;} +.row-fluid .offset7:first-child{margin-left:59.574468085106375%;*margin-left:59.46808510638297%;} +.row-fluid .offset6{margin-left:53.191489361702125%;*margin-left:53.085106382978715%;} +.row-fluid .offset6:first-child{margin-left:51.063829787234035%;*margin-left:50.95744680851063%;} +.row-fluid .offset5{margin-left:44.68085106382979%;*margin-left:44.57446808510638%;} +.row-fluid .offset5:first-child{margin-left:42.5531914893617%;*margin-left:42.4468085106383%;} +.row-fluid .offset4{margin-left:36.170212765957444%;*margin-left:36.06382978723405%;} +.row-fluid .offset4:first-child{margin-left:34.04255319148936%;*margin-left:33.93617021276596%;} +.row-fluid .offset3{margin-left:27.659574468085104%;*margin-left:27.5531914893617%;} +.row-fluid .offset3:first-child{margin-left:25.53191489361702%;*margin-left:25.425531914893618%;} +.row-fluid .offset2{margin-left:19.148936170212764%;*margin-left:19.04255319148936%;} +.row-fluid .offset2:first-child{margin-left:17.02127659574468%;*margin-left:16.914893617021278%;} +.row-fluid .offset1{margin-left:10.638297872340425%;*margin-left:10.53191489361702%;} +.row-fluid .offset1:first-child{margin-left:8.51063829787234%;*margin-left:8.404255319148938%;} +[class*="span"].hide,.row-fluid [class*="span"].hide{display:none;} +[class*="span"].pull-right,.row-fluid [class*="span"].pull-right{float:right;} +.container{margin-right:auto;margin-left:auto;*zoom:1;}.container:before,.container:after{display:table;content:"";line-height:0;} +.container:after{clear:both;} +.container-fluid{padding-right:20px;padding-left:20px;*zoom:1;}.container-fluid:before,.container-fluid:after{display:table;content:"";line-height:0;} +.container-fluid:after{clear:both;} +p{margin:0 0 10px;} +.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px;} +small{font-size:85%;} +strong{font-weight:bold;} +em{font-style:italic;} +cite{font-style:normal;} +.muted{color:#999999;} +a.muted:hover,a.muted:focus{color:#808080;} +.text-warning{color:#c09853;} +a.text-warning:hover,a.text-warning:focus{color:#a47e3c;} +.text-error{color:#b94a48;} +a.text-error:hover,a.text-error:focus{color:#953b39;} +.text-info{color:#3a87ad;} +a.text-info:hover,a.text-info:focus{color:#2d6987;} +.text-success{color:#468847;} +a.text-success:hover,a.text-success:focus{color:#356635;} +.text-left{text-align:left;} +.text-right{text-align:right;} +.text-center{text-align:center;} +h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:20px;color:inherit;text-rendering:optimizelegibility;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;line-height:1;color:#999999;} +h1,h2,h3{line-height:40px;} +h1{font-size:38.5px;} +h2{font-size:31.5px;} +h3{font-size:24.5px;} +h4{font-size:17.5px;} +h5{font-size:14px;} +h6{font-size:11.9px;} +h1 small{font-size:24.5px;} +h2 small{font-size:17.5px;} +h3 small{font-size:14px;} +h4 small{font-size:14px;} +.page-header{padding-bottom:9px;margin:20px 0 30px;border-bottom:1px solid #eeeeee;} +ul,ol{padding:0;margin:0 0 10px 25px;} +ul ul,ul ol,ol ol,ol ul{margin-bottom:0;} +li{line-height:20px;} +ul.unstyled,ol.unstyled{margin-left:0;list-style:none;} +ul.inline,ol.inline{margin-left:0;list-style:none;}ul.inline>li,ol.inline>li{display:inline-block;*display:inline;*zoom:1;padding-left:5px;padding-right:5px;} +dl{margin-bottom:20px;} +dt,dd{line-height:20px;} +dt{font-weight:bold;} +dd{margin-left:10px;} +.dl-horizontal{*zoom:1;}.dl-horizontal:before,.dl-horizontal:after{display:table;content:"";line-height:0;} +.dl-horizontal:after{clear:both;} +.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} +.dl-horizontal dd{margin-left:180px;} +hr{margin:20px 0;border:0;border-top:1px solid #eeeeee;border-bottom:1px solid #ffffff;} +abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999999;} +abbr.initialism{font-size:90%;text-transform:uppercase;} +blockquote{padding:0 0 0 15px;margin:0 0 20px;border-left:5px solid #eeeeee;}blockquote p{margin-bottom:0;font-size:17.5px;font-weight:300;line-height:1.25;} +blockquote small{display:block;line-height:20px;color:#999999;}blockquote small:before{content:'\2014 \00A0';} +blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eeeeee;border-left:0;}blockquote.pull-right p,blockquote.pull-right small{text-align:right;} +blockquote.pull-right small:before{content:'';} +blockquote.pull-right small:after{content:'\00A0 \2014';} +q:before,q:after,blockquote:before,blockquote:after{content:"";} +address{display:block;margin-bottom:20px;font-style:normal;line-height:20px;} +code,pre{padding:0 3px 2px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;color:#333333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +code{padding:2px 4px;color:#d14;background-color:#f7f7f9;border:1px solid #e1e1e8;white-space:nowrap;} +pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}pre.prettyprint{margin-bottom:20px;} +pre code{padding:0;color:inherit;white-space:pre;white-space:pre-wrap;background-color:transparent;border:0;} +.pre-scrollable{max-height:340px;overflow-y:scroll;} +.label,.badge{display:inline-block;padding:2px 4px;font-size:11.844px;font-weight:bold;line-height:14px;color:#ffffff;vertical-align:baseline;white-space:nowrap;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#999999;} +.label{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.badge{padding-left:9px;padding-right:9px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;} +.label:empty,.badge:empty{display:none;} +a.label:hover,a.label:focus,a.badge:hover,a.badge:focus{color:#ffffff;text-decoration:none;cursor:pointer;} +.label-important,.badge-important{background-color:#b94a48;} +.label-important[href],.badge-important[href]{background-color:#953b39;} +.label-warning,.badge-warning{background-color:#f89406;} +.label-warning[href],.badge-warning[href]{background-color:#c67605;} +.label-success,.badge-success{background-color:#468847;} +.label-success[href],.badge-success[href]{background-color:#356635;} +.label-info,.badge-info{background-color:#3a87ad;} +.label-info[href],.badge-info[href]{background-color:#2d6987;} +.label-inverse,.badge-inverse{background-color:#333333;} +.label-inverse[href],.badge-inverse[href]{background-color:#1a1a1a;} +.btn .label,.btn .badge{position:relative;top:-1px;} +.btn-mini .label,.btn-mini .badge{top:0;} +table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0;} +.table{width:100%;margin-bottom:20px;}.table th,.table td{padding:8px;line-height:20px;text-align:left;vertical-align:top;border-top:1px solid #dddddd;} +.table th{font-weight:bold;} +.table thead th{vertical-align:bottom;} +.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0;} +.table tbody+tbody{border-top:2px solid #dddddd;} +.table .table{background-color:#ffffff;} +.table-condensed th,.table-condensed td{padding:4px 5px;} +.table-bordered{border:1px solid #dddddd;border-collapse:separate;*border-collapse:collapse;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.table-bordered th,.table-bordered td{border-left:1px solid #dddddd;} +.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0;} +.table-bordered thead:first-child tr:first-child>th:first-child,.table-bordered tbody:first-child tr:first-child>td:first-child,.table-bordered tbody:first-child tr:first-child>th:first-child{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;} +.table-bordered thead:first-child tr:first-child>th:last-child,.table-bordered tbody:first-child tr:first-child>td:last-child,.table-bordered tbody:first-child tr:first-child>th:last-child{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;} +.table-bordered thead:last-child tr:last-child>th:first-child,.table-bordered tbody:last-child tr:last-child>td:first-child,.table-bordered tbody:last-child tr:last-child>th:first-child,.table-bordered tfoot:last-child tr:last-child>td:first-child,.table-bordered tfoot:last-child tr:last-child>th:first-child{-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.table-bordered thead:last-child tr:last-child>th:last-child,.table-bordered tbody:last-child tr:last-child>td:last-child,.table-bordered tbody:last-child tr:last-child>th:last-child,.table-bordered tfoot:last-child tr:last-child>td:last-child,.table-bordered tfoot:last-child tr:last-child>th:last-child{-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} +.table-bordered tfoot+tbody:last-child tr:last-child td:first-child{-webkit-border-bottom-left-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;} +.table-bordered tfoot+tbody:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:0;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;} +.table-bordered caption+thead tr:first-child th:first-child,.table-bordered caption+tbody tr:first-child td:first-child,.table-bordered colgroup+thead tr:first-child th:first-child,.table-bordered colgroup+tbody tr:first-child td:first-child{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;} +.table-bordered caption+thead tr:first-child th:last-child,.table-bordered caption+tbody tr:first-child td:last-child,.table-bordered colgroup+thead tr:first-child th:last-child,.table-bordered colgroup+tbody tr:first-child td:last-child{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;} +.table-striped tbody>tr:nth-child(odd)>td,.table-striped tbody>tr:nth-child(odd)>th{background-color:#f9f9f9;} +.table-hover tbody tr:hover>td,.table-hover tbody tr:hover>th{background-color:#f5f5f5;} +table td[class*="span"],table th[class*="span"],.row-fluid table td[class*="span"],.row-fluid table th[class*="span"]{display:table-cell;float:none;margin-left:0;} +.table td.span1,.table th.span1{float:none;width:44px;margin-left:0;} +.table td.span2,.table th.span2{float:none;width:124px;margin-left:0;} +.table td.span3,.table th.span3{float:none;width:204px;margin-left:0;} +.table td.span4,.table th.span4{float:none;width:284px;margin-left:0;} +.table td.span5,.table th.span5{float:none;width:364px;margin-left:0;} +.table td.span6,.table th.span6{float:none;width:444px;margin-left:0;} +.table td.span7,.table th.span7{float:none;width:524px;margin-left:0;} +.table td.span8,.table th.span8{float:none;width:604px;margin-left:0;} +.table td.span9,.table th.span9{float:none;width:684px;margin-left:0;} +.table td.span10,.table th.span10{float:none;width:764px;margin-left:0;} +.table td.span11,.table th.span11{float:none;width:844px;margin-left:0;} +.table td.span12,.table th.span12{float:none;width:924px;margin-left:0;} +.table tbody tr.success>td{background-color:#dff0d8;} +.table tbody tr.error>td{background-color:#f2dede;} +.table tbody tr.warning>td{background-color:#fcf8e3;} +.table tbody tr.info>td{background-color:#d9edf7;} +.table-hover tbody tr.success:hover>td{background-color:#d0e9c6;} +.table-hover tbody tr.error:hover>td{background-color:#ebcccc;} +.table-hover tbody tr.warning:hover>td{background-color:#faf2cc;} +.table-hover tbody tr.info:hover>td{background-color:#c4e3f3;} +form{margin:0 0 20px;} +fieldset{padding:0;margin:0;border:0;} +legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333333;border:0;border-bottom:1px solid #e5e5e5;}legend small{font-size:15px;color:#999999;} +label,input,button,select,textarea{font-size:14px;font-weight:normal;line-height:20px;} +input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;} +label{display:block;margin-bottom:5px;} +select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:20px;padding:4px 6px;margin-bottom:10px;font-size:14px;line-height:20px;color:#555555;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;vertical-align:middle;} +input,textarea,.uneditable-input{width:206px;} +textarea{height:auto;} +textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#ffffff;border:1px solid #cccccc;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-webkit-transition:border linear .2s, box-shadow linear .2s;-moz-transition:border linear .2s, box-shadow linear .2s;-o-transition:border linear .2s, box-shadow linear .2s;transition:border linear .2s, box-shadow linear .2s;}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82, 168, 236, 0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);} +input[type="radio"],input[type="checkbox"]{margin:4px 0 0;*margin-top:0;margin-top:1px \9;line-height:normal;} +input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto;} +select,input[type="file"]{height:30px;*margin-top:4px;line-height:30px;} +select{width:220px;border:1px solid #cccccc;background-color:#ffffff;} +select[multiple],select[size]{height:auto;} +select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +.uneditable-input,.uneditable-textarea{color:#999999;background-color:#fcfcfc;border-color:#cccccc;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;} +.uneditable-input{overflow:hidden;white-space:nowrap;} +.uneditable-textarea{width:auto;height:auto;} +input:-moz-placeholder,textarea:-moz-placeholder{color:#999999;} +input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#999999;} +input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#999999;} +.radio,.checkbox{min-height:20px;padding-left:20px;} +.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-20px;} +.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px;} +.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle;} +.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px;} +.input-mini{width:60px;} +.input-small{width:90px;} +.input-medium{width:150px;} +.input-large{width:210px;} +.input-xlarge{width:270px;} +.input-xxlarge{width:530px;} +input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0;} +.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block;} +input,textarea,.uneditable-input{margin-left:0;} +.controls-row [class*="span"]+[class*="span"]{margin-left:20px;} +input.span12,textarea.span12,.uneditable-input.span12{width:926px;} +input.span11,textarea.span11,.uneditable-input.span11{width:846px;} +input.span10,textarea.span10,.uneditable-input.span10{width:766px;} +input.span9,textarea.span9,.uneditable-input.span9{width:686px;} +input.span8,textarea.span8,.uneditable-input.span8{width:606px;} +input.span7,textarea.span7,.uneditable-input.span7{width:526px;} +input.span6,textarea.span6,.uneditable-input.span6{width:446px;} +input.span5,textarea.span5,.uneditable-input.span5{width:366px;} +input.span4,textarea.span4,.uneditable-input.span4{width:286px;} +input.span3,textarea.span3,.uneditable-input.span3{width:206px;} +input.span2,textarea.span2,.uneditable-input.span2{width:126px;} +input.span1,textarea.span1,.uneditable-input.span1{width:46px;} +.controls-row{*zoom:1;}.controls-row:before,.controls-row:after{display:table;content:"";line-height:0;} +.controls-row:after{clear:both;} +.controls-row [class*="span"],.row-fluid .controls-row [class*="span"]{float:left;} +.controls-row .checkbox[class*="span"],.controls-row .radio[class*="span"]{padding-top:5px;} +input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eeeeee;} +input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent;} +.control-group.warning .control-label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853;} +.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853;} +.control-group.warning input,.control-group.warning select,.control-group.warning textarea{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;} +.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853;} +.control-group.error .control-label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48;} +.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48;} +.control-group.error input,.control-group.error select,.control-group.error textarea{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;} +.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48;} +.control-group.success .control-label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847;} +.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847;} +.control-group.success input,.control-group.success select,.control-group.success textarea{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;} +.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847;} +.control-group.info .control-label,.control-group.info .help-block,.control-group.info .help-inline{color:#3a87ad;} +.control-group.info .checkbox,.control-group.info .radio,.control-group.info input,.control-group.info select,.control-group.info textarea{color:#3a87ad;} +.control-group.info input,.control-group.info select,.control-group.info textarea{border-color:#3a87ad;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.info input:focus,.control-group.info select:focus,.control-group.info textarea:focus{border-color:#2d6987;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7ab5d3;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7ab5d3;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7ab5d3;} +.control-group.info .input-prepend .add-on,.control-group.info .input-append .add-on{color:#3a87ad;background-color:#d9edf7;border-color:#3a87ad;} +input:focus:invalid,textarea:focus:invalid,select:focus:invalid{color:#b94a48;border-color:#ee5f5b;}input:focus:invalid:focus,textarea:focus:invalid:focus,select:focus:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7;} +.form-actions{padding:19px 20px 20px;margin-top:20px;margin-bottom:20px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1;}.form-actions:before,.form-actions:after{display:table;content:"";line-height:0;} +.form-actions:after{clear:both;} +.help-block,.help-inline{color:#595959;} +.help-block{display:block;margin-bottom:10px;} +.help-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;padding-left:5px;} +.input-append,.input-prepend{display:inline-block;margin-bottom:10px;vertical-align:middle;font-size:0;white-space:nowrap;}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input,.input-append .dropdown-menu,.input-prepend .dropdown-menu,.input-append .popover,.input-prepend .popover{font-size:14px;} +.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;vertical-align:top;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2;} +.input-append .add-on,.input-prepend .add-on{display:inline-block;width:auto;height:20px;min-width:16px;padding:4px 5px;font-size:14px;font-weight:normal;line-height:20px;text-align:center;text-shadow:0 1px 0 #ffffff;background-color:#eeeeee;border:1px solid #ccc;} +.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn,.input-append .btn-group>.dropdown-toggle,.input-prepend .btn-group>.dropdown-toggle{vertical-align:top;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546;} +.input-prepend .add-on,.input-prepend .btn{margin-right:-1px;} +.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} +.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;}.input-append input+.btn-group .btn:last-child,.input-append select+.btn-group .btn:last-child,.input-append .uneditable-input+.btn-group .btn:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.input-append .add-on,.input-append .btn,.input-append .btn-group{margin-left:-1px;} +.input-append .add-on:last-child,.input-append .btn:last-child,.input-append .btn-group:last-child>.dropdown-toggle{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}.input-prepend.input-append input+.btn-group .btn,.input-prepend.input-append select+.btn-group .btn,.input-prepend.input-append .uneditable-input+.btn-group .btn{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} +.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.input-prepend.input-append .btn-group:first-child{margin-left:0;} +input.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} +.form-search .input-append .search-query,.form-search .input-prepend .search-query{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.form-search .input-append .search-query{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px;} +.form-search .input-append .btn{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0;} +.form-search .input-prepend .search-query{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0;} +.form-search .input-prepend .btn{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px;} +.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;*zoom:1;margin-bottom:0;vertical-align:middle;} +.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none;} +.form-search label,.form-inline label,.form-search .btn-group,.form-inline .btn-group{display:inline-block;} +.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0;} +.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle;} +.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0;} +.control-group{margin-bottom:10px;} +legend+.control-group{margin-top:20px;-webkit-margin-top-collapse:separate;} +.form-horizontal .control-group{margin-bottom:20px;*zoom:1;}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;content:"";line-height:0;} +.form-horizontal .control-group:after{clear:both;} +.form-horizontal .control-label{float:left;width:160px;padding-top:5px;text-align:right;} +.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:180px;*margin-left:0;}.form-horizontal .controls:first-child{*padding-left:180px;} +.form-horizontal .help-block{margin-bottom:0;} +.form-horizontal input+.help-block,.form-horizontal select+.help-block,.form-horizontal textarea+.help-block,.form-horizontal .uneditable-input+.help-block,.form-horizontal .input-prepend+.help-block,.form-horizontal .input-append+.help-block{margin-top:10px;} +.form-horizontal .form-actions{padding-left:180px;} +.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333333;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top, #ffffff, #e6e6e6);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));background-image:-webkit-linear-gradient(top, #ffffff, #e6e6e6);background-image:-o-linear-gradient(top, #ffffff, #e6e6e6);background-image:linear-gradient(to bottom, #ffffff, #e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);border:1px solid #cccccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333333;background-color:#e6e6e6;*background-color:#d9d9d9;} +.btn:active,.btn.active{background-color:#cccccc \9;} +.btn:first-child{*margin-left:0;} +.btn:hover,.btn:focus{color:#333333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position 0.1s linear;-moz-transition:background-position 0.1s linear;-o-transition:background-position 0.1s linear;transition:background-position 0.1s linear;} +.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} +.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:0.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px;} +.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0;} +.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px;} +.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.btn-block+.btn-block{margin-top:5px;} +input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%;} +.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255, 255, 255, 0.75);} +.btn-primary{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#006dcc;background-image:-moz-linear-gradient(top, #0088cc, #0044cc);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));background-image:-webkit-linear-gradient(top, #0088cc, #0044cc);background-image:-o-linear-gradient(top, #0088cc, #0044cc);background-image:linear-gradient(to bottom, #0088cc, #0044cc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);border-color:#0044cc #0044cc #002a80;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#0044cc;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#ffffff;background-color:#0044cc;*background-color:#003bb3;} +.btn-primary:active,.btn-primary.active{background-color:#003399 \9;} +.btn-warning{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(to bottom, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{color:#ffffff;background-color:#f89406;*background-color:#df8505;} +.btn-warning:active,.btn-warning.active{background-color:#c67605 \9;} +.btn-danger{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#da4f49;background-image:-moz-linear-gradient(top, #ee5f5b, #bd362f);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));background-image:-webkit-linear-gradient(top, #ee5f5b, #bd362f);background-image:-o-linear-gradient(top, #ee5f5b, #bd362f);background-image:linear-gradient(to bottom, #ee5f5b, #bd362f);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);border-color:#bd362f #bd362f #802420;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#bd362f;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{color:#ffffff;background-color:#bd362f;*background-color:#a9302a;} +.btn-danger:active,.btn-danger.active{background-color:#942a25 \9;} +.btn-success{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#5bb75b;background-image:-moz-linear-gradient(top, #62c462, #51a351);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));background-image:-webkit-linear-gradient(top, #62c462, #51a351);background-image:-o-linear-gradient(top, #62c462, #51a351);background-image:linear-gradient(to bottom, #62c462, #51a351);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0);border-color:#51a351 #51a351 #387038;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#51a351;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{color:#ffffff;background-color:#51a351;*background-color:#499249;} +.btn-success:active,.btn-success.active{background-color:#408140 \9;} +.btn-info{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#49afcd;background-image:-moz-linear-gradient(top, #5bc0de, #2f96b4);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4));background-image:-webkit-linear-gradient(top, #5bc0de, #2f96b4);background-image:-o-linear-gradient(top, #5bc0de, #2f96b4);background-image:linear-gradient(to bottom, #5bc0de, #2f96b4);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f96b4', GradientType=0);border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#2f96b4;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{color:#ffffff;background-color:#2f96b4;*background-color:#2a85a0;} +.btn-info:active,.btn-info.active{background-color:#24748c \9;} +.btn-inverse{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#363636;background-image:-moz-linear-gradient(top, #444444, #222222);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#444444), to(#222222));background-image:-webkit-linear-gradient(top, #444444, #222222);background-image:-o-linear-gradient(top, #444444, #222222);background-image:linear-gradient(to bottom, #444444, #222222);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444', endColorstr='#ff222222', GradientType=0);border-color:#222222 #222222 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#222222;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-inverse:hover,.btn-inverse:focus,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{color:#ffffff;background-color:#222222;*background-color:#151515;} +.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9;} +button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px;}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0;} +button.btn.btn-large,input[type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px;} +button.btn.btn-small,input[type="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px;} +button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px;} +.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +.btn-link{border-color:transparent;cursor:pointer;color:#0088cc;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.btn-link:hover,.btn-link:focus{color:#005580;text-decoration:underline;background-color:transparent;} +.btn-link[disabled]:hover,.btn-link[disabled]:focus{color:#333333;text-decoration:none;} +[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat;margin-top:1px;} +.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:focus>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>li>a:focus>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:focus>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"],.dropdown-submenu:focus>a>[class*=" icon-"]{background-image:url("../img/glyphicons-halflings-white.png");} +.icon-glass{background-position:0 0;} +.icon-music{background-position:-24px 0;} +.icon-search{background-position:-48px 0;} +.icon-envelope{background-position:-72px 0;} +.icon-heart{background-position:-96px 0;} +.icon-star{background-position:-120px 0;} +.icon-star-empty{background-position:-144px 0;} +.icon-user{background-position:-168px 0;} +.icon-film{background-position:-192px 0;} +.icon-th-large{background-position:-216px 0;} +.icon-th{background-position:-240px 0;} +.icon-th-list{background-position:-264px 0;} +.icon-ok{background-position:-288px 0;} +.icon-remove{background-position:-312px 0;} +.icon-zoom-in{background-position:-336px 0;} +.icon-zoom-out{background-position:-360px 0;} +.icon-off{background-position:-384px 0;} +.icon-signal{background-position:-408px 0;} +.icon-cog{background-position:-432px 0;} +.icon-trash{background-position:-456px 0;} +.icon-home{background-position:0 -24px;} +.icon-file{background-position:-24px -24px;} +.icon-time{background-position:-48px -24px;} +.icon-road{background-position:-72px -24px;} +.icon-download-alt{background-position:-96px -24px;} +.icon-download{background-position:-120px -24px;} +.icon-upload{background-position:-144px -24px;} +.icon-inbox{background-position:-168px -24px;} +.icon-play-circle{background-position:-192px -24px;} +.icon-repeat{background-position:-216px -24px;} +.icon-refresh{background-position:-240px -24px;} +.icon-list-alt{background-position:-264px -24px;} +.icon-lock{background-position:-287px -24px;} +.icon-flag{background-position:-312px -24px;} +.icon-headphones{background-position:-336px -24px;} +.icon-volume-off{background-position:-360px -24px;} +.icon-volume-down{background-position:-384px -24px;} +.icon-volume-up{background-position:-408px -24px;} +.icon-qrcode{background-position:-432px -24px;} +.icon-barcode{background-position:-456px -24px;} +.icon-tag{background-position:0 -48px;} +.icon-tags{background-position:-25px -48px;} +.icon-book{background-position:-48px -48px;} +.icon-bookmark{background-position:-72px -48px;} +.icon-print{background-position:-96px -48px;} +.icon-camera{background-position:-120px -48px;} +.icon-font{background-position:-144px -48px;} +.icon-bold{background-position:-167px -48px;} +.icon-italic{background-position:-192px -48px;} +.icon-text-height{background-position:-216px -48px;} +.icon-text-width{background-position:-240px -48px;} +.icon-align-left{background-position:-264px -48px;} +.icon-align-center{background-position:-288px -48px;} +.icon-align-right{background-position:-312px -48px;} +.icon-align-justify{background-position:-336px -48px;} +.icon-list{background-position:-360px -48px;} +.icon-indent-left{background-position:-384px -48px;} +.icon-indent-right{background-position:-408px -48px;} +.icon-facetime-video{background-position:-432px -48px;} +.icon-picture{background-position:-456px -48px;} +.icon-pencil{background-position:0 -72px;} +.icon-map-marker{background-position:-24px -72px;} +.icon-adjust{background-position:-48px -72px;} +.icon-tint{background-position:-72px -72px;} +.icon-edit{background-position:-96px -72px;} +.icon-share{background-position:-120px -72px;} +.icon-check{background-position:-144px -72px;} +.icon-move{background-position:-168px -72px;} +.icon-step-backward{background-position:-192px -72px;} +.icon-fast-backward{background-position:-216px -72px;} +.icon-backward{background-position:-240px -72px;} +.icon-play{background-position:-264px -72px;} +.icon-pause{background-position:-288px -72px;} +.icon-stop{background-position:-312px -72px;} +.icon-forward{background-position:-336px -72px;} +.icon-fast-forward{background-position:-360px -72px;} +.icon-step-forward{background-position:-384px -72px;} +.icon-eject{background-position:-408px -72px;} +.icon-chevron-left{background-position:-432px -72px;} +.icon-chevron-right{background-position:-456px -72px;} +.icon-plus-sign{background-position:0 -96px;} +.icon-minus-sign{background-position:-24px -96px;} +.icon-remove-sign{background-position:-48px -96px;} +.icon-ok-sign{background-position:-72px -96px;} +.icon-question-sign{background-position:-96px -96px;} +.icon-info-sign{background-position:-120px -96px;} +.icon-screenshot{background-position:-144px -96px;} +.icon-remove-circle{background-position:-168px -96px;} +.icon-ok-circle{background-position:-192px -96px;} +.icon-ban-circle{background-position:-216px -96px;} +.icon-arrow-left{background-position:-240px -96px;} +.icon-arrow-right{background-position:-264px -96px;} +.icon-arrow-up{background-position:-289px -96px;} +.icon-arrow-down{background-position:-312px -96px;} +.icon-share-alt{background-position:-336px -96px;} +.icon-resize-full{background-position:-360px -96px;} +.icon-resize-small{background-position:-384px -96px;} +.icon-plus{background-position:-408px -96px;} +.icon-minus{background-position:-433px -96px;} +.icon-asterisk{background-position:-456px -96px;} +.icon-exclamation-sign{background-position:0 -120px;} +.icon-gift{background-position:-24px -120px;} +.icon-leaf{background-position:-48px -120px;} +.icon-fire{background-position:-72px -120px;} +.icon-eye-open{background-position:-96px -120px;} +.icon-eye-close{background-position:-120px -120px;} +.icon-warning-sign{background-position:-144px -120px;} +.icon-plane{background-position:-168px -120px;} +.icon-calendar{background-position:-192px -120px;} +.icon-random{background-position:-216px -120px;width:16px;} +.icon-comment{background-position:-240px -120px;} +.icon-magnet{background-position:-264px -120px;} +.icon-chevron-up{background-position:-288px -120px;} +.icon-chevron-down{background-position:-313px -119px;} +.icon-retweet{background-position:-336px -120px;} +.icon-shopping-cart{background-position:-360px -120px;} +.icon-folder-close{background-position:-384px -120px;width:16px;} +.icon-folder-open{background-position:-408px -120px;width:16px;} +.icon-resize-vertical{background-position:-432px -119px;} +.icon-resize-horizontal{background-position:-456px -118px;} +.icon-hdd{background-position:0 -144px;} +.icon-bullhorn{background-position:-24px -144px;} +.icon-bell{background-position:-48px -144px;} +.icon-certificate{background-position:-72px -144px;} +.icon-thumbs-up{background-position:-96px -144px;} +.icon-thumbs-down{background-position:-120px -144px;} +.icon-hand-right{background-position:-144px -144px;} +.icon-hand-left{background-position:-168px -144px;} +.icon-hand-up{background-position:-192px -144px;} +.icon-hand-down{background-position:-216px -144px;} +.icon-circle-arrow-right{background-position:-240px -144px;} +.icon-circle-arrow-left{background-position:-264px -144px;} +.icon-circle-arrow-up{background-position:-288px -144px;} +.icon-circle-arrow-down{background-position:-312px -144px;} +.icon-globe{background-position:-336px -144px;} +.icon-wrench{background-position:-360px -144px;} +.icon-tasks{background-position:-384px -144px;} +.icon-filter{background-position:-408px -144px;} +.icon-briefcase{background-position:-432px -144px;} +.icon-fullscreen{background-position:-456px -144px;} +.btn-group{position:relative;display:inline-block;*display:inline;*zoom:1;font-size:0;vertical-align:middle;white-space:nowrap;*margin-left:.3em;}.btn-group:first-child{*margin-left:0;} +.btn-group+.btn-group{margin-left:5px;} +.btn-toolbar{font-size:0;margin-top:10px;margin-bottom:10px;}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group{margin-left:5px;} +.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.btn-group>.btn+.btn{margin-left:-1px;} +.btn-group>.btn,.btn-group>.dropdown-menu,.btn-group>.popover{font-size:14px;} +.btn-group>.btn-mini{font-size:10.5px;} +.btn-group>.btn-small{font-size:11.9px;} +.btn-group>.btn-large{font-size:17.5px;} +.btn-group>.btn:first-child{margin-left:0;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} +.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-top-left-radius:6px;-moz-border-radius-topleft:6px;border-top-left-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomleft:6px;border-bottom-left-radius:6px;} +.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;-moz-border-radius-bottomright:6px;border-bottom-right-radius:6px;} +.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2;} +.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0;} +.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);*padding-top:5px;*padding-bottom:5px;} +.btn-group>.btn-mini+.dropdown-toggle{padding-left:5px;padding-right:5px;*padding-top:2px;*padding-bottom:2px;} +.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px;} +.btn-group>.btn-large+.dropdown-toggle{padding-left:12px;padding-right:12px;*padding-top:7px;*padding-bottom:7px;} +.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} +.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6;} +.btn-group.open .btn-primary.dropdown-toggle{background-color:#0044cc;} +.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406;} +.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f;} +.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351;} +.btn-group.open .btn-info.dropdown-toggle{background-color:#2f96b4;} +.btn-group.open .btn-inverse.dropdown-toggle{background-color:#222222;} +.btn .caret{margin-top:8px;margin-left:0;} +.btn-large .caret{margin-top:6px;} +.btn-large .caret{border-left-width:5px;border-right-width:5px;border-top-width:5px;} +.btn-mini .caret,.btn-small .caret{margin-top:8px;} +.dropup .btn-large .caret{border-bottom-width:5px;} +.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} +.btn-group-vertical{display:inline-block;*display:inline;*zoom:1;} +.btn-group-vertical>.btn{display:block;float:none;max-width:100%;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.btn-group-vertical>.btn+.btn{margin-left:0;margin-top:-1px;} +.btn-group-vertical>.btn:first-child{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;} +.btn-group-vertical>.btn:last-child{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;} +.btn-group-vertical>.btn-large:first-child{-webkit-border-radius:6px 6px 0 0;-moz-border-radius:6px 6px 0 0;border-radius:6px 6px 0 0;} +.btn-group-vertical>.btn-large:last-child{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;} +.nav{margin-left:0;margin-bottom:20px;list-style:none;} +.nav>li>a{display:block;} +.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eeeeee;} +.nav>li>a>img{max-width:none;} +.nav>.pull-right{float:right;} +.nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:20px;color:#999999;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);text-transform:uppercase;} +.nav li+.nav-header{margin-top:9px;} +.nav-list{padding-left:15px;padding-right:15px;margin-bottom:0;} +.nav-list>li>a,.nav-list .nav-header{margin-left:-15px;margin-right:-15px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);} +.nav-list>li>a{padding:3px 15px;} +.nav-list>.active>a,.nav-list>.active>a:hover,.nav-list>.active>a:focus{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.2);background-color:#0088cc;} +.nav-list [class^="icon-"],.nav-list [class*=" icon-"]{margin-right:2px;} +.nav-list .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #ffffff;} +.nav-tabs,.nav-pills{*zoom:1;}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;content:"";line-height:0;} +.nav-tabs:after,.nav-pills:after{clear:both;} +.nav-tabs>li,.nav-pills>li{float:left;} +.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px;} +.nav-tabs{border-bottom:1px solid #ddd;} +.nav-tabs>li{margin-bottom:-1px;} +.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:20px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;}.nav-tabs>li>a:hover,.nav-tabs>li>a:focus{border-color:#eeeeee #eeeeee #dddddd;} +.nav-tabs>.active>a,.nav-tabs>.active>a:hover,.nav-tabs>.active>a:focus{color:#555555;background-color:#ffffff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default;} +.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;} +.nav-pills>.active>a,.nav-pills>.active>a:hover,.nav-pills>.active>a:focus{color:#ffffff;background-color:#0088cc;} +.nav-stacked>li{float:none;} +.nav-stacked>li>a{margin-right:0;} +.nav-tabs.nav-stacked{border-bottom:0;} +.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;} +.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.nav-tabs.nav-stacked>li>a:hover,.nav-tabs.nav-stacked>li>a:focus{border-color:#ddd;z-index:2;} +.nav-pills.nav-stacked>li>a{margin-bottom:3px;} +.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px;} +.nav-tabs .dropdown-menu{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;} +.nav-pills .dropdown-menu{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.nav .dropdown-toggle .caret{border-top-color:#0088cc;border-bottom-color:#0088cc;margin-top:6px;} +.nav .dropdown-toggle:hover .caret,.nav .dropdown-toggle:focus .caret{border-top-color:#005580;border-bottom-color:#005580;} +.nav-tabs .dropdown-toggle .caret{margin-top:8px;} +.nav .active .dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff;} +.nav-tabs .active .dropdown-toggle .caret{border-top-color:#555555;border-bottom-color:#555555;} +.nav>.dropdown.active>a:hover,.nav>.dropdown.active>a:focus{cursor:pointer;} +.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover,.nav>li.dropdown.open.active>a:focus{color:#ffffff;background-color:#999999;border-color:#999999;} +.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret,.nav li.dropdown.open a:focus .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;opacity:1;filter:alpha(opacity=100);} +.tabs-stacked .open>a:hover,.tabs-stacked .open>a:focus{border-color:#999999;} +.tabbable{*zoom:1;}.tabbable:before,.tabbable:after{display:table;content:"";line-height:0;} +.tabbable:after{clear:both;} +.tab-content{overflow:auto;} +.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0;} +.tab-content>.tab-pane,.pill-content>.pill-pane{display:none;} +.tab-content>.active,.pill-content>.active{display:block;} +.tabs-below>.nav-tabs{border-top:1px solid #ddd;} +.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0;} +.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;}.tabs-below>.nav-tabs>li>a:hover,.tabs-below>.nav-tabs>li>a:focus{border-bottom-color:transparent;border-top-color:#ddd;} +.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover,.tabs-below>.nav-tabs>.active>a:focus{border-color:transparent #ddd #ddd #ddd;} +.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none;} +.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px;} +.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd;} +.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} +.tabs-left>.nav-tabs>li>a:hover,.tabs-left>.nav-tabs>li>a:focus{border-color:#eeeeee #dddddd #eeeeee #eeeeee;} +.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover,.tabs-left>.nav-tabs .active>a:focus{border-color:#ddd transparent #ddd #ddd;*border-right-color:#ffffff;} +.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd;} +.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.tabs-right>.nav-tabs>li>a:hover,.tabs-right>.nav-tabs>li>a:focus{border-color:#eeeeee #eeeeee #eeeeee #dddddd;} +.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover,.tabs-right>.nav-tabs .active>a:focus{border-color:#ddd #ddd #ddd transparent;*border-left-color:#ffffff;} +.nav>.disabled>a{color:#999999;} +.nav>.disabled>a:hover,.nav>.disabled>a:focus{text-decoration:none;background-color:transparent;cursor:default;} +.navbar{overflow:visible;margin-bottom:20px;*position:relative;*z-index:2;} +.navbar-inner{min-height:40px;padding-left:20px;padding-right:20px;background-color:#fafafa;background-image:-moz-linear-gradient(top, #ffffff, #f2f2f2);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2));background-image:-webkit-linear-gradient(top, #ffffff, #f2f2f2);background-image:-o-linear-gradient(top, #ffffff, #f2f2f2);background-image:linear-gradient(to bottom, #ffffff, #f2f2f2);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);border:1px solid #d4d4d4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.065);-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.065);box-shadow:0 1px 4px rgba(0, 0, 0, 0.065);*zoom:1;}.navbar-inner:before,.navbar-inner:after{display:table;content:"";line-height:0;} +.navbar-inner:after{clear:both;} +.navbar .container{width:auto;} +.nav-collapse.collapse{height:auto;overflow:visible;} +.navbar .brand{float:left;display:block;padding:10px 20px 10px;margin-left:-20px;font-size:20px;font-weight:200;color:#777777;text-shadow:0 1px 0 #ffffff;}.navbar .brand:hover,.navbar .brand:focus{text-decoration:none;} +.navbar-text{margin-bottom:0;line-height:40px;color:#777777;} +.navbar-link{color:#777777;}.navbar-link:hover,.navbar-link:focus{color:#333333;} +.navbar .divider-vertical{height:40px;margin:0 9px;border-left:1px solid #f2f2f2;border-right:1px solid #ffffff;} +.navbar .btn,.navbar .btn-group{margin-top:5px;} +.navbar .btn-group .btn,.navbar .input-prepend .btn,.navbar .input-append .btn,.navbar .input-prepend .btn-group,.navbar .input-append .btn-group{margin-top:0;} +.navbar-form{margin-bottom:0;*zoom:1;}.navbar-form:before,.navbar-form:after{display:table;content:"";line-height:0;} +.navbar-form:after{clear:both;} +.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px;} +.navbar-form input,.navbar-form select,.navbar-form .btn{display:inline-block;margin-bottom:0;} +.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px;} +.navbar-form .input-append,.navbar-form .input-prepend{margin-top:5px;white-space:nowrap;}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0;} +.navbar-search{position:relative;float:left;margin-top:5px;margin-bottom:0;}.navbar-search .search-query{margin-bottom:0;padding:4px 14px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} +.navbar-static-top{position:static;margin-bottom:0;}.navbar-static-top .navbar-inner{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0;} +.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{border-width:0 0 1px;} +.navbar-fixed-bottom .navbar-inner{border-width:1px 0 0;} +.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-left:0;padding-right:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px;} +.navbar-fixed-top{top:0;} +.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{-webkit-box-shadow:0 1px 10px rgba(0,0,0,.1);-moz-box-shadow:0 1px 10px rgba(0,0,0,.1);box-shadow:0 1px 10px rgba(0,0,0,.1);} +.navbar-fixed-bottom{bottom:0;}.navbar-fixed-bottom .navbar-inner{-webkit-box-shadow:0 -1px 10px rgba(0,0,0,.1);-moz-box-shadow:0 -1px 10px rgba(0,0,0,.1);box-shadow:0 -1px 10px rgba(0,0,0,.1);} +.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0;} +.navbar .nav.pull-right{float:right;margin-right:0;} +.navbar .nav>li{float:left;} +.navbar .nav>li>a{float:none;padding:10px 15px 10px;color:#777777;text-decoration:none;text-shadow:0 1px 0 #ffffff;} +.navbar .nav .dropdown-toggle .caret{margin-top:8px;} +.navbar .nav>li>a:focus,.navbar .nav>li>a:hover{background-color:transparent;color:#333333;text-decoration:none;} +.navbar .nav>.active>a,.navbar .nav>.active>a:hover,.navbar .nav>.active>a:focus{color:#555555;text-decoration:none;background-color:#e5e5e5;-webkit-box-shadow:inset 0 3px 8px rgba(0, 0, 0, 0.125);-moz-box-shadow:inset 0 3px 8px rgba(0, 0, 0, 0.125);box-shadow:inset 0 3px 8px rgba(0, 0, 0, 0.125);} +.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-left:5px;margin-right:5px;color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#ededed;background-image:-moz-linear-gradient(top, #f2f2f2, #e5e5e5);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f2f2f2), to(#e5e5e5));background-image:-webkit-linear-gradient(top, #f2f2f2, #e5e5e5);background-image:-o-linear-gradient(top, #f2f2f2, #e5e5e5);background-image:linear-gradient(to bottom, #f2f2f2, #e5e5e5);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffe5e5e5', GradientType=0);border-color:#e5e5e5 #e5e5e5 #bfbfbf;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#e5e5e5;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);}.navbar .btn-navbar:hover,.navbar .btn-navbar:focus,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{color:#ffffff;background-color:#e5e5e5;*background-color:#d9d9d9;} +.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#cccccc \9;} +.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);-moz-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);} +.btn-navbar .icon-bar+.icon-bar{margin-top:3px;} +.navbar .nav>li>.dropdown-menu:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0, 0, 0, 0.2);position:absolute;top:-7px;left:9px;} +.navbar .nav>li>.dropdown-menu:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #ffffff;position:absolute;top:-6px;left:10px;} +.navbar-fixed-bottom .nav>li>.dropdown-menu:before{border-top:7px solid #ccc;border-top-color:rgba(0, 0, 0, 0.2);border-bottom:0;bottom:-7px;top:auto;} +.navbar-fixed-bottom .nav>li>.dropdown-menu:after{border-top:6px solid #ffffff;border-bottom:0;bottom:-6px;top:auto;} +.navbar .nav li.dropdown>a:hover .caret,.navbar .nav li.dropdown>a:focus .caret{border-top-color:#333333;border-bottom-color:#333333;} +.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{background-color:#e5e5e5;color:#555555;} +.navbar .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#777777;border-bottom-color:#777777;} +.navbar .nav li.dropdown.open>.dropdown-toggle .caret,.navbar .nav li.dropdown.active>.dropdown-toggle .caret,.navbar .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#555555;border-bottom-color:#555555;} +.navbar .pull-right>li>.dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right{left:auto;right:0;}.navbar .pull-right>li>.dropdown-menu:before,.navbar .nav>li>.dropdown-menu.pull-right:before{left:auto;right:12px;} +.navbar .pull-right>li>.dropdown-menu:after,.navbar .nav>li>.dropdown-menu.pull-right:after{left:auto;right:13px;} +.navbar .pull-right>li>.dropdown-menu .dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right .dropdown-menu{left:auto;right:100%;margin-left:0;margin-right:-1px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;} +.navbar-inverse .navbar-inner{background-color:#1b1b1b;background-image:-moz-linear-gradient(top, #222222, #111111);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111));background-image:-webkit-linear-gradient(top, #222222, #111111);background-image:-o-linear-gradient(top, #222222, #111111);background-image:linear-gradient(to bottom, #222222, #111111);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);border-color:#252525;} +.navbar-inverse .brand,.navbar-inverse .nav>li>a{color:#999999;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);}.navbar-inverse .brand:hover,.navbar-inverse .nav>li>a:hover,.navbar-inverse .brand:focus,.navbar-inverse .nav>li>a:focus{color:#ffffff;} +.navbar-inverse .brand{color:#999999;} +.navbar-inverse .navbar-text{color:#999999;} +.navbar-inverse .nav>li>a:focus,.navbar-inverse .nav>li>a:hover{background-color:transparent;color:#ffffff;} +.navbar-inverse .nav .active>a,.navbar-inverse .nav .active>a:hover,.navbar-inverse .nav .active>a:focus{color:#ffffff;background-color:#111111;} +.navbar-inverse .navbar-link{color:#999999;}.navbar-inverse .navbar-link:hover,.navbar-inverse .navbar-link:focus{color:#ffffff;} +.navbar-inverse .divider-vertical{border-left-color:#111111;border-right-color:#222222;} +.navbar-inverse .nav li.dropdown.open>.dropdown-toggle,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{background-color:#111111;color:#ffffff;} +.navbar-inverse .nav li.dropdown>a:hover .caret,.navbar-inverse .nav li.dropdown>a:focus .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} +.navbar-inverse .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#999999;border-bottom-color:#999999;} +.navbar-inverse .nav li.dropdown.open>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} +.navbar-inverse .navbar-search .search-query{color:#ffffff;background-color:#515151;border-color:#111111;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none;}.navbar-inverse .navbar-search .search-query:-moz-placeholder{color:#cccccc;} +.navbar-inverse .navbar-search .search-query:-ms-input-placeholder{color:#cccccc;} +.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder{color:#cccccc;} +.navbar-inverse .navbar-search .search-query:focus,.navbar-inverse .navbar-search .search-query.focused{padding:5px 15px;color:#333333;text-shadow:0 1px 0 #ffffff;background-color:#ffffff;border:0;-webkit-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);box-shadow:0 0 3px rgba(0, 0, 0, 0.15);outline:0;} +.navbar-inverse .btn-navbar{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#0e0e0e;background-image:-moz-linear-gradient(top, #151515, #040404);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#151515), to(#040404));background-image:-webkit-linear-gradient(top, #151515, #040404);background-image:-o-linear-gradient(top, #151515, #040404);background-image:linear-gradient(to bottom, #151515, #040404);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515', endColorstr='#ff040404', GradientType=0);border-color:#040404 #040404 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#040404;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.navbar-inverse .btn-navbar:hover,.navbar-inverse .btn-navbar:focus,.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active,.navbar-inverse .btn-navbar.disabled,.navbar-inverse .btn-navbar[disabled]{color:#ffffff;background-color:#040404;*background-color:#000000;} +.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active{background-color:#000000 \9;} +.breadcrumb{padding:8px 15px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.breadcrumb>li{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 0 #ffffff;}.breadcrumb>li>.divider{padding:0 5px;color:#ccc;} +.breadcrumb>.active{color:#999999;} +.pagination{margin:20px 0;} +.pagination ul{display:inline-block;*display:inline;*zoom:1;margin-left:0;margin-bottom:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);} +.pagination ul>li{display:inline;} +.pagination ul>li>a,.pagination ul>li>span{float:left;padding:4px 12px;line-height:20px;text-decoration:none;background-color:#ffffff;border:1px solid #dddddd;border-left-width:0;} +.pagination ul>li>a:hover,.pagination ul>li>a:focus,.pagination ul>.active>a,.pagination ul>.active>span{background-color:#f5f5f5;} +.pagination ul>.active>a,.pagination ul>.active>span{color:#999999;cursor:default;} +.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover,.pagination ul>.disabled>a:focus{color:#999999;background-color:transparent;cursor:default;} +.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{border-left-width:1px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} +.pagination-centered{text-align:center;} +.pagination-right{text-align:right;} +.pagination-large ul>li>a,.pagination-large ul>li>span{padding:11px 19px;font-size:17.5px;} +.pagination-large ul>li:first-child>a,.pagination-large ul>li:first-child>span{-webkit-border-top-left-radius:6px;-moz-border-radius-topleft:6px;border-top-left-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomleft:6px;border-bottom-left-radius:6px;} +.pagination-large ul>li:last-child>a,.pagination-large ul>li:last-child>span{-webkit-border-top-right-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;-moz-border-radius-bottomright:6px;border-bottom-right-radius:6px;} +.pagination-mini ul>li:first-child>a,.pagination-small ul>li:first-child>a,.pagination-mini ul>li:first-child>span,.pagination-small ul>li:first-child>span{-webkit-border-top-left-radius:3px;-moz-border-radius-topleft:3px;border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-moz-border-radius-bottomleft:3px;border-bottom-left-radius:3px;} +.pagination-mini ul>li:last-child>a,.pagination-small ul>li:last-child>a,.pagination-mini ul>li:last-child>span,.pagination-small ul>li:last-child>span{-webkit-border-top-right-radius:3px;-moz-border-radius-topright:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-bottomright:3px;border-bottom-right-radius:3px;} +.pagination-small ul>li>a,.pagination-small ul>li>span{padding:2px 10px;font-size:11.9px;} +.pagination-mini ul>li>a,.pagination-mini ul>li>span{padding:0 6px;font-size:10.5px;} +.pager{margin:20px 0;list-style:none;text-align:center;*zoom:1;}.pager:before,.pager:after{display:table;content:"";line-height:0;} +.pager:after{clear:both;} +.pager li{display:inline;} +.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} +.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#f5f5f5;} +.pager .next>a,.pager .next>span{float:right;} +.pager .previous>a,.pager .previous>span{float:left;} +.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999999;background-color:#fff;cursor:default;} +.thumbnails{margin-left:-20px;list-style:none;*zoom:1;}.thumbnails:before,.thumbnails:after{display:table;content:"";line-height:0;} +.thumbnails:after{clear:both;} +.row-fluid .thumbnails{margin-left:0;} +.thumbnails>li{float:left;margin-bottom:20px;margin-left:20px;} +.thumbnail{display:block;padding:4px;line-height:20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.055);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.055);box-shadow:0 1px 3px rgba(0, 0, 0, 0.055);-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-o-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;} +a.thumbnail:hover,a.thumbnail:focus{border-color:#0088cc;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);} +.thumbnail>img{display:block;max-width:100%;margin-left:auto;margin-right:auto;} +.thumbnail .caption{padding:9px;color:#555555;} +.alert{padding:8px 35px 8px 14px;margin-bottom:20px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.alert,.alert h4{color:#c09853;} +.alert h4{margin:0;} +.alert .close{position:relative;top:-2px;right:-21px;line-height:20px;} +.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#468847;} +.alert-success h4{color:#468847;} +.alert-danger,.alert-error{background-color:#f2dede;border-color:#eed3d7;color:#b94a48;} +.alert-danger h4,.alert-error h4{color:#b94a48;} +.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#3a87ad;} +.alert-info h4{color:#3a87ad;} +.alert-block{padding-top:14px;padding-bottom:14px;} +.alert-block>p,.alert-block>ul{margin-bottom:0;} +.alert-block p+p{margin-top:5px;} +@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-ms-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-o-keyframes progress-bar-stripes{from{background-position:0 0;} to{background-position:40px 0;}}@keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}.progress{overflow:hidden;height:20px;margin-bottom:20px;background-color:#f7f7f7;background-image:-moz-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9));background-image:-webkit-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-o-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:linear-gradient(to bottom, #f5f5f5, #f9f9f9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.progress .bar{width:0%;height:100%;color:#ffffff;float:left;font-size:12px;text-align:center;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top, #149bdf, #0480be);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be));background-image:-webkit-linear-gradient(top, #149bdf, #0480be);background-image:-o-linear-gradient(top, #149bdf, #0480be);background-image:linear-gradient(to bottom, #149bdf, #0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width 0.6s ease;-moz-transition:width 0.6s ease;-o-transition:width 0.6s ease;transition:width 0.6s ease;} +.progress .bar+.bar{-webkit-box-shadow:inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);-moz-box-shadow:inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);} +.progress-striped .bar{background-color:#149bdf;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);-webkit-background-size:40px 40px;-moz-background-size:40px 40px;-o-background-size:40px 40px;background-size:40px 40px;} +.progress.active .bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-moz-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite;} +.progress-danger .bar,.progress .bar-danger{background-color:#dd514c;background-image:-moz-linear-gradient(top, #ee5f5b, #c43c35);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35));background-image:-webkit-linear-gradient(top, #ee5f5b, #c43c35);background-image:-o-linear-gradient(top, #ee5f5b, #c43c35);background-image:linear-gradient(to bottom, #ee5f5b, #c43c35);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffc43c35', GradientType=0);} +.progress-danger.progress-striped .bar,.progress-striped .bar-danger{background-color:#ee5f5b;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.progress-success .bar,.progress .bar-success{background-color:#5eb95e;background-image:-moz-linear-gradient(top, #62c462, #57a957);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957));background-image:-webkit-linear-gradient(top, #62c462, #57a957);background-image:-o-linear-gradient(top, #62c462, #57a957);background-image:linear-gradient(to bottom, #62c462, #57a957);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff57a957', GradientType=0);} +.progress-success.progress-striped .bar,.progress-striped .bar-success{background-color:#62c462;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.progress-info .bar,.progress .bar-info{background-color:#4bb1cf;background-image:-moz-linear-gradient(top, #5bc0de, #339bb9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9));background-image:-webkit-linear-gradient(top, #5bc0de, #339bb9);background-image:-o-linear-gradient(top, #5bc0de, #339bb9);background-image:linear-gradient(to bottom, #5bc0de, #339bb9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff339bb9', GradientType=0);} +.progress-info.progress-striped .bar,.progress-striped .bar-info{background-color:#5bc0de;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.progress-warning .bar,.progress .bar-warning{background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(to bottom, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);} +.progress-warning.progress-striped .bar,.progress-striped .bar-warning{background-color:#fbb450;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.hero-unit{padding:60px;margin-bottom:30px;font-size:18px;font-weight:200;line-height:30px;color:inherit;background-color:#eeeeee;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;color:inherit;letter-spacing:-1px;} +.hero-unit li{line-height:30px;} +.media,.media-body{overflow:hidden;*overflow:visible;zoom:1;} +.media,.media .media{margin-top:15px;} +.media:first-child{margin-top:0;} +.media-object{display:block;} +.media-heading{margin:0 0 5px;} +.media>.pull-left{margin-right:10px;} +.media>.pull-right{margin-left:10px;} +.media-list{margin-left:0;list-style:none;} +.tooltip{position:absolute;z-index:1030;display:block;visibility:visible;font-size:11px;line-height:1.4;opacity:0;filter:alpha(opacity=0);}.tooltip.in{opacity:0.8;filter:alpha(opacity=80);} +.tooltip.top{margin-top:-3px;padding:5px 0;} +.tooltip.right{margin-left:3px;padding:0 5px;} +.tooltip.bottom{margin-top:3px;padding:5px 0;} +.tooltip.left{margin-left:-3px;padding:0 5px;} +.tooltip-inner{max-width:200px;padding:8px;color:#ffffff;text-align:center;text-decoration:none;background-color:#000000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid;} +.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000000;} +.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000000;} +.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000000;} +.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000000;} +.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;background-color:#ffffff;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);white-space:normal;}.popover.top{margin-top:-10px;} +.popover.right{margin-left:10px;} +.popover.bottom{margin-top:10px;} +.popover.left{margin-left:-10px;} +.popover-title{margin:0;padding:8px 14px;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;}.popover-title:empty{display:none;} +.popover-content{padding:9px 14px;} +.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid;} +.popover .arrow{border-width:11px;} +.popover .arrow:after{border-width:10px;content:"";} +.popover.top .arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0, 0, 0, 0.25);bottom:-11px;}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#ffffff;} +.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0, 0, 0, 0.25);}.popover.right .arrow:after{left:1px;bottom:-10px;border-left-width:0;border-right-color:#ffffff;} +.popover.bottom .arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0, 0, 0, 0.25);top:-11px;}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#ffffff;} +.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0, 0, 0, 0.25);}.popover.left .arrow:after{right:1px;border-right-width:0;border-left-color:#ffffff;bottom:-10px;} +.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000000;}.modal-backdrop.fade{opacity:0;} +.modal-backdrop,.modal-backdrop.fade.in{opacity:0.8;filter:alpha(opacity=80);} +.modal{position:fixed;top:10%;left:50%;z-index:1050;width:560px;margin-left:-280px;background-color:#ffffff;border:1px solid #999;border:1px solid rgba(0, 0, 0, 0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;outline:none;}.modal.fade{-webkit-transition:opacity .3s linear, top .3s ease-out;-moz-transition:opacity .3s linear, top .3s ease-out;-o-transition:opacity .3s linear, top .3s ease-out;transition:opacity .3s linear, top .3s ease-out;top:-25%;} +.modal.fade.in{top:10%;} +.modal-header{padding:9px 15px;border-bottom:1px solid #eee;}.modal-header .close{margin-top:2px;} +.modal-header h3{margin:0;line-height:30px;} +.modal-body{position:relative;overflow-y:auto;max-height:400px;padding:15px;} +.modal-form{margin-bottom:0;} +.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;*zoom:1;}.modal-footer:before,.modal-footer:after{display:table;content:"";line-height:0;} +.modal-footer:after{clear:both;} +.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0;} +.modal-footer .btn-group .btn+.btn{margin-left:-1px;} +.modal-footer .btn-block+.btn-block{margin-left:0;} +.dropup,.dropdown{position:relative;} +.dropdown-toggle{*margin-bottom:-3px;} +.dropdown-toggle:active,.open .dropdown-toggle{outline:0;} +.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000000;border-right:4px solid transparent;border-left:4px solid transparent;content:"";} +.dropdown .caret{margin-top:8px;margin-left:2px;} +.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#ffffff;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;}.dropdown-menu.pull-right{right:0;left:auto;} +.dropdown-menu .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #ffffff;} +.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333333;white-space:nowrap;} +.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-submenu:hover>a,.dropdown-submenu:focus>a{text-decoration:none;color:#ffffff;background-color:#0081c2;background-image:-moz-linear-gradient(top, #0088cc, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image:-webkit-linear-gradient(top, #0088cc, #0077b3);background-image:-o-linear-gradient(top, #0088cc, #0077b3);background-image:linear-gradient(to bottom, #0088cc, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);} +.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#ffffff;text-decoration:none;outline:0;background-color:#0081c2;background-image:-moz-linear-gradient(top, #0088cc, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image:-webkit-linear-gradient(top, #0088cc, #0077b3);background-image:-o-linear-gradient(top, #0088cc, #0077b3);background-image:linear-gradient(to bottom, #0088cc, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);} +.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999999;} +.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);cursor:default;} +.open{*z-index:1000;}.open>.dropdown-menu{display:block;} +.pull-right>.dropdown-menu{right:0;left:auto;} +.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000000;content:"";} +.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px;} +.dropdown-submenu{position:relative;} +.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;} +.dropdown-submenu:hover>.dropdown-menu{display:block;} +.dropup .dropdown-submenu>.dropdown-menu{top:auto;bottom:0;margin-top:0;margin-bottom:-2px;-webkit-border-radius:5px 5px 5px 0;-moz-border-radius:5px 5px 5px 0;border-radius:5px 5px 5px 0;} +.dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#cccccc;margin-top:5px;margin-right:-10px;} +.dropdown-submenu:hover>a:after{border-left-color:#ffffff;} +.dropdown-submenu.pull-left{float:none;}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;} +.dropdown .dropdown-menu .nav-header{padding-left:20px;padding-right:20px;} +.typeahead{z-index:1051;margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.accordion{margin-bottom:20px;} +.accordion-group{margin-bottom:2px;border:1px solid #e5e5e5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.accordion-heading{border-bottom:0;} +.accordion-heading .accordion-toggle{display:block;padding:8px 15px;} +.accordion-toggle{cursor:pointer;} +.accordion-inner{padding:9px 15px;border-top:1px solid #e5e5e5;} +.carousel{position:relative;margin-bottom:20px;line-height:1;} +.carousel-inner{overflow:hidden;width:100%;position:relative;} +.carousel-inner>.item{display:none;position:relative;-webkit-transition:0.6s ease-in-out left;-moz-transition:0.6s ease-in-out left;-o-transition:0.6s ease-in-out left;transition:0.6s ease-in-out left;}.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;line-height:1;} +.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block;} +.carousel-inner>.active{left:0;} +.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%;} +.carousel-inner>.next{left:100%;} +.carousel-inner>.prev{left:-100%;} +.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0;} +.carousel-inner>.active.left{left:-100%;} +.carousel-inner>.active.right{left:100%;} +.carousel-control{position:absolute;top:40%;left:15px;width:40px;height:40px;margin-top:-20px;font-size:60px;font-weight:100;line-height:30px;color:#ffffff;text-align:center;background:#222222;border:3px solid #ffffff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:0.5;filter:alpha(opacity=50);}.carousel-control.right{left:auto;right:15px;} +.carousel-control:hover,.carousel-control:focus{color:#ffffff;text-decoration:none;opacity:0.9;filter:alpha(opacity=90);} +.carousel-indicators{position:absolute;top:15px;right:15px;z-index:5;margin:0;list-style:none;}.carousel-indicators li{display:block;float:left;width:10px;height:10px;margin-left:5px;text-indent:-999px;background-color:#ccc;background-color:rgba(255, 255, 255, 0.25);border-radius:5px;} +.carousel-indicators .active{background-color:#fff;} +.carousel-caption{position:absolute;left:0;right:0;bottom:0;padding:15px;background:#333333;background:rgba(0, 0, 0, 0.75);} +.carousel-caption h4,.carousel-caption p{color:#ffffff;line-height:20px;} +.carousel-caption h4{margin:0 0 5px;} +.carousel-caption p{margin-bottom:0;} +.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);} +.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.close{float:right;font-size:20px;font-weight:bold;line-height:20px;color:#000000;text-shadow:0 1px 0 #ffffff;opacity:0.2;filter:alpha(opacity=20);}.close:hover,.close:focus{color:#000000;text-decoration:none;cursor:pointer;opacity:0.4;filter:alpha(opacity=40);} +button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none;} +.pull-right{float:right;} +.pull-left{float:left;} +.hide{display:none;} +.show{display:block;} +.invisible{visibility:hidden;} +.affix{position:fixed;} +.fade{opacity:0;-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;}.fade.in{opacity:1;} +.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height 0.35s ease;-moz-transition:height 0.35s ease;-o-transition:height 0.35s ease;transition:height 0.35s ease;}.collapse.in{height:auto;} +@-ms-viewport{width:device-width;}.hidden{display:none;visibility:hidden;} +.visible-phone{display:none !important;} +.visible-tablet{display:none !important;} +.hidden-desktop{display:none !important;} +.visible-desktop{display:inherit !important;} +@media (min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit !important;} .visible-desktop{display:none !important ;} .visible-tablet{display:inherit !important;} .hidden-tablet{display:none !important;}}@media (max-width:767px){.hidden-desktop{display:inherit !important;} .visible-desktop{display:none !important;} .visible-phone{display:inherit !important;} .hidden-phone{display:none !important;}}.visible-print{display:none !important;} +@media print{.visible-print{display:inherit !important;} .hidden-print{display:none !important;}}@media (max-width:767px){body{padding-left:20px;padding-right:20px;} .navbar-fixed-top,.navbar-fixed-bottom,.navbar-static-top{margin-left:-20px;margin-right:-20px;} .container-fluid{padding:0;} .dl-horizontal dt{float:none;clear:none;width:auto;text-align:left;} .dl-horizontal dd{margin-left:0;} .container{width:auto;} .row-fluid{width:100%;} .row,.thumbnails{margin-left:0;} .thumbnails>li{float:none;margin-left:0;} [class*="span"],.uneditable-input[class*="span"],.row-fluid [class*="span"]{float:none;display:block;width:100%;margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} .span12,.row-fluid .span12{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} .row-fluid [class*="offset"]:first-child{margin-left:0;} .input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} .input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto;} .controls-row [class*="span"]+[class*="span"]{margin-left:0;} .modal{position:fixed;top:20px;left:20px;right:20px;width:auto;margin:0;}.modal.fade{top:-100px;} .modal.fade.in{top:20px;}}@media (max-width:480px){.nav-collapse{-webkit-transform:translate3d(0, 0, 0);} .page-header h1 small{display:block;line-height:20px;} input[type="checkbox"],input[type="radio"]{border:1px solid #ccc;} .form-horizontal .control-label{float:none;width:auto;padding-top:0;text-align:left;} .form-horizontal .controls{margin-left:0;} .form-horizontal .control-list{padding-top:0;} .form-horizontal .form-actions{padding-left:10px;padding-right:10px;} .media .pull-left,.media .pull-right{float:none;display:block;margin-bottom:10px;} .media-object{margin-right:0;margin-left:0;} .modal{top:10px;left:10px;right:10px;} .modal-header .close{padding:10px;margin:-10px;} .carousel-caption{position:static;}}@media (min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";line-height:0;} .row:after{clear:both;} [class*="span"]{float:left;min-height:1px;margin-left:20px;} .container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px;} .span12{width:724px;} .span11{width:662px;} .span10{width:600px;} .span9{width:538px;} .span8{width:476px;} .span7{width:414px;} .span6{width:352px;} .span5{width:290px;} .span4{width:228px;} .span3{width:166px;} .span2{width:104px;} .span1{width:42px;} .offset12{margin-left:764px;} .offset11{margin-left:702px;} .offset10{margin-left:640px;} .offset9{margin-left:578px;} .offset8{margin-left:516px;} .offset7{margin-left:454px;} .offset6{margin-left:392px;} .offset5{margin-left:330px;} .offset4{margin-left:268px;} .offset3{margin-left:206px;} .offset2{margin-left:144px;} .offset1{margin-left:82px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";line-height:0;} .row-fluid:after{clear:both;} .row-fluid [class*="span"]{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.7624309392265194%;*margin-left:2.709239449864817%;} .row-fluid [class*="span"]:first-child{margin-left:0;} .row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.7624309392265194%;} .row-fluid .span12{width:100%;*width:99.94680851063829%;} .row-fluid .span11{width:91.43646408839778%;*width:91.38327259903608%;} .row-fluid .span10{width:82.87292817679558%;*width:82.81973668743387%;} .row-fluid .span9{width:74.30939226519337%;*width:74.25620077583166%;} .row-fluid .span8{width:65.74585635359117%;*width:65.69266486422946%;} .row-fluid .span7{width:57.18232044198895%;*width:57.12912895262725%;} .row-fluid .span6{width:48.61878453038674%;*width:48.56559304102504%;} .row-fluid .span5{width:40.05524861878453%;*width:40.00205712942283%;} .row-fluid .span4{width:31.491712707182323%;*width:31.43852121782062%;} .row-fluid .span3{width:22.92817679558011%;*width:22.87498530621841%;} .row-fluid .span2{width:14.3646408839779%;*width:14.311449394616199%;} .row-fluid .span1{width:5.801104972375691%;*width:5.747913483013988%;} .row-fluid .offset12{margin-left:105.52486187845304%;*margin-left:105.41847889972962%;} .row-fluid .offset12:first-child{margin-left:102.76243093922652%;*margin-left:102.6560479605031%;} .row-fluid .offset11{margin-left:96.96132596685082%;*margin-left:96.8549429881274%;} .row-fluid .offset11:first-child{margin-left:94.1988950276243%;*margin-left:94.09251204890089%;} .row-fluid .offset10{margin-left:88.39779005524862%;*margin-left:88.2914070765252%;} .row-fluid .offset10:first-child{margin-left:85.6353591160221%;*margin-left:85.52897613729868%;} .row-fluid .offset9{margin-left:79.8342541436464%;*margin-left:79.72787116492299%;} .row-fluid .offset9:first-child{margin-left:77.07182320441989%;*margin-left:76.96544022569647%;} .row-fluid .offset8{margin-left:71.2707182320442%;*margin-left:71.16433525332079%;} .row-fluid .offset8:first-child{margin-left:68.50828729281768%;*margin-left:68.40190431409427%;} .row-fluid .offset7{margin-left:62.70718232044199%;*margin-left:62.600799341718584%;} .row-fluid .offset7:first-child{margin-left:59.94475138121547%;*margin-left:59.838368402492065%;} .row-fluid .offset6{margin-left:54.14364640883978%;*margin-left:54.037263430116376%;} .row-fluid .offset6:first-child{margin-left:51.38121546961326%;*margin-left:51.27483249088986%;} .row-fluid .offset5{margin-left:45.58011049723757%;*margin-left:45.47372751851417%;} .row-fluid .offset5:first-child{margin-left:42.81767955801105%;*margin-left:42.71129657928765%;} .row-fluid .offset4{margin-left:37.01657458563536%;*margin-left:36.91019160691196%;} .row-fluid .offset4:first-child{margin-left:34.25414364640884%;*margin-left:34.14776066768544%;} .row-fluid .offset3{margin-left:28.45303867403315%;*margin-left:28.346655695309746%;} .row-fluid .offset3:first-child{margin-left:25.69060773480663%;*margin-left:25.584224756083227%;} .row-fluid .offset2{margin-left:19.88950276243094%;*margin-left:19.783119783707537%;} .row-fluid .offset2:first-child{margin-left:17.12707182320442%;*margin-left:17.02068884448102%;} .row-fluid .offset1{margin-left:11.32596685082873%;*margin-left:11.219583872105325%;} .row-fluid .offset1:first-child{margin-left:8.56353591160221%;*margin-left:8.457152932878806%;} input,textarea,.uneditable-input{margin-left:0;} .controls-row [class*="span"]+[class*="span"]{margin-left:20px;} input.span12,textarea.span12,.uneditable-input.span12{width:710px;} input.span11,textarea.span11,.uneditable-input.span11{width:648px;} input.span10,textarea.span10,.uneditable-input.span10{width:586px;} input.span9,textarea.span9,.uneditable-input.span9{width:524px;} input.span8,textarea.span8,.uneditable-input.span8{width:462px;} input.span7,textarea.span7,.uneditable-input.span7{width:400px;} input.span6,textarea.span6,.uneditable-input.span6{width:338px;} input.span5,textarea.span5,.uneditable-input.span5{width:276px;} input.span4,textarea.span4,.uneditable-input.span4{width:214px;} input.span3,textarea.span3,.uneditable-input.span3{width:152px;} input.span2,textarea.span2,.uneditable-input.span2{width:90px;} input.span1,textarea.span1,.uneditable-input.span1{width:28px;}}@media (min-width:1200px){.row{margin-left:-30px;*zoom:1;}.row:before,.row:after{display:table;content:"";line-height:0;} .row:after{clear:both;} [class*="span"]{float:left;min-height:1px;margin-left:30px;} .container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px;} .span12{width:1170px;} .span11{width:1070px;} .span10{width:970px;} .span9{width:870px;} .span8{width:770px;} .span7{width:670px;} .span6{width:570px;} .span5{width:470px;} .span4{width:370px;} .span3{width:270px;} .span2{width:170px;} .span1{width:70px;} .offset12{margin-left:1230px;} .offset11{margin-left:1130px;} .offset10{margin-left:1030px;} .offset9{margin-left:930px;} .offset8{margin-left:830px;} .offset7{margin-left:730px;} .offset6{margin-left:630px;} .offset5{margin-left:530px;} .offset4{margin-left:430px;} .offset3{margin-left:330px;} .offset2{margin-left:230px;} .offset1{margin-left:130px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";line-height:0;} .row-fluid:after{clear:both;} .row-fluid [class*="span"]{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.564102564102564%;*margin-left:2.5109110747408616%;} .row-fluid [class*="span"]:first-child{margin-left:0;} .row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.564102564102564%;} .row-fluid .span12{width:100%;*width:99.94680851063829%;} .row-fluid .span11{width:91.45299145299145%;*width:91.39979996362975%;} .row-fluid .span10{width:82.90598290598291%;*width:82.8527914166212%;} .row-fluid .span9{width:74.35897435897436%;*width:74.30578286961266%;} .row-fluid .span8{width:65.81196581196582%;*width:65.75877432260411%;} .row-fluid .span7{width:57.26495726495726%;*width:57.21176577559556%;} .row-fluid .span6{width:48.717948717948715%;*width:48.664757228587014%;} .row-fluid .span5{width:40.17094017094017%;*width:40.11774868157847%;} .row-fluid .span4{width:31.623931623931625%;*width:31.570740134569924%;} .row-fluid .span3{width:23.076923076923077%;*width:23.023731587561375%;} .row-fluid .span2{width:14.52991452991453%;*width:14.476723040552828%;} .row-fluid .span1{width:5.982905982905983%;*width:5.929714493544281%;} .row-fluid .offset12{margin-left:105.12820512820512%;*margin-left:105.02182214948171%;} .row-fluid .offset12:first-child{margin-left:102.56410256410257%;*margin-left:102.45771958537915%;} .row-fluid .offset11{margin-left:96.58119658119658%;*margin-left:96.47481360247316%;} .row-fluid .offset11:first-child{margin-left:94.01709401709402%;*margin-left:93.91071103837061%;} .row-fluid .offset10{margin-left:88.03418803418803%;*margin-left:87.92780505546462%;} .row-fluid .offset10:first-child{margin-left:85.47008547008548%;*margin-left:85.36370249136206%;} .row-fluid .offset9{margin-left:79.48717948717949%;*margin-left:79.38079650845607%;} .row-fluid .offset9:first-child{margin-left:76.92307692307693%;*margin-left:76.81669394435352%;} .row-fluid .offset8{margin-left:70.94017094017094%;*margin-left:70.83378796144753%;} .row-fluid .offset8:first-child{margin-left:68.37606837606839%;*margin-left:68.26968539734497%;} .row-fluid .offset7{margin-left:62.393162393162385%;*margin-left:62.28677941443899%;} .row-fluid .offset7:first-child{margin-left:59.82905982905982%;*margin-left:59.72267685033642%;} .row-fluid .offset6{margin-left:53.84615384615384%;*margin-left:53.739770867430444%;} .row-fluid .offset6:first-child{margin-left:51.28205128205128%;*margin-left:51.175668303327875%;} .row-fluid .offset5{margin-left:45.299145299145295%;*margin-left:45.1927623204219%;} .row-fluid .offset5:first-child{margin-left:42.73504273504273%;*margin-left:42.62865975631933%;} .row-fluid .offset4{margin-left:36.75213675213675%;*margin-left:36.645753773413354%;} .row-fluid .offset4:first-child{margin-left:34.18803418803419%;*margin-left:34.081651209310785%;} .row-fluid .offset3{margin-left:28.205128205128204%;*margin-left:28.0987452264048%;} .row-fluid .offset3:first-child{margin-left:25.641025641025642%;*margin-left:25.53464266230224%;} .row-fluid .offset2{margin-left:19.65811965811966%;*margin-left:19.551736679396257%;} .row-fluid .offset2:first-child{margin-left:17.094017094017094%;*margin-left:16.98763411529369%;} .row-fluid .offset1{margin-left:11.11111111111111%;*margin-left:11.004728132387708%;} .row-fluid .offset1:first-child{margin-left:8.547008547008547%;*margin-left:8.440625568285142%;} input,textarea,.uneditable-input{margin-left:0;} .controls-row [class*="span"]+[class*="span"]{margin-left:30px;} input.span12,textarea.span12,.uneditable-input.span12{width:1156px;} input.span11,textarea.span11,.uneditable-input.span11{width:1056px;} input.span10,textarea.span10,.uneditable-input.span10{width:956px;} input.span9,textarea.span9,.uneditable-input.span9{width:856px;} input.span8,textarea.span8,.uneditable-input.span8{width:756px;} input.span7,textarea.span7,.uneditable-input.span7{width:656px;} input.span6,textarea.span6,.uneditable-input.span6{width:556px;} input.span5,textarea.span5,.uneditable-input.span5{width:456px;} input.span4,textarea.span4,.uneditable-input.span4{width:356px;} input.span3,textarea.span3,.uneditable-input.span3{width:256px;} input.span2,textarea.span2,.uneditable-input.span2{width:156px;} input.span1,textarea.span1,.uneditable-input.span1{width:56px;} .thumbnails{margin-left:-30px;} .thumbnails>li{margin-left:30px;} .row-fluid .thumbnails{margin-left:0;}}@media (max-width:979px){body{padding-top:0;} .navbar-fixed-top,.navbar-fixed-bottom{position:static;} .navbar-fixed-top{margin-bottom:20px;} .navbar-fixed-bottom{margin-top:20px;} .navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px;} .navbar .container{width:auto;padding:0;} .navbar .brand{padding-left:10px;padding-right:10px;margin:0 0 0 -5px;} .nav-collapse{clear:both;} .nav-collapse .nav{float:none;margin:0 0 10px;} .nav-collapse .nav>li{float:none;} .nav-collapse .nav>li>a{margin-bottom:2px;} .nav-collapse .nav>.divider-vertical{display:none;} .nav-collapse .nav .nav-header{color:#777777;text-shadow:none;} .nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:9px 15px;font-weight:bold;color:#777777;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} .nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} .nav-collapse .dropdown-menu li+li a{margin-bottom:2px;} .nav-collapse .nav>li>a:hover,.nav-collapse .nav>li>a:focus,.nav-collapse .dropdown-menu a:hover,.nav-collapse .dropdown-menu a:focus{background-color:#f2f2f2;} .navbar-inverse .nav-collapse .nav>li>a,.navbar-inverse .nav-collapse .dropdown-menu a{color:#999999;} .navbar-inverse .nav-collapse .nav>li>a:hover,.navbar-inverse .nav-collapse .nav>li>a:focus,.navbar-inverse .nav-collapse .dropdown-menu a:hover,.navbar-inverse .nav-collapse .dropdown-menu a:focus{background-color:#111111;} .nav-collapse.in .btn-group{margin-top:5px;padding:0;} .nav-collapse .dropdown-menu{position:static;top:auto;left:auto;float:none;display:none;max-width:none;margin:0 15px;padding:0;background-color:transparent;border:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} .nav-collapse .open>.dropdown-menu{display:block;} .nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none;} .nav-collapse .dropdown-menu .divider{display:none;} .nav-collapse .nav>li>.dropdown-menu:before,.nav-collapse .nav>li>.dropdown-menu:after{display:none;} .nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:10px 15px;margin:10px 0;border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);} .navbar-inverse .nav-collapse .navbar-form,.navbar-inverse .nav-collapse .navbar-search{border-top-color:#111111;border-bottom-color:#111111;} .navbar .nav-collapse .nav.pull-right{float:none;margin-left:0;} .nav-collapse,.nav-collapse.collapse{overflow:hidden;height:0;} .navbar .btn-navbar{display:block;} .navbar-static .navbar-inner{padding-left:10px;padding-right:10px;}}@media (min-width:980px){.nav-collapse.collapse{height:auto !important;overflow:visible !important;}} diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/resources/style/main.css b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/resources/style/main.css similarity index 91% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/resources/style/main.css rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/resources/style/main.css index c8339ec..c5b37ff 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/resources/style/main.css +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Examples/resources/style/main.css @@ -1,42 +1,42 @@ -label > span { - display: inline-block; - width: 300px; -} - -#payment-errors { - color: #ff0000; -} - -pre { - clear: left; -} - -dl#list { - clear: left; -} - -dl#list dt { - clear: left; - float: left; - padding-bottom: 10px; - width: 200px; -} - -dl#list dd { - float: left; - width: 700px; -} - -dl#list dd ul { - list-style: none; - padding: 0; -} - -dl#list dd ul li span { - display: inline-block; - width: 150px; -} - -hr { - border: 1px solid #000; +label > span { + display: inline-block; + width: 300px; +} + +#payment-errors { + color: #ff0000; +} + +pre { + clear: left; +} + +dl#list { + clear: left; +} + +dl#list dt { + clear: left; + float: left; + padding-bottom: 10px; + width: 200px; +} + +dl#list dd { + float: left; + width: 700px; +} + +dl#list dd ul { + list-style: none; + padding: 0; +} + +dl#list dd ul li span { + display: inline-block; + width: 150px; +} + +hr { + border: 1px solid #000; } \ No newline at end of file diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Samples.sln b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Samples.sln similarity index 85% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Samples.sln rename to worldpay-sample-dotnet-4-0/Worldpay.Sdk.Samples.sln index 730be1a..6cba476 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Samples.sln +++ b/worldpay-sample-dotnet-4-0/Worldpay.Sdk.Samples.sln @@ -1,7 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worldpay.Sdk.Examples", "Worldpay.Sdk.Examples\Worldpay.Sdk.Examples20.csproj", "{C1E26FE7-56C2-446D-A65A-830D8747758B}" +# Visual Studio Express 14 for Web +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worldpay.Sdk.Examples", "Worldpay.Sdk.Examples\Worldpay.Sdk.Examples35.csproj", "{C1E26FE7-56C2-446D-A65A-830D8747758B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6C59865C-07ED-4BD8-99D8-4A8BAE7BF16C}" ProjectSection(SolutionItems) = preProject diff --git a/worldpay-sample-dotnet-4-6/.gitignore b/worldpay-sample-dotnet-4-6/.gitignore new file mode 100644 index 0000000..9d3ff52 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/.gitignore @@ -0,0 +1,4 @@ +TestResults +obj +*.suo +*.user diff --git a/worldpay-sample-dotnet-4-6/.vs/config/applicationhost.config b/worldpay-sample-dotnet-4-6/.vs/config/applicationhost.config new file mode 100644 index 0000000..f105bcf --- /dev/null +++ b/worldpay-sample-dotnet-4-6/.vs/config/applicationhost.config @@ -0,0 +1,1038 @@ + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + + +
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMCancel.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMCancel.aspx new file mode 100644 index 0000000..d9f4df5 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMCancel.aspx @@ -0,0 +1,13 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMCancel.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMCancel" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Create Order Example

    + +

    Payment Response

    +

    + + +

    +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMCancel.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMCancel.aspx.cs new file mode 100644 index 0000000..b2b3bf4 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMCancel.aspx.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class APMCancel : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + string orderCode = (string)Session["orderCode"]; + OrderResponse.Text = "APM Order " + orderCode + " has been cancelled
    "; + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMCancel.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMCancel.aspx.designer.cs new file mode 100644 index 0000000..81c3d7c --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMCancel.aspx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class APMCancel { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMFailure.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMFailure.aspx new file mode 100644 index 0000000..2d02a22 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMFailure.aspx @@ -0,0 +1,13 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMFailure.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMFailure" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Create Order Example

    + +

    Payment Response

    +

    + + +

    +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMFailure.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMFailure.aspx.cs new file mode 100644 index 0000000..a4f8c5d --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMFailure.aspx.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class APMFailure : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + string orderCode = (string)Session["orderCode"]; + OrderResponse.Text = "There was an error authorizing the APM Order " + orderCode + "
    "; + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMFailure.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMFailure.aspx.designer.cs new file mode 100644 index 0000000..16a4525 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMFailure.aspx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class APMFailure { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMPending.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMPending.aspx new file mode 100644 index 0000000..f33b685 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMPending.aspx @@ -0,0 +1,13 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMPending.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMPending" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Create Order Example

    + +

    Payment Response

    +

    + + +

    +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMPending.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMPending.aspx.cs new file mode 100644 index 0000000..268c8c9 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMPending.aspx.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class APMPending : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + string orderCode = (string)Session["orderCode"]; + OrderResponse.Text = "APM Order " + orderCode + " has been marked as pending
    "; + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMPending.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMPending.aspx.designer.cs new file mode 100644 index 0000000..44b3072 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMPending.aspx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class APMPending { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMSuccess.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMSuccess.aspx new file mode 100644 index 0000000..7734f11 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMSuccess.aspx @@ -0,0 +1,13 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APMSuccess.aspx.cs" Inherits="Worldpay.Sdk.Examples.APMSuccess" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Create Order Example

    + +

    Payment Response

    +

    + + +

    +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMSuccess.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMSuccess.aspx.cs new file mode 100644 index 0000000..d27d7cc --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMSuccess.aspx.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class APMSuccess : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + string orderCode = (string)Session["orderCode"]; + OrderResponse.Text = "APM Order " + orderCode + " has been authorized
    "; + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMSuccess.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMSuccess.aspx.designer.cs new file mode 100644 index 0000000..deddb14 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/APMSuccess.aspx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class APMSuccess { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/AuthorizeOrder.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/AuthorizeOrder.aspx new file mode 100644 index 0000000..2173a7f --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/AuthorizeOrder.aspx @@ -0,0 +1,13 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AuthorizeOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.AuthorizeOrder" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Create Order Example

    + +

    Payment Response

    +

    + + +

    +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.cs new file mode 100644 index 0000000..d374156 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class AuthorizeOrder : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + onAuthorizeOrder(this, null); + } + + protected void onAuthorizeOrder(object sender, CommandEventArgs e) + { + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + string orderCode = (string)Session["orderCode"]; + var responseCode = HttpContext.Current.Request.Form["PaRes"]; + var httpRequest = HttpContext.Current.Request; + ThreeDSecureInfo threeDSInfo = new ThreeDSecureInfo() + { + shopperIpAddress = httpRequest.UserHostAddress, + shopperSessionId = HttpContext.Current.Session.SessionID, + shopperUserAgent = httpRequest.UserAgent, + shopperAcceptHeader = String.Join(";", httpRequest.AcceptTypes) + }; + + try + { + var response = client.GetOrderService().Authorize(orderCode, responseCode, threeDSInfo); + OrderResponse.Text = "Order code:" + response.orderCode + "
    Payment Status: " + + response.paymentStatus + "
    Environment: " + response.environment; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request with order code " + orderCode, exc); + } + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.designer.cs new file mode 100644 index 0000000..1e2fdfd --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/AuthorizeOrder.aspx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class AuthorizeOrder { + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx new file mode 100644 index 0000000..cfe49a3 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx @@ -0,0 +1,25 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CancelAuthorizedOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.CancelAuthorizedOrder" MasterPageFile="Master.Master" %> +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Cancel Authorized Order Example

    + + +
    +
    +
    + + +
    + + +
    + + +

    Response

    +

    +
    + + + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.cs new file mode 100644 index 0000000..fea0c51 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.cs @@ -0,0 +1,38 @@ +using System; +using System.Web; +using System.Web.UI.WebControls; + +namespace Worldpay.Sdk.Examples +{ + public partial class CancelAuthorizedOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnCancelOrder(object sender, CommandEventArgs e) + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + var orderCode = form["orderCode"]; + + try + { + client.GetOrderService().CancelAuthorizedOrder(orderCode); + ServerResponse.Text = String.Format("Authorized order {0} has been cancelled", orderCode); + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request ", exc); + } + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.designer.cs new file mode 100644 index 0000000..0ae3b24 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CancelAuthorizedOrder.aspx.designer.cs @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class CancelAuthorizedOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// CancelAuthorizedOrderForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm CancelAuthorizedOrderForm; + + /// + /// CancelOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button CancelOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx new file mode 100644 index 0000000..d43d583 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx @@ -0,0 +1,29 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CaptureAuthorizedOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.CaptureAuthorizedOrder" MasterPageFile="Master.Master" %> +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Capture Authorized Order Example

    + + +
    +
    +
    + + +
    +
    + + +
    + + +
    + + +

    Response

    +

    +
    + + + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.cs new file mode 100644 index 0000000..ac5a534 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.cs @@ -0,0 +1,47 @@ +using System; +using System.Web; +using System.Web.UI.WebControls; + +namespace Worldpay.Sdk.Examples +{ + public partial class CaptureAuthorizedOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnCaptureOrder(object sender, CommandEventArgs e) + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + var orderCode = form["orderCode"]; + int amount = 0; + try + { + amount = (int)(Convert.ToDecimal(form["amount"]) * 100); + } + catch (Exception excAmount) { } + + try + { + var response = client.GetOrderService().CaptureAuthorizedOrder(orderCode, amount); + + ServerResponse.Text = "Order code:" + response.orderCode + + "
    Payment Status: " + response.paymentStatus + + "
    Environment: " + response.environment; + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request ", exc); + } + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.designer.cs new file mode 100644 index 0000000..1be08eb --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CaptureAuthorizedOrder.aspx.designer.cs @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class CaptureAuthorizedOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// CaptureAuthorizedOrderForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm CaptureAuthorizedOrderForm; + + /// + /// CaptureOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button CaptureOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ConfigurationService.asmx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ConfigurationService.asmx new file mode 100644 index 0000000..97d5e9c --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ConfigurationService.asmx @@ -0,0 +1 @@ +<%@ WebService Language="C#" CodeBehind="ConfigurationService.asmx.cs" Class="Worldpay.Sdk.Examples.ConfigurationService" %> diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ConfigurationService.asmx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ConfigurationService.asmx.cs new file mode 100644 index 0000000..9bb54c4 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ConfigurationService.asmx.cs @@ -0,0 +1,21 @@ +using System.Web.Services; + +namespace Worldpay.Sdk.Examples +{ + /// + /// Service exposing the sample application's configuration for modification, e.g. API URL, keys. + /// + public class ConfigurationService : WebService + { + [WebMethod(EnableSession = true)] + public string Test(string apiEndpoint, string jsEndpoint, string serviceKey, string clientKey) + { + Session["apiEndpoint"] = apiEndpoint; + Session["js_endpoint"] = jsEndpoint; + Session["service_key"] = serviceKey; + Session["client_key"] = clientKey; + Session["mode"] = clientKey.StartsWith("L_C") ? "live" : "test"; + return ""; // Required to prevent a console error in FF. See https://bugzilla.mozilla.org/show_bug.cgi?id=884693 + } + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CreateOrder.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CreateOrder.aspx new file mode 100644 index 0000000..d8da820 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CreateOrder.aspx @@ -0,0 +1,525 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CreateOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.CreateOrder" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + + +
    +

    .NET Library Create Order Example

    + + +
    +
    Checkout
    + +
    + + +
    + +
    + + +
    + + + +
    + + +
    + +
    + + +
    + + + + + + + + + +
    + + +
    + + +
    + + +
    + +
    + + + / + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    Billing address
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    Delivery address
    +
    + + +
    +
    + + +
    +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    Other
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + + + + + +
    + + +
    + +
    + + +
    + +
    +
    + + +

    Response

    +

    Order Code:

    +

    Token:

    +

    Payment Status:

    +
    + +
    + + + + +
    diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CreateOrder.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CreateOrder.aspx.cs new file mode 100644 index 0000000..1d66e39 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CreateOrder.aspx.cs @@ -0,0 +1,368 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Web; +using System.Web.UI.WebControls; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; +using Newtonsoft.Json; + +namespace Worldpay.Sdk.Examples +{ + public partial class CreateOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + if (IsPostBack) + { + RequestPanel.Visible = false; + OnCreateOrder(this, null); + } + } + + protected void OnCreateOrder(object sender, CommandEventArgs e) + { + var form = HttpContext.Current.Request.Form; + var orderType = (OrderType)Enum.Parse(typeof(OrderType), form["orderType"]); + + if (orderType == OrderType.APM) + { + createAPMOrder(); + return; + } + else + { + createOrder(); + return; + } + } + + private void createOrder() + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + var orderType = (OrderType)Enum.Parse(typeof(OrderType), form["orderType"]); + + var cardRequest = new CardRequest(); + cardRequest.cardNumber = form["number"]; + cardRequest.cvc = form["cvc"]; + cardRequest.name = form["name"]; + cardRequest.expiryMonth = Convert.ToInt32(form["exp-month"]); + cardRequest.expiryYear = Convert.ToInt32(form["exp-year"]); + cardRequest.type = form["cardType"]; + int? _amount = 0; + var _currencyCode = ""; + Dictionary custIdentifiers = new Dictionary(); + + try + { + custIdentifiers = JavaScriptConvert.DeserializeObject>(form["customer-identifiers"]); + + } + catch (Exception exc) { } + + try + { + if (!string.IsNullOrEmpty(form["amount"])) + { + double n; + bool isNumeric = double.TryParse(form["amount"], out n); + _amount = isNumeric ? (int)(Convert.ToDecimal(form["amount"]) * 100) : -1; + } + } + catch (Exception excAmount) { } + + try + { + _currencyCode = Enum.Parse(typeof(CurrencyCode), form["currency"]).ToString(); + } + catch (Exception excCurrency) { } + + var billingAddress = new Address() + { + address1 = form["address1"], + address2 = form["address2"], + address3 = form["address3"], + postalCode = form["postcode"], + city = form["city"], + telephoneNumber = form["telephone-number"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["countryCode"]).ToString() + }; + + var deliveryAddress = new DeliveryAddress() + { + firstName = form["delivery-firstName"], + lastName = form["delivery-lastName"], + address1 = form["delivery-address1"], + address2 = form["delivery-address2"], + address3 = form["delivery-address3"], + postalCode = form["delivery-postcode"], + city = form["delivery-city"], + telephoneNumber = form["delivery-telephone-number"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["delivery-countryCode"]).ToString() + }; + + var is3DS = form["3ds"] == "on" ? true : false; + ThreeDSecureInfo threeDSInfo = null; + if (is3DS) + { + var httpRequest = HttpContext.Current.Request; + threeDSInfo = new ThreeDSecureInfo() + { + shopperIpAddress = httpRequest.UserHostAddress, + shopperSessionId = HttpContext.Current.Session.SessionID, + shopperUserAgent = httpRequest.UserAgent, + shopperAcceptHeader = String.Join(";", httpRequest.AcceptTypes) + }; + } + + var request = new OrderRequest() + { + token = form["token"], + orderDescription = form["description"], + amount = _amount, + currencyCode = _currencyCode, + name = is3DS && Session["mode"].Equals("test") ? "3D" : form["name"], + shopperEmailAddress = form["shopper-email"], + statementNarrative = form["statement-narrative"], + billingAddress = billingAddress, + deliveryAddress = deliveryAddress, + threeDSecureInfo = is3DS ? threeDSInfo : new ThreeDSecureInfo(), + is3DSOrder = is3DS, + authorizeOnly = form["authorizeOnly"] == "on", + orderType = orderType.ToString(), + customerIdentifiers = custIdentifiers, + customerOrderCode = form["customer-order-code"], + orderCodePrefix = form["order-code-prefix"], + orderCodeSuffix = form["order-code-suffix"] + }; + + var directOrder = form["direct-order"] == "1"; + if (directOrder) + { + request.shopperLanguageCode = form["language-code"]; + request.reusable = form["chkReusable"] == "on"; + request.paymentMethod = new CardRequest() + { + name = form["name"], + expiryMonth = Convert.ToInt32(form["exp-month"]), + expiryYear = Convert.ToInt32(form["exp-year"]), + cardNumber = form["number"], + cvc = form["cvc"] + }; + } + + if (!string.IsNullOrEmpty(form["settlement-currency"])) + { + request.settlementCurrency = form["settlement-currency"]; + } + if (!string.IsNullOrEmpty(form["site-code"])) + { + request.siteCode = form["site-code"]; + } + + try + { + var response = client.GetOrderService().Create(request); + + HandleSuccessResponse(response); + + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request with token " + request.token, exc); + } + } + + private void createAPMOrder() + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + int? _amount = 0; + var _currencyCode = ""; + Dictionary custIdentifiers = new Dictionary(); + + try + { + custIdentifiers = JavaScriptConvert.DeserializeObject>(form["customer-identifiers"]); + + } + catch (Exception exc) { } + + try + { + if (!string.IsNullOrEmpty(form["amount"])) + { + double n; + bool isNumeric = double.TryParse(form["amount"], out n); + _amount = isNumeric ? (int)(Convert.ToDecimal(form["amount"]) * 100) : -1; + } + } + catch (Exception excAmount) { } + + try + { + _currencyCode = Enum.Parse(typeof(CurrencyCode), form["currency"]).ToString(); + } + catch (Exception excCurrency) { } + + var billingAddress = new Address() + { + address1 = form["address1"], + address2 = form["address2"], + address3 = form["address3"], + postalCode = form["postcode"], + city = form["city"], + telephoneNumber = form["telephone-number"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["countryCode"]).ToString() + }; + + var deliveryAddress = new DeliveryAddress() + { + firstName = form["delivery-firstName"], + lastName = form["delivery-lastName"], + address1 = form["delivery-address1"], + address2 = form["delivery-address2"], + address3 = form["delivery-address3"], + postalCode = form["delivery-postcode"], + city = form["delivery-city"], + telephoneNumber = form["delivery-telephone-number"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["delivery-countryCode"]).ToString() + }; + + var request = new OrderRequest() + { + token = form["token"], + name = form["name"], + shopperEmailAddress = form["shopper-email"], + statementNarrative = form["statement-narrative"], + orderDescription = form["description"], + amount = _amount, + currencyCode = _currencyCode, + billingAddress = billingAddress, + deliveryAddress = deliveryAddress, + customerIdentifiers = custIdentifiers, + customerOrderCode = form["customer-order-code"], + orderCodePrefix = form["order-code-prefix"], + orderCodeSuffix = form["order-code-suffix"], + successUrl = form["success-url"], + failureUrl = form["failure-url"], + pendingUrl = form["pending-url"], + cancelUrl = form["cancel-url"] + }; + + var directOrder = form["direct-order"] == "1"; + if (directOrder) + { + var _apmFields = new Dictionary(); + if (!string.IsNullOrEmpty(form["swiftCode"])) + { + _apmFields.Add("swiftCode", form["swiftCode"]); + } + if (!string.IsNullOrEmpty(form["shopperBankCode"])) + { + _apmFields.Add("shopperBankCode", form["shopperBankCode"]); + } + + request.shopperLanguageCode = form["language-code"]; + request.reusable = form["chkReusable"] == "on"; + request.paymentMethod = new APMRequest() + { + apmName = form["apm-name"], + shopperCountryCode = form["countryCode"], + apmFields = _apmFields + }; + } + + if (!string.IsNullOrEmpty(form["settlement-currency"])) + { + request.settlementCurrency = form["settlement-currency"]; + } + + try + { + var response = client.GetOrderService().Create(request); + + HandleSuccessResponse(response); + + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request with token " + request.token, exc); + } + } + + private void HandleSuccessResponse(OrderResponse response) + { + if (response.paymentStatus == OrderStatus.PRE_AUTHORIZED && response.paymentResponse.type == OrderType.APM.ToString()) + { + HandleAPMResponse(response); + return; + } + if (response.paymentStatus == OrderStatus.PRE_AUTHORIZED && response.is3DSOrder) + { + Handle3DSResponse(response); + return; + } + + ResponseOrderCode.Text = response.orderCode; + ResponseToken.Text = response.token; + ResponsePaymentStatus.Text = response.paymentStatus.ToString(); + ResponseJson.Text = JavaScriptConvert.SerializeObject(response); + } + + private void HandleAPMResponse(OrderResponse response) + { + Session["orderCode"] = response.orderCode; + Response.Clear(); + + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.Append(""); + sb.AppendFormat("", response.redirectURL); + sb.Append(""); + sb.Append(""); + + Response.Write(sb.ToString()); + HttpContext.Current.ApplicationInstance.CompleteRequest(); + } + + private void Handle3DSResponse(OrderResponse response) + { + Session["orderCode"] = response.orderCode; + Response.Clear(); + + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.AppendFormat(@""); + sb.AppendFormat("
    ", response.redirectURL); + sb.AppendFormat("", response.oneTime3DsToken); + sb.AppendFormat("", response.redirectURL); + sb.Append(""); + sb.Append("
    "); + sb.Append(""); + sb.Append(""); + + Response.Write(sb.ToString()); + HttpContext.Current.ApplicationInstance.CompleteRequest(); + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CreateOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CreateOrder.aspx.designer.cs new file mode 100644 index 0000000..ec358c2 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/CreateOrder.aspx.designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class CreateOrder { + + /// + /// aspnetForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm aspnetForm; + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// PlaceOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button PlaceOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ResponseOrderCode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseOrderCode; + + /// + /// ResponseToken control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseToken; + + /// + /// ResponsePaymentStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponsePaymentStatus; + + /// + /// ResponseJson control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseJson; + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ErrorControl.ascx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ErrorControl.ascx new file mode 100644 index 0000000..506d1c8 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ErrorControl.ascx @@ -0,0 +1,8 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ErrorControl.ascx.cs" Inherits="Worldpay.Sdk.Examples.ErrorControl" %> + + +

    Error Code:

    +

    HTTP Status:

    +

    Error Description:

    +

    Error Message:

    +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ErrorControl.ascx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ErrorControl.ascx.cs new file mode 100644 index 0000000..30fdf4b --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ErrorControl.ascx.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class ErrorControl : System.Web.UI.UserControl + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + public void DisplayError(ApiError apiError) + { + ErrorPanel.Visible = true; + ErrorCode.Text = apiError.customCode; + HttpStatus.Text = apiError.httpStatusCode.ToString(); + ErrorDescription.Text = apiError.description; + ErrorMessage.Text = apiError.message; + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ErrorControl.ascx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ErrorControl.ascx.designer.cs new file mode 100644 index 0000000..9c8ea00 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/ErrorControl.ascx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class ErrorControl { + + /// + /// ErrorPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel ErrorPanel; + + /// + /// ErrorCode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorCode; + + /// + /// HttpStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal HttpStatus; + + /// + /// ErrorDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorDescription; + + /// + /// ErrorMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ErrorMessage; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/GetOrder.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/GetOrder.aspx new file mode 100644 index 0000000..11f0026 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/GetOrder.aspx @@ -0,0 +1,25 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.GetOrder" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Get Order Example

    + + +
    +
    +
    + + +
    + + +
    + + +

    Response

    +
    +
    + + +
    diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/GetOrder.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/GetOrder.aspx.cs new file mode 100644 index 0000000..d8cfb12 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/GetOrder.aspx.cs @@ -0,0 +1,40 @@ +using System; +using System.Web.UI; +using System.Web.UI.WebControls; +using Newtonsoft.Json; +using Worldpay.Sdk; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class GetOrder : Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnGetOrder(object sender, CommandEventArgs e) + { + string orderCode = Request["orderCode"]; + if (orderCode == null) + { + throw new WorldpayException("Order code must be specified"); + } + + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + try + { + var response = client.GetOrderService().FindOrder(orderCode); + ServerResponse.Text = JavaScriptConvert.SerializeObject(response); + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/GetOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/GetOrder.aspx.designer.cs new file mode 100644 index 0000000..c1526cb --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/GetOrder.aspx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class GetOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// BtnRefundOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button BtnRefundOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Global.asax b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Global.asax new file mode 100644 index 0000000..55af080 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="Worldpay.Sdk.Examples.Global" Language="C#" %> diff --git a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Global.asax.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Global.asax.cs similarity index 91% rename from worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Global.asax.cs rename to worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Global.asax.cs index cd16d72..f7845ea 100644 --- a/worldpay-sample-dotnet-2-0/Worldpay.Sdk.Examples/Global.asax.cs +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Global.asax.cs @@ -1,49 +1,50 @@ -using System; -using System.Configuration; -using Configuration = Worldpay.Sdk.Configuration; - -namespace Worldpay.Sdk.Examples -{ - public class Global : System.Web.HttpApplication - { - - protected void Application_Start(object sender, EventArgs e) - { - - } - - protected void Session_Start(object sender, EventArgs e) - { - // Set configuration to default values - Session["apiendpoint"] = Configuration.BaseUrl; - Session["js_endpoint"] = ConfigurationManager.AppSettings["JsEndpoint"]; - Session["service_key"] = Configuration.ServiceKey; - Session["client_key"] = Configuration.ClientKey; - } - - protected void Application_BeginRequest(object sender, EventArgs e) - { - - } - - protected void Application_AuthenticateRequest(object sender, EventArgs e) - { - - } - - protected void Application_Error(object sender, EventArgs e) - { - - } - - protected void Session_End(object sender, EventArgs e) - { - - } - - protected void Application_End(object sender, EventArgs e) - { - - } - } +using System; +using System.Configuration; +using System.Net; +using Configuration = Worldpay.Sdk.Configuration; + +namespace Worldpay.Sdk.Examples +{ + public class Global : System.Web.HttpApplication + { + + protected void Application_Start(object sender, EventArgs e) + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + } + + protected void Session_Start(object sender, EventArgs e) + { + // Set configuration to default values + Session["apiendpoint"] = Configuration.BaseUrl; + Session["js_endpoint"] = ConfigurationManager.AppSettings["JsEndpoint"]; + Session["service_key"] = Configuration.ServiceKey; + Session["client_key"] = Configuration.ClientKey; + } + + protected void Application_BeginRequest(object sender, EventArgs e) + { + + } + + protected void Application_AuthenticateRequest(object sender, EventArgs e) + { + + } + + protected void Application_Error(object sender, EventArgs e) + { + + } + + protected void Session_End(object sender, EventArgs e) + { + + } + + protected void Application_End(object sender, EventArgs e) + { + + } + } } \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/JsonUtils.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/JsonUtils.cs new file mode 100644 index 0000000..e68c362 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/JsonUtils.cs @@ -0,0 +1,31 @@ +using System.Globalization; +using System.IO; +using Newtonsoft.Json; + +namespace Worldpay.Sdk.Examples +{ + /// + /// Utilities recreating functionality available in Newtonsoft.Json for .NET 3.5 + /// + public static class JsonUtils + { + /// + /// Serialize an object to JSON using pretty-print to make the response human-readable + /// + /// Object to serialize + /// JSON representing the object with indented formatting + public static string SerializeObject(object value) + { + var sw = new StringWriter(CultureInfo.InvariantCulture); + var jsonSerializer = new JsonSerializer(); + + using (JsonWriter jsonWriter = new JsonTextWriter(sw)) + { + jsonWriter.Formatting = Formatting.Indented; + jsonSerializer.Serialize(jsonWriter, value); + } + + return sw.ToString(); + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Master.Master b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Master.Master new file mode 100644 index 0000000..eaeade4 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Master.Master @@ -0,0 +1,117 @@ +<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Master.master.cs" Inherits="Worldpay.Sdk.Examples.Master" %> + + + + + + .NET Library + + + + +
    + + + + + +
    +
    +
    +

    Library Version:

    +
    + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Master.Master.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Master.Master.cs new file mode 100644 index 0000000..4f3de4b --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Master.Master.cs @@ -0,0 +1,15 @@ +using System; +using System.Diagnostics; +using System.Reflection; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class Master : System.Web.UI.MasterPage + { + protected void Page_Load(object sender, EventArgs e) + { + LibraryVersion.Text = FileVersionInfo.GetVersionInfo(Assembly.GetAssembly(typeof(OrderRequest)).Location).ProductVersion; + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Master.Master.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Master.Master.designer.cs new file mode 100644 index 0000000..fab3be7 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Master.Master.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class Master { + + /// + /// ContentPlaceHolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ContentPlaceHolder ContentPlaceHolder; + + /// + /// LibraryVersion control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal LibraryVersion; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Navbar.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Navbar.aspx new file mode 100644 index 0000000..752e45e --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Navbar.aspx @@ -0,0 +1,99 @@ + + + +
    +
    +
    + + " class='config_input'/> +
    +
    + + " class='config_input'/> +
    +
    +
    +
    + + " class='config_input'/> +
    +
    + + " class='config_input'/> +
    +
    + + +
    + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx new file mode 100644 index 0000000..e1ec00d --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx @@ -0,0 +1,28 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PartiallyRefundOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.PartiallyRefundOrder" MasterPageFile="Master.Master" %> +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Partial Refund Example

    + + +
    +
    +
    + + +
    +
    + + +
    + + +
    + + +

    Response

    +

    +
    + + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.cs new file mode 100644 index 0000000..4c6599a --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.cs @@ -0,0 +1,50 @@ +using System; +using System.Web.UI.WebControls; + +namespace Worldpay.Sdk.Examples +{ + public partial class PartiallyRefundOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnPartialRefund(object sender, CommandEventArgs e) + { + int refundAmount = 0; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + string orderCode = Request["orderCode"]; + + if (orderCode == null) + { + throw new WorldpayException("Order code must be specified"); + } + + try + { + refundAmount = Int32.Parse(Request["amount"]); + } + catch (Exception exc) { } + + try + { + client.GetOrderService().Refund(orderCode, refundAmount); + if (refundAmount == 0) + { + ServerResponse.Text = String.Format("Order {0} has been refunded for the full amount", orderCode); + } + else + { + ServerResponse.Text = String.Format("Order {0} has been refunded for {1}", orderCode, refundAmount); + } + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + } + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.designer.cs new file mode 100644 index 0000000..0f8f7db --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/PartiallyRefundOrder.aspx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class PartiallyRefundOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// RefundOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button RefundOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Properties/AssemblyInfo.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6d34d43 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +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("Worldpay.Sdk.Examples")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Worldpay.Sdk.Examples")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[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("b88c4d54-24a7-4190-a09d-684ba569176d")] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Properties/PublishProfiles/local.pubxml b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Properties/PublishProfiles/local.pubxml new file mode 100644 index 0000000..f0eb257 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Properties/PublishProfiles/local.pubxml @@ -0,0 +1,22 @@ + + + + + MSDeploy + http://localhost/Worldpay + localhost + Default Web Site/Worldpay + + True + InProc + + <_SavePWD>False + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RecurringPayment.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RecurringPayment.aspx new file mode 100644 index 0000000..f7cb515 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RecurringPayment.aspx @@ -0,0 +1,260 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RecurringPayment.aspx.cs" Inherits="Worldpay.Sdk.Examples.RecurringPayment" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + + +
    +

    .NET Library
    Recurring Payment Example

    + + +
    +
    Checkout
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    Billing address
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    Delivery address
    + +
    + + +
    +
    + + +
    +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    Other
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + +
    +
    + + +

    Response

    +

    Order Code:

    +

    Token:

    +

    Payment Status:

    +
    + +
    + + + + + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RecurringPayment.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RecurringPayment.aspx.cs new file mode 100644 index 0000000..c0fd7c8 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RecurringPayment.aspx.cs @@ -0,0 +1,182 @@ +using System; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Worldpay.Sdk; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Worldpay.Sdk.Examples +{ + public partial class RecurringPayment : Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + + if (IsPostBack) + { + RequestPanel.Visible = false; + OnCreateOrder(this, null); + } + } + + protected void OnCreateOrder(object sender, CommandEventArgs e) + { + var form = HttpContext.Current.Request.Form; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + var orderType = (OrderType)Enum.Parse(typeof(OrderType), form["orderType"]); + int? _amount = 0; + var _currencyCode = ""; + Dictionary custIdentifiers = new Dictionary(); + + try + { + if (!string.IsNullOrEmpty(form["amount"])) + { + double n; + bool isNumeric = double.TryParse(form["amount"], out n); + _amount = isNumeric ? (int)(Convert.ToDecimal(form["amount"]) * 100) : -1; + } + } + catch (Exception excAmount) { } + + try + { + _currencyCode = Enum.Parse(typeof(CurrencyCode), form["currency"]).ToString(); + } + catch (Exception excCurrency) { } + + try + { + custIdentifiers = JavaScriptConvert.DeserializeObject>(form["customer-identifiers"]); + + } + catch (Exception exc) { } + + var billingAddress = new Address() + { + address1 = form["address1"], + address2 = form["address2"], + address3 = form["address3"], + postalCode = form["postcode"], + city = form["city"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["countryCode"]).ToString() + }; + + var deliveryAddress = new DeliveryAddress() + { + firstName = form["delivery-firstName"], + lastName = form["delivery-lastName"], + address1 = form["delivery-address1"], + address2 = form["delivery-address2"], + address3 = form["delivery-address3"], + postalCode = form["delivery-postcode"], + city = form["delivery-city"], + state = "", + countryCode = Enum.Parse(typeof(CountryCode), form["delivery-countryCode"]).ToString() + }; + + var is3DS = form["3ds"] == "on" ? true : false; + ThreeDSecureInfo threeDSInfo = null; + if (is3DS) + { + var httpRequest = HttpContext.Current.Request; + threeDSInfo = new ThreeDSecureInfo() + { + shopperIpAddress = httpRequest.UserHostAddress, + shopperSessionId = HttpContext.Current.Session.SessionID, + shopperUserAgent = httpRequest.UserAgent, + shopperAcceptHeader = String.Join(";", httpRequest.AcceptTypes) + }; + } + + var request = new OrderRequest + { + token = form["token"], + orderDescription = form["description"], + statementNarrative = form["statement-narrative"], + billingAddress = billingAddress, + deliveryAddress = deliveryAddress, + amount = _amount, + currencyCode = _currencyCode, + name = is3DS && Session["mode"].Equals("test") ? "3D" : form["name"], + threeDSecureInfo = is3DS ? threeDSInfo : new ThreeDSecureInfo(), + is3DSOrder = is3DS, + customerOrderCode = form["customer-order-code"], + orderCodePrefix = form["order-code-prefix"], + orderCodeSuffix = form["order-code-suffix"], + shopperEmailAddress = form["shopper-email"], + customerIdentifiers = custIdentifiers, + authorizeOnly = form["authorizeOnly"] == "on", + orderType = orderType.ToString() + }; + + if (!string.IsNullOrEmpty(form["settlement-currency"])) + { + request.settlementCurrency = form["settlement-currency"]; + } + if (!string.IsNullOrEmpty(form["site-code"])) + { + request.siteCode = form["site-code"]; + } + + try + { + var response = client.GetOrderService().Create(request); + HandleSuccessResponse(response); + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + catch (Exception exc) + { + throw new InvalidOperationException("Error sending request with token " + request.token, exc); + } + } + + private void HandleSuccessResponse(OrderResponse response) + { + if (response.paymentStatus == OrderStatus.PRE_AUTHORIZED && response.is3DSOrder) + { + Handle3DSResponse(response); + return; + } + + ResponseOrderCode.Text = response.orderCode; + ResponseToken.Text = response.token; + ResponsePaymentStatus.Text = response.paymentStatus.ToString(); + ResponseJson.Text = JavaScriptConvert.SerializeObject(response); + SuccessPanel.Visible = true; + } + + private void Handle3DSResponse(OrderResponse response) + { + Session["orderCode"] = response.orderCode; + Response.Clear(); + + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.AppendFormat(@""); + sb.AppendFormat("
    ", response.redirectURL); + sb.AppendFormat("", response.oneTime3DsToken); + sb.AppendFormat("", response.redirectURL); + sb.Append(""); + sb.Append("
    "); + sb.Append(""); + sb.Append(""); + + Response.Write(sb.ToString()); + HttpContext.Current.ApplicationInstance.CompleteRequest(); + } + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RecurringPayment.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RecurringPayment.aspx.designer.cs new file mode 100644 index 0000000..1bbedc5 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RecurringPayment.aspx.designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class RecurringPayment { + + /// + /// aspnetForm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm aspnetForm; + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// PlaceOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button PlaceOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ResponseOrderCode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseOrderCode; + + /// + /// ResponseToken control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseToken; + + /// + /// ResponsePaymentStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponsePaymentStatus; + + /// + /// ResponseJson control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseJson; + + /// + /// OrderResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal OrderResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RefundOrder.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RefundOrder.aspx new file mode 100644 index 0000000..b283bc8 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RefundOrder.aspx @@ -0,0 +1,25 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RefundOrder.aspx.cs" Inherits="Worldpay.Sdk.Examples.RefundOrder" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Refund Example

    + + +
    +
    +
    + + +
    + + +
    + + +

    Response

    +

    +
    + + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RefundOrder.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RefundOrder.aspx.cs new file mode 100644 index 0000000..2a232a8 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RefundOrder.aspx.cs @@ -0,0 +1,36 @@ +using System; +using System.Web.UI.WebControls; + +namespace Worldpay.Sdk.Examples +{ + public partial class RefundOrder : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnRefund(object sender, CommandEventArgs e) + { + string orderCode = Request["orderCode"]; + if (orderCode == null) + { + throw new WorldpayException("Order code must be specified"); + } + + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + try + { + client.GetOrderService().Refund(orderCode); + ServerResponse.Text = String.Format("Order {0} has been refunded!", orderCode); + SuccessPanel.Visible = true; + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + } + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RefundOrder.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RefundOrder.aspx.designer.cs new file mode 100644 index 0000000..dc9dc66 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/RefundOrder.aspx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class RefundOrder { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// BtnRefundOrder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button BtnRefundOrder; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ServerResponse control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ServerResponse; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/StoredCard.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/StoredCard.aspx new file mode 100644 index 0000000..9961ed0 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/StoredCard.aspx @@ -0,0 +1,30 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StoredCard.aspx.cs" Inherits="Worldpay.Sdk.Examples.StoredCard" MasterPageFile="Master.Master" %> + +<%@ Register TagPrefix="uc" TagName="ErrorControl" Src="ErrorControl.ascx" %> + + +

    .NET Library Stored Card Details Example

    + + +
    +
    +
    + + +
    + + +
    + + +

    Response

    +

    Name:

    +

    Expiry Month:

    +

    Expiry Year:

    +

    Card Type:

    +

    Masked Card Number:

    +
    +
    + + +
    \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/StoredCard.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/StoredCard.aspx.cs new file mode 100644 index 0000000..171b748 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/StoredCard.aspx.cs @@ -0,0 +1,44 @@ +using System; +using System.Web.UI.WebControls; +using Worldpay.Sdk.Examples; +using Worldpay.Sdk.Models; +using Newtonsoft.Json; + +namespace Worldpay.Sdk.Examples +{ + public partial class StoredCard : System.Web.UI.Page + { + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + DataBind(); + } + + protected void OnShowCardDetails(object sender, CommandEventArgs e) + { + var token = Request["token"]; + var client = new WorldpayRestClient((string)Session["apiEndpoint"], (string)Session["service_key"]); + + try + { + var details = client.GetTokenService().Get(token); + HandleSuccessResponse(details); + } + catch (WorldpayException exc) + { + ErrorControl.DisplayError(exc.apiError); + } + } + + private void HandleSuccessResponse(TokenResponse details) + { + ResultName.Text = details.paymentMethod.name; + ResultMonth.Text = details.paymentMethod.expiryMonth.ToString(); + ResultYear.Text = details.paymentMethod.expiryYear.ToString(); + ResultType.Text = details.paymentMethod.cardType; + ResultCardNumber.Text = details.paymentMethod.maskedCardNumber; + ResponseJson.Text = JavaScriptConvert.SerializeObject(details); + SuccessPanel.Visible = true; + } + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/StoredCard.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/StoredCard.aspx.designer.cs new file mode 100644 index 0000000..660b298 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/StoredCard.aspx.designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples { + + + public partial class StoredCard { + + /// + /// RequestPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RequestPanel; + + /// + /// ShowCard control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button ShowCard; + + /// + /// SuccessPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SuccessPanel; + + /// + /// ResultName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultName; + + /// + /// ResultMonth control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultMonth; + + /// + /// ResultYear control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultYear; + + /// + /// ResultType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultType; + + /// + /// ResultCardNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResultCardNumber; + + /// + /// ResponseJson control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal ResponseJson; + + /// + /// ErrorControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::Worldpay.Sdk.Examples.ErrorControl ErrorControl; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Web.Debug.config b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Web.Debug.config new file mode 100644 index 0000000..2e302f9 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Web.Release.config b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Web.Release.config new file mode 100644 index 0000000..c358444 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Web.config b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Web.config new file mode 100644 index 0000000..2557944 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Web.config @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Webhook.aspx b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Webhook.aspx new file mode 100644 index 0000000..d2eea0f --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Webhook.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Webhook.aspx.cs" Inherits="Worldpay.Sdk.Examples.Webhook" %> + + + + + + + + +
    +
    + +
    +
    + + diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Webhook.aspx.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Webhook.aspx.cs new file mode 100644 index 0000000..e698ce7 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Webhook.aspx.cs @@ -0,0 +1,86 @@ +using System; +using System.IO; +using System.Web; +using Worldpay.Sdk.Enums; +using Worldpay.Sdk.Models; + +namespace Worldpay.Sdk.Examples +{ + public partial class Webhook : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + try + { + var client = new WorldpayRestClient("your service key"); + var response = client.GetWebhookService().ProcessWebhook(HttpContext.Current.Request); + + switch (response.paymentStatus) + { + case OrderStatus.SUCCESS: + // The order has been successful + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.REFUNDED: + // The order has been refunded + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.FAILED: + // The order has failed + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.SETTLED: + // The order has been settled + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.CHARGED_BACK: + // The order has been charged back + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.INFORMATION_REQUESTED: + // Information requested about the order + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.INFORMATION_SUPPLIED: + // Information has been supplied about the order + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.CHARGEBACK_REVERSED: + // The order's charge back has been reversed + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + case OrderStatus.EXPIRED: + // The order is expired + Record(response.notificationEventType, response.orderCode, response.paymentStatus); + break; + } + + Response.StatusCode = 200; + } + catch (WorldpayException exc) + { + RecordError(exc); + Response.StatusCode = 500; + Response.StatusDescription = exc.Message; + Response.End(); + } + } + + private void Record(string notificationType, string code, OrderStatus status) + { + using (var writer = new StreamWriter(new FileStream(Configuration.OrderLog, FileMode.Append))) + { + writer.WriteLine("{0}: {1} {2}", notificationType, code, status); + } + } + + private void RecordError(Exception exc) + { + using (var writer = new StreamWriter(new FileStream(Configuration.OrderLog, FileMode.Append))) + { + writer.WriteLine(exc.ToString()); + } + } + + } +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Webhook.aspx.designer.cs b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Webhook.aspx.designer.cs new file mode 100644 index 0000000..0115c7b --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Webhook.aspx.designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Worldpay.Sdk.Examples +{ + + + public partial class Webhook + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + } +} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj new file mode 100644 index 0000000..ace7a09 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples.csproj @@ -0,0 +1,263 @@ + + + + + Debug + AnyCPU + + + 2.0 + {C1E26FE7-56C2-446D-A65A-830D8747758B} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + WorldPay.Sdk.Examples + WorldPay.Sdk.Examples + v4.0 + true + + + + + True + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\ + TRACE + prompt + 4 + false + + + + + False + lib\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + False + lib\Worldpay.Sdk.dll + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + + APMCancel.aspx + ASPXCodeBehind + + + APMCancel.aspx + + + APMFailure.aspx + ASPXCodeBehind + + + APMFailure.aspx + + + APMPending.aspx + ASPXCodeBehind + + + APMPending.aspx + + + APMSuccess.aspx + ASPXCodeBehind + + + APMSuccess.aspx + + + CaptureAuthorizedOrder.aspx + ASPXCodeBehind + + + CaptureAuthorizedOrder.aspx + + + CancelAuthorizedOrder.aspx + ASPXCodeBehind + + + CancelAuthorizedOrder.aspx + + + ErrorControl.ascx + ASPXCodeBehind + + + ErrorControl.ascx + + + GetOrder.aspx + ASPXCodeBehind + + + GetOrder.aspx + + + Global.asax + + + Master.Master + ASPXCodeBehind + + + Master.Master + + + RecurringPayment.aspx + ASPXCodeBehind + + + RecurringPayment.aspx + + + StoredCard.aspx + ASPXCodeBehind + + + PartiallyRefundOrder.aspx + ASPXCodeBehind + + + StoredCard.aspx + + + PartiallyRefundOrder.aspx + + + CreateOrder.aspx + ASPXCodeBehind + + + CreateOrder.aspx + + + + RefundOrder.aspx + ASPXCodeBehind + + + RefundOrder.aspx + + + AuthorizeOrder.aspx + ASPXCodeBehind + + + AuthorizeOrder.aspx + + + ConfigurationService.asmx + Component + + + Webhook.aspx + ASPXCodeBehind + + + Webhook.aspx + + + + + + + + + Web.config + + + Web.config + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 0 + / + http://localhost:59977/ + False + False + + + False + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples20.csproj b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples20.csproj new file mode 100644 index 0000000..5675b77 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples20.csproj @@ -0,0 +1,272 @@ + + + + + Debug + AnyCPU + + + 2.0 + {C1E26FE7-56C2-446D-A65A-830D8747758B} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Worldpay.Sdk.Examples + Worldpay.Sdk.Examples + v2.0 + true + + + + + True + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + False + lib\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + APMCancel.aspx + ASPXCodeBehind + + + APMCancel.aspx + + + APMFailure.aspx + ASPXCodeBehind + + + APMFailure.aspx + + + APMPending.aspx + ASPXCodeBehind + + + APMPending.aspx + + + APMSuccess.aspx + ASPXCodeBehind + + + APMSuccess.aspx + + + AuthorizeOrder.aspx + ASPXCodeBehind + + + AuthorizeOrder.aspx + + + CancelAuthorizedOrder.aspx + ASPXCodeBehind + + + CancelAuthorizedOrder.aspx + + + CaptureAuthorizedOrder.aspx + ASPXCodeBehind + + + CaptureAuthorizedOrder.aspx + + + ConfigurationService.asmx + Component + + + CreateOrder.aspx + ASPXCodeBehind + + + CreateOrder.aspx + + + ErrorControl.ascx + ASPXCodeBehind + + + ErrorControl.ascx + + + GetOrder.aspx + ASPXCodeBehind + + + GetOrder.aspx + + + Global.asax + + + + Master.Master + ASPXCodeBehind + + + Master.Master + + + PartiallyRefundOrder.aspx + ASPXCodeBehind + + + PartiallyRefundOrder.aspx + + + + RecurringPayment.aspx + ASPXCodeBehind + + + RecurringPayment.aspx + + + RefundOrder.aspx + ASPXCodeBehind + + + RefundOrder.aspx + + + StoredCard.aspx + ASPXCodeBehind + + + StoredCard.aspx + + + Webhook.aspx + ASPXCodeBehind + + + Webhook.aspx + + + + + + + + Web.config + + + Web.config + + + + + + + + {d2ab0290-8b33-4467-a0df-975372b29e38} + Worldpay.Sdk20 + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + bin\20\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + + + + + + + True + True + 0 + / + http://localhost:59977/ + False + False + + + False + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj new file mode 100644 index 0000000..bcecfd5 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/Worldpay.Sdk.Examples35.csproj @@ -0,0 +1,274 @@ + + + + + Debug + AnyCPU + + + 2.0 + {C1E26FE7-56C2-446D-A65A-830D8747758B} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + WorldPay.Sdk.Examples + WorldPay.Sdk.Examples + v4.6 + true + + + + + True + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\ + TRACE + prompt + 4 + false + + + + False + lib\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + False + bin\Worldpay.Sdk.dll + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + + APMCancel.aspx + ASPXCodeBehind + + + APMCancel.aspx + + + APMFailure.aspx + ASPXCodeBehind + + + APMFailure.aspx + + + APMPending.aspx + ASPXCodeBehind + + + APMPending.aspx + + + APMSuccess.aspx + ASPXCodeBehind + + + APMSuccess.aspx + + + CaptureAuthorizedOrder.aspx + ASPXCodeBehind + + + CaptureAuthorizedOrder.aspx + + + CancelAuthorizedOrder.aspx + ASPXCodeBehind + + + CancelAuthorizedOrder.aspx + + + ErrorControl.ascx + ASPXCodeBehind + + + ErrorControl.ascx + + + GetOrder.aspx + ASPXCodeBehind + + + GetOrder.aspx + + + Global.asax + + + Master.Master + ASPXCodeBehind + + + Master.Master + + + RecurringPayment.aspx + ASPXCodeBehind + + + RecurringPayment.aspx + + + StoredCard.aspx + ASPXCodeBehind + + + PartiallyRefundOrder.aspx + ASPXCodeBehind + + + StoredCard.aspx + + + PartiallyRefundOrder.aspx + + + CreateOrder.aspx + ASPXCodeBehind + + + CreateOrder.aspx + + + + RefundOrder.aspx + ASPXCodeBehind + + + RefundOrder.aspx + + + AuthorizeOrder.aspx + ASPXCodeBehind + + + AuthorizeOrder.aspx + + + ConfigurationService.asmx + Component + + + Webhook.aspx + ASPXCodeBehind + + + Webhook.aspx + + + + + + + + + Web.config + Designer + + + Web.config + Designer + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + bin\35\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + false + + + + + + + + + True + True + 0 + / + http://localhost:59977/ + False + False + + + False + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/Newtonsoft.Json.dll b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/Newtonsoft.Json.dll new file mode 100644 index 0000000..78f11b9 Binary files /dev/null and b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/Newtonsoft.Json.dll differ diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll new file mode 100644 index 0000000..f1be32e Binary files /dev/null and b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll differ diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config new file mode 100644 index 0000000..2557944 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.dll.config @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb new file mode 100644 index 0000000..53b5c6c Binary files /dev/null and b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/WorldPay.Sdk.Examples.pdb differ diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll new file mode 100644 index 0000000..2103b11 Binary files /dev/null and b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.dll differ diff --git a/worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.pdb b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.pdb similarity index 100% rename from worldpay-sample-dotnet-3-5/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.pdb rename to worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/bin/Worldpay.Sdk.pdb diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/lib/Newtonsoft.Json.dll b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/lib/Newtonsoft.Json.dll new file mode 100644 index 0000000..78f11b9 Binary files /dev/null and b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/lib/Newtonsoft.Json.dll differ diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll new file mode 100644 index 0000000..ea5cd4a Binary files /dev/null and b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/lib/Worldpay.Sdk.dll differ diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/resources/style/bootstrap-combined.min.css b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/resources/style/bootstrap-combined.min.css new file mode 100644 index 0000000..f005e97 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/resources/style/bootstrap-combined.min.css @@ -0,0 +1,873 @@ +/*! + * Bootstrap v2.3.0 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ +.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0;} +.clearfix:after{clear:both;} +.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;} +.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;} +audio,canvas,video{display:inline-block;*display:inline;*zoom:1;} +audio:not([controls]){display:none;} +html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;} +a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +a:hover,a:active{outline:0;} +sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline;} +sup{top:-0.5em;} +sub{bottom:-0.25em;} +img{max-width:100%;width:auto\9;height:auto;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic;} +#map_canvas img,.google-maps img{max-width:none;} +button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle;} +button,input{*overflow:visible;line-height:normal;} +button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0;} +button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;} +label,select,button,input[type="button"],input[type="reset"],input[type="submit"],input[type="radio"],input[type="checkbox"]{cursor:pointer;} +input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield;} +input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none;} +textarea{overflow:auto;vertical-align:top;} +@media print{*{text-shadow:none !important;color:#000 !important;background:transparent !important;box-shadow:none !important;} a,a:visited{text-decoration:underline;} a[href]:after{content:" (" attr(href) ")";} abbr[title]:after{content:" (" attr(title) ")";} .ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:"";} pre,blockquote{border:1px solid #999;page-break-inside:avoid;} thead{display:table-header-group;} tr,img{page-break-inside:avoid;} img{max-width:100% !important;} @page {margin:0.5cm;}p,h2,h3{orphans:3;widows:3;} h2,h3{page-break-after:avoid;}}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333333;background-color:#ffffff;} +a{color:#0088cc;text-decoration:none;} +a:hover,a:focus{color:#005580;text-decoration:underline;} +.img-rounded{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.img-polaroid{padding:4px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);box-shadow:0 1px 3px rgba(0, 0, 0, 0.1);} +.img-circle{-webkit-border-radius:500px;-moz-border-radius:500px;border-radius:500px;} +.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";line-height:0;} +.row:after{clear:both;} +[class*="span"]{float:left;min-height:1px;margin-left:20px;} +.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px;} +.span12{width:940px;} +.span11{width:860px;} +.span10{width:780px;} +.span9{width:700px;} +.span8{width:620px;} +.span7{width:540px;} +.span6{width:460px;} +.span5{width:380px;} +.span4{width:300px;} +.span3{width:220px;} +.span2{width:140px;} +.span1{width:60px;} +.offset12{margin-left:980px;} +.offset11{margin-left:900px;} +.offset10{margin-left:820px;} +.offset9{margin-left:740px;} +.offset8{margin-left:660px;} +.offset7{margin-left:580px;} +.offset6{margin-left:500px;} +.offset5{margin-left:420px;} +.offset4{margin-left:340px;} +.offset3{margin-left:260px;} +.offset2{margin-left:180px;} +.offset1{margin-left:100px;} +.row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";line-height:0;} +.row-fluid:after{clear:both;} +.row-fluid [class*="span"]{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.127659574468085%;*margin-left:2.074468085106383%;} +.row-fluid [class*="span"]:first-child{margin-left:0;} +.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.127659574468085%;} +.row-fluid .span12{width:100%;*width:99.94680851063829%;} +.row-fluid .span11{width:91.48936170212765%;*width:91.43617021276594%;} +.row-fluid .span10{width:82.97872340425532%;*width:82.92553191489361%;} +.row-fluid .span9{width:74.46808510638297%;*width:74.41489361702126%;} +.row-fluid .span8{width:65.95744680851064%;*width:65.90425531914893%;} +.row-fluid .span7{width:57.44680851063829%;*width:57.39361702127659%;} +.row-fluid .span6{width:48.93617021276595%;*width:48.88297872340425%;} +.row-fluid .span5{width:40.42553191489362%;*width:40.37234042553192%;} +.row-fluid .span4{width:31.914893617021278%;*width:31.861702127659576%;} +.row-fluid .span3{width:23.404255319148934%;*width:23.351063829787233%;} +.row-fluid .span2{width:14.893617021276595%;*width:14.840425531914894%;} +.row-fluid .span1{width:6.382978723404255%;*width:6.329787234042553%;} +.row-fluid .offset12{margin-left:104.25531914893617%;*margin-left:104.14893617021275%;} +.row-fluid .offset12:first-child{margin-left:102.12765957446808%;*margin-left:102.02127659574467%;} +.row-fluid .offset11{margin-left:95.74468085106382%;*margin-left:95.6382978723404%;} +.row-fluid .offset11:first-child{margin-left:93.61702127659574%;*margin-left:93.51063829787232%;} +.row-fluid .offset10{margin-left:87.23404255319149%;*margin-left:87.12765957446807%;} +.row-fluid .offset10:first-child{margin-left:85.1063829787234%;*margin-left:84.99999999999999%;} +.row-fluid .offset9{margin-left:78.72340425531914%;*margin-left:78.61702127659572%;} +.row-fluid .offset9:first-child{margin-left:76.59574468085106%;*margin-left:76.48936170212764%;} +.row-fluid .offset8{margin-left:70.2127659574468%;*margin-left:70.10638297872339%;} +.row-fluid .offset8:first-child{margin-left:68.08510638297872%;*margin-left:67.9787234042553%;} +.row-fluid .offset7{margin-left:61.70212765957446%;*margin-left:61.59574468085106%;} +.row-fluid .offset7:first-child{margin-left:59.574468085106375%;*margin-left:59.46808510638297%;} +.row-fluid .offset6{margin-left:53.191489361702125%;*margin-left:53.085106382978715%;} +.row-fluid .offset6:first-child{margin-left:51.063829787234035%;*margin-left:50.95744680851063%;} +.row-fluid .offset5{margin-left:44.68085106382979%;*margin-left:44.57446808510638%;} +.row-fluid .offset5:first-child{margin-left:42.5531914893617%;*margin-left:42.4468085106383%;} +.row-fluid .offset4{margin-left:36.170212765957444%;*margin-left:36.06382978723405%;} +.row-fluid .offset4:first-child{margin-left:34.04255319148936%;*margin-left:33.93617021276596%;} +.row-fluid .offset3{margin-left:27.659574468085104%;*margin-left:27.5531914893617%;} +.row-fluid .offset3:first-child{margin-left:25.53191489361702%;*margin-left:25.425531914893618%;} +.row-fluid .offset2{margin-left:19.148936170212764%;*margin-left:19.04255319148936%;} +.row-fluid .offset2:first-child{margin-left:17.02127659574468%;*margin-left:16.914893617021278%;} +.row-fluid .offset1{margin-left:10.638297872340425%;*margin-left:10.53191489361702%;} +.row-fluid .offset1:first-child{margin-left:8.51063829787234%;*margin-left:8.404255319148938%;} +[class*="span"].hide,.row-fluid [class*="span"].hide{display:none;} +[class*="span"].pull-right,.row-fluid [class*="span"].pull-right{float:right;} +.container{margin-right:auto;margin-left:auto;*zoom:1;}.container:before,.container:after{display:table;content:"";line-height:0;} +.container:after{clear:both;} +.container-fluid{padding-right:20px;padding-left:20px;*zoom:1;}.container-fluid:before,.container-fluid:after{display:table;content:"";line-height:0;} +.container-fluid:after{clear:both;} +p{margin:0 0 10px;} +.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px;} +small{font-size:85%;} +strong{font-weight:bold;} +em{font-style:italic;} +cite{font-style:normal;} +.muted{color:#999999;} +a.muted:hover,a.muted:focus{color:#808080;} +.text-warning{color:#c09853;} +a.text-warning:hover,a.text-warning:focus{color:#a47e3c;} +.text-error{color:#b94a48;} +a.text-error:hover,a.text-error:focus{color:#953b39;} +.text-info{color:#3a87ad;} +a.text-info:hover,a.text-info:focus{color:#2d6987;} +.text-success{color:#468847;} +a.text-success:hover,a.text-success:focus{color:#356635;} +.text-left{text-align:left;} +.text-right{text-align:right;} +.text-center{text-align:center;} +h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:20px;color:inherit;text-rendering:optimizelegibility;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;line-height:1;color:#999999;} +h1,h2,h3{line-height:40px;} +h1{font-size:38.5px;} +h2{font-size:31.5px;} +h3{font-size:24.5px;} +h4{font-size:17.5px;} +h5{font-size:14px;} +h6{font-size:11.9px;} +h1 small{font-size:24.5px;} +h2 small{font-size:17.5px;} +h3 small{font-size:14px;} +h4 small{font-size:14px;} +.page-header{padding-bottom:9px;margin:20px 0 30px;border-bottom:1px solid #eeeeee;} +ul,ol{padding:0;margin:0 0 10px 25px;} +ul ul,ul ol,ol ol,ol ul{margin-bottom:0;} +li{line-height:20px;} +ul.unstyled,ol.unstyled{margin-left:0;list-style:none;} +ul.inline,ol.inline{margin-left:0;list-style:none;}ul.inline>li,ol.inline>li{display:inline-block;*display:inline;*zoom:1;padding-left:5px;padding-right:5px;} +dl{margin-bottom:20px;} +dt,dd{line-height:20px;} +dt{font-weight:bold;} +dd{margin-left:10px;} +.dl-horizontal{*zoom:1;}.dl-horizontal:before,.dl-horizontal:after{display:table;content:"";line-height:0;} +.dl-horizontal:after{clear:both;} +.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} +.dl-horizontal dd{margin-left:180px;} +hr{margin:20px 0;border:0;border-top:1px solid #eeeeee;border-bottom:1px solid #ffffff;} +abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999999;} +abbr.initialism{font-size:90%;text-transform:uppercase;} +blockquote{padding:0 0 0 15px;margin:0 0 20px;border-left:5px solid #eeeeee;}blockquote p{margin-bottom:0;font-size:17.5px;font-weight:300;line-height:1.25;} +blockquote small{display:block;line-height:20px;color:#999999;}blockquote small:before{content:'\2014 \00A0';} +blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eeeeee;border-left:0;}blockquote.pull-right p,blockquote.pull-right small{text-align:right;} +blockquote.pull-right small:before{content:'';} +blockquote.pull-right small:after{content:'\00A0 \2014';} +q:before,q:after,blockquote:before,blockquote:after{content:"";} +address{display:block;margin-bottom:20px;font-style:normal;line-height:20px;} +code,pre{padding:0 3px 2px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;color:#333333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +code{padding:2px 4px;color:#d14;background-color:#f7f7f9;border:1px solid #e1e1e8;white-space:nowrap;} +pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}pre.prettyprint{margin-bottom:20px;} +pre code{padding:0;color:inherit;white-space:pre;white-space:pre-wrap;background-color:transparent;border:0;} +.pre-scrollable{max-height:340px;overflow-y:scroll;} +.label,.badge{display:inline-block;padding:2px 4px;font-size:11.844px;font-weight:bold;line-height:14px;color:#ffffff;vertical-align:baseline;white-space:nowrap;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#999999;} +.label{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.badge{padding-left:9px;padding-right:9px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;} +.label:empty,.badge:empty{display:none;} +a.label:hover,a.label:focus,a.badge:hover,a.badge:focus{color:#ffffff;text-decoration:none;cursor:pointer;} +.label-important,.badge-important{background-color:#b94a48;} +.label-important[href],.badge-important[href]{background-color:#953b39;} +.label-warning,.badge-warning{background-color:#f89406;} +.label-warning[href],.badge-warning[href]{background-color:#c67605;} +.label-success,.badge-success{background-color:#468847;} +.label-success[href],.badge-success[href]{background-color:#356635;} +.label-info,.badge-info{background-color:#3a87ad;} +.label-info[href],.badge-info[href]{background-color:#2d6987;} +.label-inverse,.badge-inverse{background-color:#333333;} +.label-inverse[href],.badge-inverse[href]{background-color:#1a1a1a;} +.btn .label,.btn .badge{position:relative;top:-1px;} +.btn-mini .label,.btn-mini .badge{top:0;} +table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0;} +.table{width:100%;margin-bottom:20px;}.table th,.table td{padding:8px;line-height:20px;text-align:left;vertical-align:top;border-top:1px solid #dddddd;} +.table th{font-weight:bold;} +.table thead th{vertical-align:bottom;} +.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0;} +.table tbody+tbody{border-top:2px solid #dddddd;} +.table .table{background-color:#ffffff;} +.table-condensed th,.table-condensed td{padding:4px 5px;} +.table-bordered{border:1px solid #dddddd;border-collapse:separate;*border-collapse:collapse;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.table-bordered th,.table-bordered td{border-left:1px solid #dddddd;} +.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0;} +.table-bordered thead:first-child tr:first-child>th:first-child,.table-bordered tbody:first-child tr:first-child>td:first-child,.table-bordered tbody:first-child tr:first-child>th:first-child{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;} +.table-bordered thead:first-child tr:first-child>th:last-child,.table-bordered tbody:first-child tr:first-child>td:last-child,.table-bordered tbody:first-child tr:first-child>th:last-child{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;} +.table-bordered thead:last-child tr:last-child>th:first-child,.table-bordered tbody:last-child tr:last-child>td:first-child,.table-bordered tbody:last-child tr:last-child>th:first-child,.table-bordered tfoot:last-child tr:last-child>td:first-child,.table-bordered tfoot:last-child tr:last-child>th:first-child{-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.table-bordered thead:last-child tr:last-child>th:last-child,.table-bordered tbody:last-child tr:last-child>td:last-child,.table-bordered tbody:last-child tr:last-child>th:last-child,.table-bordered tfoot:last-child tr:last-child>td:last-child,.table-bordered tfoot:last-child tr:last-child>th:last-child{-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} +.table-bordered tfoot+tbody:last-child tr:last-child td:first-child{-webkit-border-bottom-left-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;} +.table-bordered tfoot+tbody:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:0;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;} +.table-bordered caption+thead tr:first-child th:first-child,.table-bordered caption+tbody tr:first-child td:first-child,.table-bordered colgroup+thead tr:first-child th:first-child,.table-bordered colgroup+tbody tr:first-child td:first-child{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;} +.table-bordered caption+thead tr:first-child th:last-child,.table-bordered caption+tbody tr:first-child td:last-child,.table-bordered colgroup+thead tr:first-child th:last-child,.table-bordered colgroup+tbody tr:first-child td:last-child{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;} +.table-striped tbody>tr:nth-child(odd)>td,.table-striped tbody>tr:nth-child(odd)>th{background-color:#f9f9f9;} +.table-hover tbody tr:hover>td,.table-hover tbody tr:hover>th{background-color:#f5f5f5;} +table td[class*="span"],table th[class*="span"],.row-fluid table td[class*="span"],.row-fluid table th[class*="span"]{display:table-cell;float:none;margin-left:0;} +.table td.span1,.table th.span1{float:none;width:44px;margin-left:0;} +.table td.span2,.table th.span2{float:none;width:124px;margin-left:0;} +.table td.span3,.table th.span3{float:none;width:204px;margin-left:0;} +.table td.span4,.table th.span4{float:none;width:284px;margin-left:0;} +.table td.span5,.table th.span5{float:none;width:364px;margin-left:0;} +.table td.span6,.table th.span6{float:none;width:444px;margin-left:0;} +.table td.span7,.table th.span7{float:none;width:524px;margin-left:0;} +.table td.span8,.table th.span8{float:none;width:604px;margin-left:0;} +.table td.span9,.table th.span9{float:none;width:684px;margin-left:0;} +.table td.span10,.table th.span10{float:none;width:764px;margin-left:0;} +.table td.span11,.table th.span11{float:none;width:844px;margin-left:0;} +.table td.span12,.table th.span12{float:none;width:924px;margin-left:0;} +.table tbody tr.success>td{background-color:#dff0d8;} +.table tbody tr.error>td{background-color:#f2dede;} +.table tbody tr.warning>td{background-color:#fcf8e3;} +.table tbody tr.info>td{background-color:#d9edf7;} +.table-hover tbody tr.success:hover>td{background-color:#d0e9c6;} +.table-hover tbody tr.error:hover>td{background-color:#ebcccc;} +.table-hover tbody tr.warning:hover>td{background-color:#faf2cc;} +.table-hover tbody tr.info:hover>td{background-color:#c4e3f3;} +form{margin:0 0 20px;} +fieldset{padding:0;margin:0;border:0;} +legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333333;border:0;border-bottom:1px solid #e5e5e5;}legend small{font-size:15px;color:#999999;} +label,input,button,select,textarea{font-size:14px;font-weight:normal;line-height:20px;} +input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;} +label{display:block;margin-bottom:5px;} +select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:20px;padding:4px 6px;margin-bottom:10px;font-size:14px;line-height:20px;color:#555555;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;vertical-align:middle;} +input,textarea,.uneditable-input{width:206px;} +textarea{height:auto;} +textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#ffffff;border:1px solid #cccccc;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-webkit-transition:border linear .2s, box-shadow linear .2s;-moz-transition:border linear .2s, box-shadow linear .2s;-o-transition:border linear .2s, box-shadow linear .2s;transition:border linear .2s, box-shadow linear .2s;}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82, 168, 236, 0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);} +input[type="radio"],input[type="checkbox"]{margin:4px 0 0;*margin-top:0;margin-top:1px \9;line-height:normal;} +input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto;} +select,input[type="file"]{height:30px;*margin-top:4px;line-height:30px;} +select{width:220px;border:1px solid #cccccc;background-color:#ffffff;} +select[multiple],select[size]{height:auto;} +select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +.uneditable-input,.uneditable-textarea{color:#999999;background-color:#fcfcfc;border-color:#cccccc;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;} +.uneditable-input{overflow:hidden;white-space:nowrap;} +.uneditable-textarea{width:auto;height:auto;} +input:-moz-placeholder,textarea:-moz-placeholder{color:#999999;} +input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#999999;} +input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#999999;} +.radio,.checkbox{min-height:20px;padding-left:20px;} +.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-20px;} +.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px;} +.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle;} +.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px;} +.input-mini{width:60px;} +.input-small{width:90px;} +.input-medium{width:150px;} +.input-large{width:210px;} +.input-xlarge{width:270px;} +.input-xxlarge{width:530px;} +input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0;} +.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block;} +input,textarea,.uneditable-input{margin-left:0;} +.controls-row [class*="span"]+[class*="span"]{margin-left:20px;} +input.span12,textarea.span12,.uneditable-input.span12{width:926px;} +input.span11,textarea.span11,.uneditable-input.span11{width:846px;} +input.span10,textarea.span10,.uneditable-input.span10{width:766px;} +input.span9,textarea.span9,.uneditable-input.span9{width:686px;} +input.span8,textarea.span8,.uneditable-input.span8{width:606px;} +input.span7,textarea.span7,.uneditable-input.span7{width:526px;} +input.span6,textarea.span6,.uneditable-input.span6{width:446px;} +input.span5,textarea.span5,.uneditable-input.span5{width:366px;} +input.span4,textarea.span4,.uneditable-input.span4{width:286px;} +input.span3,textarea.span3,.uneditable-input.span3{width:206px;} +input.span2,textarea.span2,.uneditable-input.span2{width:126px;} +input.span1,textarea.span1,.uneditable-input.span1{width:46px;} +.controls-row{*zoom:1;}.controls-row:before,.controls-row:after{display:table;content:"";line-height:0;} +.controls-row:after{clear:both;} +.controls-row [class*="span"],.row-fluid .controls-row [class*="span"]{float:left;} +.controls-row .checkbox[class*="span"],.controls-row .radio[class*="span"]{padding-top:5px;} +input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eeeeee;} +input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent;} +.control-group.warning .control-label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853;} +.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853;} +.control-group.warning input,.control-group.warning select,.control-group.warning textarea{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;} +.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853;} +.control-group.error .control-label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48;} +.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48;} +.control-group.error input,.control-group.error select,.control-group.error textarea{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;} +.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48;} +.control-group.success .control-label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847;} +.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847;} +.control-group.success input,.control-group.success select,.control-group.success textarea{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;} +.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847;} +.control-group.info .control-label,.control-group.info .help-block,.control-group.info .help-inline{color:#3a87ad;} +.control-group.info .checkbox,.control-group.info .radio,.control-group.info input,.control-group.info select,.control-group.info textarea{color:#3a87ad;} +.control-group.info input,.control-group.info select,.control-group.info textarea{border-color:#3a87ad;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.control-group.info input:focus,.control-group.info select:focus,.control-group.info textarea:focus{border-color:#2d6987;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7ab5d3;-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7ab5d3;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7ab5d3;} +.control-group.info .input-prepend .add-on,.control-group.info .input-append .add-on{color:#3a87ad;background-color:#d9edf7;border-color:#3a87ad;} +input:focus:invalid,textarea:focus:invalid,select:focus:invalid{color:#b94a48;border-color:#ee5f5b;}input:focus:invalid:focus,textarea:focus:invalid:focus,select:focus:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7;} +.form-actions{padding:19px 20px 20px;margin-top:20px;margin-bottom:20px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1;}.form-actions:before,.form-actions:after{display:table;content:"";line-height:0;} +.form-actions:after{clear:both;} +.help-block,.help-inline{color:#595959;} +.help-block{display:block;margin-bottom:10px;} +.help-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;padding-left:5px;} +.input-append,.input-prepend{display:inline-block;margin-bottom:10px;vertical-align:middle;font-size:0;white-space:nowrap;}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input,.input-append .dropdown-menu,.input-prepend .dropdown-menu,.input-append .popover,.input-prepend .popover{font-size:14px;} +.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;vertical-align:top;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2;} +.input-append .add-on,.input-prepend .add-on{display:inline-block;width:auto;height:20px;min-width:16px;padding:4px 5px;font-size:14px;font-weight:normal;line-height:20px;text-align:center;text-shadow:0 1px 0 #ffffff;background-color:#eeeeee;border:1px solid #ccc;} +.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn,.input-append .btn-group>.dropdown-toggle,.input-prepend .btn-group>.dropdown-toggle{vertical-align:top;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546;} +.input-prepend .add-on,.input-prepend .btn{margin-right:-1px;} +.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} +.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;}.input-append input+.btn-group .btn:last-child,.input-append select+.btn-group .btn:last-child,.input-append .uneditable-input+.btn-group .btn:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.input-append .add-on,.input-append .btn,.input-append .btn-group{margin-left:-1px;} +.input-append .add-on:last-child,.input-append .btn:last-child,.input-append .btn-group:last-child>.dropdown-toggle{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}.input-prepend.input-append input+.btn-group .btn,.input-prepend.input-append select+.btn-group .btn,.input-prepend.input-append .uneditable-input+.btn-group .btn{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} +.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.input-prepend.input-append .btn-group:first-child{margin-left:0;} +input.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} +.form-search .input-append .search-query,.form-search .input-prepend .search-query{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.form-search .input-append .search-query{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px;} +.form-search .input-append .btn{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0;} +.form-search .input-prepend .search-query{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0;} +.form-search .input-prepend .btn{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px;} +.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;*zoom:1;margin-bottom:0;vertical-align:middle;} +.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none;} +.form-search label,.form-inline label,.form-search .btn-group,.form-inline .btn-group{display:inline-block;} +.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0;} +.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle;} +.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0;} +.control-group{margin-bottom:10px;} +legend+.control-group{margin-top:20px;-webkit-margin-top-collapse:separate;} +.form-horizontal .control-group{margin-bottom:20px;*zoom:1;}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;content:"";line-height:0;} +.form-horizontal .control-group:after{clear:both;} +.form-horizontal .control-label{float:left;width:160px;padding-top:5px;text-align:right;} +.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:180px;*margin-left:0;}.form-horizontal .controls:first-child{*padding-left:180px;} +.form-horizontal .help-block{margin-bottom:0;} +.form-horizontal input+.help-block,.form-horizontal select+.help-block,.form-horizontal textarea+.help-block,.form-horizontal .uneditable-input+.help-block,.form-horizontal .input-prepend+.help-block,.form-horizontal .input-append+.help-block{margin-top:10px;} +.form-horizontal .form-actions{padding-left:180px;} +.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333333;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top, #ffffff, #e6e6e6);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));background-image:-webkit-linear-gradient(top, #ffffff, #e6e6e6);background-image:-o-linear-gradient(top, #ffffff, #e6e6e6);background-image:linear-gradient(to bottom, #ffffff, #e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);border:1px solid #cccccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333333;background-color:#e6e6e6;*background-color:#d9d9d9;} +.btn:active,.btn.active{background-color:#cccccc \9;} +.btn:first-child{*margin-left:0;} +.btn:hover,.btn:focus{color:#333333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position 0.1s linear;-moz-transition:background-position 0.1s linear;-o-transition:background-position 0.1s linear;transition:background-position 0.1s linear;} +.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} +.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:0.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px;} +.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0;} +.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px;} +.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} +.btn-block+.btn-block{margin-top:5px;} +input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%;} +.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255, 255, 255, 0.75);} +.btn-primary{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#006dcc;background-image:-moz-linear-gradient(top, #0088cc, #0044cc);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));background-image:-webkit-linear-gradient(top, #0088cc, #0044cc);background-image:-o-linear-gradient(top, #0088cc, #0044cc);background-image:linear-gradient(to bottom, #0088cc, #0044cc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);border-color:#0044cc #0044cc #002a80;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#0044cc;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#ffffff;background-color:#0044cc;*background-color:#003bb3;} +.btn-primary:active,.btn-primary.active{background-color:#003399 \9;} +.btn-warning{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(to bottom, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{color:#ffffff;background-color:#f89406;*background-color:#df8505;} +.btn-warning:active,.btn-warning.active{background-color:#c67605 \9;} +.btn-danger{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#da4f49;background-image:-moz-linear-gradient(top, #ee5f5b, #bd362f);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));background-image:-webkit-linear-gradient(top, #ee5f5b, #bd362f);background-image:-o-linear-gradient(top, #ee5f5b, #bd362f);background-image:linear-gradient(to bottom, #ee5f5b, #bd362f);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);border-color:#bd362f #bd362f #802420;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#bd362f;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{color:#ffffff;background-color:#bd362f;*background-color:#a9302a;} +.btn-danger:active,.btn-danger.active{background-color:#942a25 \9;} +.btn-success{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#5bb75b;background-image:-moz-linear-gradient(top, #62c462, #51a351);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));background-image:-webkit-linear-gradient(top, #62c462, #51a351);background-image:-o-linear-gradient(top, #62c462, #51a351);background-image:linear-gradient(to bottom, #62c462, #51a351);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0);border-color:#51a351 #51a351 #387038;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#51a351;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{color:#ffffff;background-color:#51a351;*background-color:#499249;} +.btn-success:active,.btn-success.active{background-color:#408140 \9;} +.btn-info{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#49afcd;background-image:-moz-linear-gradient(top, #5bc0de, #2f96b4);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4));background-image:-webkit-linear-gradient(top, #5bc0de, #2f96b4);background-image:-o-linear-gradient(top, #5bc0de, #2f96b4);background-image:linear-gradient(to bottom, #5bc0de, #2f96b4);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f96b4', GradientType=0);border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#2f96b4;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{color:#ffffff;background-color:#2f96b4;*background-color:#2a85a0;} +.btn-info:active,.btn-info.active{background-color:#24748c \9;} +.btn-inverse{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#363636;background-image:-moz-linear-gradient(top, #444444, #222222);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#444444), to(#222222));background-image:-webkit-linear-gradient(top, #444444, #222222);background-image:-o-linear-gradient(top, #444444, #222222);background-image:linear-gradient(to bottom, #444444, #222222);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444', endColorstr='#ff222222', GradientType=0);border-color:#222222 #222222 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#222222;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-inverse:hover,.btn-inverse:focus,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{color:#ffffff;background-color:#222222;*background-color:#151515;} +.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9;} +button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px;}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0;} +button.btn.btn-large,input[type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px;} +button.btn.btn-small,input[type="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px;} +button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px;} +.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +.btn-link{border-color:transparent;cursor:pointer;color:#0088cc;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.btn-link:hover,.btn-link:focus{color:#005580;text-decoration:underline;background-color:transparent;} +.btn-link[disabled]:hover,.btn-link[disabled]:focus{color:#333333;text-decoration:none;} +[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat;margin-top:1px;} +.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:focus>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>li>a:focus>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:focus>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"],.dropdown-submenu:focus>a>[class*=" icon-"]{background-image:url("../img/glyphicons-halflings-white.png");} +.icon-glass{background-position:0 0;} +.icon-music{background-position:-24px 0;} +.icon-search{background-position:-48px 0;} +.icon-envelope{background-position:-72px 0;} +.icon-heart{background-position:-96px 0;} +.icon-star{background-position:-120px 0;} +.icon-star-empty{background-position:-144px 0;} +.icon-user{background-position:-168px 0;} +.icon-film{background-position:-192px 0;} +.icon-th-large{background-position:-216px 0;} +.icon-th{background-position:-240px 0;} +.icon-th-list{background-position:-264px 0;} +.icon-ok{background-position:-288px 0;} +.icon-remove{background-position:-312px 0;} +.icon-zoom-in{background-position:-336px 0;} +.icon-zoom-out{background-position:-360px 0;} +.icon-off{background-position:-384px 0;} +.icon-signal{background-position:-408px 0;} +.icon-cog{background-position:-432px 0;} +.icon-trash{background-position:-456px 0;} +.icon-home{background-position:0 -24px;} +.icon-file{background-position:-24px -24px;} +.icon-time{background-position:-48px -24px;} +.icon-road{background-position:-72px -24px;} +.icon-download-alt{background-position:-96px -24px;} +.icon-download{background-position:-120px -24px;} +.icon-upload{background-position:-144px -24px;} +.icon-inbox{background-position:-168px -24px;} +.icon-play-circle{background-position:-192px -24px;} +.icon-repeat{background-position:-216px -24px;} +.icon-refresh{background-position:-240px -24px;} +.icon-list-alt{background-position:-264px -24px;} +.icon-lock{background-position:-287px -24px;} +.icon-flag{background-position:-312px -24px;} +.icon-headphones{background-position:-336px -24px;} +.icon-volume-off{background-position:-360px -24px;} +.icon-volume-down{background-position:-384px -24px;} +.icon-volume-up{background-position:-408px -24px;} +.icon-qrcode{background-position:-432px -24px;} +.icon-barcode{background-position:-456px -24px;} +.icon-tag{background-position:0 -48px;} +.icon-tags{background-position:-25px -48px;} +.icon-book{background-position:-48px -48px;} +.icon-bookmark{background-position:-72px -48px;} +.icon-print{background-position:-96px -48px;} +.icon-camera{background-position:-120px -48px;} +.icon-font{background-position:-144px -48px;} +.icon-bold{background-position:-167px -48px;} +.icon-italic{background-position:-192px -48px;} +.icon-text-height{background-position:-216px -48px;} +.icon-text-width{background-position:-240px -48px;} +.icon-align-left{background-position:-264px -48px;} +.icon-align-center{background-position:-288px -48px;} +.icon-align-right{background-position:-312px -48px;} +.icon-align-justify{background-position:-336px -48px;} +.icon-list{background-position:-360px -48px;} +.icon-indent-left{background-position:-384px -48px;} +.icon-indent-right{background-position:-408px -48px;} +.icon-facetime-video{background-position:-432px -48px;} +.icon-picture{background-position:-456px -48px;} +.icon-pencil{background-position:0 -72px;} +.icon-map-marker{background-position:-24px -72px;} +.icon-adjust{background-position:-48px -72px;} +.icon-tint{background-position:-72px -72px;} +.icon-edit{background-position:-96px -72px;} +.icon-share{background-position:-120px -72px;} +.icon-check{background-position:-144px -72px;} +.icon-move{background-position:-168px -72px;} +.icon-step-backward{background-position:-192px -72px;} +.icon-fast-backward{background-position:-216px -72px;} +.icon-backward{background-position:-240px -72px;} +.icon-play{background-position:-264px -72px;} +.icon-pause{background-position:-288px -72px;} +.icon-stop{background-position:-312px -72px;} +.icon-forward{background-position:-336px -72px;} +.icon-fast-forward{background-position:-360px -72px;} +.icon-step-forward{background-position:-384px -72px;} +.icon-eject{background-position:-408px -72px;} +.icon-chevron-left{background-position:-432px -72px;} +.icon-chevron-right{background-position:-456px -72px;} +.icon-plus-sign{background-position:0 -96px;} +.icon-minus-sign{background-position:-24px -96px;} +.icon-remove-sign{background-position:-48px -96px;} +.icon-ok-sign{background-position:-72px -96px;} +.icon-question-sign{background-position:-96px -96px;} +.icon-info-sign{background-position:-120px -96px;} +.icon-screenshot{background-position:-144px -96px;} +.icon-remove-circle{background-position:-168px -96px;} +.icon-ok-circle{background-position:-192px -96px;} +.icon-ban-circle{background-position:-216px -96px;} +.icon-arrow-left{background-position:-240px -96px;} +.icon-arrow-right{background-position:-264px -96px;} +.icon-arrow-up{background-position:-289px -96px;} +.icon-arrow-down{background-position:-312px -96px;} +.icon-share-alt{background-position:-336px -96px;} +.icon-resize-full{background-position:-360px -96px;} +.icon-resize-small{background-position:-384px -96px;} +.icon-plus{background-position:-408px -96px;} +.icon-minus{background-position:-433px -96px;} +.icon-asterisk{background-position:-456px -96px;} +.icon-exclamation-sign{background-position:0 -120px;} +.icon-gift{background-position:-24px -120px;} +.icon-leaf{background-position:-48px -120px;} +.icon-fire{background-position:-72px -120px;} +.icon-eye-open{background-position:-96px -120px;} +.icon-eye-close{background-position:-120px -120px;} +.icon-warning-sign{background-position:-144px -120px;} +.icon-plane{background-position:-168px -120px;} +.icon-calendar{background-position:-192px -120px;} +.icon-random{background-position:-216px -120px;width:16px;} +.icon-comment{background-position:-240px -120px;} +.icon-magnet{background-position:-264px -120px;} +.icon-chevron-up{background-position:-288px -120px;} +.icon-chevron-down{background-position:-313px -119px;} +.icon-retweet{background-position:-336px -120px;} +.icon-shopping-cart{background-position:-360px -120px;} +.icon-folder-close{background-position:-384px -120px;width:16px;} +.icon-folder-open{background-position:-408px -120px;width:16px;} +.icon-resize-vertical{background-position:-432px -119px;} +.icon-resize-horizontal{background-position:-456px -118px;} +.icon-hdd{background-position:0 -144px;} +.icon-bullhorn{background-position:-24px -144px;} +.icon-bell{background-position:-48px -144px;} +.icon-certificate{background-position:-72px -144px;} +.icon-thumbs-up{background-position:-96px -144px;} +.icon-thumbs-down{background-position:-120px -144px;} +.icon-hand-right{background-position:-144px -144px;} +.icon-hand-left{background-position:-168px -144px;} +.icon-hand-up{background-position:-192px -144px;} +.icon-hand-down{background-position:-216px -144px;} +.icon-circle-arrow-right{background-position:-240px -144px;} +.icon-circle-arrow-left{background-position:-264px -144px;} +.icon-circle-arrow-up{background-position:-288px -144px;} +.icon-circle-arrow-down{background-position:-312px -144px;} +.icon-globe{background-position:-336px -144px;} +.icon-wrench{background-position:-360px -144px;} +.icon-tasks{background-position:-384px -144px;} +.icon-filter{background-position:-408px -144px;} +.icon-briefcase{background-position:-432px -144px;} +.icon-fullscreen{background-position:-456px -144px;} +.btn-group{position:relative;display:inline-block;*display:inline;*zoom:1;font-size:0;vertical-align:middle;white-space:nowrap;*margin-left:.3em;}.btn-group:first-child{*margin-left:0;} +.btn-group+.btn-group{margin-left:5px;} +.btn-toolbar{font-size:0;margin-top:10px;margin-bottom:10px;}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group{margin-left:5px;} +.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.btn-group>.btn+.btn{margin-left:-1px;} +.btn-group>.btn,.btn-group>.dropdown-menu,.btn-group>.popover{font-size:14px;} +.btn-group>.btn-mini{font-size:10.5px;} +.btn-group>.btn-small{font-size:11.9px;} +.btn-group>.btn-large{font-size:17.5px;} +.btn-group>.btn:first-child{margin-left:0;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} +.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-top-left-radius:6px;-moz-border-radius-topleft:6px;border-top-left-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomleft:6px;border-bottom-left-radius:6px;} +.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;-moz-border-radius-bottomright:6px;border-bottom-right-radius:6px;} +.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2;} +.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0;} +.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);*padding-top:5px;*padding-bottom:5px;} +.btn-group>.btn-mini+.dropdown-toggle{padding-left:5px;padding-right:5px;*padding-top:2px;*padding-bottom:2px;} +.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px;} +.btn-group>.btn-large+.dropdown-toggle{padding-left:12px;padding-right:12px;*padding-top:7px;*padding-bottom:7px;} +.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} +.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6;} +.btn-group.open .btn-primary.dropdown-toggle{background-color:#0044cc;} +.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406;} +.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f;} +.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351;} +.btn-group.open .btn-info.dropdown-toggle{background-color:#2f96b4;} +.btn-group.open .btn-inverse.dropdown-toggle{background-color:#222222;} +.btn .caret{margin-top:8px;margin-left:0;} +.btn-large .caret{margin-top:6px;} +.btn-large .caret{border-left-width:5px;border-right-width:5px;border-top-width:5px;} +.btn-mini .caret,.btn-small .caret{margin-top:8px;} +.dropup .btn-large .caret{border-bottom-width:5px;} +.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} +.btn-group-vertical{display:inline-block;*display:inline;*zoom:1;} +.btn-group-vertical>.btn{display:block;float:none;max-width:100%;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.btn-group-vertical>.btn+.btn{margin-left:0;margin-top:-1px;} +.btn-group-vertical>.btn:first-child{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;} +.btn-group-vertical>.btn:last-child{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;} +.btn-group-vertical>.btn-large:first-child{-webkit-border-radius:6px 6px 0 0;-moz-border-radius:6px 6px 0 0;border-radius:6px 6px 0 0;} +.btn-group-vertical>.btn-large:last-child{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;} +.nav{margin-left:0;margin-bottom:20px;list-style:none;} +.nav>li>a{display:block;} +.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eeeeee;} +.nav>li>a>img{max-width:none;} +.nav>.pull-right{float:right;} +.nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:20px;color:#999999;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);text-transform:uppercase;} +.nav li+.nav-header{margin-top:9px;} +.nav-list{padding-left:15px;padding-right:15px;margin-bottom:0;} +.nav-list>li>a,.nav-list .nav-header{margin-left:-15px;margin-right:-15px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);} +.nav-list>li>a{padding:3px 15px;} +.nav-list>.active>a,.nav-list>.active>a:hover,.nav-list>.active>a:focus{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.2);background-color:#0088cc;} +.nav-list [class^="icon-"],.nav-list [class*=" icon-"]{margin-right:2px;} +.nav-list .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #ffffff;} +.nav-tabs,.nav-pills{*zoom:1;}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;content:"";line-height:0;} +.nav-tabs:after,.nav-pills:after{clear:both;} +.nav-tabs>li,.nav-pills>li{float:left;} +.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px;} +.nav-tabs{border-bottom:1px solid #ddd;} +.nav-tabs>li{margin-bottom:-1px;} +.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:20px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;}.nav-tabs>li>a:hover,.nav-tabs>li>a:focus{border-color:#eeeeee #eeeeee #dddddd;} +.nav-tabs>.active>a,.nav-tabs>.active>a:hover,.nav-tabs>.active>a:focus{color:#555555;background-color:#ffffff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default;} +.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;} +.nav-pills>.active>a,.nav-pills>.active>a:hover,.nav-pills>.active>a:focus{color:#ffffff;background-color:#0088cc;} +.nav-stacked>li{float:none;} +.nav-stacked>li>a{margin-right:0;} +.nav-tabs.nav-stacked{border-bottom:0;} +.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;} +.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.nav-tabs.nav-stacked>li>a:hover,.nav-tabs.nav-stacked>li>a:focus{border-color:#ddd;z-index:2;} +.nav-pills.nav-stacked>li>a{margin-bottom:3px;} +.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px;} +.nav-tabs .dropdown-menu{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;} +.nav-pills .dropdown-menu{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.nav .dropdown-toggle .caret{border-top-color:#0088cc;border-bottom-color:#0088cc;margin-top:6px;} +.nav .dropdown-toggle:hover .caret,.nav .dropdown-toggle:focus .caret{border-top-color:#005580;border-bottom-color:#005580;} +.nav-tabs .dropdown-toggle .caret{margin-top:8px;} +.nav .active .dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff;} +.nav-tabs .active .dropdown-toggle .caret{border-top-color:#555555;border-bottom-color:#555555;} +.nav>.dropdown.active>a:hover,.nav>.dropdown.active>a:focus{cursor:pointer;} +.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover,.nav>li.dropdown.open.active>a:focus{color:#ffffff;background-color:#999999;border-color:#999999;} +.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret,.nav li.dropdown.open a:focus .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;opacity:1;filter:alpha(opacity=100);} +.tabs-stacked .open>a:hover,.tabs-stacked .open>a:focus{border-color:#999999;} +.tabbable{*zoom:1;}.tabbable:before,.tabbable:after{display:table;content:"";line-height:0;} +.tabbable:after{clear:both;} +.tab-content{overflow:auto;} +.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0;} +.tab-content>.tab-pane,.pill-content>.pill-pane{display:none;} +.tab-content>.active,.pill-content>.active{display:block;} +.tabs-below>.nav-tabs{border-top:1px solid #ddd;} +.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0;} +.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;}.tabs-below>.nav-tabs>li>a:hover,.tabs-below>.nav-tabs>li>a:focus{border-bottom-color:transparent;border-top-color:#ddd;} +.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover,.tabs-below>.nav-tabs>.active>a:focus{border-color:transparent #ddd #ddd #ddd;} +.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none;} +.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px;} +.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd;} +.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} +.tabs-left>.nav-tabs>li>a:hover,.tabs-left>.nav-tabs>li>a:focus{border-color:#eeeeee #dddddd #eeeeee #eeeeee;} +.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover,.tabs-left>.nav-tabs .active>a:focus{border-color:#ddd transparent #ddd #ddd;*border-right-color:#ffffff;} +.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd;} +.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.tabs-right>.nav-tabs>li>a:hover,.tabs-right>.nav-tabs>li>a:focus{border-color:#eeeeee #eeeeee #eeeeee #dddddd;} +.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover,.tabs-right>.nav-tabs .active>a:focus{border-color:#ddd #ddd #ddd transparent;*border-left-color:#ffffff;} +.nav>.disabled>a{color:#999999;} +.nav>.disabled>a:hover,.nav>.disabled>a:focus{text-decoration:none;background-color:transparent;cursor:default;} +.navbar{overflow:visible;margin-bottom:20px;*position:relative;*z-index:2;} +.navbar-inner{min-height:40px;padding-left:20px;padding-right:20px;background-color:#fafafa;background-image:-moz-linear-gradient(top, #ffffff, #f2f2f2);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2));background-image:-webkit-linear-gradient(top, #ffffff, #f2f2f2);background-image:-o-linear-gradient(top, #ffffff, #f2f2f2);background-image:linear-gradient(to bottom, #ffffff, #f2f2f2);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);border:1px solid #d4d4d4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.065);-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.065);box-shadow:0 1px 4px rgba(0, 0, 0, 0.065);*zoom:1;}.navbar-inner:before,.navbar-inner:after{display:table;content:"";line-height:0;} +.navbar-inner:after{clear:both;} +.navbar .container{width:auto;} +.nav-collapse.collapse{height:auto;overflow:visible;} +.navbar .brand{float:left;display:block;padding:10px 20px 10px;margin-left:-20px;font-size:20px;font-weight:200;color:#777777;text-shadow:0 1px 0 #ffffff;}.navbar .brand:hover,.navbar .brand:focus{text-decoration:none;} +.navbar-text{margin-bottom:0;line-height:40px;color:#777777;} +.navbar-link{color:#777777;}.navbar-link:hover,.navbar-link:focus{color:#333333;} +.navbar .divider-vertical{height:40px;margin:0 9px;border-left:1px solid #f2f2f2;border-right:1px solid #ffffff;} +.navbar .btn,.navbar .btn-group{margin-top:5px;} +.navbar .btn-group .btn,.navbar .input-prepend .btn,.navbar .input-append .btn,.navbar .input-prepend .btn-group,.navbar .input-append .btn-group{margin-top:0;} +.navbar-form{margin-bottom:0;*zoom:1;}.navbar-form:before,.navbar-form:after{display:table;content:"";line-height:0;} +.navbar-form:after{clear:both;} +.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px;} +.navbar-form input,.navbar-form select,.navbar-form .btn{display:inline-block;margin-bottom:0;} +.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px;} +.navbar-form .input-append,.navbar-form .input-prepend{margin-top:5px;white-space:nowrap;}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0;} +.navbar-search{position:relative;float:left;margin-top:5px;margin-bottom:0;}.navbar-search .search-query{margin-bottom:0;padding:4px 14px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} +.navbar-static-top{position:static;margin-bottom:0;}.navbar-static-top .navbar-inner{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0;} +.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{border-width:0 0 1px;} +.navbar-fixed-bottom .navbar-inner{border-width:1px 0 0;} +.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-left:0;padding-right:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px;} +.navbar-fixed-top{top:0;} +.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{-webkit-box-shadow:0 1px 10px rgba(0,0,0,.1);-moz-box-shadow:0 1px 10px rgba(0,0,0,.1);box-shadow:0 1px 10px rgba(0,0,0,.1);} +.navbar-fixed-bottom{bottom:0;}.navbar-fixed-bottom .navbar-inner{-webkit-box-shadow:0 -1px 10px rgba(0,0,0,.1);-moz-box-shadow:0 -1px 10px rgba(0,0,0,.1);box-shadow:0 -1px 10px rgba(0,0,0,.1);} +.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0;} +.navbar .nav.pull-right{float:right;margin-right:0;} +.navbar .nav>li{float:left;} +.navbar .nav>li>a{float:none;padding:10px 15px 10px;color:#777777;text-decoration:none;text-shadow:0 1px 0 #ffffff;} +.navbar .nav .dropdown-toggle .caret{margin-top:8px;} +.navbar .nav>li>a:focus,.navbar .nav>li>a:hover{background-color:transparent;color:#333333;text-decoration:none;} +.navbar .nav>.active>a,.navbar .nav>.active>a:hover,.navbar .nav>.active>a:focus{color:#555555;text-decoration:none;background-color:#e5e5e5;-webkit-box-shadow:inset 0 3px 8px rgba(0, 0, 0, 0.125);-moz-box-shadow:inset 0 3px 8px rgba(0, 0, 0, 0.125);box-shadow:inset 0 3px 8px rgba(0, 0, 0, 0.125);} +.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-left:5px;margin-right:5px;color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#ededed;background-image:-moz-linear-gradient(top, #f2f2f2, #e5e5e5);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f2f2f2), to(#e5e5e5));background-image:-webkit-linear-gradient(top, #f2f2f2, #e5e5e5);background-image:-o-linear-gradient(top, #f2f2f2, #e5e5e5);background-image:linear-gradient(to bottom, #f2f2f2, #e5e5e5);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffe5e5e5', GradientType=0);border-color:#e5e5e5 #e5e5e5 #bfbfbf;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#e5e5e5;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);}.navbar .btn-navbar:hover,.navbar .btn-navbar:focus,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{color:#ffffff;background-color:#e5e5e5;*background-color:#d9d9d9;} +.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#cccccc \9;} +.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);-moz-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);} +.btn-navbar .icon-bar+.icon-bar{margin-top:3px;} +.navbar .nav>li>.dropdown-menu:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0, 0, 0, 0.2);position:absolute;top:-7px;left:9px;} +.navbar .nav>li>.dropdown-menu:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #ffffff;position:absolute;top:-6px;left:10px;} +.navbar-fixed-bottom .nav>li>.dropdown-menu:before{border-top:7px solid #ccc;border-top-color:rgba(0, 0, 0, 0.2);border-bottom:0;bottom:-7px;top:auto;} +.navbar-fixed-bottom .nav>li>.dropdown-menu:after{border-top:6px solid #ffffff;border-bottom:0;bottom:-6px;top:auto;} +.navbar .nav li.dropdown>a:hover .caret,.navbar .nav li.dropdown>a:focus .caret{border-top-color:#333333;border-bottom-color:#333333;} +.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{background-color:#e5e5e5;color:#555555;} +.navbar .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#777777;border-bottom-color:#777777;} +.navbar .nav li.dropdown.open>.dropdown-toggle .caret,.navbar .nav li.dropdown.active>.dropdown-toggle .caret,.navbar .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#555555;border-bottom-color:#555555;} +.navbar .pull-right>li>.dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right{left:auto;right:0;}.navbar .pull-right>li>.dropdown-menu:before,.navbar .nav>li>.dropdown-menu.pull-right:before{left:auto;right:12px;} +.navbar .pull-right>li>.dropdown-menu:after,.navbar .nav>li>.dropdown-menu.pull-right:after{left:auto;right:13px;} +.navbar .pull-right>li>.dropdown-menu .dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right .dropdown-menu{left:auto;right:100%;margin-left:0;margin-right:-1px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;} +.navbar-inverse .navbar-inner{background-color:#1b1b1b;background-image:-moz-linear-gradient(top, #222222, #111111);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111));background-image:-webkit-linear-gradient(top, #222222, #111111);background-image:-o-linear-gradient(top, #222222, #111111);background-image:linear-gradient(to bottom, #222222, #111111);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);border-color:#252525;} +.navbar-inverse .brand,.navbar-inverse .nav>li>a{color:#999999;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);}.navbar-inverse .brand:hover,.navbar-inverse .nav>li>a:hover,.navbar-inverse .brand:focus,.navbar-inverse .nav>li>a:focus{color:#ffffff;} +.navbar-inverse .brand{color:#999999;} +.navbar-inverse .navbar-text{color:#999999;} +.navbar-inverse .nav>li>a:focus,.navbar-inverse .nav>li>a:hover{background-color:transparent;color:#ffffff;} +.navbar-inverse .nav .active>a,.navbar-inverse .nav .active>a:hover,.navbar-inverse .nav .active>a:focus{color:#ffffff;background-color:#111111;} +.navbar-inverse .navbar-link{color:#999999;}.navbar-inverse .navbar-link:hover,.navbar-inverse .navbar-link:focus{color:#ffffff;} +.navbar-inverse .divider-vertical{border-left-color:#111111;border-right-color:#222222;} +.navbar-inverse .nav li.dropdown.open>.dropdown-toggle,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{background-color:#111111;color:#ffffff;} +.navbar-inverse .nav li.dropdown>a:hover .caret,.navbar-inverse .nav li.dropdown>a:focus .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} +.navbar-inverse .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#999999;border-bottom-color:#999999;} +.navbar-inverse .nav li.dropdown.open>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} +.navbar-inverse .navbar-search .search-query{color:#ffffff;background-color:#515151;border-color:#111111;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none;}.navbar-inverse .navbar-search .search-query:-moz-placeholder{color:#cccccc;} +.navbar-inverse .navbar-search .search-query:-ms-input-placeholder{color:#cccccc;} +.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder{color:#cccccc;} +.navbar-inverse .navbar-search .search-query:focus,.navbar-inverse .navbar-search .search-query.focused{padding:5px 15px;color:#333333;text-shadow:0 1px 0 #ffffff;background-color:#ffffff;border:0;-webkit-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);box-shadow:0 0 3px rgba(0, 0, 0, 0.15);outline:0;} +.navbar-inverse .btn-navbar{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#0e0e0e;background-image:-moz-linear-gradient(top, #151515, #040404);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#151515), to(#040404));background-image:-webkit-linear-gradient(top, #151515, #040404);background-image:-o-linear-gradient(top, #151515, #040404);background-image:linear-gradient(to bottom, #151515, #040404);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515', endColorstr='#ff040404', GradientType=0);border-color:#040404 #040404 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#040404;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.navbar-inverse .btn-navbar:hover,.navbar-inverse .btn-navbar:focus,.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active,.navbar-inverse .btn-navbar.disabled,.navbar-inverse .btn-navbar[disabled]{color:#ffffff;background-color:#040404;*background-color:#000000;} +.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active{background-color:#000000 \9;} +.breadcrumb{padding:8px 15px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.breadcrumb>li{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 0 #ffffff;}.breadcrumb>li>.divider{padding:0 5px;color:#ccc;} +.breadcrumb>.active{color:#999999;} +.pagination{margin:20px 0;} +.pagination ul{display:inline-block;*display:inline;*zoom:1;margin-left:0;margin-bottom:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);} +.pagination ul>li{display:inline;} +.pagination ul>li>a,.pagination ul>li>span{float:left;padding:4px 12px;line-height:20px;text-decoration:none;background-color:#ffffff;border:1px solid #dddddd;border-left-width:0;} +.pagination ul>li>a:hover,.pagination ul>li>a:focus,.pagination ul>.active>a,.pagination ul>.active>span{background-color:#f5f5f5;} +.pagination ul>.active>a,.pagination ul>.active>span{color:#999999;cursor:default;} +.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover,.pagination ul>.disabled>a:focus{color:#999999;background-color:transparent;cursor:default;} +.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{border-left-width:1px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} +.pagination-centered{text-align:center;} +.pagination-right{text-align:right;} +.pagination-large ul>li>a,.pagination-large ul>li>span{padding:11px 19px;font-size:17.5px;} +.pagination-large ul>li:first-child>a,.pagination-large ul>li:first-child>span{-webkit-border-top-left-radius:6px;-moz-border-radius-topleft:6px;border-top-left-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomleft:6px;border-bottom-left-radius:6px;} +.pagination-large ul>li:last-child>a,.pagination-large ul>li:last-child>span{-webkit-border-top-right-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;-moz-border-radius-bottomright:6px;border-bottom-right-radius:6px;} +.pagination-mini ul>li:first-child>a,.pagination-small ul>li:first-child>a,.pagination-mini ul>li:first-child>span,.pagination-small ul>li:first-child>span{-webkit-border-top-left-radius:3px;-moz-border-radius-topleft:3px;border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-moz-border-radius-bottomleft:3px;border-bottom-left-radius:3px;} +.pagination-mini ul>li:last-child>a,.pagination-small ul>li:last-child>a,.pagination-mini ul>li:last-child>span,.pagination-small ul>li:last-child>span{-webkit-border-top-right-radius:3px;-moz-border-radius-topright:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-bottomright:3px;border-bottom-right-radius:3px;} +.pagination-small ul>li>a,.pagination-small ul>li>span{padding:2px 10px;font-size:11.9px;} +.pagination-mini ul>li>a,.pagination-mini ul>li>span{padding:0 6px;font-size:10.5px;} +.pager{margin:20px 0;list-style:none;text-align:center;*zoom:1;}.pager:before,.pager:after{display:table;content:"";line-height:0;} +.pager:after{clear:both;} +.pager li{display:inline;} +.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} +.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#f5f5f5;} +.pager .next>a,.pager .next>span{float:right;} +.pager .previous>a,.pager .previous>span{float:left;} +.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999999;background-color:#fff;cursor:default;} +.thumbnails{margin-left:-20px;list-style:none;*zoom:1;}.thumbnails:before,.thumbnails:after{display:table;content:"";line-height:0;} +.thumbnails:after{clear:both;} +.row-fluid .thumbnails{margin-left:0;} +.thumbnails>li{float:left;margin-bottom:20px;margin-left:20px;} +.thumbnail{display:block;padding:4px;line-height:20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.055);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.055);box-shadow:0 1px 3px rgba(0, 0, 0, 0.055);-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-o-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;} +a.thumbnail:hover,a.thumbnail:focus{border-color:#0088cc;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);} +.thumbnail>img{display:block;max-width:100%;margin-left:auto;margin-right:auto;} +.thumbnail .caption{padding:9px;color:#555555;} +.alert{padding:8px 35px 8px 14px;margin-bottom:20px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.alert,.alert h4{color:#c09853;} +.alert h4{margin:0;} +.alert .close{position:relative;top:-2px;right:-21px;line-height:20px;} +.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#468847;} +.alert-success h4{color:#468847;} +.alert-danger,.alert-error{background-color:#f2dede;border-color:#eed3d7;color:#b94a48;} +.alert-danger h4,.alert-error h4{color:#b94a48;} +.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#3a87ad;} +.alert-info h4{color:#3a87ad;} +.alert-block{padding-top:14px;padding-bottom:14px;} +.alert-block>p,.alert-block>ul{margin-bottom:0;} +.alert-block p+p{margin-top:5px;} +@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-ms-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-o-keyframes progress-bar-stripes{from{background-position:0 0;} to{background-position:40px 0;}}@keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}.progress{overflow:hidden;height:20px;margin-bottom:20px;background-color:#f7f7f7;background-image:-moz-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9));background-image:-webkit-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-o-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:linear-gradient(to bottom, #f5f5f5, #f9f9f9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.progress .bar{width:0%;height:100%;color:#ffffff;float:left;font-size:12px;text-align:center;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top, #149bdf, #0480be);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be));background-image:-webkit-linear-gradient(top, #149bdf, #0480be);background-image:-o-linear-gradient(top, #149bdf, #0480be);background-image:linear-gradient(to bottom, #149bdf, #0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width 0.6s ease;-moz-transition:width 0.6s ease;-o-transition:width 0.6s ease;transition:width 0.6s ease;} +.progress .bar+.bar{-webkit-box-shadow:inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);-moz-box-shadow:inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);} +.progress-striped .bar{background-color:#149bdf;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);-webkit-background-size:40px 40px;-moz-background-size:40px 40px;-o-background-size:40px 40px;background-size:40px 40px;} +.progress.active .bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-moz-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite;} +.progress-danger .bar,.progress .bar-danger{background-color:#dd514c;background-image:-moz-linear-gradient(top, #ee5f5b, #c43c35);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35));background-image:-webkit-linear-gradient(top, #ee5f5b, #c43c35);background-image:-o-linear-gradient(top, #ee5f5b, #c43c35);background-image:linear-gradient(to bottom, #ee5f5b, #c43c35);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffc43c35', GradientType=0);} +.progress-danger.progress-striped .bar,.progress-striped .bar-danger{background-color:#ee5f5b;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.progress-success .bar,.progress .bar-success{background-color:#5eb95e;background-image:-moz-linear-gradient(top, #62c462, #57a957);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957));background-image:-webkit-linear-gradient(top, #62c462, #57a957);background-image:-o-linear-gradient(top, #62c462, #57a957);background-image:linear-gradient(to bottom, #62c462, #57a957);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff57a957', GradientType=0);} +.progress-success.progress-striped .bar,.progress-striped .bar-success{background-color:#62c462;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.progress-info .bar,.progress .bar-info{background-color:#4bb1cf;background-image:-moz-linear-gradient(top, #5bc0de, #339bb9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9));background-image:-webkit-linear-gradient(top, #5bc0de, #339bb9);background-image:-o-linear-gradient(top, #5bc0de, #339bb9);background-image:linear-gradient(to bottom, #5bc0de, #339bb9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff339bb9', GradientType=0);} +.progress-info.progress-striped .bar,.progress-striped .bar-info{background-color:#5bc0de;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.progress-warning .bar,.progress .bar-warning{background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(to bottom, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);} +.progress-warning.progress-striped .bar,.progress-striped .bar-warning{background-color:#fbb450;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.hero-unit{padding:60px;margin-bottom:30px;font-size:18px;font-weight:200;line-height:30px;color:inherit;background-color:#eeeeee;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;color:inherit;letter-spacing:-1px;} +.hero-unit li{line-height:30px;} +.media,.media-body{overflow:hidden;*overflow:visible;zoom:1;} +.media,.media .media{margin-top:15px;} +.media:first-child{margin-top:0;} +.media-object{display:block;} +.media-heading{margin:0 0 5px;} +.media>.pull-left{margin-right:10px;} +.media>.pull-right{margin-left:10px;} +.media-list{margin-left:0;list-style:none;} +.tooltip{position:absolute;z-index:1030;display:block;visibility:visible;font-size:11px;line-height:1.4;opacity:0;filter:alpha(opacity=0);}.tooltip.in{opacity:0.8;filter:alpha(opacity=80);} +.tooltip.top{margin-top:-3px;padding:5px 0;} +.tooltip.right{margin-left:3px;padding:0 5px;} +.tooltip.bottom{margin-top:3px;padding:5px 0;} +.tooltip.left{margin-left:-3px;padding:0 5px;} +.tooltip-inner{max-width:200px;padding:8px;color:#ffffff;text-align:center;text-decoration:none;background-color:#000000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid;} +.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000000;} +.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000000;} +.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000000;} +.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000000;} +.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;background-color:#ffffff;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);white-space:normal;}.popover.top{margin-top:-10px;} +.popover.right{margin-left:10px;} +.popover.bottom{margin-top:10px;} +.popover.left{margin-left:-10px;} +.popover-title{margin:0;padding:8px 14px;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;}.popover-title:empty{display:none;} +.popover-content{padding:9px 14px;} +.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid;} +.popover .arrow{border-width:11px;} +.popover .arrow:after{border-width:10px;content:"";} +.popover.top .arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0, 0, 0, 0.25);bottom:-11px;}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#ffffff;} +.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0, 0, 0, 0.25);}.popover.right .arrow:after{left:1px;bottom:-10px;border-left-width:0;border-right-color:#ffffff;} +.popover.bottom .arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0, 0, 0, 0.25);top:-11px;}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#ffffff;} +.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0, 0, 0, 0.25);}.popover.left .arrow:after{right:1px;border-right-width:0;border-left-color:#ffffff;bottom:-10px;} +.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000000;}.modal-backdrop.fade{opacity:0;} +.modal-backdrop,.modal-backdrop.fade.in{opacity:0.8;filter:alpha(opacity=80);} +.modal{position:fixed;top:10%;left:50%;z-index:1050;width:560px;margin-left:-280px;background-color:#ffffff;border:1px solid #999;border:1px solid rgba(0, 0, 0, 0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;outline:none;}.modal.fade{-webkit-transition:opacity .3s linear, top .3s ease-out;-moz-transition:opacity .3s linear, top .3s ease-out;-o-transition:opacity .3s linear, top .3s ease-out;transition:opacity .3s linear, top .3s ease-out;top:-25%;} +.modal.fade.in{top:10%;} +.modal-header{padding:9px 15px;border-bottom:1px solid #eee;}.modal-header .close{margin-top:2px;} +.modal-header h3{margin:0;line-height:30px;} +.modal-body{position:relative;overflow-y:auto;max-height:400px;padding:15px;} +.modal-form{margin-bottom:0;} +.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;*zoom:1;}.modal-footer:before,.modal-footer:after{display:table;content:"";line-height:0;} +.modal-footer:after{clear:both;} +.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0;} +.modal-footer .btn-group .btn+.btn{margin-left:-1px;} +.modal-footer .btn-block+.btn-block{margin-left:0;} +.dropup,.dropdown{position:relative;} +.dropdown-toggle{*margin-bottom:-3px;} +.dropdown-toggle:active,.open .dropdown-toggle{outline:0;} +.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000000;border-right:4px solid transparent;border-left:4px solid transparent;content:"";} +.dropdown .caret{margin-top:8px;margin-left:2px;} +.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#ffffff;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;}.dropdown-menu.pull-right{right:0;left:auto;} +.dropdown-menu .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #ffffff;} +.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333333;white-space:nowrap;} +.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-submenu:hover>a,.dropdown-submenu:focus>a{text-decoration:none;color:#ffffff;background-color:#0081c2;background-image:-moz-linear-gradient(top, #0088cc, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image:-webkit-linear-gradient(top, #0088cc, #0077b3);background-image:-o-linear-gradient(top, #0088cc, #0077b3);background-image:linear-gradient(to bottom, #0088cc, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);} +.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#ffffff;text-decoration:none;outline:0;background-color:#0081c2;background-image:-moz-linear-gradient(top, #0088cc, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image:-webkit-linear-gradient(top, #0088cc, #0077b3);background-image:-o-linear-gradient(top, #0088cc, #0077b3);background-image:linear-gradient(to bottom, #0088cc, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);} +.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999999;} +.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);cursor:default;} +.open{*z-index:1000;}.open>.dropdown-menu{display:block;} +.pull-right>.dropdown-menu{right:0;left:auto;} +.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000000;content:"";} +.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px;} +.dropdown-submenu{position:relative;} +.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;} +.dropdown-submenu:hover>.dropdown-menu{display:block;} +.dropup .dropdown-submenu>.dropdown-menu{top:auto;bottom:0;margin-top:0;margin-bottom:-2px;-webkit-border-radius:5px 5px 5px 0;-moz-border-radius:5px 5px 5px 0;border-radius:5px 5px 5px 0;} +.dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#cccccc;margin-top:5px;margin-right:-10px;} +.dropdown-submenu:hover>a:after{border-left-color:#ffffff;} +.dropdown-submenu.pull-left{float:none;}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;} +.dropdown .dropdown-menu .nav-header{padding-left:20px;padding-right:20px;} +.typeahead{z-index:1051;margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.accordion{margin-bottom:20px;} +.accordion-group{margin-bottom:2px;border:1px solid #e5e5e5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.accordion-heading{border-bottom:0;} +.accordion-heading .accordion-toggle{display:block;padding:8px 15px;} +.accordion-toggle{cursor:pointer;} +.accordion-inner{padding:9px 15px;border-top:1px solid #e5e5e5;} +.carousel{position:relative;margin-bottom:20px;line-height:1;} +.carousel-inner{overflow:hidden;width:100%;position:relative;} +.carousel-inner>.item{display:none;position:relative;-webkit-transition:0.6s ease-in-out left;-moz-transition:0.6s ease-in-out left;-o-transition:0.6s ease-in-out left;transition:0.6s ease-in-out left;}.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;line-height:1;} +.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block;} +.carousel-inner>.active{left:0;} +.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%;} +.carousel-inner>.next{left:100%;} +.carousel-inner>.prev{left:-100%;} +.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0;} +.carousel-inner>.active.left{left:-100%;} +.carousel-inner>.active.right{left:100%;} +.carousel-control{position:absolute;top:40%;left:15px;width:40px;height:40px;margin-top:-20px;font-size:60px;font-weight:100;line-height:30px;color:#ffffff;text-align:center;background:#222222;border:3px solid #ffffff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:0.5;filter:alpha(opacity=50);}.carousel-control.right{left:auto;right:15px;} +.carousel-control:hover,.carousel-control:focus{color:#ffffff;text-decoration:none;opacity:0.9;filter:alpha(opacity=90);} +.carousel-indicators{position:absolute;top:15px;right:15px;z-index:5;margin:0;list-style:none;}.carousel-indicators li{display:block;float:left;width:10px;height:10px;margin-left:5px;text-indent:-999px;background-color:#ccc;background-color:rgba(255, 255, 255, 0.25);border-radius:5px;} +.carousel-indicators .active{background-color:#fff;} +.carousel-caption{position:absolute;left:0;right:0;bottom:0;padding:15px;background:#333333;background:rgba(0, 0, 0, 0.75);} +.carousel-caption h4,.carousel-caption p{color:#ffffff;line-height:20px;} +.carousel-caption h4{margin:0 0 5px;} +.carousel-caption p{margin-bottom:0;} +.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);} +.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.close{float:right;font-size:20px;font-weight:bold;line-height:20px;color:#000000;text-shadow:0 1px 0 #ffffff;opacity:0.2;filter:alpha(opacity=20);}.close:hover,.close:focus{color:#000000;text-decoration:none;cursor:pointer;opacity:0.4;filter:alpha(opacity=40);} +button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none;} +.pull-right{float:right;} +.pull-left{float:left;} +.hide{display:none;} +.show{display:block;} +.invisible{visibility:hidden;} +.affix{position:fixed;} +.fade{opacity:0;-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;}.fade.in{opacity:1;} +.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height 0.35s ease;-moz-transition:height 0.35s ease;-o-transition:height 0.35s ease;transition:height 0.35s ease;}.collapse.in{height:auto;} +@-ms-viewport{width:device-width;}.hidden{display:none;visibility:hidden;} +.visible-phone{display:none !important;} +.visible-tablet{display:none !important;} +.hidden-desktop{display:none !important;} +.visible-desktop{display:inherit !important;} +@media (min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit !important;} .visible-desktop{display:none !important ;} .visible-tablet{display:inherit !important;} .hidden-tablet{display:none !important;}}@media (max-width:767px){.hidden-desktop{display:inherit !important;} .visible-desktop{display:none !important;} .visible-phone{display:inherit !important;} .hidden-phone{display:none !important;}}.visible-print{display:none !important;} +@media print{.visible-print{display:inherit !important;} .hidden-print{display:none !important;}}@media (max-width:767px){body{padding-left:20px;padding-right:20px;} .navbar-fixed-top,.navbar-fixed-bottom,.navbar-static-top{margin-left:-20px;margin-right:-20px;} .container-fluid{padding:0;} .dl-horizontal dt{float:none;clear:none;width:auto;text-align:left;} .dl-horizontal dd{margin-left:0;} .container{width:auto;} .row-fluid{width:100%;} .row,.thumbnails{margin-left:0;} .thumbnails>li{float:none;margin-left:0;} [class*="span"],.uneditable-input[class*="span"],.row-fluid [class*="span"]{float:none;display:block;width:100%;margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} .span12,.row-fluid .span12{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} .row-fluid [class*="offset"]:first-child{margin-left:0;} .input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} .input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto;} .controls-row [class*="span"]+[class*="span"]{margin-left:0;} .modal{position:fixed;top:20px;left:20px;right:20px;width:auto;margin:0;}.modal.fade{top:-100px;} .modal.fade.in{top:20px;}}@media (max-width:480px){.nav-collapse{-webkit-transform:translate3d(0, 0, 0);} .page-header h1 small{display:block;line-height:20px;} input[type="checkbox"],input[type="radio"]{border:1px solid #ccc;} .form-horizontal .control-label{float:none;width:auto;padding-top:0;text-align:left;} .form-horizontal .controls{margin-left:0;} .form-horizontal .control-list{padding-top:0;} .form-horizontal .form-actions{padding-left:10px;padding-right:10px;} .media .pull-left,.media .pull-right{float:none;display:block;margin-bottom:10px;} .media-object{margin-right:0;margin-left:0;} .modal{top:10px;left:10px;right:10px;} .modal-header .close{padding:10px;margin:-10px;} .carousel-caption{position:static;}}@media (min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";line-height:0;} .row:after{clear:both;} [class*="span"]{float:left;min-height:1px;margin-left:20px;} .container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px;} .span12{width:724px;} .span11{width:662px;} .span10{width:600px;} .span9{width:538px;} .span8{width:476px;} .span7{width:414px;} .span6{width:352px;} .span5{width:290px;} .span4{width:228px;} .span3{width:166px;} .span2{width:104px;} .span1{width:42px;} .offset12{margin-left:764px;} .offset11{margin-left:702px;} .offset10{margin-left:640px;} .offset9{margin-left:578px;} .offset8{margin-left:516px;} .offset7{margin-left:454px;} .offset6{margin-left:392px;} .offset5{margin-left:330px;} .offset4{margin-left:268px;} .offset3{margin-left:206px;} .offset2{margin-left:144px;} .offset1{margin-left:82px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";line-height:0;} .row-fluid:after{clear:both;} .row-fluid [class*="span"]{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.7624309392265194%;*margin-left:2.709239449864817%;} .row-fluid [class*="span"]:first-child{margin-left:0;} .row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.7624309392265194%;} .row-fluid .span12{width:100%;*width:99.94680851063829%;} .row-fluid .span11{width:91.43646408839778%;*width:91.38327259903608%;} .row-fluid .span10{width:82.87292817679558%;*width:82.81973668743387%;} .row-fluid .span9{width:74.30939226519337%;*width:74.25620077583166%;} .row-fluid .span8{width:65.74585635359117%;*width:65.69266486422946%;} .row-fluid .span7{width:57.18232044198895%;*width:57.12912895262725%;} .row-fluid .span6{width:48.61878453038674%;*width:48.56559304102504%;} .row-fluid .span5{width:40.05524861878453%;*width:40.00205712942283%;} .row-fluid .span4{width:31.491712707182323%;*width:31.43852121782062%;} .row-fluid .span3{width:22.92817679558011%;*width:22.87498530621841%;} .row-fluid .span2{width:14.3646408839779%;*width:14.311449394616199%;} .row-fluid .span1{width:5.801104972375691%;*width:5.747913483013988%;} .row-fluid .offset12{margin-left:105.52486187845304%;*margin-left:105.41847889972962%;} .row-fluid .offset12:first-child{margin-left:102.76243093922652%;*margin-left:102.6560479605031%;} .row-fluid .offset11{margin-left:96.96132596685082%;*margin-left:96.8549429881274%;} .row-fluid .offset11:first-child{margin-left:94.1988950276243%;*margin-left:94.09251204890089%;} .row-fluid .offset10{margin-left:88.39779005524862%;*margin-left:88.2914070765252%;} .row-fluid .offset10:first-child{margin-left:85.6353591160221%;*margin-left:85.52897613729868%;} .row-fluid .offset9{margin-left:79.8342541436464%;*margin-left:79.72787116492299%;} .row-fluid .offset9:first-child{margin-left:77.07182320441989%;*margin-left:76.96544022569647%;} .row-fluid .offset8{margin-left:71.2707182320442%;*margin-left:71.16433525332079%;} .row-fluid .offset8:first-child{margin-left:68.50828729281768%;*margin-left:68.40190431409427%;} .row-fluid .offset7{margin-left:62.70718232044199%;*margin-left:62.600799341718584%;} .row-fluid .offset7:first-child{margin-left:59.94475138121547%;*margin-left:59.838368402492065%;} .row-fluid .offset6{margin-left:54.14364640883978%;*margin-left:54.037263430116376%;} .row-fluid .offset6:first-child{margin-left:51.38121546961326%;*margin-left:51.27483249088986%;} .row-fluid .offset5{margin-left:45.58011049723757%;*margin-left:45.47372751851417%;} .row-fluid .offset5:first-child{margin-left:42.81767955801105%;*margin-left:42.71129657928765%;} .row-fluid .offset4{margin-left:37.01657458563536%;*margin-left:36.91019160691196%;} .row-fluid .offset4:first-child{margin-left:34.25414364640884%;*margin-left:34.14776066768544%;} .row-fluid .offset3{margin-left:28.45303867403315%;*margin-left:28.346655695309746%;} .row-fluid .offset3:first-child{margin-left:25.69060773480663%;*margin-left:25.584224756083227%;} .row-fluid .offset2{margin-left:19.88950276243094%;*margin-left:19.783119783707537%;} .row-fluid .offset2:first-child{margin-left:17.12707182320442%;*margin-left:17.02068884448102%;} .row-fluid .offset1{margin-left:11.32596685082873%;*margin-left:11.219583872105325%;} .row-fluid .offset1:first-child{margin-left:8.56353591160221%;*margin-left:8.457152932878806%;} input,textarea,.uneditable-input{margin-left:0;} .controls-row [class*="span"]+[class*="span"]{margin-left:20px;} input.span12,textarea.span12,.uneditable-input.span12{width:710px;} input.span11,textarea.span11,.uneditable-input.span11{width:648px;} input.span10,textarea.span10,.uneditable-input.span10{width:586px;} input.span9,textarea.span9,.uneditable-input.span9{width:524px;} input.span8,textarea.span8,.uneditable-input.span8{width:462px;} input.span7,textarea.span7,.uneditable-input.span7{width:400px;} input.span6,textarea.span6,.uneditable-input.span6{width:338px;} input.span5,textarea.span5,.uneditable-input.span5{width:276px;} input.span4,textarea.span4,.uneditable-input.span4{width:214px;} input.span3,textarea.span3,.uneditable-input.span3{width:152px;} input.span2,textarea.span2,.uneditable-input.span2{width:90px;} input.span1,textarea.span1,.uneditable-input.span1{width:28px;}}@media (min-width:1200px){.row{margin-left:-30px;*zoom:1;}.row:before,.row:after{display:table;content:"";line-height:0;} .row:after{clear:both;} [class*="span"]{float:left;min-height:1px;margin-left:30px;} .container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px;} .span12{width:1170px;} .span11{width:1070px;} .span10{width:970px;} .span9{width:870px;} .span8{width:770px;} .span7{width:670px;} .span6{width:570px;} .span5{width:470px;} .span4{width:370px;} .span3{width:270px;} .span2{width:170px;} .span1{width:70px;} .offset12{margin-left:1230px;} .offset11{margin-left:1130px;} .offset10{margin-left:1030px;} .offset9{margin-left:930px;} .offset8{margin-left:830px;} .offset7{margin-left:730px;} .offset6{margin-left:630px;} .offset5{margin-left:530px;} .offset4{margin-left:430px;} .offset3{margin-left:330px;} .offset2{margin-left:230px;} .offset1{margin-left:130px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";line-height:0;} .row-fluid:after{clear:both;} .row-fluid [class*="span"]{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.564102564102564%;*margin-left:2.5109110747408616%;} .row-fluid [class*="span"]:first-child{margin-left:0;} .row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.564102564102564%;} .row-fluid .span12{width:100%;*width:99.94680851063829%;} .row-fluid .span11{width:91.45299145299145%;*width:91.39979996362975%;} .row-fluid .span10{width:82.90598290598291%;*width:82.8527914166212%;} .row-fluid .span9{width:74.35897435897436%;*width:74.30578286961266%;} .row-fluid .span8{width:65.81196581196582%;*width:65.75877432260411%;} .row-fluid .span7{width:57.26495726495726%;*width:57.21176577559556%;} .row-fluid .span6{width:48.717948717948715%;*width:48.664757228587014%;} .row-fluid .span5{width:40.17094017094017%;*width:40.11774868157847%;} .row-fluid .span4{width:31.623931623931625%;*width:31.570740134569924%;} .row-fluid .span3{width:23.076923076923077%;*width:23.023731587561375%;} .row-fluid .span2{width:14.52991452991453%;*width:14.476723040552828%;} .row-fluid .span1{width:5.982905982905983%;*width:5.929714493544281%;} .row-fluid .offset12{margin-left:105.12820512820512%;*margin-left:105.02182214948171%;} .row-fluid .offset12:first-child{margin-left:102.56410256410257%;*margin-left:102.45771958537915%;} .row-fluid .offset11{margin-left:96.58119658119658%;*margin-left:96.47481360247316%;} .row-fluid .offset11:first-child{margin-left:94.01709401709402%;*margin-left:93.91071103837061%;} .row-fluid .offset10{margin-left:88.03418803418803%;*margin-left:87.92780505546462%;} .row-fluid .offset10:first-child{margin-left:85.47008547008548%;*margin-left:85.36370249136206%;} .row-fluid .offset9{margin-left:79.48717948717949%;*margin-left:79.38079650845607%;} .row-fluid .offset9:first-child{margin-left:76.92307692307693%;*margin-left:76.81669394435352%;} .row-fluid .offset8{margin-left:70.94017094017094%;*margin-left:70.83378796144753%;} .row-fluid .offset8:first-child{margin-left:68.37606837606839%;*margin-left:68.26968539734497%;} .row-fluid .offset7{margin-left:62.393162393162385%;*margin-left:62.28677941443899%;} .row-fluid .offset7:first-child{margin-left:59.82905982905982%;*margin-left:59.72267685033642%;} .row-fluid .offset6{margin-left:53.84615384615384%;*margin-left:53.739770867430444%;} .row-fluid .offset6:first-child{margin-left:51.28205128205128%;*margin-left:51.175668303327875%;} .row-fluid .offset5{margin-left:45.299145299145295%;*margin-left:45.1927623204219%;} .row-fluid .offset5:first-child{margin-left:42.73504273504273%;*margin-left:42.62865975631933%;} .row-fluid .offset4{margin-left:36.75213675213675%;*margin-left:36.645753773413354%;} .row-fluid .offset4:first-child{margin-left:34.18803418803419%;*margin-left:34.081651209310785%;} .row-fluid .offset3{margin-left:28.205128205128204%;*margin-left:28.0987452264048%;} .row-fluid .offset3:first-child{margin-left:25.641025641025642%;*margin-left:25.53464266230224%;} .row-fluid .offset2{margin-left:19.65811965811966%;*margin-left:19.551736679396257%;} .row-fluid .offset2:first-child{margin-left:17.094017094017094%;*margin-left:16.98763411529369%;} .row-fluid .offset1{margin-left:11.11111111111111%;*margin-left:11.004728132387708%;} .row-fluid .offset1:first-child{margin-left:8.547008547008547%;*margin-left:8.440625568285142%;} input,textarea,.uneditable-input{margin-left:0;} .controls-row [class*="span"]+[class*="span"]{margin-left:30px;} input.span12,textarea.span12,.uneditable-input.span12{width:1156px;} input.span11,textarea.span11,.uneditable-input.span11{width:1056px;} input.span10,textarea.span10,.uneditable-input.span10{width:956px;} input.span9,textarea.span9,.uneditable-input.span9{width:856px;} input.span8,textarea.span8,.uneditable-input.span8{width:756px;} input.span7,textarea.span7,.uneditable-input.span7{width:656px;} input.span6,textarea.span6,.uneditable-input.span6{width:556px;} input.span5,textarea.span5,.uneditable-input.span5{width:456px;} input.span4,textarea.span4,.uneditable-input.span4{width:356px;} input.span3,textarea.span3,.uneditable-input.span3{width:256px;} input.span2,textarea.span2,.uneditable-input.span2{width:156px;} input.span1,textarea.span1,.uneditable-input.span1{width:56px;} .thumbnails{margin-left:-30px;} .thumbnails>li{margin-left:30px;} .row-fluid .thumbnails{margin-left:0;}}@media (max-width:979px){body{padding-top:0;} .navbar-fixed-top,.navbar-fixed-bottom{position:static;} .navbar-fixed-top{margin-bottom:20px;} .navbar-fixed-bottom{margin-top:20px;} .navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px;} .navbar .container{width:auto;padding:0;} .navbar .brand{padding-left:10px;padding-right:10px;margin:0 0 0 -5px;} .nav-collapse{clear:both;} .nav-collapse .nav{float:none;margin:0 0 10px;} .nav-collapse .nav>li{float:none;} .nav-collapse .nav>li>a{margin-bottom:2px;} .nav-collapse .nav>.divider-vertical{display:none;} .nav-collapse .nav .nav-header{color:#777777;text-shadow:none;} .nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:9px 15px;font-weight:bold;color:#777777;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} .nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} .nav-collapse .dropdown-menu li+li a{margin-bottom:2px;} .nav-collapse .nav>li>a:hover,.nav-collapse .nav>li>a:focus,.nav-collapse .dropdown-menu a:hover,.nav-collapse .dropdown-menu a:focus{background-color:#f2f2f2;} .navbar-inverse .nav-collapse .nav>li>a,.navbar-inverse .nav-collapse .dropdown-menu a{color:#999999;} .navbar-inverse .nav-collapse .nav>li>a:hover,.navbar-inverse .nav-collapse .nav>li>a:focus,.navbar-inverse .nav-collapse .dropdown-menu a:hover,.navbar-inverse .nav-collapse .dropdown-menu a:focus{background-color:#111111;} .nav-collapse.in .btn-group{margin-top:5px;padding:0;} .nav-collapse .dropdown-menu{position:static;top:auto;left:auto;float:none;display:none;max-width:none;margin:0 15px;padding:0;background-color:transparent;border:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} .nav-collapse .open>.dropdown-menu{display:block;} .nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none;} .nav-collapse .dropdown-menu .divider{display:none;} .nav-collapse .nav>li>.dropdown-menu:before,.nav-collapse .nav>li>.dropdown-menu:after{display:none;} .nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:10px 15px;margin:10px 0;border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);} .navbar-inverse .nav-collapse .navbar-form,.navbar-inverse .nav-collapse .navbar-search{border-top-color:#111111;border-bottom-color:#111111;} .navbar .nav-collapse .nav.pull-right{float:none;margin-left:0;} .nav-collapse,.nav-collapse.collapse{overflow:hidden;height:0;} .navbar .btn-navbar{display:block;} .navbar-static .navbar-inner{padding-left:10px;padding-right:10px;}}@media (min-width:980px){.nav-collapse.collapse{height:auto !important;overflow:visible !important;}} diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/resources/style/main.css b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/resources/style/main.css new file mode 100644 index 0000000..c5b37ff --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Examples/resources/style/main.css @@ -0,0 +1,42 @@ +label > span { + display: inline-block; + width: 300px; +} + +#payment-errors { + color: #ff0000; +} + +pre { + clear: left; +} + +dl#list { + clear: left; +} + +dl#list dt { + clear: left; + float: left; + padding-bottom: 10px; + width: 200px; +} + +dl#list dd { + float: left; + width: 700px; +} + +dl#list dd ul { + list-style: none; + padding: 0; +} + +dl#list dd ul li span { + display: inline-block; + width: 150px; +} + +hr { + border: 1px solid #000; +} \ No newline at end of file diff --git a/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Samples.sln b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Samples.sln new file mode 100644 index 0000000..6cba476 --- /dev/null +++ b/worldpay-sample-dotnet-4-6/Worldpay.Sdk.Samples.sln @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 14 for Web +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worldpay.Sdk.Examples", "Worldpay.Sdk.Examples\Worldpay.Sdk.Examples35.csproj", "{C1E26FE7-56C2-446D-A65A-830D8747758B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6C59865C-07ED-4BD8-99D8-4A8BAE7BF16C}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C1E26FE7-56C2-446D-A65A-830D8747758B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1E26FE7-56C2-446D-A65A-830D8747758B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1E26FE7-56C2-446D-A65A-830D8747758B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1E26FE7-56C2-446D-A65A-830D8747758B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal