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

Commit

Permalink
add three zfc options.
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Dec 5, 2016
1 parent 354fbe5 commit c8ea394
Show file tree
Hide file tree
Showing 29 changed files with 719 additions and 71 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ zfc arguments help:
-t, --customtypes=VALUE [optional, default=empty]comma separated allows custom types
-c, --conditionalsymbol=VALUE [optional, default=empty]conditional compiler symbol
-r, --resolvername=VALUE [optional, default=DefaultResolver]Register CustomSerializer target
-d, --disallowinternaltype [optional, default=false]Don't generate internal type", x => { DisallowInternalType = true; } },
-e, --propertyenumonly, [optional, default=false]Generate only property enum type only", x => { PropertyEnumOnly = true; } },
-m, --disallowinmetadata, [optional, default=false]Don't generate in metadata type", x => { DisallowInMetadata = true; } },
```

```
Expand Down
2 changes: 1 addition & 1 deletion nuget/ZeroFormatter.Interfaces.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ZeroFormatter.Interfaces</id>
<version>1.5.2</version>
<version>1.5.3</version>
<title>ZeroFormatter.Interfaces</title>
<authors>neuecc</authors>
<owners>y.neuecc</owners>
Expand Down
4 changes: 2 additions & 2 deletions nuget/ZeroFormatter.Unity.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ZeroFormatter.Unity</id>
<version>1.5.2</version>
<version>1.5.3</version>
<title>ZeroFormatter.Unity</title>
<authors>neuecc</authors>
<owners>y.neuecc</owners>
Expand All @@ -17,7 +17,7 @@
</frameworkAssemblies>
<dependencies>
<group targetFramework="Unity Full v3.5">
<dependency id="ZeroFormatter.Interfaces" version="1.5.2" />
<dependency id="ZeroFormatter.Interfaces" version="1.5.3" />
</group>
</dependencies>
</metadata>
Expand Down
6 changes: 3 additions & 3 deletions nuget/ZeroFormatter.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ZeroFormatter</id>
<version>1.5.2</version>
<version>1.5.3</version>
<title>ZeroFormatter</title>
<authors>neuecc</authors>
<owners>y.neuecc</owners>
Expand All @@ -17,10 +17,10 @@
</frameworkAssemblies>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ZeroFormatter.Interfaces" version="1.5.2" />
<dependency id="ZeroFormatter.Interfaces" version="1.5.3" />
</group>
<group targetFramework=".NETStandard1.6">
<dependency id="ZeroFormatter.Interfaces" version="1.5.2" />
<dependency id="ZeroFormatter.Interfaces" version="1.5.3" />
<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
6 changes: 3 additions & 3 deletions nuget/push.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REM nuget push ZeroFormatter.Analyzer.1.1.1.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.1.5.2.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.Interfaces.1.5.2.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.Unity.1.5.2.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.1.5.3.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.Interfaces.1.5.3.nupkg -Source https://www.nuget.org/api/v2/package
nuget push ZeroFormatter.Unity.1.5.3.nupkg -Source https://www.nuget.org/api/v2/package
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.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyVersion("1.5.3.0")]
[assembly: AssemblyFileVersion("1.5.3.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.5.2-*",
"version": "1.5.3-*",
"buildOptions": {
"emitEntryPoint": true
},
Expand All @@ -9,8 +9,8 @@
"type": "platform",
"version": "1.0.0"
},
"ZeroFormatter.Interfaces.NETCore": "1.5.2",
"ZeroFormatter.NETCore": "1.5.2"
"ZeroFormatter.Interfaces.NETCore": "1.5.3",
"ZeroFormatter.NETCore": "1.5.3"
},

"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.5.2": {
"ZeroFormatter.Interfaces.NETCore/1.5.3": {
"type": "project",
"framework": ".NETStandard,Version=v1.1",
"dependencies": {
Expand All @@ -2006,7 +2006,7 @@
"netstandard1.1/ZeroFormatter.Interfaces.NETCore.dll": {}
}
},
"ZeroFormatter.NETCore/1.5.2": {
"ZeroFormatter.NETCore/1.5.3": {
"type": "project",
"framework": ".NETStandard,Version=v1.6",
"dependencies": {
Expand All @@ -2024,7 +2024,7 @@
"System.Text.Encoding": "4.0.11",
"System.Text.Encoding.Extensions": "4.0.11",
"System.Threading": "4.0.11",
"ZeroFormatter.Interfaces.NETCore": "1.5.2"
"ZeroFormatter.Interfaces.NETCore": "1.5.3"
},
"compile": {
"netstandard1.6/ZeroFormatter.NETCore.dll": {}
Expand Down Expand Up @@ -6627,12 +6627,12 @@
"ref/xamarinwatchos10/_._"
]
},
"ZeroFormatter.Interfaces.NETCore/1.5.2": {
"ZeroFormatter.Interfaces.NETCore/1.5.3": {
"type": "project",
"path": "../../src/ZeroFormatter.Interfaces.NETCore/project.json",
"msbuildProject": "../../src/ZeroFormatter.Interfaces.NETCore/ZeroFormatter.Interfaces.NETCore.xproj"
},
"ZeroFormatter.NETCore/1.5.2": {
"ZeroFormatter.NETCore/1.5.3": {
"type": "project",
"path": "../../src/ZeroFormatter.NETCore/project.json",
"msbuildProject": "../../src/ZeroFormatter.NETCore/ZeroFormatter.NETCore.xproj"
Expand All @@ -6641,8 +6641,8 @@
"projectFileDependencyGroups": {
"": [
"Microsoft.NETCore.App >= 1.0.0",
"ZeroFormatter.Interfaces.NETCore >= 1.5.2",
"ZeroFormatter.NETCore >= 1.5.2"
"ZeroFormatter.Interfaces.NETCore >= 1.5.3",
"ZeroFormatter.NETCore >= 1.5.3"
],
".NETCoreApp,Version=v1.0": []
},
Expand Down
74 changes: 74 additions & 0 deletions sandbox/Sandbox.Shared/InnerClass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZeroFormatter;

namespace Sandbox.Shared
{
public class InnerClassA
{
public enum InnerEnum
{
A, B, C
}

[ZeroFormattable]
public class InnerObject
{
[Index(0)]
public virtual int MyProperty { get; set; }
}
}

public class InnerClassB
{
public enum InnerEnum
{
A, B, C
}

private enum NgGenerateEnum
{
A, B, C
}

enum NgGenerateEnum2
{
Z
}

[ZeroFormattable]
public class InnerObject
{
[Index(0)]
public virtual int MyProperty { get; set; }


[Index(1)]
public virtual InsideEnum MyProperty2 { get; set; }


[Index(2)]
public virtual TypeCode MyProperty3 { get; set; }
}
}

[ZeroFormattable]
class InternalOkGenerateType
{
[Index(0)]
public virtual int MyProperty { get; set; }
}

public enum OutSideEnum
{
A, B, C
}

public enum InsideEnum
{
A, B, C
}
}
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.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyVersion("1.5.3.0")]
[assembly: AssemblyFileVersion("1.5.3.0")]
1 change: 1 addition & 0 deletions sandbox/Sandbox.Shared/Sandbox.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<Compile Include="Bar\MyClass.cs" />
<Compile Include="Foo\MyClass.cs" />
<Compile Include="GlobalNamespace.cs" />
<Compile Include="InnerClass.cs" />
<Compile Include="Perf.cs" />
<Compile Include="PseudoVector.cs" />
<Compile Include="Inherit.cs" />
Expand Down
8 changes: 4 additions & 4 deletions sandbox/Sandbox/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ class Program
{
static void Main(string[] args)
{
var prop = new StaticProperty() { HugaHuga = 999, My2 = new[] { new DameClass { Ok = 9 } } };
var a = ZeroFormatterSerializer.Convert(new InnerClassA.InnerObject());
var b = ZeroFormatterSerializer.Convert(new InnerClassB.InnerObject());

var hoge = ZeroFormatterSerializer.Convert(prop);
Console.WriteLine(hoge.HugaHuga);
Console.WriteLine(hoge.My2[0].Ok);
Console.WriteLine(a.GetType().FullName);
Console.WriteLine(b.GetType().FullName);
}
}

Expand Down
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.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyVersion("1.5.3.0")]
[assembly: AssemblyFileVersion("1.5.3.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.5.2" Language="en-US" Publisher="neuecc"/>
<Identity Id="ZeroFormatterAnalyzer.343bae8e-c880-437c-9e30-748b9e0f9b6e" Version="1.5.3" Language="en-US" Publisher="neuecc"/>
<DisplayName>ZeroFormatterAnalyzer</DisplayName>
<Description xml:space="preserve">New Launcher of ZeroFormatter.Analyzer</Description>
</Metadata>
Expand Down
14 changes: 11 additions & 3 deletions src/ZeroFormatter.CodeGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ class CommandlineArguments
public List<string> AllowCustomTypes { get; private set; }
public List<string> ConditionalSymbols { get; private set; }
public bool IsSeparate { get; private set; }
public string ResolverName { get; set; }
public string ResolverName { get; private set; }
public bool DisallowInternalType { get; private set; }
public bool PropertyEnumOnly { get; private set; }
public bool DisallowInMetadata { get; private set; }
// public string ZeroFormatterInitializerNamespace { get; set; }

public bool IsParsed { get; set; }

Expand All @@ -37,6 +41,10 @@ public CommandlineArguments(string[] args)
{ "t|customtypes=", "[optional, default=empty]comma separated allows custom types", x => { AllowCustomTypes.AddRange(x.Split(',')); } },
{ "c|conditionalsymbol=", "[optional, default=empty]conditional compiler symbol", x => { ConditionalSymbols.AddRange(x.Split(',')); } },
{ "r|resolvername=", "[optional, default=DefaultResolver]Register CustomSerializer target", x => { ResolverName = x; } },
{ "d|disallowinternaltype", "[optional, default=false]Don't generate internal type", x => { DisallowInternalType = true; } },
{ "e|propertyenumonly", "[optional, default=false]Generate only property enum type only", x => { PropertyEnumOnly = true; } },
{ "m|disallowinmetadata", "[optional, default=false]Don't generate in metadata type", x => { DisallowInMetadata = true; } },
// { "n|initializernamespace=", "[optional, default=ZeroFormatter.Internal]ZeroFormatterInitializer namespace", _ => { ZeroFormatterInitializerNamespace = true; } },
};
if (args.Length == 0)
{
Expand Down Expand Up @@ -87,7 +95,7 @@ static void Main(string[] args)
var sw = Stopwatch.StartNew();
Console.WriteLine("Project Compilation Start:" + csprojPath);

var tc = new TypeCollector(csprojPath, cmdArgs.ConditionalSymbols, cmdArgs.AllowCustomTypes);
var tc = new TypeCollector(csprojPath, cmdArgs.ConditionalSymbols, cmdArgs.AllowCustomTypes, cmdArgs.DisallowInternalType, cmdArgs.PropertyEnumOnly, cmdArgs.DisallowInMetadata);

Console.WriteLine("Project Compilation Complete:" + sw.Elapsed.ToString());
Console.WriteLine();
Expand Down Expand Up @@ -139,7 +147,7 @@ static void Main(string[] args)
sw.Restart();

var initializerPath = Path.Combine(outputpath, "ZeroFormatterInitializer.cs");
Output(initializerPath, new InitializerGenerator() { Objects = objectGen, Enums = enumGen, Structs = structGen, GenericTypes = genericTypes, UnuseUnityAttribute = unuse, Unions = unionGen, ResolverName= cmdArgs.ResolverName }.TransformText());
Output(initializerPath, new InitializerGenerator() { Objects = objectGen, Enums = enumGen, Structs = structGen, GenericTypes = genericTypes, UnuseUnityAttribute = unuse, Unions = unionGen, ResolverName = cmdArgs.ResolverName }.TransformText());

foreach (var item in objectGen.SelectMany(x => x.Types))
{
Expand Down
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.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyVersion("1.5.3.0")]
[assembly: AssemblyFileVersion("1.5.3.0")]
Loading

0 comments on commit c8ea394

Please sign in to comment.