Skip to content
Browse files

fix whitespace issues hopefully once and for all

  • Loading branch information...
1 parent d228ce0 commit da5a21f6bdd854702b520d1397ae4972f30ccf1c @mythz mythz committed Oct 3, 2012
Showing with 3,499 additions and 3,499 deletions.
  1. +23 −23 src/ServiceStack.Text.MonoTouch/ServiceStack.Text.MonoTouch.sln
  2. +37 −37 src/ServiceStack.Text.WP/Properties/AssemblyInfo.cs
  3. +269 −269 src/ServiceStack.Text.WP/ServiceStack.Text.WP.csproj
  4. +30 −30 src/ServiceStack.Text.WP/ServiceStack.Text.WP.sln
  5. +92 −92 src/ServiceStack.Text.sln
  6. +165 −165 src/ServiceStack.Text/AssemblyUtils.cs
  7. +292 −292 src/ServiceStack.Text/Common/DateTimeSerializer.cs
  8. +187 −187 src/ServiceStack.Text/Common/DeserializeArray.cs
  9. +124 −124 src/ServiceStack.Text/Common/DeserializeCollection.cs
  10. +274 −274 src/ServiceStack.Text/Common/DeserializeDictionary.cs
  11. +76 −76 src/ServiceStack.Text/Common/DeserializeDynamic.cs
  12. +262 −262 src/ServiceStack.Text/Common/DeserializeListWithElements.cs
  13. +211 −211 src/ServiceStack.Text/Common/DeserializeSpecializedCollections.cs
  14. +146 −146 src/ServiceStack.Text/Common/DeserializeTypeRef.cs
  15. +129 −129 src/ServiceStack.Text/Common/DeserializeTypeRefJsv.cs
  16. +50 −50 src/ServiceStack.Text/Common/DeserializeTypeUtils.cs
  17. +64 −64 src/ServiceStack.Text/Common/ITypeSerializer.cs
  18. +36 −36 src/ServiceStack.Text/Common/JsDelegates.cs
  19. +121 −121 src/ServiceStack.Text/Common/JsReader.cs
  20. +13 −13 src/ServiceStack.Text/Common/JsState.cs
  21. +59 −59 src/ServiceStack.Text/Common/ParseUtils.cs
  22. +109 −109 src/ServiceStack.Text/Common/StaticParseMethod.cs
  23. +230 −230 src/ServiceStack.Text/Common/WriteDictionary.cs
  24. +500 −500 src/ServiceStack.Text/Common/WriteLists.cs
View
46 src/ServiceStack.Text.MonoTouch/ServiceStack.Text.MonoTouch.sln
@@ -1,23 +1,23 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.MonoTouch", "ServiceStack.Text.MonoTouch\ServiceStack.Text.MonoTouch.csproj", "{1137B5AC-2259-413C-A473-93721D2A7551}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {1137B5AC-2259-413C-A473-93721D2A7551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1137B5AC-2259-413C-A473-93721D2A7551}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1137B5AC-2259-413C-A473-93721D2A7551}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1137B5AC-2259-413C-A473-93721D2A7551}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = ServiceStack.Text.MonoTouch\ServiceStack.Text.MonoTouch.csproj
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.MonoTouch", "ServiceStack.Text.MonoTouch\ServiceStack.Text.MonoTouch.csproj", "{1137B5AC-2259-413C-A473-93721D2A7551}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1137B5AC-2259-413C-A473-93721D2A7551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1137B5AC-2259-413C-A473-93721D2A7551}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1137B5AC-2259-413C-A473-93721D2A7551}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1137B5AC-2259-413C-A473-93721D2A7551}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = ServiceStack.Text.MonoTouch\ServiceStack.Text.MonoTouch.csproj
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
74 src/ServiceStack.Text.WP/Properties/AssemblyInfo.cs
@@ -1,37 +1,37 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Resources;
-
-// 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("ServiceStack.Text.WP")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ServiceStack.Text.WP")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[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("8ca3569c-1483-4469-aacd-2994c5248974")]
-
-// 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")]
-[assembly: NeutralResourcesLanguageAttribute("en-US")]
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Resources;
+
+// 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("ServiceStack.Text.WP")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ServiceStack.Text.WP")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[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("8ca3569c-1483-4469-aacd-2994c5248974")]
+
+// 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")]
+[assembly: NeutralResourcesLanguageAttribute("en-US")]
View
538 src/ServiceStack.Text.WP/ServiceStack.Text.WP.csproj
@@ -1,270 +1,270 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>10.0.20506</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{0F6EB1D6-D49D-4D55-8F63-500666DA2E49}</ProjectGuid>
- <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>ServiceStack.Text.WP</RootNamespace>
- <AssemblyName>ServiceStack.Text.WP</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
- <TargetFrameworkProfile>WindowsPhone71</TargetFrameworkProfile>
- <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
- <SilverlightApplication>false</SilverlightApplication>
- <ValidateXaml>true</ValidateXaml>
- <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>Bin\Debug</OutputPath>
- <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
- <NoStdLib>true</NoStdLib>
- <NoConfig>true</NoConfig>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>Bin\Release</OutputPath>
- <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
- <NoStdLib>true</NoStdLib>
- <NoConfig>true</NoConfig>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <DocumentationFile>Bin\Release\ServiceStack.Text.WP.XML</DocumentationFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.Windows" />
- <Reference Include="system" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml" />
- <Reference Include="System.Net" />
- <Reference Include="mscorlib.extensions" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\ServiceStack.Text\AssemblyUtils.cs">
- <Link>AssemblyUtils.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DateTimeSerializer.cs">
- <Link>Common\DateTimeSerializer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeArray.cs">
- <Link>Common\DeserializeArray.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeBuiltin.cs">
- <Link>Common\DeserializeBuiltin.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeCollection.cs">
- <Link>Common\DeserializeCollection.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeDictionary.cs">
- <Link>Common\DeserializeDictionary.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeListWithElements.cs">
- <Link>Common\DeserializeListWithElements.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeSpecializedCollections.cs">
- <Link>Common\DeserializeSpecializedCollections.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeType.cs">
- <Link>Common\DeserializeType.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeTypeRef.cs">
- <Link>Common\DeserializeTypeRef.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeTypeRefJson.cs">
- <Link>Common\DeserializeTypeRefJson.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeTypeRefJsv.cs">
- <Link>Common\DeserializeTypeRefJsv.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\DeserializeTypeUtils.cs">
- <Link>Common\DeserializeTypeUtils.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\ITypeSerializer.cs">
- <Link>Common\ITypeSerializer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\JsDelegates.cs">
- <Link>Common\JsDelegates.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\JsReader.cs">
- <Link>Common\JsReader.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\JsState.cs">
- <Link>Common\JsState.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\JsWriter.cs">
- <Link>Common\JsWriter.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\ParseUtils.cs">
- <Link>Common\ParseUtils.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\StaticParseMethod.cs">
- <Link>Common\StaticParseMethod.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\WriteDictionary.cs">
- <Link>Common\WriteDictionary.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\WriteLists.cs">
- <Link>Common\WriteLists.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Common\WriteType.cs">
- <Link>Common\WriteType.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Controller\CommandProcessor.cs">
- <Link>Controller\CommandProcessor.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Controller\PathInfo.cs">
- <Link>Controller\PathInfo.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\CsvConfig.cs">
- <Link>CsvConfig.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\CsvSerializer.cs">
- <Link>CsvSerializer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\CsvStreamExtensions.cs">
- <Link>CsvStreamExtensions.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\CsvWriter.cs">
- <Link>CsvWriter.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\DateTimeExtensions.cs">
- <Link>DateTimeExtensions.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Env.cs">
- <Link>Env.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\HashSet.cs">
- <Link>HashSet.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\ITracer.cs">
- <Link>ITracer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\ITypeSerializer.Generic.cs">
- <Link>ITypeSerializer.Generic.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\JsConfig.cs">
- <Link>JsConfig.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\JsonObject.cs">
- <Link>JsonObject.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\JsonSerializer.cs">
- <Link>JsonSerializer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\JsonSerializer.Generic.cs">
- <Link>JsonSerializer.Generic.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Json\JsonReader.Generic.cs">
- <Link>Json\JsonReader.Generic.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Json\JsonTypeSerializer.cs">
- <Link>Json\JsonTypeSerializer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Json\JsonUtils.cs">
- <Link>Json\JsonUtils.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Json\JsonWriter.Generic.cs">
- <Link>Json\JsonWriter.Generic.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\JsvFormatter.cs">
- <Link>JsvFormatter.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Jsv\JsvDeserializeType.cs">
- <Link>Jsv\JsvDeserializeType.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Jsv\JsvReader.Generic.cs">
- <Link>Jsv\JsvReader.Generic.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Jsv\JsvSerializer.Generic.cs">
- <Link>Jsv\JsvSerializer.Generic.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Jsv\JsvTypeSerializer.cs">
- <Link>Jsv\JsvTypeSerializer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Jsv\JsvWriter.Generic.cs">
- <Link>Jsv\JsvWriter.Generic.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\ListExtensions.cs">
- <Link>ListExtensions.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\MapExtensions.cs">
- <Link>MapExtensions.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Marc\Link.cs">
- <Link>Marc\Link.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Marc\ObjectAccessor.cs">
- <Link>Marc\ObjectAccessor.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Marc\TypeAccessor.cs">
- <Link>Marc\TypeAccessor.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\QueryStringSerializer.cs">
- <Link>QueryStringSerializer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\ReflectionExtensions.cs">
- <Link>ReflectionExtensions.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Reflection\StaticAccessors.cs">
- <Link>Reflection\StaticAccessors.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\StreamExtensions.cs">
- <Link>StreamExtensions.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\StringExtensions.cs">
- <Link>StringExtensions.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Support\AssemblyTypeDefinition.cs">
- <Link>Support\AssemblyTypeDefinition.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Support\DoubleConverter.cs">
- <Link>Support\DoubleConverter.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Support\TypePair.cs">
- <Link>Support\TypePair.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\TextExtensions.cs">
- <Link>TextExtensions.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\Tracer.cs">
- <Link>Tracer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\TranslateListWithElements.cs">
- <Link>TranslateListWithElements.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\TypeConfig.cs">
- <Link>TypeConfig.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\TypeSerializer.cs">
- <Link>TypeSerializer.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\TypeSerializer.Generic.cs">
- <Link>TypeSerializer.Generic.cs</Link>
- </Compile>
- <Compile Include="..\ServiceStack.Text\XmlSerializer.cs">
- <Link>XmlSerializer.cs</Link>
- </Compile>
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
- <ProjectExtensions />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.20506</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{0F6EB1D6-D49D-4D55-8F63-500666DA2E49}</ProjectGuid>
+ <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ServiceStack.Text.WP</RootNamespace>
+ <AssemblyName>ServiceStack.Text.WP</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
+ <TargetFrameworkProfile>WindowsPhone71</TargetFrameworkProfile>
+ <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
+ <SilverlightApplication>false</SilverlightApplication>
+ <ValidateXaml>true</ValidateXaml>
+ <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>Bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>Bin\Release</OutputPath>
+ <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <DocumentationFile>Bin\Release\ServiceStack.Text.WP.XML</DocumentationFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Windows" />
+ <Reference Include="system" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Net" />
+ <Reference Include="mscorlib.extensions" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\ServiceStack.Text\AssemblyUtils.cs">
+ <Link>AssemblyUtils.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DateTimeSerializer.cs">
+ <Link>Common\DateTimeSerializer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeArray.cs">
+ <Link>Common\DeserializeArray.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeBuiltin.cs">
+ <Link>Common\DeserializeBuiltin.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeCollection.cs">
+ <Link>Common\DeserializeCollection.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeDictionary.cs">
+ <Link>Common\DeserializeDictionary.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeListWithElements.cs">
+ <Link>Common\DeserializeListWithElements.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeSpecializedCollections.cs">
+ <Link>Common\DeserializeSpecializedCollections.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeType.cs">
+ <Link>Common\DeserializeType.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeTypeRef.cs">
+ <Link>Common\DeserializeTypeRef.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeTypeRefJson.cs">
+ <Link>Common\DeserializeTypeRefJson.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeTypeRefJsv.cs">
+ <Link>Common\DeserializeTypeRefJsv.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\DeserializeTypeUtils.cs">
+ <Link>Common\DeserializeTypeUtils.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\ITypeSerializer.cs">
+ <Link>Common\ITypeSerializer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\JsDelegates.cs">
+ <Link>Common\JsDelegates.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\JsReader.cs">
+ <Link>Common\JsReader.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\JsState.cs">
+ <Link>Common\JsState.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\JsWriter.cs">
+ <Link>Common\JsWriter.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\ParseUtils.cs">
+ <Link>Common\ParseUtils.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\StaticParseMethod.cs">
+ <Link>Common\StaticParseMethod.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\WriteDictionary.cs">
+ <Link>Common\WriteDictionary.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\WriteLists.cs">
+ <Link>Common\WriteLists.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Common\WriteType.cs">
+ <Link>Common\WriteType.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Controller\CommandProcessor.cs">
+ <Link>Controller\CommandProcessor.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Controller\PathInfo.cs">
+ <Link>Controller\PathInfo.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\CsvConfig.cs">
+ <Link>CsvConfig.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\CsvSerializer.cs">
+ <Link>CsvSerializer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\CsvStreamExtensions.cs">
+ <Link>CsvStreamExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\CsvWriter.cs">
+ <Link>CsvWriter.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\DateTimeExtensions.cs">
+ <Link>DateTimeExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Env.cs">
+ <Link>Env.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\HashSet.cs">
+ <Link>HashSet.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\ITracer.cs">
+ <Link>ITracer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\ITypeSerializer.Generic.cs">
+ <Link>ITypeSerializer.Generic.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\JsConfig.cs">
+ <Link>JsConfig.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\JsonObject.cs">
+ <Link>JsonObject.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\JsonSerializer.cs">
+ <Link>JsonSerializer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\JsonSerializer.Generic.cs">
+ <Link>JsonSerializer.Generic.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Json\JsonReader.Generic.cs">
+ <Link>Json\JsonReader.Generic.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Json\JsonTypeSerializer.cs">
+ <Link>Json\JsonTypeSerializer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Json\JsonUtils.cs">
+ <Link>Json\JsonUtils.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Json\JsonWriter.Generic.cs">
+ <Link>Json\JsonWriter.Generic.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\JsvFormatter.cs">
+ <Link>JsvFormatter.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Jsv\JsvDeserializeType.cs">
+ <Link>Jsv\JsvDeserializeType.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Jsv\JsvReader.Generic.cs">
+ <Link>Jsv\JsvReader.Generic.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Jsv\JsvSerializer.Generic.cs">
+ <Link>Jsv\JsvSerializer.Generic.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Jsv\JsvTypeSerializer.cs">
+ <Link>Jsv\JsvTypeSerializer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Jsv\JsvWriter.Generic.cs">
+ <Link>Jsv\JsvWriter.Generic.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\ListExtensions.cs">
+ <Link>ListExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\MapExtensions.cs">
+ <Link>MapExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Marc\Link.cs">
+ <Link>Marc\Link.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Marc\ObjectAccessor.cs">
+ <Link>Marc\ObjectAccessor.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Marc\TypeAccessor.cs">
+ <Link>Marc\TypeAccessor.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\QueryStringSerializer.cs">
+ <Link>QueryStringSerializer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\ReflectionExtensions.cs">
+ <Link>ReflectionExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Reflection\StaticAccessors.cs">
+ <Link>Reflection\StaticAccessors.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\StreamExtensions.cs">
+ <Link>StreamExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\StringExtensions.cs">
+ <Link>StringExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Support\AssemblyTypeDefinition.cs">
+ <Link>Support\AssemblyTypeDefinition.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Support\DoubleConverter.cs">
+ <Link>Support\DoubleConverter.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Support\TypePair.cs">
+ <Link>Support\TypePair.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\TextExtensions.cs">
+ <Link>TextExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\Tracer.cs">
+ <Link>Tracer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\TranslateListWithElements.cs">
+ <Link>TranslateListWithElements.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\TypeConfig.cs">
+ <Link>TypeConfig.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\TypeSerializer.cs">
+ <Link>TypeSerializer.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\TypeSerializer.Generic.cs">
+ <Link>TypeSerializer.Generic.cs</Link>
+ </Compile>
+ <Compile Include="..\ServiceStack.Text\XmlSerializer.cs">
+ <Link>XmlSerializer.cs</Link>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
+ <ProjectExtensions />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
</Project>
View
60 src/ServiceStack.Text.WP/ServiceStack.Text.WP.sln
@@ -1,30 +1,30 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.WP", "ServiceStack.Text.WP.csproj", "{0F6EB1D6-D49D-4D55-8F63-500666DA2E49}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|Xbox 360 = Debug|Xbox 360
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|Xbox 360 = Release|Xbox 360
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Any CPU.Build.0 = Release|Any CPU
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Xbox 360.ActiveCfg = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.WP", "ServiceStack.Text.WP.csproj", "{0F6EB1D6-D49D-4D55-8F63-500666DA2E49}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|Xbox 360 = Debug|Xbox 360
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|Xbox 360 = Release|Xbox 360
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {0F6EB1D6-D49D-4D55-8F63-500666DA2E49}.Release|Xbox 360.ActiveCfg = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
184 src/ServiceStack.Text.sln
@@ -1,92 +1,92 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{F7FB50ED-EAFF-4839-935A-5BB4A4158245}"
- ProjectSection(SolutionItems) = preProject
- ..\build\build.bat = ..\build\build.bat
- ..\build.cmd = ..\build.cmd
- ..\build\NuGetPack.cmd = ..\build\NuGetPack.cmd
- ..\NuGet\servicestack.text.nuspec = ..\NuGet\servicestack.text.nuspec
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text", "ServiceStack.Text\ServiceStack.Text.csproj", "{579B3FDB-CDAD-44E1-8417-885C38E49A0E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.Tests", "..\tests\ServiceStack.Text.Tests\ServiceStack.Text.Tests.csproj", "{9770BD40-AA3B-4785-B5E0-F4C470F9F14E}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{EEDB2902-813A-4277-837B-74F1E67E9759}"
- ProjectSection(SolutionItems) = preProject
- .nuget\NuGet.Config = .nuget\NuGet.Config
- .nuget\NuGet.exe = .nuget\NuGet.exe
- .nuget\NuGet.targets = .nuget\NuGet.targets
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|x86 = Debug|x86
- Debug|Xbox 360 = Debug|Xbox 360
- MonoTouch|Any CPU = MonoTouch|Any CPU
- MonoTouch|Mixed Platforms = MonoTouch|Mixed Platforms
- MonoTouch|x86 = MonoTouch|x86
- MonoTouch|Xbox 360 = MonoTouch|Xbox 360
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|x86 = Release|x86
- Release|Xbox 360 = Release|Xbox 360
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|x86.ActiveCfg = Debug|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Any CPU.ActiveCfg = MonoTouch|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Any CPU.Build.0 = MonoTouch|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Mixed Platforms.ActiveCfg = MonoTouch|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Mixed Platforms.Build.0 = MonoTouch|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|x86.ActiveCfg = MonoTouch|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Xbox 360.ActiveCfg = MonoTouch|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.Build.0 = Release|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|x86.ActiveCfg = Release|Any CPU
- {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Xbox 360.ActiveCfg = Release|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|x86.ActiveCfg = Debug|x86
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|x86.Build.0 = Debug|x86
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Any CPU.ActiveCfg = MonoTouch|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Any CPU.Build.0 = MonoTouch|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Mixed Platforms.ActiveCfg = MonoTouch|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Mixed Platforms.Build.0 = MonoTouch|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|x86.ActiveCfg = MonoTouch|x86
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|x86.Build.0 = MonoTouch|x86
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Xbox 360.ActiveCfg = MonoTouch|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Any CPU.Build.0 = Release|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|x86.ActiveCfg = Release|x86
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|x86.Build.0 = Release|x86
- {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Xbox 360.ActiveCfg = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = ServiceStack.Text\ServiceStack.Text.csproj
- Policies = $0
- $0.DotNetNamingPolicy = $1
- $1.DirectoryNamespaceAssociation = None
- $1.ResourceNamePolicy = FileFormatDefault
- $0.StandardHeader = $2
- $2.Text =
- $2.IncludeInNewFiles = True
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{F7FB50ED-EAFF-4839-935A-5BB4A4158245}"
+ ProjectSection(SolutionItems) = preProject
+ ..\build\build.bat = ..\build\build.bat
+ ..\build.cmd = ..\build.cmd
+ ..\build\NuGetPack.cmd = ..\build\NuGetPack.cmd
+ ..\NuGet\servicestack.text.nuspec = ..\NuGet\servicestack.text.nuspec
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text", "ServiceStack.Text\ServiceStack.Text.csproj", "{579B3FDB-CDAD-44E1-8417-885C38E49A0E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Text.Tests", "..\tests\ServiceStack.Text.Tests\ServiceStack.Text.Tests.csproj", "{9770BD40-AA3B-4785-B5E0-F4C470F9F14E}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{EEDB2902-813A-4277-837B-74F1E67E9759}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|x86 = Debug|x86
+ Debug|Xbox 360 = Debug|Xbox 360
+ MonoTouch|Any CPU = MonoTouch|Any CPU
+ MonoTouch|Mixed Platforms = MonoTouch|Mixed Platforms
+ MonoTouch|x86 = MonoTouch|x86
+ MonoTouch|Xbox 360 = MonoTouch|Xbox 360
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|x86 = Release|x86
+ Release|Xbox 360 = Release|Xbox 360
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Any CPU.ActiveCfg = MonoTouch|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Any CPU.Build.0 = MonoTouch|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Mixed Platforms.ActiveCfg = MonoTouch|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Mixed Platforms.Build.0 = MonoTouch|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|x86.ActiveCfg = MonoTouch|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.MonoTouch|Xbox 360.ActiveCfg = MonoTouch|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|x86.ActiveCfg = Release|Any CPU
+ {579B3FDB-CDAD-44E1-8417-885C38E49A0E}.Release|Xbox 360.ActiveCfg = Release|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|x86.ActiveCfg = Debug|x86
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|x86.Build.0 = Debug|x86
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Debug|Xbox 360.ActiveCfg = Debug|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Any CPU.ActiveCfg = MonoTouch|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Any CPU.Build.0 = MonoTouch|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Mixed Platforms.ActiveCfg = MonoTouch|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Mixed Platforms.Build.0 = MonoTouch|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|x86.ActiveCfg = MonoTouch|x86
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|x86.Build.0 = MonoTouch|x86
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.MonoTouch|Xbox 360.ActiveCfg = MonoTouch|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|x86.ActiveCfg = Release|x86
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|x86.Build.0 = Release|x86
+ {9770BD40-AA3B-4785-B5E0-F4C470F9F14E}.Release|Xbox 360.ActiveCfg = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = ServiceStack.Text\ServiceStack.Text.csproj
+ Policies = $0
+ $0.DotNetNamingPolicy = $1
+ $1.DirectoryNamespaceAssociation = None
+ $1.ResourceNamePolicy = FileFormatDefault
+ $0.StandardHeader = $2
+ $2.Text =
+ $2.IncludeInNewFiles = True
+ EndGlobalSection
+EndGlobal
View
330 src/ServiceStack.Text/AssemblyUtils.cs
@@ -1,166 +1,166 @@
-using System;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Text.RegularExpressions;
-#if SILVERLIGHT
-
-#endif
-using ServiceStack.Common.Support;
-
-namespace ServiceStack.Text
-{
- /// <summary>
- /// Utils to load types
- /// </summary>
- public static class AssemblyUtils
- {
- private const string FileUri = "file:///";
- private const string DllExt = "dll";
- private const string ExeExt = "dll";
- private const char UriSeperator = '/';
-
-#if !XBOX
- /// <summary>
- /// Find the type from the name supplied
- /// </summary>
- /// <param name="typeName">[typeName] or [typeName, assemblyName]</param>
- /// <returns></returns>
- public static Type FindType(string typeName)
- {
-#if !SILVERLIGHT
- var type = Type.GetType(typeName);
- if (type != null) return type;
-#endif
- var typeDef = new AssemblyTypeDefinition(typeName);
- if (!String.IsNullOrEmpty(typeDef.AssemblyName))
- {
- return FindType(typeDef.TypeName, typeDef.AssemblyName);
- }
- else
- {
- return FindTypeFromLoadedAssemblies(typeDef.TypeName);
- }
- }
-#endif
-
-#if !XBOX
-
-
- /// <summary>
- /// The top-most interface of the given type, if any.
- /// </summary>
- public static Type MainInterface<T>() {
- var t = typeof(T);
- if (t.BaseType == typeof(object)) {
- // on Windows, this can be just "t.GetInterfaces()" but Mono doesn't return in order.
- var interfaceType = t.GetInterfaces().FirstOrDefault(i => !t.GetInterfaces().Any(i2 => i2.GetInterfaces().Contains(i)));
- if (interfaceType != null) return interfaceType;
- }
- return t; // not safe to use interface, as it might be a superclass's one.
- }
-
- /// <summary>
- /// Find type if it exists
- /// </summary>
- /// <param name="typeName"></param>
- /// <param name="assemblyName"></param>
- /// <returns>The type if it exists</returns>
- public static Type FindType(string typeName, string assemblyName)
- {
- var type = FindTypeFromLoadedAssemblies(typeName);
- if (type != null)
- {
- return type;
- }
- var binPath = GetAssemblyBinPath(Assembly.GetExecutingAssembly());
- Assembly assembly = null;
- var assemblyDllPath = binPath + String.Format("{0}.{1}", assemblyName, DllExt);
- if (File.Exists(assemblyDllPath))
- {
- assembly = LoadAssembly(assemblyDllPath);
- }
- var assemblyExePath = binPath + String.Format("{0}.{1}", assemblyName, ExeExt);
- if (File.Exists(assemblyExePath))
- {
- assembly = LoadAssembly(assemblyExePath);
- }
- return assembly != null ? assembly.GetType(typeName) : null;
- }
-#endif
-
-#if !XBOX
- public static Type FindTypeFromLoadedAssemblies(string typeName)
- {
-#if SILVERLIGHT4
- var assemblies = ((dynamic) AppDomain.CurrentDomain).GetAssemblies() as Assembly[];
-#else
- var assemblies = AppDomain.CurrentDomain.GetAssemblies();
-#endif
- foreach (var assembly in assemblies)
- {
- var type = assembly.GetType(typeName);
- if (type != null)
- {
- return type;
- }
- }
- return null;
- }
-#endif
-
-#if !SILVERLIGHT
-private static Assembly LoadAssembly(string assemblyPath)
- {
- return Assembly.LoadFrom(assemblyPath);
- }
-#elif WINDOWS_PHONE
- private static Assembly LoadAssembly(string assemblyPath)
- {
- return Assembly.LoadFrom(assemblyPath);
- }
-#else
- private static Assembly LoadAssembly(string assemblyPath)
- {
- var sri = System.Windows.Application.GetResourceStream(new Uri(assemblyPath, UriKind.Relative));
- var myPart = new System.Windows.AssemblyPart();
- var assembly = myPart.Load(sri.Stream);
- return assembly;
- }
-#endif
-
-#if !XBOX
- public static string GetAssemblyBinPath(Assembly assembly)
- {
-#if WINDOWS_PHONE
- var codeBase = assembly.GetName().CodeBase;
-#else
- var codeBase = assembly.CodeBase;
-#endif
-
- var binPathPos = codeBase.LastIndexOf(UriSeperator);
- var assemblyPath = codeBase.Substring(0, binPathPos + 1);
- if (assemblyPath.StartsWith(FileUri))
- {
- assemblyPath = assemblyPath.Remove(0, FileUri.Length);
- }
- return assemblyPath;
- }
-#endif
-
-#if !SILVERLIGHT
- static readonly Regex versionRegEx = new Regex(", Version=[^\\]]+", RegexOptions.Compiled);
-#else
- static readonly Regex versionRegEx = new Regex(", Version=[^\\]]+");
-#endif
- public static string ToTypeString(this Type type)
- {
- return versionRegEx.Replace(type.AssemblyQualifiedName, "");
- }
-
- public static string WriteType(Type type)
- {
- return type.ToTypeString();
- }
- }
+using System;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text.RegularExpressions;
+#if SILVERLIGHT
+
+#endif
+using ServiceStack.Common.Support;
+
+namespace ServiceStack.Text
+{
+ /// <summary>
+ /// Utils to load types
+ /// </summary>
+ public static class AssemblyUtils
+ {
+ private const string FileUri = "file:///";
+ private const string DllExt = "dll";
+ private const string ExeExt = "dll";
+ private const char UriSeperator = '/';
+
+#if !XBOX
+ /// <summary>
+ /// Find the type from the name supplied
+ /// </summary>
+ /// <param name="typeName">[typeName] or [typeName, assemblyName]</param>
+ /// <returns></returns>
+ public static Type FindType(string typeName)
+ {
+#if !SILVERLIGHT
+ var type = Type.GetType(typeName);
+ if (type != null) return type;
+#endif
+ var typeDef = new AssemblyTypeDefinition(typeName);
+ if (!String.IsNullOrEmpty(typeDef.AssemblyName))
+ {
+ return FindType(typeDef.TypeName, typeDef.AssemblyName);
+ }
+ else
+ {
+ return FindTypeFromLoadedAssemblies(typeDef.TypeName);
+ }
+ }
+#endif
+
+#if !XBOX
+
+
+ /// <summary>
+ /// The top-most interface of the given type, if any.
+ /// </summary>
+ public static Type MainInterface<T>() {
+ var t = typeof(T);
+ if (t.BaseType == typeof(object)) {
+ // on Windows, this can be just "t.GetInterfaces()" but Mono doesn't return in order.
+ var interfaceType = t.GetInterfaces().FirstOrDefault(i => !t.GetInterfaces().Any(i2 => i2.GetInterfaces().Contains(i)));
+ if (interfaceType != null) return interfaceType;
+ }
+ return t; // not safe to use interface, as it might be a superclass's one.
+ }
+
+ /// <summary>
+ /// Find type if it exists
+ /// </summary>
+ /// <param name="typeName"></param>
+ /// <param name="assemblyName"></param>
+ /// <returns>The type if it exists</returns>
+ public static Type FindType(string typeName, string assemblyName)
+ {
+ var type = FindTypeFromLoadedAssemblies(typeName);
+ if (type != null)
+ {
+ return type;
+ }
+ var binPath = GetAssemblyBinPath(Assembly.GetExecutingAssembly());
+ Assembly assembly = null;
+ var assemblyDllPath = binPath + String.Format("{0}.{1}", assemblyName, DllExt);
+ if (File.Exists(assemblyDllPath))
+ {
+ assembly = LoadAssembly(assemblyDllPath);
+ }
+ var assemblyExePath = binPath + String.Format("{0}.{1}", assemblyName, ExeExt);
+ if (File.Exists(assemblyExePath))
+ {
+ assembly = LoadAssembly(assemblyExePath);
+ }
+ return assembly != null ? assembly.GetType(typeName) : null;
+ }
+#endif
+
+#if !XBOX
+ public static Type FindTypeFromLoadedAssemblies(string typeName)
+ {
+#if SILVERLIGHT4
+ var assemblies = ((dynamic) AppDomain.CurrentDomain).GetAssemblies() as Assembly[];
+#else
+ var assemblies = AppDomain.CurrentDomain.GetAssemblies();
+#endif
+ foreach (var assembly in assemblies)
+ {
+ var type = assembly.GetType(typeName);
+ if (type != null)
+ {
+ return type;
+ }
+ }
+ return null;
+ }
+#endif
+
+#if !SILVERLIGHT
+private static Assembly LoadAssembly(string assemblyPath)
+ {
+ return Assembly.LoadFrom(assemblyPath);
+ }
+#elif WINDOWS_PHONE
+ private static Assembly LoadAssembly(string assemblyPath)
+ {
+ return Assembly.LoadFrom(assemblyPath);
+ }
+#else
+ private static Assembly LoadAssembly(string assemblyPath)
+ {
+ var sri = System.Windows.Application.GetResourceStream(new Uri(assemblyPath, UriKind.Relative));
+ var myPart = new System.Windows.AssemblyPart();
+ var assembly = myPart.Load(sri.Stream);
+ return assembly;
+ }
+#endif
+
+#if !XBOX
+ public static string GetAssemblyBinPath(Assembly assembly)
+ {
+#if WINDOWS_PHONE
+ var codeBase = assembly.GetName().CodeBase;
+#else
+ var codeBase = assembly.CodeBase;
+#endif
+
+ var binPathPos = codeBase.LastIndexOf(UriSeperator);
+ var assemblyPath = codeBase.Substring(0, binPathPos + 1);
+ if (assemblyPath.StartsWith(FileUri))
+ {
+ assemblyPath = assemblyPath.Remove(0, FileUri.Length);
+ }
+ return assemblyPath;
+ }
+#endif
+
+#if !SILVERLIGHT
+ static readonly Regex versionRegEx = new Regex(", Version=[^\\]]+", RegexOptions.Compiled);
+#else
+ static readonly Regex versionRegEx = new Regex(", Version=[^\\]]+");
+#endif
+ public static string ToTypeString(this Type type)
+ {
+ return versionRegEx.Replace(type.AssemblyQualifiedName, "");
+ }
+
+ public static string WriteType(Type type)
+ {
+ return type.ToTypeString();
+ }
+ }
}
View
584 src/ServiceStack.Text/Common/DateTimeSerializer.cs
@@ -1,293 +1,293 @@
-//
-// https://github.com/ServiceStack/ServiceStack.Text
-// ServiceStack.Text: .NET C# POCO JSON, JSV and CSV Text Serializers.
-//
-// Authors:
-// Demis Bellot (demis.bellot@gmail.com)
-//
-// Copyright 2012 ServiceStack Ltd.
-//
-// Licensed under the same terms of ServiceStack: new BSD license.
-//
-
-using System;
-using System.Globalization;
-using System.Xml;
-using ServiceStack.Text.Json;
-
-namespace ServiceStack.Text.Common
-{
- public static class DateTimeSerializer
- {
- public const string ShortDateTimeFormat = "yyyy-MM-dd"; //11
- public const string DefaultDateTimeFormat = "dd/MM/yyyy HH:mm:ss"; //20
- public const string DefaultDateTimeFormatWithFraction = "dd/MM/yyyy HH:mm:ss.fff"; //24
- public const string XsdDateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; //29
- public const string XsdDateTimeFormat3F = "yyyy-MM-ddTHH:mm:ss.fffZ"; //25
- public const string XsdDateTimeFormatSeconds = "yyyy-MM-ddTHH:mm:ssZ"; //21
-
- public const string EscapedWcfJsonPrefix = "\\/Date(";
- public const string EscapedWcfJsonSuffix = ")\\/";
- public const string WcfJsonPrefix = "/Date(";
- public const char WcfJsonSuffix = ')';
-
- public static DateTime? ParseShortestNullableXsdDateTime(string dateTimeStr)
- {
- if (dateTimeStr == null)
- return null;
-
- return ParseShortestXsdDateTime(dateTimeStr);
- }
-
- public static DateTime ParseShortestXsdDateTime(string dateTimeStr)
- {
- if (string.IsNullOrEmpty(dateTimeStr))
- return DateTime.MinValue;
-
- if (dateTimeStr.StartsWith(EscapedWcfJsonPrefix) || dateTimeStr.StartsWith(WcfJsonPrefix))
- return ParseWcfJsonDate(dateTimeStr);
-
- if (dateTimeStr.Length == DefaultDateTimeFormat.Length
- || dateTimeStr.Length == DefaultDateTimeFormatWithFraction.Length)
- return DateTime.Parse(dateTimeStr, CultureInfo.InvariantCulture);
-
- if (dateTimeStr.Length == XsdDateTimeFormatSeconds.Length)
- return DateTime.ParseExact(dateTimeStr, XsdDateTimeFormatSeconds, null,
- DateTimeStyles.AdjustToUniversal);
-
- if (dateTimeStr.Length >= XsdDateTimeFormat3F.Length
- && dateTimeStr.Length <= XsdDateTimeFormat.Length)
- {
- var dateTimeType = JsConfig.DateHandler != JsonDateHandler.ISO8601
- ? XmlDateTimeSerializationMode.Local
- : XmlDateTimeSerializationMode.RoundtripKind;
-
- return XmlConvert.ToDateTime(dateTimeStr, dateTimeType);
- }
-
- return DateTime.Parse(dateTimeStr, null, DateTimeStyles.AssumeLocal);
- }
-
- public static string ToDateTimeString(DateTime dateTime)
- {
- return dateTime.ToStableUniversalTime().ToString(XsdDateTimeFormat);
- }
-
- public static DateTime ParseDateTime(string dateTimeStr)
- {
- return DateTime.ParseExact(dateTimeStr, XsdDateTimeFormat, null);
- }
-
- public static DateTimeOffset ParseDateTimeOffset(string dateTimeOffsetStr)
- {
- if (string.IsNullOrEmpty(dateTimeOffsetStr)) return default(DateTimeOffset);
-
- // for interop, do not assume format based on config
- // format: prefer TimestampOffset, DCJSCompatible
- if (dateTimeOffsetStr.StartsWith(EscapedWcfJsonPrefix) ||
- dateTimeOffsetStr.StartsWith(WcfJsonPrefix))
- {
- return ParseWcfJsonDateOffset(dateTimeOffsetStr);
- }
-
- // format: next preference ISO8601
- // assume utc when no offset specified
- if (dateTimeOffsetStr.LastIndexOfAny(TimeZoneChars) < 10)
- {
- if (!dateTimeOffsetStr.EndsWith("Z")) dateTimeOffsetStr += "Z";
-#if __MonoCS__
- // Without that Mono uses a Local timezone))
- dateTimeOffsetStr = dateTimeOffsetStr.Substring(0, dateTimeOffsetStr.Length - 1) + "+00:00";
-#endif
- }
-
- return DateTimeOffset.Parse(dateTimeOffsetStr, CultureInfo.InvariantCulture);
- }
-
- public static string ToXsdDateTimeString(DateTime dateTime)
- {
- return XmlConvert.ToString(dateTime.ToStableUniversalTime(), XmlDateTimeSerializationMode.Utc);
- }
-
- public static string ToXsdTimeSpanString(TimeSpan timeSpan)
- {
- var r = XmlConvert.ToString(timeSpan);
-#if __MonoCS__
- // Mono returns DT even if time is 00:00:00
- if (r.EndsWith("DT")) return r.Substring(0, r.Length - 1);
-#endif
- return r;
- }
-
- public static string ToXsdTimeSpanString(TimeSpan? timeSpan)
- {
- return (timeSpan != null) ? ToXsdTimeSpanString(timeSpan.Value) : null;
- }
-
- public static DateTime ParseXsdDateTime(string dateTimeStr)
- {
- return XmlConvert.ToDateTime(dateTimeStr, XmlDateTimeSerializationMode.Utc);
- }
-
- public static TimeSpan ParseTimeSpan(string dateTimeStr)
- {
- return dateTimeStr.StartsWith("P") || dateTimeStr.StartsWith("-P")
- ? ParseXsdTimeSpan(dateTimeStr)
- : TimeSpan.Parse(dateTimeStr);
- }
-
- public static TimeSpan ParseXsdTimeSpan(string dateTimeStr)
- {
- return XmlConvert.ToTimeSpan(dateTimeStr);
- }
-
- public static TimeSpan? ParseNullableTimeSpan(string dateTimeStr)
- {
- return string.IsNullOrEmpty(dateTimeStr)
- ? (TimeSpan?) null
- : ParseTimeSpan(dateTimeStr);
- }
-
- public static TimeSpan? ParseXsdNullableTimeSpan(string dateTimeStr)
- {
- return String.IsNullOrEmpty(dateTimeStr) ?
- null :
- new TimeSpan?(XmlConvert.ToTimeSpan(dateTimeStr));
- }
-
- public static string ToShortestXsdDateTimeString(DateTime dateTime)
- {
- var timeOfDay = dateTime.TimeOfDay;
-
- if (timeOfDay.Ticks == 0)
- return dateTime.ToString(ShortDateTimeFormat);
-
- if (timeOfDay.Milliseconds == 0)
- return dateTime.ToStableUniversalTime().ToString(XsdDateTimeFormatSeconds);
-
- return ToXsdDateTimeString(dateTime);
- }
-
-
- static readonly char[] TimeZoneChars = new[] { '+', '-' };
-
- /// <summary>
- /// WCF Json format: /Date(unixts+0000)/
- /// </summary>
- /// <param name="wcfJsonDate"></param>
- /// <returns></returns>
- public static DateTimeOffset ParseWcfJsonDateOffset(string wcfJsonDate)
- {
- if (wcfJsonDate[0] == '\\')
- {
- wcfJsonDate = wcfJsonDate.Substring(1);
- }
-
- var suffixPos = wcfJsonDate.IndexOf(WcfJsonSuffix);
- var timeString = (suffixPos < 0) ? wcfJsonDate : wcfJsonDate.Substring(WcfJsonPrefix.Length, suffixPos - WcfJsonPrefix.Length);
-
- // for interop, do not assume format based on config
- if (!wcfJsonDate.StartsWith(WcfJsonPrefix))
- {
- return DateTimeOffset.Parse(timeString, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
- }
-
- var timeZonePos = timeString.LastIndexOfAny(TimeZoneChars);
- var timeZone = timeZonePos <= 0 ? string.Empty : timeString.Substring(timeZonePos);
- var unixTimeString = timeString.Substring(0, timeString.Length - timeZone.Length);
-
- var unixTime = long.Parse(unixTimeString);
-
- if (timeZone == string.Empty)
- {
- // when no timezone offset is supplied, then treat the time as UTC
- return unixTime.FromUnixTimeMs();
- }
-
- if (JsConfig.DateHandler == JsonDateHandler.DCJSCompatible)
- {
- // DCJS ignores the offset and considers it local time if any offset exists
- // REVIEW: DCJS shoves offset in a separate field 'offsetMinutes', we have the offset in the format, so shouldn't we use it?
- return unixTime.FromUnixTimeMs().ToLocalTime();
- }
-
- var offset = timeZone.FromTimeOffsetString();
- var date = unixTime.FromUnixTimeMs();
- return new DateTimeOffset(date.Ticks, offset);
- }
-
- /// <summary>
- /// WCF Json format: /Date(unixts+0000)/
- /// </summary>
- /// <param name="wcfJsonDate"></param>
- /// <returns></returns>
- public static DateTime ParseWcfJsonDate(string wcfJsonDate)
- {
- if (wcfJsonDate[0] == JsonUtils.EscapeChar)
- {
- wcfJsonDate = wcfJsonDate.Substring(1);
- }
-
- var suffixPos = wcfJsonDate.IndexOf(WcfJsonSuffix);
- var timeString = wcfJsonDate.Substring(WcfJsonPrefix.Length, suffixPos - WcfJsonPrefix.Length);
-
- // for interop, do not assume format based on config
- if (!wcfJsonDate.StartsWith(WcfJsonPrefix))
- {
- return DateTime.Parse(timeString, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
- }
-
- var timeZonePos = timeString.LastIndexOfAny(TimeZoneChars);
- var timeZone = timeZonePos <= 0 ? string.Empty : timeString.Substring(timeZonePos);
- var unixTimeString = timeString.Substring(0, timeString.Length - timeZone.Length);
-
- var unixTime = long.Parse(unixTimeString);
-
- if (timeZone == string.Empty)
- {
- // when no timezone offset is supplied, then treat the time as UTC
- return unixTime.FromUnixTimeMs();
- }
-
- if (JsConfig.DateHandler == JsonDateHandler.DCJSCompatible)
- {
- // DCJS ignores the offset and considers it local time if any offset exists
- return unixTime.FromUnixTimeMs().ToLocalTime();
- }
-
- var offset = timeZone.FromTimeOffsetString();
- var date = unixTime.FromUnixTimeMs(offset);
- return new DateTimeOffset(date, offset).DateTime;
- }
-
- public static string ToWcfJsonDate(DateTime dateTime)
- {
- if (JsConfig.DateHandler == JsonDateHandler.ISO8601)
- {
- return dateTime.ToString("o", CultureInfo.InvariantCulture);
- }
-
- var timestamp = dateTime.ToUnixTimeMs();
- var offset = dateTime.Kind == DateTimeKind.Utc
- ? string.Empty
- : TimeZoneInfo.Local.GetUtcOffset(dateTime).ToTimeOffsetString();
-
- return EscapedWcfJsonPrefix + timestamp + offset + EscapedWcfJsonSuffix;
- }
-
- public static string ToWcfJsonDateTimeOffset(DateTimeOffset dateTimeOffset)
- {
- if (JsConfig.DateHandler == JsonDateHandler.ISO8601)
- {
- return dateTimeOffset.ToString("o", CultureInfo.InvariantCulture);
- }
-
- var timestamp = dateTimeOffset.Ticks.ToUnixTimeMs();
- var offset = dateTimeOffset.Offset == TimeSpan.Zero
- ? string.Empty
- : dateTimeOffset.Offset.ToTimeOffsetString();
-
- return EscapedWcfJsonPrefix + timestamp + offset + EscapedWcfJsonSuffix;
- }
- }
+//
+// https://github.com/ServiceStack/ServiceStack.Text
+// ServiceStack.Text: .NET C# POCO JSON, JSV and CSV Text Serializers.
+//
+// Authors:
+// Demis Bellot (demis.bellot@gmail.com)
+//
+// Copyright 2012 ServiceStack Ltd.
+//
+// Licensed under the same terms of ServiceStack: new BSD license.
+//
+
+using System;
+using System.Globalization;
+using System.Xml;
+using ServiceStack.Text.Json;
+
+namespace ServiceStack.Text.Common
+{
+ public static class DateTimeSerializer
+ {
+ public const string ShortDateTimeFormat = "yyyy-MM-dd"; //11
+ public const string DefaultDateTimeFormat = "dd/MM/yyyy HH:mm:ss"; //20
+ public const string DefaultDateTimeFormatWithFraction = "dd/MM/yyyy HH:mm:ss.fff"; //24
+ public const string XsdDateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; //29
+ public const string XsdDateTimeFormat3F = "yyyy-MM-ddTHH:mm:ss.fffZ"; //25
+ public const string XsdDateTimeFormatSeconds = "yyyy-MM-ddTHH:mm:ssZ"; //21
+
+ public const string EscapedWcfJsonPrefix = "\\/Date(";
+ public const string EscapedWcfJsonSuffix = ")\\/";
+ public const string WcfJsonPrefix = "/Date(";
+ public const char WcfJsonSuffix = ')';
+
+ public static DateTime? ParseShortestNullableXsdDateTime(string dateTimeStr)
+ {
+ if (dateTimeStr == null)
+ return null;
+
+ return ParseShortestXsdDateTime(dateTimeStr);
+ }
+
+ public static DateTime ParseShortestXsdDateTime(string dateTimeStr)
+ {
+ if (string.IsNullOrEmpty(dateTimeStr))
+ return DateTime.MinValue;
+
+ if (dateTimeStr.StartsWith(EscapedWcfJsonPrefix) || dateTimeStr.StartsWith(WcfJsonPrefix))
+ return ParseWcfJsonDate(dateTimeStr);
+
+ if (dateTimeStr.Length == DefaultDateTimeFormat.Length
+ || dateTimeStr.Length == DefaultDateTimeFormatWithFraction.Length)
+ return DateTime.Parse(dateTimeStr, CultureInfo.InvariantCulture);
+
+ if (dateTimeStr.Length == XsdDateTimeFormatSeconds.Length)
+ return DateTime.ParseExact(dateTimeStr, XsdDateTimeFormatSeconds, null,
+ DateTimeStyles.AdjustToUniversal);
+
+ if (dateTimeStr.Length >= XsdDateTimeFormat3F.Length
+ && dateTimeStr.Length <= XsdDateTimeFormat.Length)
+ {
+ var dateTimeType = JsConfig.DateHandler != JsonDateHandler.ISO8601
+ ? XmlDateTimeSerializationMode.Local
+ : XmlDateTimeSerializationMode.RoundtripKind;
+
+ return XmlConvert.ToDateTime(dateTimeStr, dateTimeType);
+ }
+
+ return DateTime.Parse(dateTimeStr, null, DateTimeStyles.AssumeLocal);
+ }
+
+ public static string ToDateTimeString(DateTime dateTime)
+ {
+ return dateTime.ToStableUniversalTime().ToString(XsdDateTimeFormat);
+ }
+
+ public static DateTime ParseDateTime(string dateTimeStr)
+ {
+ return DateTime.ParseExact(dateTimeStr, XsdDateTimeFormat, null);
+ }
+
+ public static DateTimeOffset ParseDateTimeOffset(string dateTimeOffsetStr)
+ {
+ if (string.IsNullOrEmpty(dateTimeOffsetStr)) return default(DateTimeOffset);
+
+ // for interop, do not assume format based on config
+ // format: prefer TimestampOffset, DCJSCompatible
+ if (dateTimeOffsetStr.StartsWith(EscapedWcfJsonPrefix) ||
+ dateTimeOffsetStr.StartsWith(WcfJsonPrefix))
+ {
+ return ParseWcfJsonDateOffset(dateTimeOffsetStr);
+ }
+
+ // format: next preference ISO8601
+ // assume utc when no offset specified
+ if (dateTimeOffsetStr.LastIndexOfAny(TimeZoneChars) < 10)
+ {
+ if (!dateTimeOffsetStr.EndsWith("Z")) dateTimeOffsetStr += "Z";
+#if __MonoCS__
+ // Without that Mono uses a Local timezone))
+ dateTimeOffsetStr = dateTimeOffsetStr.Substring(0, dateTimeOffsetStr.Length - 1) + "+00:00";
+#endif
+ }
+
+ return DateTimeOffset.Parse(dateTimeOffsetStr, CultureInfo.InvariantCulture);
+ }
+
+ public static string ToXsdDateTimeString(DateTime dateTime)
+ {
+ return XmlConvert.ToString(dateTime.ToStableUniversalTime(), XmlDateTimeSerializationMode.Utc);
+ }
+
+ public static string ToXsdTimeSpanString(TimeSpan timeSpan)
+ {
+ var r = XmlConvert.ToString(timeSpan);
+#if __MonoCS__
+ // Mono returns DT even if time is 00:00:00
+ if (r.EndsWith("DT")) return r.Substring(0, r.Length - 1);
+#endif
+ return r;
+ }
+
+ public static string ToXsdTimeSpanString(TimeSpan? timeSpan)
+ {
+ return (timeSpan != null) ? ToXsdTimeSpanString(timeSpan.Value) : null;
+ }
+
+ public static DateTime ParseXsdDateTime(string dateTimeStr)
+ {
+ return XmlConvert.ToDateTime(dateTimeStr, XmlDateTimeSerializationMode.Utc);
+ }
+
+ public static TimeSpan ParseTimeSpan(string dateTimeStr)
+ {
+ return dateTimeStr.StartsWith("P") || dateTimeStr.StartsWith("-P")
+ ? ParseXsdTimeSpan(dateTimeStr)
+ : TimeSpan.Parse(dateTimeStr);
+ }
+
+ public static TimeSpan ParseXsdTimeSpan(string dateTimeStr)
+ {
+ return XmlConvert.ToTimeSpan(dateTimeStr);
+ }
+
+ public static TimeSpan? ParseNullableTimeSpan(string dateTimeStr)
+ {
+ return string.IsNullOrEmpty(dateTimeStr)
+ ? (TimeSpan?) null
+ : ParseTimeSpan(dateTimeStr);
+ }
+
+ public static TimeSpan? ParseXsdNullableTimeSpan(string dateTimeStr)
+ {
+ return String.IsNullOrEmpty(dateTimeStr) ?
+ null :
+ new TimeSpan?(XmlConvert.ToTimeSpan(dateTimeStr));
+ }
+
+ public static string ToShortestXsdDateTimeString(DateTime dateTime)
+ {
+ var timeOfDay = dateTime.TimeOfDay;
+
+ if (timeOfDay.Ticks == 0)
+ return dateTime.ToString(ShortDateTimeFormat);
+
+ if (timeOfDay.Milliseconds == 0)
+ return dateTime.ToStableUniversalTime().ToString(XsdDateTimeFormatSeconds);
+
+ return ToXsdDateTimeString(dateTime);
+ }
+
+
+ static readonly char[] TimeZoneChars = new[] { '+', '-' };
+
+ /// <summary>
+ /// WCF Json format: /Date(unixts+0000)/
+ /// </summary>
+ /// <param name="wcfJsonDate"></param>
+ /// <returns></returns>
+ public static DateTimeOffset ParseWcfJsonDateOffset(string wcfJsonDate)
+ {
+ if (wcfJsonDate[0] == '\\')
+ {
+ wcfJsonDate = wcfJsonDate.Substring(1);
+ }
+
+ var suffixPos = wcfJsonDate.IndexOf(WcfJsonSuffix);
+ var timeString = (suffixPos < 0) ? wcfJsonDate : wcfJsonDate.Substring(WcfJsonPrefix.Length, suffixPos - WcfJsonPrefix.Length);
+
+ // for interop, do not assume format based on config
+ if (!wcfJsonDate.StartsWith(WcfJsonPrefix))
+ {
+ return DateTimeOffset.Parse(timeString, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
+ }
+
+ var timeZonePos = timeString.LastIndexOfAny(TimeZoneChars);
+ var timeZone = timeZonePos <= 0 ? string.Empty : timeString.Substring(timeZonePos);
+ var unixTimeString = timeString.Substring(0, timeString.Length - timeZone.Length);
+
+ var unixTime = long.Parse(unixTimeString);
+
+ if (timeZone == string.Empty)
+ {
+ // when no timezone offset is supplied, then treat the time as UTC
+ return unixTime.FromUnixTimeMs();
+ }
+
+ if (JsConfig.DateHandler == JsonDateHandler.DCJSCompatible)
+ {
+ // DCJS ignores the offset and considers it local time if any offset exists
+ // REVIEW: DCJS shoves offset in a separate field 'offsetMinutes', we have the offset in the format, so shouldn't we use it?
+ return unixTime.FromUnixTimeMs().ToLocalTime();
+ }
+
+ var offset = timeZone.FromTimeOffsetString();
+ var date = unixTime.FromUnixTimeMs();
+ return new DateTimeOffset(date.Ticks, offset);
+ }
+
+ /// <summary>
+ /// WCF Json format: /Date(unixts+0000)/
+ /// </summary>
+ /// <param name="wcfJsonDate"></param>
+ /// <returns></returns>
+ public static DateTime ParseWcfJsonDate(string wcfJsonDate)
+ {
+ if (wcfJsonDate[0] == JsonUtils.EscapeChar)
+ {
+ wcfJsonDate = wcfJsonDate.Substring(1);
+ }
+
+ var suffixPos = wcfJsonDate.IndexOf(WcfJsonSuffix);
+ var timeString = wcfJsonDate.Substring(WcfJsonPrefix.Length, suffixPos - WcfJsonPrefix.Length);
+
+ // for interop, do not assume format based on config
+ if (!wcfJsonDate.StartsWith(WcfJsonPrefix))
+ {
+ return DateTime.Parse(timeString, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
+ }
+
+ var timeZonePos = timeString.LastIndexOfAny(TimeZoneChars);
+ var timeZone = timeZonePos <= 0 ? string.Empty : timeString.Substring(timeZonePos);
+ var unixTimeString = timeString.Substring(0, timeString.Length - timeZone.Length);
+
+ var unixTime = long.Parse(unixTimeString);
+
+ if (timeZone == string.Empty)
+ {
+ // when no timezone offset is supplied, then treat the time as UTC
+ return unixTime.FromUnixTimeMs();
+ }
+
+ if (JsConfig.DateHandler == JsonDateHandler.DCJSCompatible)
+ {
+ // DCJS ignores the offset and considers it local time if any offset exists
+ return unixTime.FromUnixTimeMs().ToLocalTime();
+ }
+
+ var offset = timeZone.FromTimeOffsetString();
+ var date = unixTime.FromUnixTimeMs(offset);
+ return new DateTimeOffset(date, offset).DateTime;
+ }
+
+ public static string ToWcfJsonDate(DateTime dateTime)
+ {
+ if (JsConfig.DateHandler == JsonDateHandler.ISO8601)
+ {
+ return dateTime.ToString("o", CultureInfo.InvariantCulture);
+ }
+
+ var timestamp = dateTime.ToUnixTimeMs();
+ var offset = dateTime.Kind == DateTimeKind.Utc
+ ? string.Empty
+ : TimeZoneInfo.Local.GetUtcOffset(dateTime).ToTimeOffsetString();
+
+ return EscapedWcfJsonPrefix + timestamp + offset + EscapedWcfJsonSuffix;
+ }
+
+ public static string ToWcfJsonDateTimeOffset(DateTimeOffset dateTimeOffset)
+ {
+ if (JsConfig.DateHandler == JsonDateHandler.ISO8601)
+ {
+ return dateTimeOffset.ToString("o", CultureInfo.InvariantCulture);
+ }
+
+ var timestamp = dateTimeOffset.Ticks.ToUnixTimeMs();
+ var offset = dateTimeOffset.Offset == TimeSpan.Zero
+ ? string.Empty
+ : dateTimeOffset.Offset.ToTimeOffsetString();
+
+ return EscapedWcfJsonPrefix + timestamp + offset + EscapedWcfJsonSuffix;
+ }
+ }
}
View
374 src/ServiceStack.Text/Common/DeserializeArray.cs
@@ -1,188 +1,188 @@
-//
-// https://github.com/ServiceStack/ServiceStack.Text
-// ServiceStack.Text: .NET C# POCO JSON, JSV and CSV Text Serializers.
-//
-// Authors:
-// Demis Bellot (demis.bellot@gmail.com)
-//
-// Copyright 2012 ServiceStack Ltd.
-//
-// Licensed under the same terms of ServiceStack: new BSD license.
-//
-
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Threading;
-
-namespace ServiceStack.Text.Common
-{
- internal static class DeserializeArrayWithElements<TSerializer>
- where TSerializer : ITypeSerializer
- {
- private static Dictionary<Type, ParseArrayOfElementsDelegate> ParseDelegateCache
- = new Dictionary<Type, ParseArrayOfElementsDelegate>();
-
- private delegate object ParseArrayOfElementsDelegate(string value, ParseStringDelegate parseFn);
-
- public static Func<string, ParseStringDelegate, object> GetParseFn(Type type)
- {
- ParseArrayOfElementsDelegate parseFn;
- if (ParseDelegateCache.TryGetValue(type, out parseFn)) return parseFn.Invoke;
-
- var genericType = typeof(DeserializeArrayWithElements<,>).MakeGenericType(type, typeof(TSerializer));
- var mi = genericType.GetMethod("ParseGenericArray", BindingFlags.Public | BindingFlags.Static);
- parseFn = (ParseArrayOfElementsDelegate)Delegate.CreateDelegate(typeof(ParseArrayOfElementsDelegate), mi);
-
- Dictionary<Type, ParseArrayOfElementsDelegate> snapshot, newCache;
- do
- {
- snapshot = ParseDelegateCache;
- newCache = new Dictionary<Type, ParseArrayOfElementsDelegate>(ParseDelegateCache);
- newCache[type] = parseFn;
-
- } while (!ReferenceEquals(
- Interlocked.CompareExchange(ref ParseDelegateCache, newCache, snapshot), snapshot));
-
- return parseFn.Invoke;
- }
- }
-
- internal static class DeserializeArrayWithElements<T, TSerializer>
- where TSerializer : ITypeSerializer
- {
- private static readonly ITypeSerializer Serializer = JsWriter.GetTypeSerializer<TSerializer>();
-
- public static T[] ParseGenericArray(string value, ParseStringDelegate elementParseFn)
- {
- if ((value = DeserializeListWithElements<TSerializer>.StripList(value)) == null) return null;
- if (value == string.Empty) return new T[0];
-
- if (value[0] == JsWriter.MapStartChar)
- {
- var itemValues = new List<string>();
- var i = 0;
- do
- {
- itemValues.Add(Serializer.EatTypeValue(value, ref i));
- Serializer.EatItemSeperatorOrMapEndChar(value, ref i);
- } while (i < value.Length);
-
- var results = new T[itemValues.Count];
- for (var j=0; j < itemValues.Count; j++)
- {
- results[j] = (T)elementParseFn(itemValues[j]);
- }
- return results;
- }
- else
- {
- var to = new List<T>();
- var valueLength = value.Length;
-
- var i = 0;
- while (i < valueLength)
- {
- var elementValue = Serializer.EatValue(value, ref i);
- var listValue = elementValue;
- to.Add((T)elementParseFn(listValue));
- if(Serializer.EatItemSeperatorOrMapEndChar(value, ref i)
- && i == valueLength)
- {
- // If we ate a separator and we are at the end of the value,
- // it means the last element is empty => add default
- to.Add(default(T));
- }
- }
-
- return to.ToArray();
- }
- }
- }
-
- internal static class DeserializeArray<TSerializer>
- where TSerializer : ITypeSerializer
- {
- private static Dictionary<Type, ParseStringDelegate> ParseDelegateCache = new Dictionary<Type, ParseStringDelegate>();
-
- public static ParseStringDelegate GetParseFn(Type type)
- {
- ParseStringDelegate parseFn;
- if (ParseDelegateCache.TryGetValue(type, out parseFn)) return parseFn;
-
- var genericType = typeof(DeserializeArray<,>).MakeGenericType(type, typeof(TSerializer));
- var mi = genericType.GetMethod("GetParseFn", BindingFlags.Public | BindingFlags.Static);
- var parseFactoryFn = (Func<ParseStringDelegate>)Delegate.CreateDelegate(
- typeof(Func<ParseStringDelegate>), mi);
- parseFn = parseFactoryFn();
-
- Dictionary<Type, ParseStringDelegate> snapshot, newCache;
- do
- {
- snapshot = ParseDelegateCache;
- newCache = new Dictionary<Type, ParseStringDelegate>(ParseDelegateCache);
- newCache[type] = parseFn;
-
- } while (!ReferenceEquals(
- Interlocked.CompareExchange(ref ParseDelegateCache, newCache, snapshot), snapshot));
-
- return parseFn;
- }
- }
-
- internal static class DeserializeArray<T, TSerializer>
- where TSerializer : ITypeSerializer
- {
- private static readonly ITypeSerializer Serializer = JsWriter.GetTypeSerializer<TSerializer>();
-
- private static readonly ParseStringDelegate CacheFn;
-
- static DeserializeArray()
- {
- CacheFn = GetParseFn();
- }
-
- public static ParseStringDelegate Parse
- {
- get { return CacheFn; }
- }
-
- public static ParseStringDelegate GetParseFn()
- {
- var type = typeof (T);
- if (!type.IsArray)
- throw new ArgumentException(string.Format("Type {0} is not an Array type", type.FullName));
-
- if (type == typeof(string[]))
- return ParseStringArray;
- if (type == typeof(byte[]))
- return ParseByteArray;
-
- var elementType = type.GetElementType();
- var elementParseFn = Serializer.GetParseFn(elementType);
- if (elementParseFn != null)
- {
- var parseFn = DeserializeArrayWithElements<TSerializer>.GetParseFn(elementType);
- return value => parseFn(value, elementParseFn);
- }
- return null;
- }
-
- public static string[] ParseStringArray(string value)
- {
- if ((value = DeserializeListWithElements<TSerializer>.StripList(value)) == null) return null;
- return value == string.Empty
- ? new string[0]
- : DeserializeListWithElements<TSerializer>.ParseStringList(value).ToArray();
- }
-
- public static byte[] ParseByteArray(string value)
- {
- if ((value = DeserializeListWithElements<TSerializer>.StripList(value)) == null) return null;
- if ((value = Serializer.UnescapeSafeString(value)) == null) return null;
- return value == string.Empty
- ? new byte[0]
- : Convert.FromBase64String(value);
- }
- }
+//
+// https://github.com/ServiceStack/ServiceStack.Text
+// ServiceStack.Text: .NET C# POCO JSON, JSV and CSV Text Serializers.
+//
+// Authors:
+// Demis Bellot (demis.bellot@gmail.com)
+//
+// Copyright 2012 ServiceStack Ltd.
+//
+// Licensed under the same terms of ServiceStack: new BSD license.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Threading;
+
+namespace ServiceStack.Text.Common
+{
+ internal static class DeserializeArrayWithElements<TSerializer>
+ where TSerializer : ITypeSerializer
+ {
+ private static Dictionary<Type, ParseArrayOfElementsDelegate> ParseDelegateCache
+ = new Dictionary<Type, ParseArrayOfElementsDelegate>();
+
+ private delegate object ParseArrayOfElementsDelegate(string value, ParseStringDelegate parseFn);
+
+ public static Func<string, ParseStringDelegate, object> GetParseFn(Type type)
+ {
+ ParseArrayOfElementsDelegate parseFn;
+ if (ParseDelegateCache.TryGetValue(type, out parseFn)) return parseFn.Invoke;
+
+ var genericType = typeof(DeserializeArrayWithElements<,>).MakeGenericType(type, typeof(TSerializer));
+ var mi = genericType.GetMethod("ParseGenericArray", BindingFlags.Public | BindingFlags.Static);
+ parseFn = (ParseArrayOfElementsDelegate)Delegate.CreateDelegate(typeof(ParseArrayOfElementsDelegate), mi);
+
+ Dictionary<Type, ParseArrayOfElementsDelegate> snapshot, newCache;
+ do
+ {
+ snapshot = ParseDelegateCache;
+ newCache = new Dictionary<Type, ParseArrayOfElementsDelegate>(ParseDelegateCache);
+ newCache[type] = parseFn;
+
+ } while (!ReferenceEquals(
+ Interlocked.CompareExchange(ref ParseDelegateCache, newCache, snapshot), snapshot));
+
+ return parseFn.Invoke;
+ }
+ }
+
+ internal static class DeserializeArrayWithElements<T, TSerializer>
+ where TSerializer : ITypeSerializer
+ {
+ private static readonly ITypeSerializer Serializer = JsWriter.GetTypeSerializer<TSerializer>();
+
+ public static T[] ParseGenericArray(string value, ParseStringDelegate elementParseFn)
+ {
+ if ((value = DeserializeListWithElements<TSerializer>.StripList(value)) == null) return null;
+ if (value == string.Empty) return new T[0];
+
+ if (value[0] == JsWriter.MapStartChar)
+ {
+ var itemValues = new List<string>();
+ var i = 0;
+ do
+ {
+ itemValues.Add(Serializer.EatTypeValue(value, ref i));
+ Serializer.EatItemSeperatorOrMapEndChar(value, ref i);
+ } while (i < value.Length);
+
+ var results = new T[itemValues.Count];
+ for (var j=0; j < itemValues.Count; j++)
+ {
+ results[j] = (T)elementParseFn(itemValues[j]);
+ }
+ return results;
+ }
+ else
+ {
+ var to = new List<T>();
+ var valueLength = value.Length;
+
+ var i = 0;
+ while (i < valueLength)
+ {
+ var elementValue = Serializer.EatValue(value, ref i);
+ var listValue = elementValue;
+ to.Add((T)elementParseFn(listValue));
+ if(Serializer.EatItemSeperatorOrMapEndChar(value, ref i)
+ && i == valueLength)
+ {
+ // If we ate a separator and we are at the end of the value,
+ // it means the last element is empty => add default
+ to.Add(default(T));
+ }
+ }
+
+ return to.ToArray();
+ }
+ }
+ }
+
+ internal static class DeserializeArray<TSerializer>
+ where TSerializer : ITypeSerializer
+ {
+ private static Dictionary<Type, ParseStringDelegate> ParseDelegateCache = new Dictionary<Type, ParseStringDelegate>();
+
+ public static ParseStringDelegate GetParseFn(Type type)
+ {
+ ParseStringDelegate parseFn;
+ if (ParseDelegateCache.TryGetValue(type, out parseFn)) return parseFn;
+
+ var genericType = typeof(DeserializeArray<,>).MakeGenericType(type, typeof(TSerializer));
+ var mi = genericType.GetMethod("GetParseFn", BindingFlags.Public | BindingFlags.Static);
+ var parseFactoryFn = (Func<ParseStringDelegate>)Delegate.CreateDelegate(
+ typeof(Func<ParseStringDelegate>), mi);
+ parseFn = parseFactoryFn();
+
+ Dictionary<Type, ParseStringDelegate> snapshot, newCache;
+ do
+ {
+ snapshot = ParseDelegateCache;
+ newCache = new Dictionary<Type, ParseStringDelegate>(ParseDelegateCache);
+ newCache[type] = parseFn;
+
+ } while (!ReferenceEquals(
+ Interlocked.CompareExchange(ref ParseDelegateCache, newCache, snapshot), snapshot));
+
+ return parseFn;
+ }
+ }
+
+ internal static class DeserializeArray<T, TSerializer>
+ where TSerializer : ITypeSerializer
+ {
+ private static readonly ITypeSerializer Serializer = JsWriter.GetTypeSerializer<TSerializer>();
+
+ private static readonly ParseStringDelegate CacheFn;
+
+ static DeserializeArray()
+ {
+ CacheFn = GetParseFn();
+ }
+
+ public static ParseStringDelegate Parse
+ {
+ get { return CacheFn; }
+ }
+
+ public static ParseStringDelegate GetParseFn()
+ {
+ var type = typeof (T);
+ if (!type.IsArray)
+ throw new ArgumentException(string.Format("Type {0} is not an Array type", type.FullName));
+
+ if (type == typeof(string[]))
+ return ParseStringArray;
+ if (type == typeof(byte[]))
+ return ParseByteArray;
+
+ var elementType = type.GetElementType();
+ var elementParseFn = Serializer.GetParseFn(elementType);
+ if (elementParseFn != null)
+ {
+ var parseFn = DeserializeArrayWithElements<TSerializer>.GetParseFn(elementType);
+ return value => parseFn(value, elementParseFn);
+ }
+ return null;
+ }
+
+ public static string[] ParseStringArray(string value)
+ {
+ if ((value = DeserializeListWithElements<TSerializer>.StripList(value)) == null) return null;
+ return value == string.Empty
+ ? new string[0]
+ : DeserializeListWithElements<TSerializer>.ParseStringList(value).ToArray();
+ }
+
+ public static byte[] ParseByteArray(string value)
+ {
+ if ((value = DeserializeListWithElements<TSerializer>.StripList(value)) == null) return null;
+ if ((value = Serializer.UnescapeSafeString(value)) == null) return null;
+ return value == string.Empty
+ ? new byte[0]
+ : Convert.FromBase64String(value);
+ }
+ }
}
View
248 src/ServiceStack.Text/Common/DeserializeCollection.cs
@@ -1,125 +1,125 @@
-//
-// https://github.com/ServiceStack/ServiceStack.Text
-// ServiceStack.Text: .NET C# POCO JSON, JSV and CSV Text Serializers.
-//
-// Authors:
-// Demis Bellot (demis.bellot@gmail.com)
-//
-// Copyright 2012 ServiceStack Ltd.
-//
-// Licensed under the same terms of ServiceStack: new BSD license.
-//
-
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Threading;
-#if WINDOWS_PHONE
-using ServiceStack.Text.WP;
-#endif
-
-namespace ServiceStack.Text.Common
-{
- internal static class DeserializeCollection<TSerializer>
- where TSerializer : ITypeSerializer
- {
- private static readonly ITypeSerializer Serializer = JsWriter.GetTypeSerializer<TSerializer>();
-
- public static ParseStringDelegate GetParseMethod(Type type)
- {
- var collectionInterface = type.GetTypeWithGenericInterfaceOf(typeof(ICollection<>));
- if (collectionInterface == null)
- throw new ArgumentException(string.Format("Type {0} is not of type ICollection<>", type.FullName));
-
- //optimized access for regularly used types
- if (type.HasInterface(typeof(ICollection<string>)))
- return value => ParseStringCollection(value, type);
-
- if (type.HasInterface(typeof(ICollection<int>)))
- return value => ParseIntCollection(value, type);
-
- var elementType = collectionInterface.GetGenericArguments()[0];
-
- var supportedTypeParseMethod = Serializer.GetParseFn(elementType);
- if (supportedTypeParseMethod != null)
- {
- var createCollectionType = type.HasAnyTypeDefinitionsOf(typeof(ICollection<>))
- ? null : type;
-
- return value => ParseCollectionType(value, createCollectionType, elementType, supportedTypeParseMethod);
- }
-
- return null;
- }
-
- public static ICollection<string> ParseStringCollection(string value, Type createType)
- {
- var items = DeserializeArrayWithElements<string, TSerializer>.ParseGenericArray(value, Serializer.ParseString);
- return CreateAndPopulate(createType, items);
- }
-
- public static ICollection<int> ParseIntCollection(string value, Type createType)
- {
- var items = DeserializeArrayWithElements<int, TSerializer>.ParseGenericArray(value, x => int.Parse(x));
- return CreateAndPopulate(createType, items);
- }
-
- public static ICollection<T> ParseCollection<T>(string value, Type createType, ParseStringDelegate parseFn)
- {
- if (value == null) return null;
-
- var items = DeserializeArrayWithElements<T, TSerializer>.ParseGenericArray(value, parseFn);
- return CreateAndPopulate(createType, items);
- }
-
- private static ICollection<T> CreateAndPopulate<T>(Type ofCollectionType, T[] withItems)
- {
- if (ofCollectionType == null) return new List<T>(withItems);
-
- var genericTypeDefinition = ofCollectionType.IsGenericType()
- ? ofCollectionType.GetGenericTypeDefinition()
- : null;
-#if !XBOX
- if (genericTypeDefinition == typeof(HashSet<T>))
- return new HashSet<T>(withItems);
-#endif
- if (genericTypeDefinition == typeof(LinkedList<T>))
- return new LinkedList<T>(withItems);
-
- var collection = (ICollection<T>)ofCollectionType.CreateInstance();
- foreach (var item in withItems)
- {
- collection.Add(item);
- }
- return collection;
- }
-
- private static Dictionary<Type, ParseCollectionDelegate> ParseDelegateCache
- = new Dictionary<Type, ParseCollectionDelegate>();
-
- private delegate object ParseCollectionDelegate(string value, Type createType, ParseStringDelegate parseFn);
-
- public static object ParseCollectionType(string value, Type createType, Type elementType, ParseStringDelegate parseFn)
- {
- ParseCollectionDelegate parseDelegate;
- if (ParseDelegateCache.TryGetValue(elementType, out parseDelegate))
- return parseDelegate(value, createType, parseFn);
-
- var mi = typeof(DeserializeCollection<TSerializer>).GetMethod("ParseCollection", BindingFlags.Static | BindingFlags.Public);
- var genericMi = mi.MakeGenericMethod(new[] { elementType });
- parseDelegate = (ParseCollectionDelegate)Delegate.CreateDelegate(typeof(ParseCollectionDelegate), genericMi);
-
- Dictionary<Type, ParseCollectionDelegate> snapshot, newCache;
- do
- {
- snapshot = ParseDelegateCache;
- newCache = new Dictionary<Type, ParseCollectionDelegate>(ParseDelegateCache);
- newCache[elementType] = parseDelegate;
-
- } while (!ReferenceEquals(
- Interlocked.CompareExchange(ref ParseDelegateCache, newCache, snapshot), snapshot));
-
- return parseDelegate(value, createType, parseFn);
- }
- }
+//
+// https://github.com/ServiceStack/ServiceStack.Text
+// ServiceStack.Text: .NET C# POCO JSON, JSV and CSV Text Serializers.
+//
+// Authors:
+// Demis Bellot (demis.bellot@gmail.com)
+//
+// Copyright 2012 ServiceStack Ltd.
+//
+// Licensed under the same terms of ServiceStack: new BSD license.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Threading;
+#if WINDOWS_PHONE
+using ServiceStack.Text.WP;
+#endif
+
+namespace ServiceStack.Text.Common
+{
+ internal static class DeserializeCollection<TSerializer>
+ where TSerializer : ITypeSerializer
+ {
+ private static readonly ITypeSerializer Serializer = JsWriter.GetTypeSerializer<TSerializer>();
+
+ public static ParseStringDelegate GetParseMethod(Type type)
+ {
+ var collectionInterface = type.GetTypeWithGenericInterfaceOf(typeof(ICollection<>));
+ if (collectionInterface == null)
+ throw new ArgumentException(string.Format("Type {0} is not of type ICollection<>", type.FullName));
+
+ //optimized access for regularly used types
+ if (type.HasInterface(typeof(ICollection<string>)))
+ return value => ParseStringCollection(value, type);
+
+ if (type.HasInterface(typeof(ICollection<int>)))
+ return value => ParseIntCollection(value, type);
+
+ var elementType = collectionInterface.GetGenericArguments()[0];
+
+ var supportedTypeParseMethod = Serializer.GetParseFn(elementType);
+ if (supportedTypeParseMethod != null)
+ {
+ var createCollectionType = type.HasAnyTypeDefinitionsOf(typeof(ICollection<>))
+ ? null : type;
+
+ return value => ParseCollectionType(value, createCollectionType, elementType, supportedTypeParseMethod);
+ }
+
+ return null;
+ }
+
+ public static ICollection<string> ParseStringCollection(string value, Type createType)
+ {
+ var items = DeserializeArrayWithElements<string, TSerializer>.ParseGenericArray(value, Serializer.ParseString);
+ return CreateAndPopulate(createType, items);
+ }
+
+ public static ICollection<int> ParseIntCollection(string value, Type createType)
+ {
+ var items = DeserializeArrayWithElements<int, TSerializer>.ParseGenericArray(value, x => int.Parse(x));
+ return CreateAndPopulate(createType, items);
+ }
+
+ public static ICollection<T> ParseCollection<T>(string value, Type createType, ParseStringDelegate parseFn)
+ {
+ if (value == null) return null;
+
+ var items = DeserializeArrayWithElements<T, TSerializer>.ParseGenericArray(value, parseFn);
+ return CreateAndPopulate(createType, items);