Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
authorJamesNK <james@newtonking.com>2010-10-12 11:15:13 +0400
committerJamesNK <james@newtonking.com>2010-10-12 11:15:13 +0400
commit336f14b3d2cd59a854a3b8565d99bdc3ff0d8c1c (patch)
tree5fd108d4fe9551b9acbd0b9e64e8d9d71a8e1237 /Src
parent4cea6d3c09d26ce9eded9e65e02debb62674778e (diff)
-Added NuPack to build process
-Fixed deserializing structs when reusing existing values -Renamed Windows Phone 7 dll to Newtonsoft.Json.WindowsPhone.dll
Diffstat (limited to 'Src')
-rw-r--r--Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj4
-rw-r--r--Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj4
-rw-r--r--Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj (renamed from Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Phone.csproj)12
-rw-r--r--Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj4
-rw-r--r--Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs32
-rw-r--r--Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj8
-rw-r--r--Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj10
-rw-r--r--Src/Newtonsoft.Json/Newtonsoft.Json.WindowsPhone.csproj (renamed from Src/Newtonsoft.Json/Newtonsoft.Json.Phone.csproj)10
-rw-r--r--Src/Newtonsoft.Json/Newtonsoft.Json.csproj8
-rw-r--r--Src/Newtonsoft.Json/Properties/AssemblyInfo.cs6
-rw-r--r--Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs5
11 files changed, 70 insertions, 33 deletions
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
index d32076d..5d44575 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
@@ -47,7 +47,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\DotNet20\</OutputPath>
+ <OutputPath>bin\Debug\Net20\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET20</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -56,7 +56,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\DotNet20\</OutputPath>
+ <OutputPath>bin\Release\Net20\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj
index 55e858c..0ec68d9 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj
@@ -49,7 +49,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\DotNet35\</OutputPath>
+ <OutputPath>bin\Debug\Net35\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET35</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -58,7 +58,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\DotNet35\</OutputPath>
+ <OutputPath>bin\Release\Net35\</OutputPath>
<DefineConstants>TRACE;NET35</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Phone.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj
index 034f400..c0d05f9 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Phone.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj
@@ -9,8 +9,8 @@
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Newtonsoft.Json.Tests.Phone</RootNamespace>
- <AssemblyName>Newtonsoft.Json.Tests.Phone</AssemblyName>
+ <RootNamespace>Newtonsoft.Json.Tests.WindowsPhone</RootNamespace>
+ <AssemblyName>Newtonsoft.Json.Tests.WindowsPhone</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile>
@@ -23,7 +23,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>Bin\Debug\Phone\</OutputPath>
+ <OutputPath>Bin\Debug\WindowsPhone\</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
@@ -33,7 +33,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>Bin\Release\Phone\</OutputPath>
+ <OutputPath>Bin\Release\WindowsPhone\</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
@@ -211,9 +211,9 @@
<Compile Include="Utilities\ReflectionUtilsTests.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\Newtonsoft.Json\Newtonsoft.Json.Phone.csproj">
+ <ProjectReference Include="..\Newtonsoft.Json\Newtonsoft.Json.WindowsPhone.csproj">
<Project>{7A7F70AB-5C07-47ED-BDD2-ECC14DBACA5E}</Project>
- <Name>Newtonsoft.Json.Phone</Name>
+ <Name>Newtonsoft.Json.WindowsPhone</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
index 5f00323..fc75f49 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
@@ -49,7 +49,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\DotNet\</OutputPath>
+ <OutputPath>bin\Debug\Net\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -58,7 +58,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\DotNet\</OutputPath>
+ <OutputPath>bin\Release\Net\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
index a49318f..74d89f5 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
@@ -3665,5 +3665,37 @@ keyword such as type of business.""
IDictionary<string, decimal> d = JsonConvert.DeserializeObject<IDictionary<string, decimal>>(json);
Assert.AreEqual(123456789876543.21m, d["Value"]);
}
+
+ public struct Vector
+ {
+ public float X;
+ public float Y;
+ public float Z;
+
+ public override string ToString()
+ {
+ return string.Format("({0},{1},{2})", X, Y, Z);
+ }
+ }
+
+ public class VectorParent
+ {
+ public Vector Position;
+ }
+
+ [Test]
+ public void DeserializeStructProperty()
+ {
+ VectorParent obj = new VectorParent();
+ obj.Position = new Vector { X = 1, Y = 2, Z = 3 };
+
+ string str = JsonConvert.SerializeObject(obj);
+
+ obj = JsonConvert.DeserializeObject<VectorParent>(str);
+
+ Assert.AreEqual(1, obj.Position.X);
+ Assert.AreEqual(2, obj.Position.Y);
+ Assert.AreEqual(3, obj.Position.Z);
+ }
}
} \ No newline at end of file
diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj
index acf353f..97c213d 100644
--- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj
+++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj
@@ -47,11 +47,11 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\DotNet20\</OutputPath>
+ <OutputPath>bin\Debug\Net20\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET20</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <DocumentationFile>bin\Debug\DotNet20\Newtonsoft.Json.Net20.xml</DocumentationFile>
+ <DocumentationFile>bin\Debug\Net20\Newtonsoft.Json.Net20.xml</DocumentationFile>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRules>
</CodeAnalysisRules>
@@ -60,11 +60,11 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\DotNet20\</OutputPath>
+ <OutputPath>bin\Release\Net20\</OutputPath>
<DefineConstants>TRACE;NET20</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <DocumentationFile>bin\Release\DotNet20\Newtonsoft.Json.Net20.xml</DocumentationFile>
+ <DocumentationFile>bin\Release\Net20\Newtonsoft.Json.Net20.xml</DocumentationFile>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj
index 7d922ee..892a927 100644
--- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj
+++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj
@@ -48,11 +48,11 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\DotNet35\</OutputPath>
+ <OutputPath>bin\Debug\Net35\</OutputPath>
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;NET35</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <DocumentationFile>bin\Debug\DotNet35\Newtonsoft.Json.Net35.xml</DocumentationFile>
+ <DocumentationFile>bin\Debug\Net35\Newtonsoft.Json.Net35.xml</DocumentationFile>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRules>
</CodeAnalysisRules>
@@ -61,12 +61,12 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\DotNet35\</OutputPath>
+ <OutputPath>bin\Release\Net35\</OutputPath>
<DefineConstants>TRACE;NET35</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <DocumentationFile>bin\Release\DotNet35\Newtonsoft.Json.Net35.xml</DocumentationFile>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <DocumentationFile>bin\Release\Net35\Newtonsoft.Json.Net35.xml</DocumentationFile>
+ <CodeAnalysisRuleSet>..\..\..\..\trunk\Src\Newtonsoft.Json\Newtonsoft.Json.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Phone.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.WindowsPhone.csproj
index c6bfcdb..a686d4c 100644
--- a/Src/Newtonsoft.Json/Newtonsoft.Json.Phone.csproj
+++ b/Src/Newtonsoft.Json/Newtonsoft.Json.WindowsPhone.csproj
@@ -9,8 +9,8 @@
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Newtonsoft.Json.Phone</RootNamespace>
- <AssemblyName>Newtonsoft.Json.Phone</AssemblyName>
+ <RootNamespace>Newtonsoft.Json.WindowsPhone</RootNamespace>
+ <AssemblyName>Newtonsoft.Json.WindowsPhone</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile>
@@ -23,7 +23,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>Bin\Debug\Phone\</OutputPath>
+ <OutputPath>Bin\Debug\WindowsPhone\</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
@@ -35,13 +35,13 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>Bin\Release\Phone\</OutputPath>
+ <OutputPath>Bin\Release\WindowsPhone\</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <DocumentationFile>Bin\Release\Phone\Newtonsoft.Json.Phone.xml</DocumentationFile>
+ <DocumentationFile>Bin\Release\WindowsPhone\Newtonsoft.Json.WindowsPhone.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Runtime.Serialization" />
diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj
index 7c6902d..a7ca2cb 100644
--- a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj
+++ b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj
@@ -48,11 +48,11 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\DotNet\</OutputPath>
+ <OutputPath>bin\Debug\Net\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <DocumentationFile>bin\Debug\DotNet\Newtonsoft.Json.xml</DocumentationFile>
+ <DocumentationFile>bin\Debug\Net\Newtonsoft.Json.xml</DocumentationFile>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRules>
</CodeAnalysisRules>
@@ -61,11 +61,11 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\DotNet\</OutputPath>
+ <OutputPath>bin\Release\Net\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <DocumentationFile>bin\Release\DotNet\Newtonsoft.Json.xml</DocumentationFile>
+ <DocumentationFile>bin\Release\Net\Newtonsoft.Json.xml</DocumentationFile>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
index 386816f..8d77d63 100644
--- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
+++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
@@ -26,7 +26,9 @@ 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.
-#if SILVERLIGHT
+#if WINDOWS_PHONE
+[assembly: AssemblyTitle("Newtonsoft Json.NET Windows Phone")]
+#elif SILVERLIGHT
[assembly: AssemblyTitle("Newtonsoft Json.NET Silverlight")]
#elif PocketPC
[assembly: AssemblyTitle("Newtonsoft Json.NET Compact")]
@@ -44,7 +46,7 @@ using System.Security;
#if !SIGNED
#if WINDOWS_PHONE
-[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests.Phone")]
+[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests.WindowsPhone")]
#elif SILVERLIGHT
[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests.Silverlight")]
#elif PocketPC
diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
index 2c60ac4..ca80b5d 100644
--- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
+++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
@@ -516,7 +516,10 @@ namespace Newtonsoft.Json.Serialization
currentValue = property.ValueProvider.GetValue(target);
gottenCurrentValue = true;
- useExistingValue = (currentValue != null && !property.PropertyType.IsArray && !ReflectionUtils.InheritsGenericDefinition(property.PropertyType, typeof(ReadOnlyCollection<>)));
+ useExistingValue = (currentValue != null
+ && !property.PropertyType.IsArray
+ && !ReflectionUtils.InheritsGenericDefinition(property.PropertyType, typeof(ReadOnlyCollection<>))
+ && !property.PropertyType.IsValueType);
}
if (!property.Writable && !useExistingValue)