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

Commit 106dca7

Browse files
committed
2 parents c65c666 + abb5015 commit 106dca7

File tree

63 files changed

+3262
-2869
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3262
-2869
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,22 @@ zfc.exe -i "..\src\Sandbox.Shared.csproj" -o "..\unity\ZfcCompiled\ZeroFormatter
486486
zfc.exe -i "..\src\Sandbox.Shared.csproj" -s -o "..\unity\ZfcCompiled\"
487487
```
488488

489+
`zfc.exe` can setup on csproj's `PreBuildEvent`(useful to generate file path under self project) or `PostBuildEvent`(useful to generate file path is another project).
490+
489491
> Note: zfc.exe is currently only run on Windows. It is .NET Core's [Roslyn](https://github.com/dotnet/roslyn) workspace API limitation but I want to implements to all platforms...
490492
491493
Generated formatters must need to register on Startup. By default, zfc generate automatic register code on `RuntimeInitializeOnLoad` timing.
492494

495+
For Unity Unit Tests, the generated formatters must be registered in the `SetUp` method:
496+
497+
```csharp
498+
[SetUp]
499+
public void RegisterZeroFormatter()
500+
{
501+
ZeroFormatterInitializer.Register();
502+
}
503+
```
504+
493505
ZeroFormatter can not serialize Unity native types by default but you can make custom formatter by define pseudo type. For example create `Vector2` to ZeroFormatter target.
494506

495507
```csharp
@@ -867,6 +879,14 @@ ZeroFormatter spec has two stages + ex.
867879
* Stage2: FixedSizeList, VariableSizeList and Object supports lazy-evaluation, does not support Extension Format.
868880
* StageEx: Supports C# Extension Format
869881

882+
List of port libraries
883+
884+
* Go, [shamaton/zeroformatter](https://github.com/shamaton/zeroformatter)
885+
* Ruby, [aki017/zero_formatter](https://github.com/aki017/zero_formatter)
886+
* Swift, [yaslab/ZeroFormatter.swift](https://github.com/yaslab/ZeroFormatter.swift)
887+
* Scala, [pocketberserker/scala-zero-formatter](https://github.com/pocketberserker/scala-zero-formatter/)
888+
* Rust, [pocketberserker/zero-formatter.rs](https://github.com/pocketberserker/zero-formatter.rs)
889+
870890
Author Info
871891
---
872892
Yoshifumi Kawai(a.k.a. neuecc) is a software developer in Japan.

nuget/ZeroFormatter.Interfaces.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>ZeroFormatter.Interfaces</id>
5-
<version>1.5.5</version>
5+
<version>1.6.2</version>
66
<title>ZeroFormatter.Interfaces</title>
77
<authors>neuecc</authors>
88
<owners>y.neuecc</owners>
99
<projectUrl>https://github.com/neuecc/ZeroFormatter/</projectUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1111
<description>Plain interfaces and KeyTuple of ZeroFormatter, it is used for define serializable targets.</description>
12-
<releaseNotes>zfc fix.</releaseNotes>
12+
<releaseNotes>fixed serialize issue when mutate under non-tracked collection.</releaseNotes>
1313
<tags>ZeroFormatter, Serialization, Formatter, Serializer</tags>
1414
<frameworkAssemblies>
1515
<frameworkAssembly assemblyName="System" targetFramework=".NETFramework3.5" />

nuget/ZeroFormatter.Unity.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>ZeroFormatter.Unity</id>
5-
<version>1.5.5</version>
5+
<version>1.6.2</version>
66
<title>ZeroFormatter.Unity</title>
77
<authors>neuecc</authors>
88
<owners>y.neuecc</owners>
99
<projectUrl>https://github.com/neuecc/ZeroFormatter/</projectUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1111
<description>Infinitely fast serializer for .NET, .NET Core and Unity.</description>
12-
<releaseNotes>zfc fix.</releaseNotes>
12+
<releaseNotes>fixed serialize issue when mutate under non-tracked collection.</releaseNotes>
1313
<tags>ZeroFormatter, Serialization, Formatter, Serializer</tags>
1414
<frameworkAssemblies>
1515
<frameworkAssembly assemblyName="System" targetFramework="Unity Full v3.5" />
1616
<frameworkAssembly assemblyName="System.Core" targetFramework="Unity Full v3.5" />
1717
</frameworkAssemblies>
1818
<dependencies>
1919
<group targetFramework="Unity Full v3.5">
20-
<dependency id="ZeroFormatter.Interfaces" version="1.5.5" />
20+
<dependency id="ZeroFormatter.Interfaces" version="1.6.2" />
2121
</group>
2222
</dependencies>
2323
</metadata>

nuget/ZeroFormatter.nuspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>ZeroFormatter</id>
5-
<version>1.5.5</version>
5+
<version>1.6.2</version>
66
<title>ZeroFormatter</title>
77
<authors>neuecc</authors>
88
<owners>y.neuecc</owners>
99
<projectUrl>https://github.com/neuecc/ZeroFormatter/</projectUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1111
<description>Infinitely fast serializer for .NET, .NET Core and Unity.</description>
12-
<releaseNotes>zfc fix.</releaseNotes>
12+
<releaseNotes>fixed serialize issue when mutate under non-tracked collection.</releaseNotes>
1313
<tags>ZeroFormatter, Serialization, Formatter, Serializer</tags>
1414
<frameworkAssemblies>
1515
<frameworkAssembly assemblyName="System" targetFramework=".NETFramework4.5" />
1616
<frameworkAssembly assemblyName="System.Core" targetFramework=".NETFramework4.5" />
1717
</frameworkAssemblies>
1818
<dependencies>
1919
<group targetFramework=".NETFramework4.5">
20-
<dependency id="ZeroFormatter.Interfaces" version="1.5.5" />
20+
<dependency id="ZeroFormatter.Interfaces" version="1.6.2" />
2121
</group>
2222
<group targetFramework=".NETStandard1.6">
23-
<dependency id="ZeroFormatter.Interfaces" version="1.5.5" />
23+
<dependency id="ZeroFormatter.Interfaces" version="1.6.2" />
2424
<dependency id="System.Reflection.Emit" version="4.0.1" />
2525
<dependency id="System.Runtime" version="4.1.0" />
2626
<dependency id="System.Runtime.Extensions" version="4.1.0" />

nuget/check_zfc.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
zfc -i "C:\Users\neuecc\Documents\Git\neuecc\ZeroFormatter\sandbox\Sandbox.Shared\Sandbox.Shared.csproj" -o "C:\Users\neuecc\Documents\Git\neuecc\ZeroFormatter\tests\ZeroFormatter.UnityTests\Assets\ZeroFormatterGenerated.cs" -c UNITY -u
1+
zfc -i "C:\Users\y.kawai\Documents\neuecc\ZeroFormatter\sandbox\Sandbox.Shared\Sandbox.Shared.csproj" -o "here.cs" -c UNITY -u

nuget/push.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
REM nuget push ZeroFormatter.Analyzer.1.1.1.0.nupkg -Source https://www.nuget.org/api/v2/package
2-
nuget push ZeroFormatter.1.5.5.nupkg -Source https://www.nuget.org/api/v2/package
3-
nuget push ZeroFormatter.Interfaces.1.5.5.nupkg -Source https://www.nuget.org/api/v2/package
4-
nuget push ZeroFormatter.Unity.1.5.5.nupkg -Source https://www.nuget.org/api/v2/package
2+
nuget push ZeroFormatter.1.6.2.nupkg -Source https://www.nuget.org/api/v2/package
3+
nuget push ZeroFormatter.Interfaces.1.6.2.nupkg -Source https://www.nuget.org/api/v2/package
4+
nuget push ZeroFormatter.Unity.1.6.2.nupkg -Source https://www.nuget.org/api/v2/package

sandbox/PerformanceComparison/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.5.5.0")]
36-
[assembly: AssemblyFileVersion("1.5.5.0")]
35+
[assembly: AssemblyVersion("1.6.2.0")]
36+
[assembly: AssemblyFileVersion("1.6.2.0")]

sandbox/Sandbox.NETCore/Program.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ public class Test
2727
public virtual string MyProperty4 { get; set; }
2828
}
2929

30+
[ZeroFormattable]
31+
public class WhatC
32+
{
33+
[Index(0)]
34+
public virtual IReadOnlyList<int> MyReadOnlyListOne { get; set; }
35+
[Index(1)]
36+
public virtual IReadOnlyList<string> MyReadOnlyListTwo { get; set; }
37+
[Index(2)]
38+
public virtual IReadOnlyDictionary<int, string> MyReadOnlyDictOne { get; set; }
39+
[Index(3)]
40+
public virtual IReadOnlyDictionary<KeyTuple<int, string>, string> MyReadOnlyDictTwo { get; set; }
41+
}
42+
43+
3044
public class Program
3145
{
3246
static int IntGetHashCode(int x) { return x; }
@@ -48,13 +62,17 @@ static void Hoge<T>(T t)
4862

4963
public static void Main(string[] args)
5064
{
51-
var methods = typeof(ZeroFormatterSerializer).GetTypeInfo().GetMethods();
52-
53-
foreach (var item in methods)
65+
var mc = new WhatC
5466
{
55-
Console.WriteLine(item.Name + ":" + string.Join(", ", item.GetParameters().Select(x => x.Name)));
56-
}
67+
MyReadOnlyListOne = new List<int> { 1, 10, 100, 1000 },
68+
MyReadOnlyListTwo = new string[] { "a", "bcde", "fghijklmnop" },
69+
MyReadOnlyDictOne = new Dictionary<int, string> { { 0, "a" }, { 100, "bcd" } },
70+
MyReadOnlyDictTwo = new Dictionary<KeyTuple<int, string>, string> { { KeyTuple.Create(10, "aiueo"), "AAA" }, { KeyTuple.Create(999, "nano"), "sa" } }
71+
};
5772

73+
var converted = ZeroFormatterSerializer.Convert(mc);
74+
var huga = converted.MyReadOnlyListOne;
75+
Console.WriteLine(huga[0]);
5876
}
5977
}
6078
}

sandbox/Sandbox.NETCore/project.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.5.5-*",
2+
"version": "1.6.2-*",
33
"buildOptions": {
44
"emitEntryPoint": true
55
},
@@ -9,8 +9,8 @@
99
"type": "platform",
1010
"version": "1.0.0"
1111
},
12-
"ZeroFormatter.Interfaces.NETCore": "1.5.5",
13-
"ZeroFormatter.NETCore": "1.5.5"
12+
"ZeroFormatter.Interfaces.NETCore": "1.6.2",
13+
"ZeroFormatter.NETCore": "1.6.2"
1414
},
1515

1616
"frameworks": {

sandbox/Sandbox.NETCore/project.lock.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,7 +1992,7 @@
19921992
"lib/netstandard1.3/_._": {}
19931993
}
19941994
},
1995-
"ZeroFormatter.Interfaces.NETCore/1.5.5": {
1995+
"ZeroFormatter.Interfaces.NETCore/1.6.2": {
19961996
"type": "project",
19971997
"framework": ".NETStandard,Version=v1.1",
19981998
"dependencies": {
@@ -2006,7 +2006,7 @@
20062006
"netstandard1.1/ZeroFormatter.Interfaces.NETCore.dll": {}
20072007
}
20082008
},
2009-
"ZeroFormatter.NETCore/1.5.5": {
2009+
"ZeroFormatter.NETCore/1.6.2": {
20102010
"type": "project",
20112011
"framework": ".NETStandard,Version=v1.6",
20122012
"dependencies": {
@@ -2024,7 +2024,7 @@
20242024
"System.Text.Encoding": "4.0.11",
20252025
"System.Text.Encoding.Extensions": "4.0.11",
20262026
"System.Threading": "4.0.11",
2027-
"ZeroFormatter.Interfaces.NETCore": "1.5.5"
2027+
"ZeroFormatter.Interfaces.NETCore": "1.6.2"
20282028
},
20292029
"compile": {
20302030
"netstandard1.6/ZeroFormatter.NETCore.dll": {}
@@ -6627,12 +6627,12 @@
66276627
"ref/xamarinwatchos10/_._"
66286628
]
66296629
},
6630-
"ZeroFormatter.Interfaces.NETCore/1.5.5": {
6630+
"ZeroFormatter.Interfaces.NETCore/1.6.2": {
66316631
"type": "project",
66326632
"path": "../../src/ZeroFormatter.Interfaces.NETCore/project.json",
66336633
"msbuildProject": "../../src/ZeroFormatter.Interfaces.NETCore/ZeroFormatter.Interfaces.NETCore.xproj"
66346634
},
6635-
"ZeroFormatter.NETCore/1.5.5": {
6635+
"ZeroFormatter.NETCore/1.6.2": {
66366636
"type": "project",
66376637
"path": "../../src/ZeroFormatter.NETCore/project.json",
66386638
"msbuildProject": "../../src/ZeroFormatter.NETCore/ZeroFormatter.NETCore.xproj"
@@ -6641,8 +6641,8 @@
66416641
"projectFileDependencyGroups": {
66426642
"": [
66436643
"Microsoft.NETCore.App >= 1.0.0",
6644-
"ZeroFormatter.Interfaces.NETCore >= 1.5.5",
6645-
"ZeroFormatter.NETCore >= 1.5.5"
6644+
"ZeroFormatter.Interfaces.NETCore >= 1.6.2",
6645+
"ZeroFormatter.NETCore >= 1.6.2"
66466646
],
66476647
".NETCoreApp,Version=v1.0": []
66486648
},

0 commit comments

Comments
 (0)