Skip to content

Commit e84aa47

Browse files
committed
Json examples
1 parent b30910a commit e84aa47

12 files changed

+214
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,4 @@ __pycache__/
287287
*.odx.cs
288288
*.xsd.cs
289289
/Examples/KY.Generator.Examples.Reflection/KY.Generator.Examples.Reflection.Console/Output/*.ts
290+
/Examples/Json/KY.Generator.Examples.Json.Reader/Output/*.cs
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.28407.52
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KY.Generator.Examples.Json.Reader", "KY.Generator.Examples.Json.Reader\KY.Generator.Examples.Json.Reader.csproj", "{5409B36A-AD9C-4951-8CFD-CDFB40CD0872}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{5409B36A-AD9C-4951-8CFD-CDFB40CD0872}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{5409B36A-AD9C-4951-8CFD-CDFB40CD0872}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{5409B36A-AD9C-4951-8CFD-CDFB40CD0872}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{5409B36A-AD9C-4951-8CFD-CDFB40CD0872}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {11A3EE6D-D96A-4DF2-85DC-0185638B9AFB}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
5+
</startup>
6+
</configuration>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{5409B36A-AD9C-4951-8CFD-CDFB40CD0872}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>KY.Generator.Examples.Json.Reader</RootNamespace>
10+
<AssemblyName>KY.Generator.Examples.Json.Reader</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
37+
<HintPath>packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
38+
</Reference>
39+
<Reference Include="System" />
40+
<Reference Include="System.Core" />
41+
<Reference Include="System.Xml.Linq" />
42+
<Reference Include="System.Data.DataSetExtensions" />
43+
<Reference Include="Microsoft.CSharp" />
44+
<Reference Include="System.Data" />
45+
<Reference Include="System.Net.Http" />
46+
<Reference Include="System.Xml" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<Compile Include="Output\Simple.cs" />
50+
<Compile Include="Output\SimpleReader.cs" />
51+
<Compile Include="Output\SimpleWithoutReader.cs" />
52+
<Compile Include="Output\SimpleWithReader.cs" />
53+
<Compile Include="Program.cs" />
54+
<Compile Include="Properties\AssemblyInfo.cs" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<None Include="App.config" />
58+
<None Include="packages.config" />
59+
<None Include="Source\simple-generator.json" />
60+
<None Include="Source\simple-with-reader-generator.json" />
61+
<None Include="Source\simple.json">
62+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
63+
</None>
64+
<None Include="Source\simple-with-extern-reader-generator.json" />
65+
</ItemGroup>
66+
<ItemGroup />
67+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
68+
<PropertyGroup>
69+
<PreBuildEvent>"$(SolutionDir)packages\KY.Generator.CLI.Standalone.0.8.2\tools\KY.Generator.exe" "$(ProjectDir)Source\simple-generator.json" "$(ProjectDir)Output"
70+
"$(SolutionDir)packages\KY.Generator.CLI.Standalone.0.8.2\tools\KY.Generator.exe" "$(ProjectDir)Source\simple-with-reader-generator.json" "$(ProjectDir)Output"
71+
"$(SolutionDir)packages\KY.Generator.CLI.Standalone.0.8.2\tools\KY.Generator.exe" "$(ProjectDir)Source\simple-with-extern-reader-generator.json" "$(ProjectDir)Output"</PreBuildEvent>
72+
</PropertyGroup>
73+
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=output/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
3+
namespace KY.Generator.Examples.Json.Reader
4+
{
5+
internal class Program
6+
{
7+
private static void Main(string[] args)
8+
{
9+
Console.WriteLine("Simple with reader");
10+
SimpleWithReader simpleWithReader = SimpleWithReader.Load("source\\simple.json");
11+
Console.WriteLine($"string: {simpleWithReader.StringProperty}");
12+
Console.WriteLine($"number: {simpleWithReader.NumberProperty}");
13+
Console.WriteLine($"boolean: {simpleWithReader.BooleanProperty}");
14+
15+
Console.WriteLine();
16+
Console.WriteLine("Simple with extern reader");
17+
Simple simple = SimpleReader.Load("source\\simple.json");
18+
Console.WriteLine($"string: {simple.StringProperty}");
19+
Console.WriteLine($"number: {simple.NumberProperty}");
20+
Console.WriteLine($"boolean: {simple.BooleanProperty}");
21+
22+
Console.WriteLine();
23+
Console.WriteLine("Press key to EXIT...");
24+
Console.ReadKey();
25+
}
26+
}
27+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("KY.Generator.Examples.Json.Reader")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("KY.Generator.Examples.Json.Reader")]
13+
[assembly: AssemblyCopyright("Copyright © 2019")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("5409b36a-ad9c-4951-8cfd-cdfb40cd0872")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"Language": "Csharp",
3+
"Json": {
4+
"ToObject": {
5+
"Source": "simple.json",
6+
"Namespace": "KY.Generator.Examples.Json.Reader",
7+
"Name": "SimpleWithoutReader" ,
8+
"FormatNames": true
9+
}
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"Language": "Csharp",
3+
"Json": {
4+
"ToObject": {
5+
"Source": "simple.json",
6+
"Namespace": "KY.Generator.Examples.Json.Reader",
7+
"FormatNames": true
8+
},
9+
"Reader": {}
10+
}
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"Language": "Csharp",
3+
"Json": {
4+
"ToObject": {
5+
"Source": "simple.json",
6+
"Namespace": "KY.Generator.Examples.Json.Reader",
7+
"Name": "SimpleWithReader",
8+
"FormatNames": true,
9+
"WithReader": true
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)