Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Commit

Permalink
merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Jun 9, 2018
2 parents 17d15f3 + 7293f40 commit 608cf01
Show file tree
Hide file tree
Showing 31 changed files with 680 additions and 217 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ Utf8Json.Resolvers.CompositeResolver.RegisterAndSetAsDefault(
Utf8Json.Resolvers.GeneratedResolver.Instance,

// set StandardResolver or your use resolver chain
Utf8Json.StandardResolver.Default,
Utf8Json.Resolvers.StandardResolver.Default,
);
```

Expand Down
6 changes: 3 additions & 3 deletions docs/Utf8Json.AspNetCoreMvcFormatter.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Utf8Json.AspNetCoreMvcFormatter</id>
<version>1.3.5</version>
<version>1.3.7</version>
<title>Utf8Json AspNetCoreMvcFormatter</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
Expand All @@ -13,11 +13,11 @@
<tags>Json, Serialization, Formatter, Serializer, Unity, Xamarin, ASPNET</tags>
<dependencies>
<group targetFramework=".NETFramework4.7">
<dependency id="Utf8Json" version="1.3.5" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.3.7" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Mvc.Abstractions" version="2.0.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Utf8Json" version="1.3.5" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.3.7" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Mvc.Abstractions" version="2.0.0" exclude="Build,Analyzers" />
</group>
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions docs/Utf8Json.ImmutableCollection.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Utf8Json.ImmutableCollection</id>
<version>1.3.5</version>
<version>1.3.7</version>
<title>Utf8Json Extension Resolver for ImmutableCollection</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
Expand All @@ -12,15 +12,15 @@
<tags>Json, Serialization, Formatter, Serializer, Unity, Xamarin</tags>
<dependencies>
<group targetFramework=".NETFramework4.7">
<dependency id="Utf8Json" version="1.3.5" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.3.7" exclude="Build,Analyzers" />
<dependency id="System.Collections.Immutable" version="1.4.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="Utf8Json" version="1.3.5" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.3.7" exclude="Build,Analyzers" />
<dependency id="System.Collections.Immutable" version="1.4.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Utf8Json" version="1.3.5" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.3.7" exclude="Build,Analyzers" />
<dependency id="System.Collections.Immutable" version="1.4.0" exclude="Build,Analyzers" />
</group>
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions docs/Utf8Json.UnityShims.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Utf8Json.UnityShims</id>
<version>1.3.5</version>
<version>1.3.7</version>
<title>Utf8Json UnityShims</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
Expand All @@ -12,15 +12,15 @@
<tags>Json, Serialization, Formatter, Serializer, Unity, Xamarin</tags>
<dependencies>
<group targetFramework=".NETFramework4.7">
<dependency id="Utf8Json" version="1.3.5" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.3.7" exclude="Build,Analyzers" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="Utf8Json" version="1.3.5" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.3.7" exclude="Build,Analyzers" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Utf8Json" version="1.3.5" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.3.7" exclude="Build,Analyzers" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
</group>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion docs/Utf8Json.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Utf8Json</id>
<version>1.3.5</version>
<version>1.3.7</version>
<title>Utf8Json</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
Expand Down
8 changes: 4 additions & 4 deletions docs/push.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nuget push Utf8Json.1.3.5.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.ImmutableCollection.1.3.5.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.UnityShims.1.3.5.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.AspNetCoreMvcFormatter.1.3.5.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.1.3.7.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.ImmutableCollection.1.3.7.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.UnityShims.1.3.7.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.AspNetCoreMvcFormatter.1.3.7.nupkg -Source https://www.nuget.org/api/v2/package
24 changes: 21 additions & 3 deletions sandbox/ConsoleAppNetCore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ public class FooException : Exception

namespace ConsoleAppNetCore
{
public abstract class JsonDBItem
{
public int ID { get { return _id; } }
private int _id = -1;
}

public class Card : JsonDBItem
{
public string Name { get { return name; } }
private string name = "0";
}


public class CustomPoint
{
public readonly int X;
Expand Down Expand Up @@ -331,13 +344,18 @@ public void SetId(Guid id)
}
}

public sealed class Entry
{
public int Number { get; set; }
public Exception Exception { get; set; }
}


static unsafe void Main(string[] args)
{

var ex = new Exception("ABC", new FooException { Bar = 100 });
var json = JsonSerializer.ToJsonString(ex);
Console.WriteLine(JsonSerializer.PrettyPrint(json));
var huga = JsonSerializer.Serialize<Card>(new Card());


}

Expand Down
12 changes: 7 additions & 5 deletions sandbox/DynamicCodeDumper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ static void Main(string[] args)
//DynamicObjectResolver.Default.GetFormatter<TestShouldSerialize>();
//DynamicObjectResolver.ExcludeNullCamelCase.GetFormatter<TestShouldSerialize>();

var seq = Enumerable.Range(1, 10).Select(x => x);
DynamicObjectResolver.Default.GetFormatterDynamic(seq.GetType());
//var seq = Enumerable.Range(1, 10).Select(x => x);
//DynamicObjectResolver.Default.GetFormatterDynamic(seq.GetType());


var yahhoi = CompositeResolver.Create(new IJsonFormatter[0], new[] { StandardResolver.Default });
//var yahhoi = CompositeResolver.Create(new IJsonFormatter[0], new[] { StandardResolver.Default });

DynamicObjectResolver.ExcludeNull.GetFormatter<System.Exception>();

//DynamicObjectResolver.Default.GetFormatter<System.Collections.ICollection>();
//DynamicObjectResolver.Default.GetFormatter<Test2>();
Expand All @@ -50,13 +52,13 @@ static void Main(string[] args)

#if NET45
var a1 = (DynamicObjectResolver.Default as ISave).Save();
var a2 = (DynamicObjectResolver.ExcludeNullCamelCase as ISave).Save();
var a2 = (DynamicObjectResolver.ExcludeNull as ISave).Save();
//var a2 = DynamicUnionResolver.Instance.Save();
//var a3 = DynamicEnumResolver.Instance.Save();
//var a4 = DynamicContractlessObjectResolver.Instance.Save();
var a3 = DynamicCompositeResolver.Save();

Verify(a3);
Verify(a2);
#endif
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Utf8Json.AspNetCoreMvcFormatter/_AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
[assembly: ComVisible(false)]

[assembly: Guid("899f8b6c-c4c7-4e8b-9875-f61fdfb630bd")]
[assembly: AssemblyVersion("1.3.5")]
[assembly: AssemblyFileVersion("1.3.5")]
[assembly: AssemblyVersion("1.3.7")]
[assembly: AssemblyFileVersion("1.3.7")]
4 changes: 2 additions & 2 deletions src/Utf8Json.ImmutableCollection/_AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
[assembly: ComVisible(false)]

[assembly: Guid("2e7ac239-3db1-4772-9f47-5f62abb56ed0")]
[assembly: AssemblyVersion("1.3.5")]
[assembly: AssemblyFileVersion("1.3.5")]
[assembly: AssemblyVersion("1.3.7")]
[assembly: AssemblyFileVersion("1.3.7")]
2 changes: 1 addition & 1 deletion src/Utf8Json.UnityClient/Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<Compile Include="Assets\Scripts\RuntimeUnitTestToolkit\ChainingAssertion.Unity.cs" />
<Compile Include="Assets\Scripts\RuntimeUnitTestToolkit\UnitTestRunner.cs" />
<Compile Include="Assets\Scripts\Tests\_Loader.cs" />
<Compile Include="Assets\Scripts\Tests\PirvateTest.cs" />
<Compile Include="Assets\Scripts\Tests\SimpleTest.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Attributes.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Formatters\AnonymousFormatter.cs" />
Expand All @@ -63,7 +64,6 @@
<Compile Include="Assets\Scripts\Utf8Json\Formatters\DictionaryFormatter.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Formatters\DynamicObjectTypeFallbackFormatter.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Formatters\EnumFormatter.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Formatters\ExceptionFormatter.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Formatters\IgnoreFormatter.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Formatters\MultiDimentionalArrayFormatter.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Formatters\NullableFormatter.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@


using System.Reflection;
using System;
using System.Linq;
using System.Collections.Generic;
Expand Down
37 changes: 37 additions & 0 deletions src/Utf8Json.UnityClient/Assets/Scripts/Tests/PirvateTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using UnityEngine;
using RuntimeUnitTestToolkit;
using System.Collections;

using System.Collections.Generic;
using System;
using Utf8Json;
using System.Text;
using System.Linq;

namespace Utf8Json.UnityClient.Tests
{
public class BassPrivate
{
int x = 0;

public int GetX()
{
return x;
}
}

public class Inherit: BassPrivate
{
public int Y;
}

public class PrivateTest
{
public void CanSerialize()
{
var foo = JsonSerializer.Deserialize<Inherit>("{\"x\":10,\"Y\":99}", Utf8Json.Resolvers.StandardResolver.AllowPrivate);
foo.Y.Is(99);
foo.GetX().Is(10);
}
}
}
1 change: 1 addition & 0 deletions src/Utf8Json.UnityClient/Assets/Scripts/Tests/_Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static class UnitTestLoader
public static void Register()
{
UnitTest.RegisterAllMethods<SimpleTest>();
UnitTest.RegisterAllMethods<PrivateTest>();

//#if !UNITY_METRO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ internal static class ReflectionExtensions

#if !NET_4_6

static readonly BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
| BindingFlags.GetField | BindingFlags.GetProperty | BindingFlags.SetField | BindingFlags.SetProperty
| BindingFlags.InvokeMethod;

public static TypeInfo GetTypeInfo(this Type type)
{
return new TypeInfo(type);
Expand All @@ -203,37 +207,37 @@ public static TypeInfo CreateTypeInfo(this TypeBuilder type)

public static MethodInfo GetRuntimeMethod(this Type type, string name, Type[] types)
{
return type.GetMethod(name, types);
return type.GetMethod(name, types); // no use flags.
}

public static MethodInfo GetRuntimeMethod(this Type type, string name)
{
return type.GetMethod(name);
return type.GetMethod(name); // no use flags.
}

public static MethodInfo[] GetRuntimeMethods(this Type type)
{
return type.GetMethods();
return type.GetMethods(flags);
}

public static PropertyInfo GetRuntimeProperty(this Type type, string name)
{
return type.GetProperty(name);
return type.GetProperty(name, flags);
}

public static PropertyInfo[] GetRuntimeProperties(this Type type)
{
return type.GetProperties();
return type.GetProperties(flags);
}

public static FieldInfo GetRuntimeField(this Type type, string name)
{
return type.GetField(name);
return type.GetField(name, flags);
}

public static FieldInfo[] GetRuntimeFields(this Type type)
{
return type.GetFields();
return type.GetFields(flags);
}

public static T GetCustomAttribute<T>(this FieldInfo type, bool inherit)
Expand Down
Loading

0 comments on commit 608cf01

Please sign in to comment.