From b38a2d52cef70d3fcdd5b8a69ba7e0ebf1fd468a Mon Sep 17 00:00:00 2001 From: SONIC3D Date: Sun, 5 May 2013 02:08:05 +0800 Subject: [PATCH 1/4] Added:Serialization/Deserialization support for float type. --- src/LitJson/JsonMapper.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/LitJson/JsonMapper.cs b/src/LitJson/JsonMapper.cs index 4c1a036..2b0a0ba 100644 --- a/src/LitJson/JsonMapper.cs +++ b/src/LitJson/JsonMapper.cs @@ -591,6 +591,12 @@ private static void RegisterBaseExporters () delegate (object obj, JsonWriter writer) { writer.Write ((ulong) obj); }; + + base_exporters_table[typeof(float)] = + delegate(object obj, JsonWriter writer) + { + writer.Write((double)(float)obj); + }; } private static void RegisterBaseImporters () @@ -651,6 +657,12 @@ private static void RegisterBaseImporters () RegisterImporter (base_importers_table, typeof (double), typeof (decimal), importer); + importer = delegate(object input) + { + return Convert.ToSingle((float)(double)input); + }; + RegisterImporter (base_importers_table, typeof (double), + typeof(float), importer); importer = delegate (object input) { return Convert.ToUInt32 ((long) input); From ae4e11eeea4a129bd6d47e0ada67090a262924e0 Mon Sep 17 00:00:00 2001 From: SONIC3D Date: Sun, 5 May 2013 02:25:20 +0800 Subject: [PATCH 2/4] Modify:Use Convert.ToDouble. --- src/LitJson/JsonMapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LitJson/JsonMapper.cs b/src/LitJson/JsonMapper.cs index 2b0a0ba..6bdc9c2 100644 --- a/src/LitJson/JsonMapper.cs +++ b/src/LitJson/JsonMapper.cs @@ -595,7 +595,7 @@ private static void RegisterBaseExporters () base_exporters_table[typeof(float)] = delegate(object obj, JsonWriter writer) { - writer.Write((double)(float)obj); + writer.Write(Convert.ToDouble ((float) obj)); }; } From 15d165e2a693ba318d8bb498e33c5df03b6584aa Mon Sep 17 00:00:00 2001 From: SONIC3D Date: Sun, 5 May 2013 02:27:42 +0800 Subject: [PATCH 3/4] Added:Serialization/Deserialization support for long(Int64) type. --- src/LitJson/JsonMapper.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/LitJson/JsonMapper.cs b/src/LitJson/JsonMapper.cs index 6bdc9c2..c5936b0 100644 --- a/src/LitJson/JsonMapper.cs +++ b/src/LitJson/JsonMapper.cs @@ -597,6 +597,12 @@ private static void RegisterBaseExporters () { writer.Write(Convert.ToDouble ((float) obj)); }; + + base_exporters_table[typeof(Int64)] = + delegate(object obj, JsonWriter writer) + { + writer.Write((Int64) obj); + }; } private static void RegisterBaseImporters () @@ -681,6 +687,12 @@ private static void RegisterBaseImporters () }; RegisterImporter (base_importers_table, typeof (string), typeof (DateTime), importer); + + importer = delegate(object input) { + return Convert.ToInt64 ((Int32)input); + }; + RegisterImporter (base_importers_table, typeof (Int32), + typeof(Int64), importer); } private static void RegisterImporter ( From 6601f2bc0a1e19805c49c06b797fe2830a3f28cc Mon Sep 17 00:00:00 2001 From: ZongJing Lu Date: Wed, 8 May 2013 16:54:02 +0800 Subject: [PATCH 4/4] Add:MonoDevelop Solution/Project files --- build/MonoDevelop/AssemblyInfo.cs | 30 ++++++ build/MonoDevelop/LitJson.csproj | 67 ++++++++++++ build/MonoDevelop/LitJson.sln | 174 ++++++++++++++++++++++++++++++ 3 files changed, 271 insertions(+) create mode 100644 build/MonoDevelop/AssemblyInfo.cs create mode 100644 build/MonoDevelop/LitJson.csproj create mode 100644 build/MonoDevelop/LitJson.sln diff --git a/build/MonoDevelop/AssemblyInfo.cs b/build/MonoDevelop/AssemblyInfo.cs new file mode 100644 index 0000000..e898497 --- /dev/null +++ b/build/MonoDevelop/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: CLSCompliant (true)] +[assembly: AssemblyTitle("LitJson")] +[assembly: AssemblyDescription("LitJSON library")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LitJSON")] +[assembly: AssemblyCopyright ( + "The authors disclaim copyright to this source code")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("0.7.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/build/MonoDevelop/LitJson.csproj b/build/MonoDevelop/LitJson.csproj new file mode 100644 index 0000000..30cc7a2 --- /dev/null +++ b/build/MonoDevelop/LitJson.csproj @@ -0,0 +1,67 @@ + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {1C91AE0D-C5CD-4BA4-934E-0A899CCA455E} + Library + LitJson + LitJson + 0.7.0 + v2.0 + + + True + full + False + bin\Debug + DEBUG; + prompt + 4 + False + + + none + True + bin\Release + prompt + 4 + False + + + + + + + + IJsonWrapper.cs + + + JsonData.cs + + + JsonException.cs + + + JsonMapper.cs + + + JsonMockWrapper.cs + + + JsonReader.cs + + + JsonWriter.cs + + + Lexer.cs + + + ParserToken.cs + + + + \ No newline at end of file diff --git a/build/MonoDevelop/LitJson.sln b/build/MonoDevelop/LitJson.sln new file mode 100644 index 0000000..e4cccdc --- /dev/null +++ b/build/MonoDevelop/LitJson.sln @@ -0,0 +1,174 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LitJson", "LitJson.csproj", "{1C91AE0D-C5CD-4BA4-934E-0A899CCA455E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1C91AE0D-C5CD-4BA4-934E-0A899CCA455E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C91AE0D-C5CD-4BA4-934E-0A899CCA455E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C91AE0D-C5CD-4BA4-934E-0A899CCA455E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C91AE0D-C5CD-4BA4-934E-0A899CCA455E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = LitJson.csproj + Policies = $0 + $0.DotNetNamingPolicy = $1 + $1.DirectoryNamespaceAssociation = None + $1.ResourceNamePolicy = FileFormatDefault + $0.TextStylePolicy = $2 + $2.inheritsSet = null + $2.scope = text/x-csharp + $0.CSharpFormattingPolicy = $3 + $3.AfterDelegateDeclarationParameterComma = True + $3.inheritsSet = Mono + $3.inheritsScope = text/x-csharp + $3.scope = text/x-csharp + $0.TextStylePolicy = $4 + $4.FileWidth = 120 + $4.TabsToSpaces = False + $4.inheritsSet = VisualStudio + $4.inheritsScope = text/plain + $4.scope = text/plain + $0.StandardHeader = $5 + $5.Text = + $5.IncludeInNewFiles = True + $0.NameConventionPolicy = $6 + $6.Rules = $7 + $7.NamingRule = $8 + $8.Name = Namespaces + $8.AffectedEntity = Namespace + $8.VisibilityMask = VisibilityMask + $8.NamingStyle = PascalCase + $8.IncludeInstanceMembers = True + $8.IncludeStaticEntities = True + $7.NamingRule = $9 + $9.Name = Types + $9.AffectedEntity = Class, Struct, Enum, Delegate + $9.VisibilityMask = Public + $9.NamingStyle = PascalCase + $9.IncludeInstanceMembers = True + $9.IncludeStaticEntities = True + $7.NamingRule = $10 + $10.Name = Interfaces + $10.RequiredPrefixes = $11 + $11.String = I + $10.AffectedEntity = Interface + $10.VisibilityMask = Public + $10.NamingStyle = PascalCase + $10.IncludeInstanceMembers = True + $10.IncludeStaticEntities = True + $7.NamingRule = $12 + $12.Name = Attributes + $12.RequiredSuffixes = $13 + $13.String = Attribute + $12.AffectedEntity = CustomAttributes + $12.VisibilityMask = Public + $12.NamingStyle = PascalCase + $12.IncludeInstanceMembers = True + $12.IncludeStaticEntities = True + $7.NamingRule = $14 + $14.Name = Event Arguments + $14.RequiredSuffixes = $15 + $15.String = EventArgs + $14.AffectedEntity = CustomEventArgs + $14.VisibilityMask = Public + $14.NamingStyle = PascalCase + $14.IncludeInstanceMembers = True + $14.IncludeStaticEntities = True + $7.NamingRule = $16 + $16.Name = Exceptions + $16.RequiredSuffixes = $17 + $17.String = Exception + $16.AffectedEntity = CustomExceptions + $16.VisibilityMask = VisibilityMask + $16.NamingStyle = PascalCase + $16.IncludeInstanceMembers = True + $16.IncludeStaticEntities = True + $7.NamingRule = $18 + $18.Name = Methods + $18.AffectedEntity = Methods + $18.VisibilityMask = Protected, Public + $18.NamingStyle = PascalCase + $18.IncludeInstanceMembers = True + $18.IncludeStaticEntities = True + $7.NamingRule = $19 + $19.Name = Static Readonly Fields + $19.AffectedEntity = ReadonlyField + $19.VisibilityMask = Protected, Public + $19.NamingStyle = PascalCase + $19.IncludeInstanceMembers = False + $19.IncludeStaticEntities = True + $7.NamingRule = $20 + $20.Name = Fields + $20.AffectedEntity = Field + $20.VisibilityMask = Protected, Public + $20.NamingStyle = PascalCase + $20.IncludeInstanceMembers = True + $20.IncludeStaticEntities = True + $7.NamingRule = $21 + $21.Name = ReadOnly Fields + $21.AffectedEntity = ReadonlyField + $21.VisibilityMask = Protected, Public + $21.NamingStyle = PascalCase + $21.IncludeInstanceMembers = True + $21.IncludeStaticEntities = False + $7.NamingRule = $22 + $22.Name = Constant Fields + $22.AffectedEntity = ConstantField + $22.VisibilityMask = Protected, Public + $22.NamingStyle = PascalCase + $22.IncludeInstanceMembers = True + $22.IncludeStaticEntities = True + $7.NamingRule = $23 + $23.Name = Properties + $23.AffectedEntity = Property + $23.VisibilityMask = Protected, Public + $23.NamingStyle = PascalCase + $23.IncludeInstanceMembers = True + $23.IncludeStaticEntities = True + $7.NamingRule = $24 + $24.Name = Events + $24.AffectedEntity = Event + $24.VisibilityMask = Protected, Public + $24.NamingStyle = PascalCase + $24.IncludeInstanceMembers = True + $24.IncludeStaticEntities = True + $7.NamingRule = $25 + $25.Name = Enum Members + $25.AffectedEntity = EnumMember + $25.VisibilityMask = VisibilityMask + $25.NamingStyle = PascalCase + $25.IncludeInstanceMembers = True + $25.IncludeStaticEntities = True + $7.NamingRule = $26 + $26.Name = Parameters + $26.AffectedEntity = Parameter + $26.VisibilityMask = VisibilityMask + $26.NamingStyle = CamelCase + $26.IncludeInstanceMembers = True + $26.IncludeStaticEntities = True + $7.NamingRule = $27 + $27.Name = Type Parameters + $27.RequiredPrefixes = $28 + $28.String = T + $27.AffectedEntity = TypeParameter + $27.VisibilityMask = VisibilityMask + $27.NamingStyle = PascalCase + $27.IncludeInstanceMembers = True + $27.IncludeStaticEntities = True + $0.VersionControlPolicy = $29 + $29.inheritsSet = Mono + $0.ChangeLogPolicy = $30 + $30.UpdateMode = None + $30.MessageStyle = $31 + $31.LineAlign = 0 + $30.inheritsSet = Mono + description = LitJSON library + version = 0.7.0 + EndGlobalSection +EndGlobal