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

Commit

Permalink
1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Nov 10, 2016
1 parent d857a27 commit 58305ad
Show file tree
Hide file tree
Showing 28 changed files with 160 additions and 61 deletions.
99 changes: 99 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,97 @@ Versioning
TODO...


Union
---
ZeroFormatter supports Union type. It can define abstract class and `UnionAttributes`, `UnionKeyAttribute`.

```csharp
public enum CharacterType
{
Human, Monster
}

// UnionAttribute abstract type becomes Union, arguments is union subtypes.
// It needs single UnionKey to discriminate
[Union(typeof(Human), typeof(Monster))]
public abstract class Character
{
[UnionKey]
public abstract CharacterType Type { get; }
}

[ZeroFormattable]
public class Human : Character
{
// UnionKey property must mark [IgnoreFormat]
// UnionKey value must return constant value(Type is free, you can use int, string, enum, etc...)
[IgnoreFormat]
public override CharacterType Type
{
get
{
return CharacterType.Human;
}
}

[Index(0)]
public virtual string Name { get; set; }

[Index(1)]
public virtual int Age { get; set; }

[Index(2)]
public virtual int Faith { get; set; }
}

[ZeroFormattable]
public class Monster : Character
{
[IgnoreFormat]
public override CharacterType Type
{
get
{
return CharacterType.Monster;
}
}

[Index(0)]
public virtual string Race { get; set; }

[Index(1)]
public virtual int Power { get; set; }

[Index(2)]
public virtual int Magic { get; set; }
}
```

You can use Union as following.

```csharp
var demon = new Monster { Race = "Demon", Power = 9999, Magic = 1000 };

// use UnionType(Character) formatter(be carefule, does not use concrete type)
var data = ZeroFormatterSerializer.Serialize<Character>(demon);

var union = ZeroFormatterSerializer.Deserialize<Character>(data);

// you can discriminate by UnionKey.
switch (union.Type)
{
case CharacterType.Monster:
var demon2 = (Monster)union;
demon2.Race.Is("Demon");
demon2.Power.Is(9999);
demon2.Magic.Is(1000);
break;
default:
Assert.Fail("invalid");
break;
}
```

for Unity
---
ZeroFormatter.Unity works on all platforms(PC, Android, iOS, etc...). But it can 'not' use dynamic serializer generation due to IL2CPP issue. But pre code generate helps it. Code Generator is located in `packages\ZeroFormatter.Interfaces.*.*.*\tools\zfc.exe`. zfc is using [Roslyn](https://github.com/dotnet/roslyn) so analyze source code, pass the target `csproj`.
Expand Down Expand Up @@ -386,6 +477,14 @@ Object is defined user own type. Class is lazy evaluation which has index header
| Struct | [Index1Item:T1, Index2Item:T2,...] | Index is required begin from 0 and sequential. This layout includes KeyTuple, KeyValuePair. |
| Struct? | [hasValue:bool(1)][Index1Item:T1, Index2Item:T2,...] | This layout includes KeyTuple?, KeyValuePair? and Tuple(C# Tuple is class but serialized in this format)|

**Union Format**

Union is eager evaluation, discriminated by key type to each value type.

| Type | Layout | Note |
| ---- | ------ | ---- |
| Union | [hasValue:bool(1)][unionKey:TKey][value:TValue] ||

**Dictionary Format**

Dictionary/MultiDictionary is eager evaluation. LazyDictionary/LazyMultiDictionary is lazy evaluation. All format are variable-length.
Expand Down
Binary file removed nuget/UnityReleases_1.1.1.zip
Binary file not shown.
Binary file added nuget/Unity_Releases_1.2.0.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions nuget/ZeroFormatter.Analyzer.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ZeroFormatter.Analyzer</id>
<version>1.0.6.0</version>
<version>1.0.7.0</version>
<title>ZeroFormatter.Analyzer</title>
<authors>neuecc</authors>
<owners>y.neuecc</owners>
<projectUrl>https://github.com/neuecc/ZeroFormatter/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Analyzer of ZeroFormatter, verify rule for [ZeroFormattable] classes.</description>
<releaseNotes>Support 1.1 WireFormat.</releaseNotes>
<releaseNotes>Support 1.2 WireFormat.</releaseNotes>
<tags>ZeroFormatter, analyzers</tags>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System" targetFramework="" />
Expand Down
4 changes: 2 additions & 2 deletions nuget/ZeroFormatter.Interfaces.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ZeroFormatter.Interfaces</id>
<version>1.1.1</version>
<version>1.2.0</version>
<title>ZeroFormatter.Interfaces</title>
<authors>neuecc</authors>
<owners>y.neuecc</owners>
<projectUrl>https://github.com/neuecc/ZeroFormatter/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Plain interfaces and KeyTuple of ZeroFormatter, it is used for define serializable targets.</description>
<releaseNotes>Support sequence wireformat.</releaseNotes>
<releaseNotes>Support Union wireformat.</releaseNotes>
<tags>ZeroFormatter, Serialization, Formatter, Serializer</tags>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System" targetFramework=".NETFramework3.5" />
Expand Down
6 changes: 3 additions & 3 deletions nuget/ZeroFormatter.Unity.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ZeroFormatter.Unity</id>
<version>1.1.1</version>
<version>1.2.0</version>
<title>ZeroFormatter.Unity</title>
<authors>neuecc</authors>
<owners>y.neuecc</owners>
<projectUrl>https://github.com/neuecc/ZeroFormatter/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Infinitly fast serializer for .NET, .NET Core and Unity.</description>
<releaseNotes>Support sequence wireformat.</releaseNotes>
<releaseNotes>Support Union wireformat.</releaseNotes>
<tags>ZeroFormatter, Serialization, Formatter, Serializer</tags>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System" targetFramework="Unity Full v3.5" />
<frameworkAssembly assemblyName="System.Core" targetFramework="Unity Full v3.5" />
</frameworkAssemblies>
<dependencies>
<group targetFramework="Unity Full v3.5">
<dependency id="ZeroFormatter.Interfaces" version="1.1.1" />
<dependency id="ZeroFormatter.Interfaces" version="1.2.0" />
</group>
</dependencies>
</metadata>
Expand Down
8 changes: 4 additions & 4 deletions nuget/ZeroFormatter.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ZeroFormatter</id>
<version>1.1.1</version>
<version>1.2.0</version>
<title>ZeroFormatter</title>
<authors>neuecc</authors>
<owners>y.neuecc</owners>
<projectUrl>https://github.com/neuecc/ZeroFormatter/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Infinitly fast serializer for .NET, .NET Core and Unity.</description>
<releaseNotes>Support sequence wireformat.</releaseNotes>
<releaseNotes>Support Union wireformat.</releaseNotes>
<tags>ZeroFormatter, Serialization, Formatter, Serializer</tags>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System" targetFramework=".NETFramework4.5" />
<frameworkAssembly assemblyName="System.Core" targetFramework=".NETFramework4.5" />
</frameworkAssemblies>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ZeroFormatter.Interfaces" version="1.1.1" />
<dependency id="ZeroFormatter.Interfaces" version="1.2.0" />
</group>
<group targetFramework=".NETStandard1.6">
<dependency id="ZeroFormatter.Interfaces" version="1.1.1" />
<dependency id="ZeroFormatter.Interfaces" version="1.2.0" />
<dependency id="System.Reflection.Emit" version="4.0.1" />
<dependency id="System.Runtime" version="4.1.0" />
<dependency id="System.Runtime.Extensions" version="4.1.0" />
Expand Down
8 changes: 4 additions & 4 deletions nuget/push.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nuget push ZeroFormatter.Analyzer.1.0.6.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.1.1.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.Interfaces.1.1.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.Unity.1.1.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.Analyzer.1.0.7.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.1.2.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.Interfaces.1.2.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.Unity.1.2.0.nupkg -Source https://www.nuget.org/api/v2/package
Binary file modified nuget/zfc.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions sandbox/PerformanceComparison/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
6 changes: 3 additions & 3 deletions sandbox/Sandbox.NETCore/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.1-*",
"version": "1.2.0-*",
"buildOptions": {
"emitEntryPoint": true
},
Expand All @@ -9,8 +9,8 @@
"type": "platform",
"version": "1.0.0"
},
"ZeroFormatter.Interfaces.NETCore": "1.1.1",
"ZeroFormatter.NETCore": "1.1.1"
"ZeroFormatter.Interfaces.NETCore": "1.2.0",
"ZeroFormatter.NETCore": "1.2.0"
},

"frameworks": {
Expand Down
14 changes: 7 additions & 7 deletions sandbox/Sandbox.NETCore/project.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@
"lib/netstandard1.3/_._": {}
}
},
"ZeroFormatter.Interfaces.NETCore/1.1.1": {
"ZeroFormatter.Interfaces.NETCore/1.2.0": {
"type": "project",
"framework": ".NETStandard,Version=v1.1",
"dependencies": {
Expand All @@ -2006,7 +2006,7 @@
"netstandard1.1/ZeroFormatter.Interfaces.NETCore.dll": {}
}
},
"ZeroFormatter.NETCore/1.1.1": {
"ZeroFormatter.NETCore/1.2.0": {
"type": "project",
"framework": ".NETStandard,Version=v1.6",
"dependencies": {
Expand All @@ -2023,7 +2023,7 @@
"System.Text.Encoding": "4.0.11",
"System.Text.Encoding.Extensions": "4.0.11",
"System.Threading": "4.0.11",
"ZeroFormatter.Interfaces.NETCore": "1.1.1"
"ZeroFormatter.Interfaces.NETCore": "1.2.0"
},
"compile": {
"netstandard1.6/ZeroFormatter.NETCore.dll": {}
Expand Down Expand Up @@ -6626,12 +6626,12 @@
"ref/xamarinwatchos10/_._"
]
},
"ZeroFormatter.Interfaces.NETCore/1.1.1": {
"ZeroFormatter.Interfaces.NETCore/1.2.0": {
"type": "project",
"path": "../../src/ZeroFormatter.Interfaces.NETCore/project.json",
"msbuildProject": "../../src/ZeroFormatter.Interfaces.NETCore/ZeroFormatter.Interfaces.NETCore.xproj"
},
"ZeroFormatter.NETCore/1.1.1": {
"ZeroFormatter.NETCore/1.2.0": {
"type": "project",
"path": "../../src/ZeroFormatter.NETCore/project.json",
"msbuildProject": "../../src/ZeroFormatter.NETCore/ZeroFormatter.NETCore.xproj"
Expand All @@ -6640,8 +6640,8 @@
"projectFileDependencyGroups": {
"": [
"Microsoft.NETCore.App >= 1.0.0",
"ZeroFormatter.Interfaces.NETCore >= 1.1.1",
"ZeroFormatter.NETCore >= 1.1.1"
"ZeroFormatter.Interfaces.NETCore >= 1.2.0",
"ZeroFormatter.NETCore >= 1.2.0"
],
".NETCoreApp,Version=v1.0": []
},
Expand Down
4 changes: 2 additions & 2 deletions sandbox/Sandbox.Shared/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
4 changes: 2 additions & 2 deletions sandbox/Sandbox/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="ZeroFormatterAnalyzer.343bae8e-c880-437c-9e30-748b9e0f9b6e" Version="1.1.1" Language="en-US" Publisher="neuecc"/>
<Identity Id="ZeroFormatterAnalyzer.343bae8e-c880-437c-9e30-748b9e0f9b6e" Version="1.2.0" Language="en-US" Publisher="neuecc"/>
<DisplayName>ZeroFormatterAnalyzer</DisplayName>
<Description xml:space="preserve">New Launcher of ZeroFormatter.Analyzer</Description>
</Metadata>
Expand Down
4 changes: 2 additions & 2 deletions src/ZeroFormatter.Analyzer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.6")]
[assembly: AssemblyFileVersion("1.0.6")]
[assembly: AssemblyVersion("1.0.7")]
[assembly: AssemblyFileVersion("1.0.7")]
4 changes: 2 additions & 2 deletions src/ZeroFormatter.CodeGenerator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
2 changes: 1 addition & 1 deletion src/ZeroFormatter.Interfaces.NETCore/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.1",
"version": "1.2.0",
"buildOptions": {
"outputName": "ZeroFormatter.Interfaces",
"compile": "../ZeroFormatter.Interfaces/*.cs"
Expand Down
4 changes: 2 additions & 2 deletions src/ZeroFormatter.Interfaces/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
4 changes: 2 additions & 2 deletions src/ZeroFormatter.NETCore/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.1",
"version": "1.2.0",
"buildOptions": {
"allowUnsafe": true,
"outputName": "ZeroFormatter",
Expand All @@ -23,7 +23,7 @@
"System.Text.Encoding": "4.0.11",
"System.Text.Encoding.Extensions": "4.0.11",
"System.Collections.Concurrent": "4.0.12",
"ZeroFormatter.Interfaces.NETCore": "1.1.1"
"ZeroFormatter.Interfaces.NETCore": "1.2.0"
},
"frameworks": {
"netstandard1.6": {
Expand Down
6 changes: 3 additions & 3 deletions src/ZeroFormatter.NETCore/project.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
"ref/netstandard1.3/System.Threading.Tasks.dll": {}
}
},
"ZeroFormatter.Interfaces.NETCore/1.1.1": {
"ZeroFormatter.Interfaces.NETCore/1.2.0": {
"type": "project",
"framework": ".NETStandard,Version=v1.1",
"dependencies": {
Expand Down Expand Up @@ -2001,7 +2001,7 @@
"ref/xamarinwatchos10/_._"
]
},
"ZeroFormatter.Interfaces.NETCore/1.1.1": {
"ZeroFormatter.Interfaces.NETCore/1.2.0": {
"type": "project",
"path": "../ZeroFormatter.Interfaces.NETCore/project.json",
"msbuildProject": "../ZeroFormatter.Interfaces.NETCore/ZeroFormatter.Interfaces.NETCore.xproj"
Expand All @@ -2022,7 +2022,7 @@
"System.Text.Encoding >= 4.0.11",
"System.Text.Encoding.Extensions >= 4.0.11",
"System.Threading >= 4.0.11",
"ZeroFormatter.Interfaces.NETCore >= 1.1.1"
"ZeroFormatter.Interfaces.NETCore >= 1.2.0"
],
".NETStandard,Version=v1.6": []
},
Expand Down
Loading

0 comments on commit 58305ad

Please sign in to comment.