├── .gitignore ├── JsonCSharpClassGeneratorLib ├── CodeWriters │ ├── CSharpCodeWriter.cs │ ├── JavaCodeWriter.cs │ ├── TypeScriptCodeWriter.cs │ └── VisualBasicCodeWriter.cs ├── FieldInfo.cs ├── ICodeWriter.cs ├── IJsonClassGeneratorConfig.cs ├── JsonClassGenerator.cs ├── JsonClassGeneratorLib.csproj ├── JsonType.cs ├── JsonTypeEnum.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── jsonclasshelper.cs └── packages.config ├── README.md ├── SpecialCopy.sln ├── SpecialCopy.userprefs ├── SpecialCopyCore ├── JsonConverterHandler.cs ├── Properties │ ├── AssemblyInfo.cs │ └── Manifest.addin.xml ├── PropertyList.cs ├── SpecialCopy.csproj ├── SpecialCopyCore.csproj ├── SpecialtCopyPreference.cs ├── gtk-gui │ ├── generated.cs │ └── gui.stetic └── packages.config ├── System.Data.Entity.Design.PluralizationServices.dll ├── Xamarin.SpecialCopy.userprefs ├── addin-project.xml └── lib └── Release ├── Newtonsoft.Json.dll ├── System.Data.Entity.Design.PluralizationServices.dll ├── Xamasoft.JsonClassGenerator.dll └── Xamasoft.JsonClassGenerator.dll.mdb /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | 11 | [Dd]ebug/ 12 | x64/ 13 | build/ 14 | [Bb]in/ 15 | [Oo]bj/ 16 | [Pp]ackages/ 17 | 18 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 19 | !packages/*/build/ 20 | 21 | # MSTest test Results 22 | [Tt]est[Rr]esult*/ 23 | [Bb]uild[Ll]og.* 24 | 25 | *_i.c 26 | *_p.c 27 | *.ilk 28 | *.meta 29 | *.obj 30 | *.pch 31 | *.pdb 32 | *.pgc 33 | *.pgd 34 | *.rsp 35 | *.sbr 36 | *.tlb 37 | *.tli 38 | *.tlh 39 | *.tmp 40 | *.tmp_proj 41 | *.log 42 | *.vspscc 43 | *.vssscc 44 | .builds 45 | *.pidb 46 | *.log 47 | *.scc 48 | 49 | # Visual C++ cache files 50 | ipch/ 51 | *.aps 52 | *.ncb 53 | *.opensdf 54 | *.sdf 55 | *.cachefile 56 | 57 | # Visual Studio profiler 58 | *.psess 59 | *.vsp 60 | *.vspx 61 | 62 | # Guidance Automation Toolkit 63 | *.gpState 64 | 65 | # ReSharper is a .NET coding add-in 66 | _ReSharper*/ 67 | *.[Rr]e[Ss]harper 68 | 69 | # TeamCity is a build add-in 70 | _TeamCity* 71 | 72 | # DotCover is a Code Coverage Tool 73 | *.dotCover 74 | 75 | # NCrunch 76 | *.ncrunch* 77 | .*crunch*.local.xml 78 | 79 | # Installshield output folder 80 | [Ee]xpress/ 81 | 82 | # DocProject is a documentation generator add-in 83 | DocProject/buildhelp/ 84 | DocProject/Help/*.HxT 85 | DocProject/Help/*.HxC 86 | DocProject/Help/*.hhc 87 | DocProject/Help/*.hhk 88 | DocProject/Help/*.hhp 89 | DocProject/Help/Html2 90 | DocProject/Help/html 91 | 92 | # Click-Once directory 93 | publish/ 94 | 95 | # Publish Web Output 96 | *.Publish.xml 97 | 98 | # NuGet Packages Directory 99 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 100 | #packages/ 101 | 102 | # Windows Azure Build Output 103 | csx 104 | *.build.csdef 105 | 106 | # Windows Store app package directory 107 | AppPackages/ 108 | 109 | # Others 110 | sql/ 111 | *.Cache 112 | ClientBin/ 113 | [Ss]tyle[Cc]op.* 114 | ~$* 115 | *~ 116 | *.dbmdl 117 | *.[Pp]ublish.xml 118 | *.pfx 119 | *.publishsettings 120 | 121 | # RIA/Silverlight projects 122 | Generated_Code/ 123 | 124 | # Backup & report files from converting an old project file to a newer 125 | # Visual Studio version. Backup files are not needed, because we have git ;-) 126 | _UpgradeReport_Files/ 127 | Backup*/ 128 | UpgradeLog*.XML 129 | UpgradeLog*.htm 130 | 131 | # SQL Server files 132 | App_Data/*.mdf 133 | App_Data/*.ldf 134 | 135 | 136 | #LightSwitch generated files 137 | GeneratedArtifacts/ 138 | _Pvt_Extensions/ 139 | ModelManifest.xml 140 | 141 | # ========================= 142 | # Windows detritus 143 | # ========================= 144 | 145 | # Windows image file caches 146 | Thumbs.db 147 | ehthumbs.db 148 | 149 | # Folder config file 150 | Desktop.ini 151 | 152 | # Recycle Bin used on file shares 153 | $RECYCLE.BIN/ 154 | 155 | # Mac desktop service store files 156 | .DS_Store -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/CodeWriters/CSharpCodeWriter.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace Xamasoft.JsonClassGenerator.CodeWriters 9 | { 10 | public class CSharpCodeWriter : ICodeWriter 11 | { 12 | public string FileExtension 13 | { 14 | get { return ".cs"; } 15 | } 16 | 17 | public string DisplayName 18 | { 19 | get { return "C#"; } 20 | } 21 | 22 | 23 | private const string NoRenameAttribute = "[Obfuscation(Feature = \"renaming\", Exclude = true)]"; 24 | private const string NoPruneAttribute = "[Obfuscation(Feature = \"trigger\", Exclude = false)]"; 25 | 26 | public string GetTypeName(JsonType type, IJsonClassGeneratorConfig config) 27 | { 28 | var arraysAsLists = !config.ExplicitDeserialization; 29 | 30 | switch (type.Type) 31 | { 32 | case JsonTypeEnum.Anything: return "object"; 33 | case JsonTypeEnum.Array: return arraysAsLists ? "IList<" + GetTypeName(type.InternalType, config) + ">" : GetTypeName(type.InternalType, config) + "[]"; 34 | case JsonTypeEnum.Dictionary: return "Dictionary"; 35 | case JsonTypeEnum.Boolean: return "bool"; 36 | case JsonTypeEnum.Float: return "double"; 37 | case JsonTypeEnum.Integer: return "int"; 38 | case JsonTypeEnum.Long: return "long"; 39 | case JsonTypeEnum.Date: return "DateTime"; 40 | case JsonTypeEnum.NonConstrained: return "object"; 41 | case JsonTypeEnum.NullableBoolean: return "bool?"; 42 | case JsonTypeEnum.NullableFloat: return "double?"; 43 | case JsonTypeEnum.NullableInteger: return "int?"; 44 | case JsonTypeEnum.NullableLong: return "long?"; 45 | case JsonTypeEnum.NullableDate: return "DateTime?"; 46 | case JsonTypeEnum.NullableSomething: return "object"; 47 | case JsonTypeEnum.Object: return type.AssignedName; 48 | case JsonTypeEnum.String: return "string"; 49 | default: throw new System.NotSupportedException("Unsupported json type"); 50 | } 51 | } 52 | 53 | 54 | private bool ShouldApplyNoRenamingAttribute(IJsonClassGeneratorConfig config) 55 | { 56 | return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && !config.UsePascalCase; 57 | } 58 | private bool ShouldApplyNoPruneAttribute(IJsonClassGeneratorConfig config) 59 | { 60 | return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && config.UseProperties; 61 | } 62 | 63 | public void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw) 64 | { 65 | if (config.UseNamespaces) 66 | { 67 | foreach (var line in JsonClassGenerator.FileHeader) 68 | { 69 | sw.WriteLine("// " + line); 70 | } 71 | sw.WriteLine(); 72 | sw.WriteLine("using System;"); 73 | sw.WriteLine("using System.Collections.Generic;"); 74 | if (ShouldApplyNoPruneAttribute(config) || ShouldApplyNoRenamingAttribute(config)) 75 | sw.WriteLine("using System.Reflection;"); 76 | if (!config.ExplicitDeserialization && config.UsePascalCase) 77 | sw.WriteLine("using Newtonsoft.Json;"); 78 | sw.WriteLine("using Newtonsoft.Json.Linq;"); 79 | if (config.ExplicitDeserialization) 80 | sw.WriteLine("using JsonCSharpClassGenerator;"); 81 | if (config.SecondaryNamespace != null && config.HasSecondaryClasses && !config.UseNestedClasses) 82 | { 83 | sw.WriteLine("using {0};", config.SecondaryNamespace); 84 | } 85 | } 86 | 87 | if (config.UseNestedClasses) 88 | { 89 | sw.WriteLine(" {0} class {1}", config.InternalVisibility ? "internal" : "public", config.MainClass); 90 | sw.WriteLine(" {"); 91 | } 92 | } 93 | 94 | public void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw) 95 | { 96 | if (config.UseNestedClasses) 97 | { 98 | sw.WriteLine(" }"); 99 | } 100 | } 101 | 102 | 103 | public void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root) 104 | { 105 | sw.WriteLine(); 106 | sw.WriteLine("namespace {0}", root && !config.UseNestedClasses ? config.Namespace : (config.SecondaryNamespace ?? config.Namespace)); 107 | sw.WriteLine("{"); 108 | sw.WriteLine(); 109 | } 110 | 111 | public void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root) 112 | { 113 | sw.WriteLine("}"); 114 | } 115 | 116 | public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type) 117 | { 118 | var visibility = config.InternalVisibility ? "internal" : "public"; 119 | 120 | 121 | 122 | if (config.UseNestedClasses) 123 | { 124 | if (!type.IsRoot) 125 | { 126 | if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute); 127 | if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute); 128 | sw.WriteLine(" {0} class {1}", visibility, type.AssignedName); 129 | sw.WriteLine(" {"); 130 | } 131 | } 132 | else 133 | { 134 | if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute); 135 | if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute); 136 | sw.WriteLine(" {0} class {1}", visibility, type.AssignedName); 137 | sw.WriteLine(" {"); 138 | } 139 | 140 | var prefix = config.UseNestedClasses && !type.IsRoot ? " " : " "; 141 | 142 | 143 | var shouldSuppressWarning = config.InternalVisibility && !config.UseProperties && !config.ExplicitDeserialization; 144 | if (shouldSuppressWarning) 145 | { 146 | sw.WriteLine("#pragma warning disable 0649"); 147 | if (!config.UsePascalCase) sw.WriteLine(); 148 | } 149 | 150 | if (type.IsRoot && config.ExplicitDeserialization) WriteStringConstructorExplicitDeserialization(config, sw, type, prefix); 151 | 152 | if (config.ExplicitDeserialization) 153 | { 154 | if (config.UseProperties) WriteClassWithPropertiesExplicitDeserialization(sw, type, prefix); 155 | else WriteClassWithFieldsExplicitDeserialization(sw, type, prefix); 156 | } 157 | else 158 | { 159 | WriteClassMembers(config, sw, type, prefix); 160 | } 161 | 162 | if (shouldSuppressWarning) 163 | { 164 | sw.WriteLine(); 165 | sw.WriteLine("#pragma warning restore 0649"); 166 | sw.WriteLine(); 167 | } 168 | 169 | 170 | if (config.UseNestedClasses && !type.IsRoot) 171 | sw.WriteLine(" }"); 172 | 173 | if (!config.UseNestedClasses) 174 | sw.WriteLine(" }"); 175 | 176 | sw.WriteLine(); 177 | 178 | 179 | } 180 | 181 | 182 | 183 | private void WriteClassMembers(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type, string prefix) 184 | { 185 | foreach (var field in type.Fields) 186 | { 187 | if (config.UsePascalCase || config.ExamplesInDocumentation) sw.WriteLine(); 188 | 189 | if (config.ExamplesInDocumentation) 190 | { 191 | sw.WriteLine(prefix + "/// "); 192 | sw.WriteLine(prefix + "/// Examples: " + field.GetExamplesText()); 193 | sw.WriteLine(prefix + "/// "); 194 | } 195 | 196 | if (config.UsePascalCase) 197 | { 198 | 199 | sw.WriteLine(prefix + "[JsonProperty(\"{0}\")]", field.JsonMemberName); 200 | } 201 | 202 | if (config.UseProperties) 203 | { 204 | sw.WriteLine(prefix + "public {0} {1} {{ get; set; }}", field.Type.GetTypeName(), field.MemberName); 205 | } 206 | else 207 | { 208 | sw.WriteLine(prefix + "public {0} {1};", field.Type.GetTypeName(), field.MemberName); 209 | } 210 | } 211 | 212 | } 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | #region Code for (obsolete) explicit deserialization 221 | private void WriteClassWithPropertiesExplicitDeserialization(TextWriter sw, JsonType type, string prefix) 222 | { 223 | 224 | sw.WriteLine(prefix + "private JObject __jobject;"); 225 | sw.WriteLine(prefix + "public {0}(JObject obj)", type.AssignedName); 226 | sw.WriteLine(prefix + "{"); 227 | sw.WriteLine(prefix + " this.__jobject = obj;"); 228 | sw.WriteLine(prefix + "}"); 229 | sw.WriteLine(); 230 | 231 | foreach (var field in type.Fields) 232 | { 233 | 234 | string variable = null; 235 | if (field.Type.MustCache) 236 | { 237 | variable = "_" + char.ToLower(field.MemberName[0]) + field.MemberName.Substring(1); 238 | sw.WriteLine(prefix + "[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]"); 239 | sw.WriteLine(prefix + "private {0} {1};", field.Type.GetTypeName(), variable); 240 | } 241 | 242 | 243 | sw.WriteLine(prefix + "public {0} {1}", field.Type.GetTypeName(), field.MemberName); 244 | sw.WriteLine(prefix + "{"); 245 | sw.WriteLine(prefix + " get"); 246 | sw.WriteLine(prefix + " {"); 247 | if (field.Type.MustCache) 248 | { 249 | sw.WriteLine(prefix + " if ({0} == null)", variable); 250 | sw.WriteLine(prefix + " {0} = {1};", variable, field.GetGenerationCode("__jobject")); 251 | sw.WriteLine(prefix + " return {0};", variable); 252 | } 253 | else 254 | { 255 | sw.WriteLine(prefix + " return {0};", field.GetGenerationCode("__jobject")); 256 | } 257 | sw.WriteLine(prefix + " }"); 258 | sw.WriteLine(prefix + "}"); 259 | sw.WriteLine(); 260 | 261 | } 262 | 263 | } 264 | 265 | 266 | private void WriteStringConstructorExplicitDeserialization(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type, string prefix) 267 | { 268 | sw.WriteLine(); 269 | sw.WriteLine(prefix + "public {1}(string json)", config.InternalVisibility ? "internal" : "public", type.AssignedName); 270 | sw.WriteLine(prefix + " : this(JObject.Parse(json))"); 271 | sw.WriteLine(prefix + "{"); 272 | sw.WriteLine(prefix + "}"); 273 | sw.WriteLine(); 274 | } 275 | 276 | private void WriteClassWithFieldsExplicitDeserialization(TextWriter sw, JsonType type, string prefix) 277 | { 278 | 279 | 280 | sw.WriteLine(prefix + "public {0}(JObject obj)", type.AssignedName); 281 | sw.WriteLine(prefix + "{"); 282 | 283 | foreach (var field in type.Fields) 284 | { 285 | sw.WriteLine(prefix + " this.{0} = {1};", field.MemberName, field.GetGenerationCode("obj")); 286 | 287 | } 288 | 289 | sw.WriteLine(prefix + "}"); 290 | sw.WriteLine(); 291 | 292 | foreach (var field in type.Fields) 293 | { 294 | sw.WriteLine(prefix + "public readonly {0} {1};", field.Type.GetTypeName(), field.MemberName); 295 | } 296 | } 297 | #endregion 298 | 299 | } 300 | } 301 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/CodeWriters/JavaCodeWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Xamasoft.JsonClassGenerator.CodeWriters 8 | { 9 | public class JavaCodeWriter : ICodeWriter 10 | { 11 | public string FileExtension 12 | { 13 | get { return ".java"; } 14 | } 15 | 16 | public string DisplayName 17 | { 18 | get { return "Java"; } 19 | } 20 | 21 | public string GetTypeName(JsonType type, IJsonClassGeneratorConfig config) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | 26 | public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type) 27 | { 28 | throw new NotImplementedException(); 29 | } 30 | 31 | public void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw) 32 | { 33 | foreach (var line in JsonClassGenerator.FileHeader) 34 | { 35 | sw.WriteLine("// " + line); 36 | } 37 | } 38 | 39 | public void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | 44 | public void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root) 45 | { 46 | throw new NotImplementedException(); 47 | } 48 | 49 | public void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root) 50 | { 51 | throw new NotImplementedException(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/CodeWriters/TypeScriptCodeWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Xamasoft.JsonClassGenerator.CodeWriters 8 | { 9 | public class TypeScriptCodeWriter : ICodeWriter 10 | { 11 | public string FileExtension 12 | { 13 | get { return ".ts"; } 14 | } 15 | 16 | public string DisplayName 17 | { 18 | get { return "TypeScript"; } 19 | } 20 | 21 | public string GetTypeName(JsonType type, IJsonClassGeneratorConfig config) 22 | { 23 | switch (type.Type) 24 | { 25 | case JsonTypeEnum.Anything: return "any"; 26 | case JsonTypeEnum.String: return "string"; 27 | case JsonTypeEnum.Boolean: return "bool"; 28 | case JsonTypeEnum.Integer: 29 | case JsonTypeEnum.Long: 30 | case JsonTypeEnum.Float: return "number"; 31 | case JsonTypeEnum.Date: return "Date"; 32 | case JsonTypeEnum.NullableInteger: 33 | case JsonTypeEnum.NullableLong: 34 | case JsonTypeEnum.NullableFloat: return "number"; 35 | case JsonTypeEnum.NullableBoolean: return "bool"; 36 | case JsonTypeEnum.NullableDate: return "Date"; 37 | case JsonTypeEnum.Object: return type.AssignedName; 38 | case JsonTypeEnum.Array: return GetTypeName(type.InternalType, config) + "[]"; 39 | case JsonTypeEnum.Dictionary: return "{ [key: string]: " + GetTypeName(type.InternalType, config) + "; }"; 40 | case JsonTypeEnum.NullableSomething: return "any"; 41 | case JsonTypeEnum.NonConstrained: return "any"; 42 | default: throw new NotSupportedException("Unsupported type"); 43 | } 44 | } 45 | 46 | public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type) 47 | { 48 | var prefix = GetNamespace(config, type.IsRoot) != null ? " " : ""; 49 | var exported = !config.InternalVisibility || config.SecondaryNamespace != null; 50 | sw.WriteLine(prefix + (exported ? "export " : string.Empty) + "interface " + type.AssignedName + " {"); 51 | foreach (var field in type.Fields) 52 | { 53 | var shouldDefineNamespace = type.IsRoot && config.SecondaryNamespace != null && config.Namespace != null && (field.Type.Type == JsonTypeEnum.Object || (field.Type.InternalType != null && field.Type.InternalType.Type == JsonTypeEnum.Object)); 54 | if (config.ExamplesInDocumentation) 55 | { 56 | sw.WriteLine(); 57 | sw.WriteLine(prefix + " /**"); 58 | sw.WriteLine(prefix + " * Examples: " + field.GetExamplesText()); 59 | sw.WriteLine(prefix + " */"); 60 | } 61 | 62 | 63 | sw.WriteLine(prefix + " " + field.JsonMemberName + (IsNullable(field.Type.Type) ? "?" : "") + ": " + (shouldDefineNamespace ? config.SecondaryNamespace + "." : string.Empty) + GetTypeName(field.Type, config) + ";"); 64 | } 65 | sw.WriteLine(prefix + "}"); 66 | sw.WriteLine(); 67 | } 68 | 69 | private bool IsNullable(JsonTypeEnum type) 70 | { 71 | return 72 | type == JsonTypeEnum.NullableBoolean || 73 | type == JsonTypeEnum.NullableDate || 74 | type == JsonTypeEnum.NullableFloat || 75 | type == JsonTypeEnum.NullableInteger || 76 | type == JsonTypeEnum.NullableLong || 77 | type == JsonTypeEnum.NullableSomething; 78 | } 79 | 80 | public void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw) 81 | { 82 | foreach (var line in JsonClassGenerator.FileHeader) 83 | { 84 | sw.WriteLine("// " + line); 85 | } 86 | sw.WriteLine(); 87 | } 88 | 89 | public void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw) 90 | { 91 | } 92 | 93 | private string GetNamespace(IJsonClassGeneratorConfig config, bool root) 94 | { 95 | return root ? config.Namespace : (config.SecondaryNamespace ?? config.Namespace); 96 | } 97 | 98 | public void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root) 99 | { 100 | if (GetNamespace(config, root) != null) 101 | { 102 | 103 | sw.WriteLine("module " + GetNamespace(config, root) + " {"); 104 | sw.WriteLine(); 105 | } 106 | } 107 | 108 | public void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root) 109 | { 110 | if (GetNamespace(config, root) != null) 111 | { 112 | sw.WriteLine("}"); 113 | sw.WriteLine(); 114 | } 115 | } 116 | 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/CodeWriters/VisualBasicCodeWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Xamasoft.JsonClassGenerator.CodeWriters 8 | { 9 | public class VisualBasicCodeWriter : ICodeWriter 10 | { 11 | public string FileExtension 12 | { 13 | get { return ".vb"; } 14 | } 15 | 16 | public string DisplayName 17 | { 18 | get { return "Visual Basic .NET"; } 19 | } 20 | 21 | private const string NoRenameAttribute = ""; 22 | private const string NoPruneAttribute = ""; 23 | 24 | public string GetTypeName(JsonType type, IJsonClassGeneratorConfig config) 25 | { 26 | var arraysAsLists = config.ExplicitDeserialization; 27 | 28 | switch (type.Type) 29 | { 30 | case JsonTypeEnum.Anything: return "Object"; 31 | case JsonTypeEnum.Array: return arraysAsLists ? "IList(Of " + GetTypeName(type.InternalType, config) + ")" : GetTypeName(type.InternalType, config) + "()"; 32 | case JsonTypeEnum.Dictionary: return "Dictionary(Of String, " + GetTypeName(type.InternalType, config) + ")"; 33 | case JsonTypeEnum.Boolean: return "Boolean"; 34 | case JsonTypeEnum.Float: return "Double"; 35 | case JsonTypeEnum.Integer: return "Integer"; 36 | case JsonTypeEnum.Long: return "Long"; 37 | case JsonTypeEnum.Date: return "DateTime"; 38 | case JsonTypeEnum.NonConstrained: return "Object"; 39 | case JsonTypeEnum.NullableBoolean: return "Boolean?"; 40 | case JsonTypeEnum.NullableFloat: return "Double?"; 41 | case JsonTypeEnum.NullableInteger: return "Integer?"; 42 | case JsonTypeEnum.NullableLong: return "Long?"; 43 | case JsonTypeEnum.NullableDate: return "DateTime?"; 44 | case JsonTypeEnum.NullableSomething: return "Object"; 45 | case JsonTypeEnum.Object: return type.AssignedName; 46 | case JsonTypeEnum.String: return "String"; 47 | default: throw new System.NotSupportedException("Unsupported json type"); 48 | } 49 | } 50 | 51 | private bool ShouldApplyNoRenamingAttribute(IJsonClassGeneratorConfig config) 52 | { 53 | return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && !config.UsePascalCase; 54 | } 55 | private bool ShouldApplyNoPruneAttribute(IJsonClassGeneratorConfig config) 56 | { 57 | return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && config.UseProperties; 58 | } 59 | 60 | public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type) 61 | { 62 | var visibility = config.InternalVisibility ? "Friend" : "Public"; 63 | 64 | if (config.UseNestedClasses) 65 | { 66 | sw.WriteLine(" {0} Partial Class {1}", visibility, config.MainClass); 67 | if (!type.IsRoot) 68 | { 69 | if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute); 70 | if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute); 71 | sw.WriteLine(" {0} Class {1}", visibility, type.AssignedName); 72 | } 73 | } 74 | else 75 | { 76 | if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute); 77 | if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute); 78 | sw.WriteLine(" {0} Class {1}", visibility, type.AssignedName); 79 | } 80 | 81 | var prefix = config.UseNestedClasses && !type.IsRoot ? " " : " "; 82 | 83 | WriteClassMembers(config, sw, type, prefix); 84 | 85 | if (config.UseNestedClasses && !type.IsRoot) 86 | sw.WriteLine(" End Class"); 87 | 88 | sw.WriteLine(" End Class"); 89 | sw.WriteLine(); 90 | 91 | } 92 | 93 | 94 | private void WriteClassMembers(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type, string prefix) 95 | { 96 | foreach (var field in type.Fields) 97 | { 98 | if (config.UsePascalCase || config.ExamplesInDocumentation) sw.WriteLine(); 99 | 100 | if (config.ExamplesInDocumentation) 101 | { 102 | sw.WriteLine(prefix + "''' "); 103 | sw.WriteLine(prefix + "''' Examples: " + field.GetExamplesText()); 104 | sw.WriteLine(prefix + "''' "); 105 | } 106 | 107 | 108 | if (config.UsePascalCase) 109 | { 110 | sw.WriteLine(prefix + "", field.JsonMemberName); 111 | } 112 | 113 | if (config.UseProperties) 114 | { 115 | sw.WriteLine(prefix + "Public Property {1} As {0}", field.Type.GetTypeName(), field.MemberName); 116 | } 117 | else 118 | { 119 | sw.WriteLine(prefix + "Public {1} As {0}", field.Type.GetTypeName(), field.MemberName); 120 | } 121 | } 122 | 123 | } 124 | 125 | 126 | 127 | 128 | 129 | public void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw) 130 | { 131 | foreach (var line in JsonClassGenerator.FileHeader) 132 | { 133 | sw.WriteLine("' " + line); 134 | } 135 | sw.WriteLine(); 136 | sw.WriteLine("Imports System"); 137 | sw.WriteLine("Imports System.Collections.Generic"); 138 | if (ShouldApplyNoRenamingAttribute(config) || ShouldApplyNoPruneAttribute(config)) 139 | sw.WriteLine("Imports System.Reflection"); 140 | if (config.UsePascalCase) 141 | sw.WriteLine("Imports Newtonsoft.Json"); 142 | sw.WriteLine("Imports Newtonsoft.Json.Linq"); 143 | if (config.SecondaryNamespace != null && config.HasSecondaryClasses && !config.UseNestedClasses) 144 | { 145 | sw.WriteLine("Imports {0}", config.SecondaryNamespace); 146 | } 147 | } 148 | 149 | public void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw) 150 | { 151 | } 152 | 153 | 154 | public void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root) 155 | { 156 | sw.WriteLine(); 157 | sw.WriteLine("Namespace Global.{0}", root && !config.UseNestedClasses ? config.Namespace : (config.SecondaryNamespace ?? config.Namespace)); 158 | sw.WriteLine(); 159 | } 160 | 161 | public void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root) 162 | { 163 | 164 | sw.WriteLine("End Namespace"); 165 | 166 | } 167 | } 168 | } -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/FieldInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2010 Xamasoft 2 | 3 | using Newtonsoft.Json; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace Xamasoft.JsonClassGenerator 10 | { 11 | public class FieldInfo 12 | { 13 | 14 | public FieldInfo(IJsonClassGeneratorConfig generator, string jsonMemberName, JsonType type, bool usePascalCase, IList Examples) 15 | { 16 | this.generator = generator; 17 | this.JsonMemberName = jsonMemberName; 18 | this.MemberName = jsonMemberName; 19 | if (usePascalCase) MemberName = JsonClassGenerator.ToTitleCase(MemberName); 20 | this.Type = type; 21 | this.Examples = Examples; 22 | } 23 | private IJsonClassGeneratorConfig generator; 24 | public string MemberName { get; private set; } 25 | public string JsonMemberName { get; private set; } 26 | public JsonType Type { get; private set; } 27 | public IList Examples { get; private set; } 28 | 29 | public string GetGenerationCode(string jobject) 30 | { 31 | var field = this; 32 | if (field.Type.Type == JsonTypeEnum.Array) 33 | { 34 | var innermost = field.Type.GetInnermostType(); 35 | return string.Format("({1})JsonClassHelper.ReadArray<{5}>(JsonClassHelper.GetJToken({0}, \"{2}\"), JsonClassHelper.{3}, typeof({6}))", 36 | jobject, 37 | field.Type.GetTypeName(), 38 | field.JsonMemberName, 39 | innermost.GetReaderName(), 40 | -1, 41 | innermost.GetTypeName(), 42 | field.Type.GetTypeName() 43 | ); 44 | } 45 | else if (field.Type.Type == JsonTypeEnum.Dictionary) 46 | { 47 | 48 | return string.Format("({1})JsonClassHelper.ReadDictionary<{2}>(JsonClassHelper.GetJToken({0}, \"{3}\"))", 49 | jobject, 50 | field.Type.GetTypeName(), 51 | field.Type.InternalType.GetTypeName(), 52 | field.JsonMemberName, 53 | field.Type.GetTypeName() 54 | ); 55 | } 56 | else 57 | { 58 | return string.Format("JsonClassHelper.{1}(JsonClassHelper.GetJToken<{2}>({0}, \"{3}\"))", 59 | jobject, 60 | field.Type.GetReaderName(), 61 | field.Type.GetJTokenType(), 62 | field.JsonMemberName); 63 | } 64 | 65 | } 66 | 67 | 68 | 69 | public string GetExamplesText() 70 | { 71 | return string.Join(", ", Examples.Take(5).Select(x => JsonConvert.SerializeObject(x)).ToArray()); 72 | } 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/ICodeWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Xamasoft.JsonClassGenerator 8 | { 9 | public interface ICodeWriter 10 | { 11 | string FileExtension { get; } 12 | string DisplayName { get; } 13 | string GetTypeName(JsonType type, IJsonClassGeneratorConfig config); 14 | void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type); 15 | void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw); 16 | void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw); 17 | void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root); 18 | void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/IJsonClassGeneratorConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Xamasoft.JsonClassGenerator 7 | { 8 | public interface IJsonClassGeneratorConfig 9 | { 10 | string Namespace { get; set; } 11 | string SecondaryNamespace { get; set; } 12 | bool UseProperties { get; set; } 13 | bool InternalVisibility { get; set; } 14 | bool ExplicitDeserialization { get; set; } 15 | bool NoHelperClass { get; set; } 16 | string MainClass { get; set; } 17 | bool UsePascalCase { get; set; } 18 | bool UseNestedClasses { get; set; } 19 | bool ApplyObfuscationAttributes { get; set; } 20 | bool SingleFile { get; set; } 21 | ICodeWriter CodeWriter { get; set; } 22 | bool HasSecondaryClasses { get; } 23 | bool AlwaysUseNullableValues { get; set; } 24 | bool UseNamespaces { get; } 25 | bool ExamplesInDocumentation { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/JsonClassGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2010 Xamasoft 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using Newtonsoft.Json; 8 | using Newtonsoft.Json.Linq; 9 | using System.IO; 10 | using System.Data.Entity.Design.PluralizationServices; 11 | using System.Globalization; 12 | using Xamasoft.JsonClassGenerator.CodeWriters; 13 | 14 | 15 | namespace Xamasoft.JsonClassGenerator 16 | { 17 | public class JsonClassGenerator : IJsonClassGeneratorConfig 18 | { 19 | 20 | 21 | public string Example { get; set; } 22 | public string TargetFolder { get; set; } 23 | public string Namespace { get; set; } 24 | public string SecondaryNamespace { get; set; } 25 | public bool UseProperties { get; set; } 26 | public bool InternalVisibility { get; set; } 27 | public bool ExplicitDeserialization { get; set; } 28 | public bool NoHelperClass { get; set; } 29 | public string MainClass { get; set; } 30 | public bool UsePascalCase { get; set; } 31 | public bool UseNestedClasses { get; set; } 32 | public bool ApplyObfuscationAttributes { get; set; } 33 | public bool SingleFile { get; set; } 34 | public ICodeWriter CodeWriter { get; set; } 35 | public TextWriter OutputStream { get; set; } 36 | public bool AlwaysUseNullableValues { get; set; } 37 | public bool ExamplesInDocumentation { get; set; } 38 | 39 | readonly PluralizationService pluralizationService = PluralizationService.CreateService(new CultureInfo("en-us")); 40 | 41 | bool used; 42 | public bool UseNamespaces { get { return Namespace != null; } } 43 | 44 | public void GenerateClasses() 45 | { 46 | if (CodeWriter == null) CodeWriter = new CSharpCodeWriter(); 47 | if (ExplicitDeserialization && !(CodeWriter is CSharpCodeWriter)) throw new ArgumentException("Explicit deserialization is obsolete and is only supported by the C# provider."); 48 | 49 | if (used) throw new InvalidOperationException("This instance of JsonClassGenerator has already been used. Please create a new instance."); 50 | used = true; 51 | 52 | 53 | var writeToDisk = TargetFolder != null; 54 | if (writeToDisk && !Directory.Exists(TargetFolder)) Directory.CreateDirectory(TargetFolder); 55 | 56 | 57 | JObject[] examples; 58 | var example = Example.StartsWith("HTTP/") ? Example.Substring(Example.IndexOf("\r\n\r\n")) : Example; 59 | using (var sr = new StringReader(example)) 60 | using (var reader = new JsonTextReader(sr)) 61 | { 62 | var json = JToken.ReadFrom(reader); 63 | if (json is JArray) 64 | { 65 | examples = ((JArray)json).Cast().ToArray(); 66 | } 67 | else if (json is JObject) 68 | { 69 | examples = new[] { (JObject)json }; 70 | } 71 | else 72 | { 73 | throw new Exception("Sample JSON must be either a JSON array, or a JSON object."); 74 | } 75 | } 76 | 77 | 78 | Types = new List(); 79 | Names.Add(MainClass); 80 | var rootType = new JsonType(this, examples[0]); 81 | rootType.IsRoot = true; 82 | rootType.AssignName(MainClass); 83 | GenerateClass(examples, rootType); 84 | 85 | if (writeToDisk) 86 | { 87 | var parentFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); 88 | if (writeToDisk && !NoHelperClass && ExplicitDeserialization) File.WriteAllBytes(Path.Combine(TargetFolder, "JsonClassHelper.cs"), Properties.Resources.JsonClassHelper); 89 | if (SingleFile) 90 | { 91 | WriteClassesToFile(Path.Combine(TargetFolder, MainClass + CodeWriter.FileExtension), Types); 92 | } 93 | else 94 | { 95 | 96 | foreach (var type in Types) 97 | { 98 | var folder = TargetFolder; 99 | if (!UseNestedClasses && !type.IsRoot && SecondaryNamespace != null) 100 | { 101 | var s = SecondaryNamespace; 102 | if (s.StartsWith(Namespace + ".")) s = s.Substring(Namespace.Length + 1); 103 | folder = Path.Combine(folder, s); 104 | Directory.CreateDirectory(folder); 105 | } 106 | WriteClassesToFile(Path.Combine(folder, (UseNestedClasses && !type.IsRoot ? MainClass + "." : string.Empty) + type.AssignedName + CodeWriter.FileExtension), new[] { type }); 107 | } 108 | } 109 | } 110 | else if (OutputStream != null) 111 | { 112 | WriteClassesToFile(OutputStream, Types); 113 | } 114 | 115 | } 116 | 117 | void WriteClassesToFile(string path, IEnumerable types) 118 | { 119 | using (var sw = new StreamWriter(path, false, Encoding.UTF8)) 120 | { 121 | WriteClassesToFile(sw, types); 122 | } 123 | } 124 | 125 | void WriteClassesToFile(TextWriter sw, IEnumerable types) 126 | { 127 | var inNamespace = false; 128 | var rootNamespace = false; 129 | 130 | CodeWriter.WriteFileStart(this, sw); 131 | foreach (var type in types) 132 | { 133 | if (UseNamespaces && inNamespace && rootNamespace != type.IsRoot && SecondaryNamespace != null) { CodeWriter.WriteNamespaceEnd(this, sw, rootNamespace); inNamespace = false; } 134 | if (UseNamespaces && !inNamespace) { CodeWriter.WriteNamespaceStart(this, sw, type.IsRoot); inNamespace = true; rootNamespace = type.IsRoot; } 135 | CodeWriter.WriteClass(this, sw, type); 136 | } 137 | if (UseNamespaces && inNamespace) CodeWriter.WriteNamespaceEnd(this, sw, rootNamespace); 138 | CodeWriter.WriteFileEnd(this, sw); 139 | } 140 | 141 | 142 | void GenerateClass(JObject[] examples, JsonType type) 143 | { 144 | var jsonFields = new Dictionary(); 145 | var fieldExamples = new Dictionary>(); 146 | 147 | var first = true; 148 | 149 | foreach (var obj in examples) 150 | { 151 | foreach (var prop in obj.Properties()) 152 | { 153 | JsonType fieldType; 154 | var currentType = new JsonType(this, prop.Value); 155 | var propName = prop.Name; 156 | if (jsonFields.TryGetValue(propName, out fieldType)) 157 | { 158 | 159 | var commonType = fieldType.GetCommonType(currentType); 160 | 161 | jsonFields[propName] = commonType; 162 | } 163 | else 164 | { 165 | var commonType = currentType; 166 | commonType = first ? commonType.MaybeMakeNullable (this) : commonType.GetCommonType (JsonType.GetNull (this)); 167 | jsonFields.Add(propName, commonType); 168 | fieldExamples[propName] = new List(); 169 | } 170 | var fe = fieldExamples[propName]; 171 | var val = prop.Value; 172 | if (val.Type == JTokenType.Null || val.Type == JTokenType.Undefined) 173 | { 174 | if (!fe.Contains(null)) 175 | { 176 | fe.Insert(0, null); 177 | } 178 | } 179 | else 180 | { 181 | var v = val.Type == JTokenType.Array || val.Type == JTokenType.Object ? val : val.Value(); 182 | if (!fe.Any (v.Equals)) 183 | fe.Add(v); 184 | } 185 | } 186 | first = false; 187 | } 188 | 189 | if (UseNestedClasses) 190 | { 191 | foreach (var field in jsonFields) 192 | { 193 | Names.Add(field.Key.ToLower()); 194 | } 195 | } 196 | 197 | foreach (var field in jsonFields) 198 | { 199 | var fieldType = field.Value; 200 | if (fieldType.Type == JsonTypeEnum.Object) 201 | { 202 | var subexamples = new List(examples.Length); 203 | foreach (var obj in examples) 204 | { 205 | JToken value; 206 | if (obj.TryGetValue(field.Key, out value)) 207 | { 208 | if (value.Type == JTokenType.Object) 209 | { 210 | subexamples.Add((JObject)value); 211 | } 212 | } 213 | } 214 | 215 | fieldType.AssignName(CreateUniqueClassName(field.Key)); 216 | GenerateClass(subexamples.ToArray(), fieldType); 217 | } 218 | 219 | if (fieldType.InternalType != null && fieldType.InternalType.Type == JsonTypeEnum.Object) 220 | { 221 | var subexamples = new List(examples.Length); 222 | foreach (var obj in examples) 223 | { 224 | JToken value; 225 | if (obj.TryGetValue(field.Key, out value)) 226 | { 227 | if (value.Type == JTokenType.Array) 228 | { 229 | foreach (var item in (JArray)value) 230 | { 231 | if (!(item is JObject)) throw new NotSupportedException("Arrays of non-objects are not supported yet."); 232 | subexamples.Add((JObject)item); 233 | } 234 | 235 | } 236 | else if (value.Type == JTokenType.Object) 237 | { 238 | foreach (var item in (JObject)value) 239 | { 240 | if (!(item.Value is JObject)) throw new NotSupportedException("Arrays of non-objects are not supported yet."); 241 | 242 | subexamples.Add((JObject)item.Value); 243 | } 244 | } 245 | } 246 | } 247 | 248 | field.Value.InternalType.AssignName(CreateUniqueClassNameFromPlural(field.Key)); 249 | GenerateClass(subexamples.ToArray(), field.Value.InternalType); 250 | } 251 | } 252 | 253 | type.Fields = jsonFields.Select(x => new FieldInfo(this, x.Key, x.Value, UsePascalCase, fieldExamples[x.Key])).ToArray(); 254 | 255 | Types.Add(type); 256 | 257 | } 258 | 259 | public IList Types { get; private set; } 260 | readonly HashSet Names = new HashSet(); 261 | 262 | string CreateUniqueClassName(string name) 263 | { 264 | name = ToTitleCase(name); 265 | 266 | var finalName = name; 267 | var i = 2; 268 | while (Names.Any(x => x.Equals(finalName, StringComparison.OrdinalIgnoreCase))) 269 | { 270 | finalName = name + i; 271 | i++; 272 | } 273 | 274 | Names.Add(finalName); 275 | return finalName; 276 | } 277 | 278 | private string CreateUniqueClassNameFromPlural(string plural) 279 | { 280 | plural = ToTitleCase(plural); 281 | return CreateUniqueClassName(pluralizationService.Singularize(plural)); 282 | } 283 | 284 | 285 | 286 | internal static string ToTitleCase(string str) 287 | { 288 | var sb = new StringBuilder(str.Length); 289 | var flag = true; 290 | 291 | for (int i = 0; i < str.Length; i++) 292 | { 293 | var c = str[i]; 294 | if (char.IsLetterOrDigit(c)) 295 | { 296 | sb.Append(flag ? char.ToUpper(c) : c); 297 | flag = false; 298 | } 299 | else 300 | { 301 | flag = true; 302 | } 303 | } 304 | 305 | return sb.ToString(); 306 | } 307 | 308 | public bool HasSecondaryClasses 309 | { 310 | get { return Types.Count > 1; } 311 | } 312 | 313 | public static readonly string[] FileHeader = { 314 | "Generated by Xamasoft JSON Class Generator", 315 | "http://www.xamasoft.com/json-class-generator" 316 | }; 317 | } 318 | } 319 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/JsonClassGeneratorLib.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7BEF7EAA-DE37-40FB-BD33-3DEF0685031F} 8 | Library 9 | Properties 10 | Xamasoft.JsonClassGenerator 11 | Xamasoft.JsonClassGenerator 12 | v4.5 13 | 512 14 | 8.0.30703 15 | 2.0 16 | 17 | 18 | true 19 | full 20 | false 21 | ..\lib\Debug 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | ..\lib\Release 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | ..\System.Data.Entity.Design.PluralizationServices.dll 39 | 40 | 41 | 42 | 43 | 44 | 45 | ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | True 59 | True 60 | Resources.resx 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | ResXFileCodeGenerator 70 | Resources.Designer.cs 71 | Designer 72 | 73 | 74 | 75 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/JsonType.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2010 Xamasoft 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using Newtonsoft.Json.Linq; 8 | using System.Data.Entity.Design.PluralizationServices; 9 | using System.Globalization; 10 | 11 | namespace Xamasoft.JsonClassGenerator 12 | { 13 | public class JsonType 14 | { 15 | 16 | 17 | private JsonType(IJsonClassGeneratorConfig generator) 18 | { 19 | this.generator = generator; 20 | } 21 | 22 | public JsonType(IJsonClassGeneratorConfig generator, JToken token) 23 | : this(generator) 24 | { 25 | 26 | Type = GetFirstTypeEnum(token); 27 | 28 | if (Type == JsonTypeEnum.Array) 29 | { 30 | var array = (JArray)token; 31 | InternalType = GetCommonType(generator, array.ToArray()); 32 | } 33 | } 34 | 35 | internal static JsonType GetNull(IJsonClassGeneratorConfig generator) 36 | { 37 | return new JsonType(generator, JsonTypeEnum.NullableSomething); 38 | } 39 | 40 | private IJsonClassGeneratorConfig generator; 41 | 42 | internal JsonType(IJsonClassGeneratorConfig generator, JsonTypeEnum type) 43 | : this(generator) 44 | { 45 | this.Type = type; 46 | } 47 | 48 | 49 | public static JsonType GetCommonType(IJsonClassGeneratorConfig generator, JToken[] tokens) 50 | { 51 | 52 | if (tokens.Length == 0) return new JsonType(generator, JsonTypeEnum.NonConstrained); 53 | 54 | var common = new JsonType(generator, tokens[0]).MaybeMakeNullable(generator); 55 | 56 | for (int i = 1; i < tokens.Length; i++) 57 | { 58 | var current = new JsonType(generator, tokens[i]); 59 | common = common.GetCommonType(current); 60 | } 61 | 62 | return common; 63 | 64 | } 65 | 66 | internal JsonType MaybeMakeNullable(IJsonClassGeneratorConfig generator) 67 | { 68 | if (!generator.AlwaysUseNullableValues) return this; 69 | return this.GetCommonType(JsonType.GetNull(generator)); 70 | } 71 | 72 | 73 | public JsonTypeEnum Type { get; private set; } 74 | public JsonType InternalType { get; private set; } 75 | public string AssignedName { get; private set; } 76 | 77 | 78 | public void AssignName(string name) 79 | { 80 | AssignedName = name; 81 | } 82 | 83 | 84 | 85 | public bool MustCache 86 | { 87 | get 88 | { 89 | switch (Type) 90 | { 91 | case JsonTypeEnum.Array: return true; 92 | case JsonTypeEnum.Object: return true; 93 | case JsonTypeEnum.Anything: return true; 94 | case JsonTypeEnum.Dictionary: return true; 95 | case JsonTypeEnum.NonConstrained: return true; 96 | default: return false; 97 | } 98 | } 99 | } 100 | 101 | public string GetReaderName() 102 | { 103 | if (Type == JsonTypeEnum.Anything || Type == JsonTypeEnum.NullableSomething || Type == JsonTypeEnum.NonConstrained) 104 | { 105 | return "ReadObject"; 106 | } 107 | if (Type == JsonTypeEnum.Object) 108 | { 109 | return string.Format("ReadStronglyTypedObject<{0}>", AssignedName); 110 | } 111 | else if (Type == JsonTypeEnum.Array) 112 | { 113 | return string.Format("ReadArray<{0}>", InternalType.GetTypeName()); 114 | } 115 | else 116 | { 117 | return string.Format("Read{0}", Enum.GetName(typeof(JsonTypeEnum), Type)); 118 | } 119 | } 120 | 121 | public JsonType GetInnermostType() 122 | { 123 | if (Type != JsonTypeEnum.Array) throw new InvalidOperationException(); 124 | if (InternalType.Type != JsonTypeEnum.Array) return InternalType; 125 | return InternalType.GetInnermostType(); 126 | } 127 | 128 | 129 | public string GetTypeName() 130 | { 131 | return generator.CodeWriter.GetTypeName(this, generator); 132 | } 133 | 134 | public string GetJTokenType() 135 | { 136 | switch (Type) 137 | { 138 | case JsonTypeEnum.Boolean: 139 | case JsonTypeEnum.Integer: 140 | case JsonTypeEnum.Long: 141 | case JsonTypeEnum.Float: 142 | case JsonTypeEnum.Date: 143 | case JsonTypeEnum.NullableBoolean: 144 | case JsonTypeEnum.NullableInteger: 145 | case JsonTypeEnum.NullableLong: 146 | case JsonTypeEnum.NullableFloat: 147 | case JsonTypeEnum.NullableDate: 148 | case JsonTypeEnum.String: 149 | return "JValue"; 150 | case JsonTypeEnum.Array: 151 | return "JArray"; 152 | case JsonTypeEnum.Dictionary: 153 | return "JObject"; 154 | case JsonTypeEnum.Object: 155 | return "JObject"; 156 | default: 157 | return "JToken"; 158 | 159 | } 160 | } 161 | 162 | public JsonType GetCommonType(JsonType type2) 163 | { 164 | var commonType = GetCommonTypeEnum(this.Type, type2.Type); 165 | 166 | if (commonType == JsonTypeEnum.Array) 167 | { 168 | if (type2.Type == JsonTypeEnum.NullableSomething) return this; 169 | if (this.Type == JsonTypeEnum.NullableSomething) return type2; 170 | var commonInternalType = InternalType.GetCommonType(type2.InternalType).MaybeMakeNullable(generator); 171 | if (commonInternalType != InternalType) return new JsonType(generator, JsonTypeEnum.Array) { InternalType = commonInternalType }; 172 | } 173 | 174 | 175 | //if (commonType == JsonTypeEnum.Dictionary) 176 | //{ 177 | // var commonInternalType = InternalType.GetCommonType(type2.InternalType); 178 | // if (commonInternalType != InternalType) return new JsonType(JsonTypeEnum.Dictionary) { InternalType = commonInternalType }; 179 | //} 180 | 181 | 182 | if (this.Type == commonType) return this; 183 | return new JsonType(generator, commonType).MaybeMakeNullable(generator); 184 | } 185 | 186 | 187 | private static bool IsNull(JsonTypeEnum type) 188 | { 189 | return type == JsonTypeEnum.NullableSomething; 190 | } 191 | 192 | 193 | 194 | private JsonTypeEnum GetCommonTypeEnum(JsonTypeEnum type1, JsonTypeEnum type2) 195 | { 196 | if (type1 == JsonTypeEnum.NonConstrained) return type2; 197 | if (type2 == JsonTypeEnum.NonConstrained) return type1; 198 | 199 | switch (type1) 200 | { 201 | case JsonTypeEnum.Boolean: 202 | if (IsNull(type2)) return JsonTypeEnum.NullableBoolean; 203 | if (type2 == JsonTypeEnum.Boolean) return type1; 204 | break; 205 | case JsonTypeEnum.NullableBoolean: 206 | if (IsNull(type2)) return type1; 207 | if (type2 == JsonTypeEnum.Boolean) return type1; 208 | break; 209 | case JsonTypeEnum.Integer: 210 | if (IsNull(type2)) return JsonTypeEnum.NullableInteger; 211 | if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.Float; 212 | if (type2 == JsonTypeEnum.Long) return JsonTypeEnum.Long; 213 | if (type2 == JsonTypeEnum.Integer) return type1; 214 | break; 215 | case JsonTypeEnum.NullableInteger: 216 | if (IsNull(type2)) return type1; 217 | if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.NullableFloat; 218 | if (type2 == JsonTypeEnum.Long) return JsonTypeEnum.NullableLong; 219 | if (type2 == JsonTypeEnum.Integer) return type1; 220 | break; 221 | case JsonTypeEnum.Float: 222 | if (IsNull(type2)) return JsonTypeEnum.NullableFloat; 223 | if (type2 == JsonTypeEnum.Float) return type1; 224 | if (type2 == JsonTypeEnum.Integer) return type1; 225 | if (type2 == JsonTypeEnum.Long) return type1; 226 | break; 227 | case JsonTypeEnum.NullableFloat: 228 | if (IsNull(type2)) return type1; 229 | if (type2 == JsonTypeEnum.Float) return type1; 230 | if (type2 == JsonTypeEnum.Integer) return type1; 231 | if (type2 == JsonTypeEnum.Long) return type1; 232 | break; 233 | case JsonTypeEnum.Long: 234 | if (IsNull(type2)) return JsonTypeEnum.NullableLong; 235 | if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.Float; 236 | if (type2 == JsonTypeEnum.Integer) return type1; 237 | break; 238 | case JsonTypeEnum.NullableLong: 239 | if (IsNull(type2)) return type1; 240 | if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.NullableFloat; 241 | if (type2 == JsonTypeEnum.Integer) return type1; 242 | if (type2 == JsonTypeEnum.Long) return type1; 243 | break; 244 | case JsonTypeEnum.Date: 245 | if (IsNull(type2)) return JsonTypeEnum.NullableDate; 246 | if (type2 == JsonTypeEnum.Date) return JsonTypeEnum.Date; 247 | break; 248 | case JsonTypeEnum.NullableDate: 249 | if (IsNull(type2)) return type1; 250 | if (type2 == JsonTypeEnum.Date) return type1; 251 | break; 252 | case JsonTypeEnum.NullableSomething: 253 | if (IsNull(type2)) return type1; 254 | if (type2 == JsonTypeEnum.String) return JsonTypeEnum.String; 255 | if (type2 == JsonTypeEnum.Integer) return JsonTypeEnum.NullableInteger; 256 | if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.NullableFloat; 257 | if (type2 == JsonTypeEnum.Long) return JsonTypeEnum.NullableLong; 258 | if (type2 == JsonTypeEnum.Boolean) return JsonTypeEnum.NullableBoolean; 259 | if (type2 == JsonTypeEnum.Date) return JsonTypeEnum.NullableDate; 260 | if (type2 == JsonTypeEnum.Array) return JsonTypeEnum.Array; 261 | if (type2 == JsonTypeEnum.Object) return JsonTypeEnum.Object; 262 | break; 263 | case JsonTypeEnum.Object: 264 | if (IsNull(type2)) return type1; 265 | if (type2 == JsonTypeEnum.Object) return type1; 266 | if (type2 == JsonTypeEnum.Dictionary) throw new ArgumentException(); 267 | break; 268 | case JsonTypeEnum.Dictionary: 269 | throw new ArgumentException(); 270 | //if (IsNull(type2)) return type1; 271 | //if (type2 == JsonTypeEnum.Object) return type1; 272 | //if (type2 == JsonTypeEnum.Dictionary) return type1; 273 | // break; 274 | case JsonTypeEnum.Array: 275 | if (IsNull(type2)) return type1; 276 | if (type2 == JsonTypeEnum.Array) return type1; 277 | break; 278 | case JsonTypeEnum.String: 279 | if (IsNull(type2)) return type1; 280 | if (type2 == JsonTypeEnum.String) return type1; 281 | break; 282 | } 283 | 284 | return JsonTypeEnum.Anything; 285 | 286 | } 287 | 288 | private static bool IsNull(JTokenType type) 289 | { 290 | return type == JTokenType.Null || type == JTokenType.Undefined; 291 | } 292 | 293 | 294 | 295 | private static JsonTypeEnum GetFirstTypeEnum(JToken token) 296 | { 297 | var type = token.Type; 298 | if (type == JTokenType.Integer) 299 | { 300 | if ((long)((JValue)token).Value < int.MaxValue) return JsonTypeEnum.Integer; 301 | else return JsonTypeEnum.Long; 302 | 303 | } 304 | switch (type) 305 | { 306 | case JTokenType.Array: return JsonTypeEnum.Array; 307 | case JTokenType.Boolean: return JsonTypeEnum.Boolean; 308 | case JTokenType.Float: return JsonTypeEnum.Float; 309 | case JTokenType.Null: return JsonTypeEnum.NullableSomething; 310 | case JTokenType.Undefined: return JsonTypeEnum.NullableSomething; 311 | case JTokenType.String: return JsonTypeEnum.String; 312 | case JTokenType.Object: return JsonTypeEnum.Object; 313 | case JTokenType.Date: return JsonTypeEnum.Date; 314 | 315 | default: return JsonTypeEnum.Anything; 316 | 317 | } 318 | } 319 | 320 | 321 | public IList Fields { get; internal set; } 322 | public bool IsRoot { get; internal set; } 323 | } 324 | } 325 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/JsonTypeEnum.cs: -------------------------------------------------------------------------------- 1 | // Copyright © 2010 Xamasoft 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace Xamasoft.JsonClassGenerator 9 | { 10 | public enum JsonTypeEnum 11 | { 12 | Anything, 13 | String, 14 | Boolean, 15 | Integer, 16 | Long, 17 | Float, 18 | Date, 19 | NullableInteger, 20 | NullableLong, 21 | NullableFloat, 22 | NullableBoolean, 23 | NullableDate, 24 | Object, 25 | Array, 26 | Dictionary, 27 | NullableSomething, 28 | NonConstrained 29 | 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 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("Json Class Generator")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Xamasoft")] 12 | [assembly: AssemblyProduct("Json Class Generator")] 13 | [assembly: AssemblyCopyright("Copyright © Xamasoft 2010-2013")] 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("d85f4fb4-29b8-4315-ad2d-74f24098c968")] 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.5.0.0")] 36 | [assembly: AssemblyFileVersion("1.5.0.0")] 37 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18033 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Xamasoft.JsonClassGenerator.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Xamasoft.JsonClassGenerator.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Byte[]. 65 | /// 66 | internal static byte[] JsonClassHelper { 67 | get { 68 | object obj = ResourceManager.GetObject("JsonClassHelper", resourceCulture); 69 | return ((byte[])(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | text/microsoft-resx 91 | 92 | 93 | 1.3 94 | 95 | 96 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 97 | 98 | 99 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 100 | 101 | 102 | ..\jsonclasshelper.cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 103 | 104 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/jsonclasshelper.cs: -------------------------------------------------------------------------------- 1 | // JSON C# Class Generator 2 | // http://www.xamasoft.com/json-class-generator 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using Newtonsoft.Json.Linq; 9 | 10 | namespace JsonCSharpClassGenerator 11 | { 12 | internal static class JsonClassHelper 13 | { 14 | 15 | public static T GetJToken(JObject obj, string field) where T : JToken 16 | { 17 | JToken value; 18 | if (obj.TryGetValue(field, out value)) return GetJToken(value); 19 | else return null; 20 | } 21 | 22 | private static T GetJToken(JToken token) where T : JToken 23 | { 24 | if (token == null) return null; 25 | if (token.Type == JTokenType.Null) return null; 26 | if (token.Type == JTokenType.Undefined) return null; 27 | return (T)token; 28 | } 29 | 30 | public static string ReadString(JToken token) 31 | { 32 | var value = GetJToken(token); 33 | if (value == null) return null; 34 | return (string)value.Value; 35 | } 36 | 37 | 38 | public static bool ReadBoolean(JToken token) 39 | { 40 | var value = GetJToken(token); 41 | if (value == null) throw new Newtonsoft.Json.JsonSerializationException(); 42 | return Convert.ToBoolean(value.Value); 43 | 44 | } 45 | 46 | public static bool? ReadNullableBoolean(JToken token) 47 | { 48 | var value = GetJToken(token); 49 | if (value == null) return null; 50 | return Convert.ToBoolean(value.Value); 51 | } 52 | 53 | 54 | public static int ReadInteger(JToken token) 55 | { 56 | var value = GetJToken(token); 57 | if (value == null) throw new Newtonsoft.Json.JsonSerializationException(); 58 | return Convert.ToInt32((long)value.Value); 59 | 60 | } 61 | 62 | public static int? ReadNullableInteger(JToken token) 63 | { 64 | var value = GetJToken(token); 65 | if (value == null) return null; 66 | return Convert.ToInt32((long)value.Value); 67 | 68 | } 69 | 70 | 71 | 72 | public static long ReadLong(JToken token) 73 | { 74 | var value = GetJToken(token); 75 | if (value == null) throw new Newtonsoft.Json.JsonSerializationException(); 76 | return Convert.ToInt64(value.Value); 77 | 78 | } 79 | 80 | public static long? ReadNullableLong(JToken token) 81 | { 82 | var value = GetJToken(token); 83 | if (value == null) return null; 84 | return Convert.ToInt64(value.Value); 85 | } 86 | 87 | 88 | public static double ReadFloat(JToken token) 89 | { 90 | var value = GetJToken(token); 91 | if (value == null) throw new Newtonsoft.Json.JsonSerializationException(); 92 | return Convert.ToDouble(value.Value); 93 | 94 | } 95 | 96 | public static double? ReadNullableFloat(JToken token) 97 | { 98 | var value = GetJToken(token); 99 | if (value == null) return null; 100 | return Convert.ToDouble(value.Value); 101 | 102 | } 103 | 104 | 105 | 106 | 107 | public static DateTime ReadDate(JToken token) 108 | { 109 | var value = GetJToken(token); 110 | if (value == null) throw new Newtonsoft.Json.JsonSerializationException(); 111 | return Convert.ToDateTime(value.Value); 112 | 113 | } 114 | 115 | public static DateTime? ReadNullableDate(JToken token) 116 | { 117 | var value = GetJToken(token); 118 | if (value == null) return null; 119 | return Convert.ToDateTime(value.Value); 120 | 121 | } 122 | 123 | public static object ReadObject(JToken token) 124 | { 125 | var value = GetJToken(token); 126 | if (value == null) return null; 127 | if (value.Type == JTokenType.Object) return value; 128 | if (value.Type == JTokenType.Array) return ReadArray(value, ReadObject); 129 | 130 | var jvalue = value as JValue; 131 | if (jvalue != null) return jvalue.Value; 132 | 133 | return value; 134 | } 135 | 136 | public static T ReadStronglyTypedObject(JToken token) where T : class 137 | { 138 | var value = GetJToken(token); 139 | if (value == null) return null; 140 | return (T)Activator.CreateInstance(typeof(T), new object[] { token }); 141 | 142 | } 143 | 144 | 145 | public delegate T ValueReader(JToken token); 146 | 147 | 148 | 149 | public static T[] ReadArray(JToken token, ValueReader reader) 150 | { 151 | var value = GetJToken(token); 152 | if (value == null) return null; 153 | 154 | var array = new T[value.Count]; 155 | for (int i = 0; i < array.Length; i++) 156 | { 157 | array[i] = reader(value[i]); 158 | } 159 | return array; 160 | 161 | } 162 | 163 | 164 | 165 | public static Dictionary ReadDictionary(JToken token) 166 | { 167 | var value = GetJToken(token); 168 | if (value == null) return null; 169 | 170 | var dict = new Dictionary(); 171 | 172 | return dict; 173 | } 174 | 175 | public static Array ReadArray(JArray jArray, ValueReader reader, Type type) 176 | { 177 | if (jArray == null) return null; 178 | 179 | var elemType = type.GetElementType(); 180 | 181 | var array = Array.CreateInstance(elemType, jArray.Count); 182 | for (int i = 0; i < array.Length; i++) 183 | { 184 | if (elemType.IsArray) 185 | { 186 | array.SetValue(ReadArray(GetJToken(jArray[i]), reader, elemType), i); 187 | } 188 | else 189 | { 190 | array.SetValue(reader(jArray[i]), i); 191 | } 192 | 193 | } 194 | return array; 195 | 196 | } 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /JsonCSharpClassGeneratorLib/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SpecialCopy 2 | ========================= 3 | 4 | An Addin for Monodevelop/Xamarin studio to paste json string as C# classes 5 | 6 | ![Image](http://i.imgur.com/7DJ8UL7.png) 7 | 8 | 9 | ## Installation 10 | You need to follow these three easy steps to install this feature on our Xamarin Studio. 11 | 12 | 1. Download the add-in package from [Releases](https://github.com/prashantvc/SpecialCopy/releases/tag/v1.0.1) 13 | 2. Open Xamarin Studio -> Add-in Manager 14 | 3. Click on _Install from file..._ button and select the downloaded package to install 15 | 16 | Once you install the add-in the _Paste JSON as classes_ command will appear in _Edit_ menu, that enable you to paste C# classes directly from the text in your clipboard. 17 | 18 | ![Imgur](http://i.imgur.com/Cmbd48u.png) 19 | 20 | ## Todo: 21 | Add preferences to 22 | - ~~Convert to PascalCase~~ 23 | - ~~Generate memberbs as Properties/Fields~~ 24 | 25 | 26 | ----- 27 | _Special thanks to the [JSON C# Class](http://jsonclassgenerator.codeplex.com/) Generator project_ 28 | 29 | 30 | -------------------------------------------------------------------------------- /SpecialCopy.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonClassGeneratorLib", "JsonCSharpClassGeneratorLib\JsonClassGeneratorLib.csproj", "{7BEF7EAA-DE37-40FB-BD33-3DEF0685031F}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpecialCopy", "SpecialCopyCore\SpecialCopy.csproj", "{87219777-DFAA-4CFF-8F93-8D8E125B5190}" 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 | {7BEF7EAA-DE37-40FB-BD33-3DEF0685031F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {7BEF7EAA-DE37-40FB-BD33-3DEF0685031F}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {7BEF7EAA-DE37-40FB-BD33-3DEF0685031F}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {7BEF7EAA-DE37-40FB-BD33-3DEF0685031F}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {87219777-DFAA-4CFF-8F93-8D8E125B5190}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {87219777-DFAA-4CFF-8F93-8D8E125B5190}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {87219777-DFAA-4CFF-8F93-8D8E125B5190}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {87219777-DFAA-4CFF-8F93-8D8E125B5190}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(MonoDevelopProperties) = preSolution 24 | StartupItem = SpecialCopyCore\SpecialCopy.csproj 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /SpecialCopy.userprefs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /SpecialCopyCore/JsonConverterHandler.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Components.Commands; 2 | using System; 3 | using MonoDevelop.Ide; 4 | using Mono.TextEditor; 5 | using MonoDevelop.Ide.Gui; 6 | using Gtk; 7 | using Xamasoft.JsonClassGenerator; 8 | using Xamasoft.JsonClassGenerator.CodeWriters; 9 | using System.IO; 10 | 11 | namespace SpecialCopy.JsonConverter 12 | { 13 | class JsonConverterHandler : CommandHandler 14 | { 15 | void PasteJson (Clipboard c, string text) 16 | { 17 | if (string.IsNullOrEmpty (text)) { 18 | InsertCSharp (string.Empty); 19 | 20 | #if DEBUG 21 | MessageService.ShowWarning ("Clipboard is empty!"); 22 | #endif 23 | 24 | return; 25 | } 26 | 27 | var gen = new JsonClassGenerator { 28 | Example = text, 29 | MainClass = "RootObject", 30 | CodeWriter = new CSharpCodeWriter () 31 | }; 32 | 33 | try { 34 | using (var sw = new StringWriter ()) { 35 | gen.UsePascalCase = PropertyList.UsePascalCase; 36 | gen.InternalVisibility = PropertyList.InternalClass; 37 | gen.UseProperties = PropertyList.UseProperties; 38 | 39 | gen.OutputStream = sw; 40 | gen.GenerateClasses (); 41 | sw.Flush (); 42 | var generatedString = sw.ToString (); 43 | InsertCSharp (generatedString); 44 | } 45 | } catch (Exception ex) { 46 | Console.WriteLine (ex.Message); 47 | MessageService.ShowWarning (string.Format ("Invalid JSON: {0}", ex.Message)); 48 | } 49 | 50 | gen = null; 51 | } 52 | 53 | void InsertCSharp (string text) 54 | { 55 | var doc = IdeApp.Workbench.ActiveDocument; 56 | var textEditorData = doc.GetContent ().GetTextEditorData (); 57 | 58 | textEditorData.InsertAtCaret (text); 59 | } 60 | 61 | protected override void Run () 62 | { 63 | var clipboard = Clipboard.Get (Gdk.Selection.Clipboard); 64 | clipboard.RequestText (PasteJson); 65 | } 66 | 67 | protected override void Update (CommandInfo info) 68 | { 69 | var doc = IdeApp.Workbench.ActiveDocument; 70 | info.Enabled = doc != null && doc.GetContent () != null; 71 | } 72 | } 73 | 74 | public enum JsonConverterCommand 75 | { 76 | PasteJson 77 | } 78 | } -------------------------------------------------------------------------------- /SpecialCopyCore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("SpecialCopyCore")] 8 | [assembly: AssemblyDescription ("")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("Prashant Cholachagudda")] 13 | [assembly: AssemblyTrademark ("")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /SpecialCopyCore/Properties/Manifest.addin.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /SpecialCopyCore/PropertyList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MonoDevelop.Core; 3 | 4 | namespace SpecialCopy 5 | { 6 | public static class PropertyList 7 | { 8 | public static bool UsePascalCase { 9 | get{ return PropertyService.Get ("SpecialCopy.UsePascalCase", true); } 10 | set{ PropertyService.Set ("SpecialCopy.UsePascalCase", value); } 11 | } 12 | 13 | public static bool UseProperties { 14 | get{ return PropertyService.Get ("SpecialCopy.UseProperties", true); } 15 | set{ PropertyService.Set ("SpecialCopy.UseProperties", value); } 16 | } 17 | 18 | public static bool InternalClass { 19 | get{ return PropertyService.Get ("SpecialCopy.InternalClass", true); } 20 | set{ PropertyService.Set ("SpecialCopy.InternalClass", value); } 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /SpecialCopyCore/SpecialCopy.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {87219777-DFAA-4CFF-8F93-8D8E125B5190} 7 | {86F6BF2A-E449-4B3E-813B-9ACC37E5545F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | Library 9 | SpecialCopy 10 | SpecialCopy 11 | 8.0.30703 12 | 2.0 13 | v4.5 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG; 21 | prompt 22 | 4 23 | false 24 | 25 | 26 | true 27 | bin\Release\ 28 | prompt 29 | 4 30 | false 31 | 32 | 33 | 34 | 35 | False 36 | 37 | 38 | False 39 | 40 | 41 | False 42 | 43 | 44 | False 45 | 46 | 47 | False 48 | 49 | 50 | False 51 | 52 | 53 | 54 | 55 | True 56 | 57 | 58 | ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll 59 | 60 | 61 | 62 | 63 | gui.stetic 64 | 65 | 66 | Always 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | {7BEF7EAA-DE37-40FB-BD33-3DEF0685031F} 81 | JsonClassGeneratorLib 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /SpecialCopyCore/SpecialCopyCore.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {87219777-DFAA-4CFF-8F93-8D8E125B5190} 7 | Library 8 | SpecialCopyCore 9 | SpecialCopyCore 10 | 8.0.30703 11 | 2.0 12 | v4.5 13 | 14 | 15 | true 16 | full 17 | false 18 | bin\Debug 19 | DEBUG; 20 | prompt 21 | 4 22 | false 23 | 24 | 25 | full 26 | true 27 | bin\Release 28 | prompt 29 | 4 30 | false 31 | 32 | 33 | 34 | 35 | False 36 | 37 | 38 | False 39 | 40 | 41 | False 42 | 43 | 44 | False 45 | 46 | 47 | False 48 | 49 | 50 | False 51 | 52 | 53 | 54 | 55 | 56 | /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/MonoDevelop.Core.dll 57 | 58 | 59 | /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/MonoDevelop.Ide.dll 60 | 61 | 62 | /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/ICSharpCode.NRefactory.dll 63 | 64 | 65 | /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/Mono.Addins.dll 66 | 67 | 68 | ..\packages\Newtonsoft.Json.6.0.7\lib\net45\Newtonsoft.Json.dll 69 | 70 | 71 | 72 | 73 | gui.stetic 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | {7BEF7EAA-DE37-40FB-BD33-3DEF0685031F} 85 | JsonClassGeneratorLib 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /SpecialCopyCore/SpecialtCopyPreference.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MonoDevelop.Ide.Gui.Dialogs; 3 | using Gtk; 4 | using MonoDevelop.Core; 5 | 6 | namespace SpecialCopy 7 | { 8 | public class SpecialCopyPanel :OptionsPanel 9 | { 10 | SpecialCopyWidget widget; 11 | 12 | public override Gtk.Widget CreatePanelWidget () 13 | { 14 | widget = new SpecialCopyWidget (); 15 | widget.UsePascalCasing = PropertyList.UsePascalCase; 16 | widget.UseProperties = PropertyList.UseProperties; 17 | widget.InternalClass = PropertyList.InternalClass; 18 | 19 | return widget; 20 | } 21 | 22 | public override void ApplyChanges () 23 | { 24 | PropertyList.UsePascalCase = widget.UsePascalCasing; 25 | PropertyList.UseProperties = widget.UseProperties; 26 | PropertyList.InternalClass = widget.InternalClass; 27 | 28 | Console.WriteLine ("Apply Changes: {0}", widget); 29 | } 30 | } 31 | 32 | class SpecialCopyWidget:VBox 33 | { 34 | VBox vbox5; 35 | Label _memberGeneration; 36 | RadioButton _properties; 37 | RadioButton _fields; 38 | VBox vbox7; 39 | Label _visibility; 40 | RadioButton _internal; 41 | RadioButton _public; 42 | CheckButton _casing; 43 | 44 | public bool UsePascalCasing { 45 | get { 46 | return _casing.Active; 47 | }set { 48 | _casing.Active = value; 49 | } 50 | } 51 | 52 | public bool UseProperties { 53 | get { 54 | return _properties.Active; 55 | } 56 | set { 57 | if (value) { 58 | _properties.Active = true; 59 | _fields.Active = false; 60 | 61 | } else { 62 | _properties.Active = false; 63 | _fields.Active = true; 64 | } 65 | } 66 | } 67 | 68 | public bool InternalClass { 69 | get { 70 | return _internal.Active; 71 | } 72 | set { 73 | if (value) { 74 | _internal.Active = true; 75 | _public.Active = false; 76 | } else { 77 | 78 | _internal.Active = false; 79 | _public.Active = true; 80 | } 81 | } 82 | } 83 | 84 | public SpecialCopyWidget () : base (false, 6) 85 | { 86 | this.vbox5 = new global::Gtk.VBox (); 87 | this.vbox5.Name = "vbox5"; 88 | this.vbox5.Spacing = 6; 89 | // Container child vbox5.Gtk.Box+BoxChild 90 | this._memberGeneration = new global::Gtk.Label (); 91 | this._memberGeneration.Name = "_memberGeneration"; 92 | this._memberGeneration.Ypad = 2; 93 | this._memberGeneration.Xalign = 0F; 94 | this._memberGeneration.LabelProp = global::Mono.Unix.Catalog.GetString ("Members generation:"); 95 | this._memberGeneration.UseMarkup = true; 96 | this.vbox5.Add (this._memberGeneration); 97 | global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this._memberGeneration])); 98 | w1.Position = 0; 99 | w1.Expand = false; 100 | w1.Fill = false; 101 | // Container child vbox5.Gtk.Box+BoxChild 102 | this._properties = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("Properties")); 103 | this._properties.CanFocus = true; 104 | this._properties.Name = "_properties"; 105 | this._properties.DrawIndicator = true; 106 | this._properties.UseUnderline = true; 107 | this._properties.Group = new global::GLib.SList (global::System.IntPtr.Zero); 108 | this.vbox5.Add (this._properties); 109 | global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this._properties])); 110 | w2.Position = 1; 111 | w2.Expand = false; 112 | w2.Fill = false; 113 | // Container child vbox5.Gtk.Box+BoxChild 114 | this._fields = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("Fields")); 115 | this._fields.CanFocus = true; 116 | this._fields.Name = "_fields"; 117 | this._fields.DrawIndicator = true; 118 | this._fields.UseUnderline = true; 119 | this._fields.Group = this._properties.Group; 120 | this.vbox5.Add (this._fields); 121 | global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this._fields])); 122 | w3.Position = 2; 123 | w3.Expand = false; 124 | w3.Fill = false; 125 | this.Add (this.vbox5); 126 | global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this [this.vbox5])); 127 | w4.Position = 0; 128 | w4.Expand = false; 129 | w4.Fill = false; 130 | // Container child vbox3.Gtk.Box+BoxChild 131 | this.vbox7 = new global::Gtk.VBox (); 132 | this.vbox7.Name = "vbox7"; 133 | this.vbox7.Spacing = 6; 134 | // Container child vbox7.Gtk.Box+BoxChild 135 | this._visibility = new global::Gtk.Label (); 136 | this._visibility.Name = "_visibility"; 137 | this._visibility.Ypad = 2; 138 | this._visibility.Xalign = 0F; 139 | this._visibility.LabelProp = global::Mono.Unix.Catalog.GetString ("Visibility:"); 140 | this._visibility.UseMarkup = true; 141 | this.vbox7.Add (this._visibility); 142 | global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox7 [this._visibility])); 143 | w5.Position = 0; 144 | w5.Expand = false; 145 | w5.Fill = false; 146 | // Container child vbox7.Gtk.Box+BoxChild 147 | this._internal = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("Internal")); 148 | this._internal.CanFocus = true; 149 | this._internal.Name = "_internal"; 150 | this._internal.DrawIndicator = true; 151 | this._internal.UseUnderline = true; 152 | this._internal.Group = new global::GLib.SList (global::System.IntPtr.Zero); 153 | this.vbox7.Add (this._internal); 154 | global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox7 [this._internal])); 155 | w6.Position = 1; 156 | w6.Expand = false; 157 | w6.Fill = false; 158 | // Container child vbox7.Gtk.Box+BoxChild 159 | this._public = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("Public")); 160 | this._public.CanFocus = true; 161 | this._public.Name = "_public"; 162 | this._public.DrawIndicator = true; 163 | this._public.UseUnderline = true; 164 | this._public.Group = this._internal.Group; 165 | this.vbox7.Add (this._public); 166 | global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox7 [this._public])); 167 | w7.Position = 2; 168 | w7.Expand = false; 169 | w7.Fill = false; 170 | this.Add (this.vbox7); 171 | global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this [this.vbox7])); 172 | w8.Position = 1; 173 | w8.Expand = false; 174 | w8.Fill = false; 175 | // Container child vbox3.Gtk.Box+BoxChild 176 | this._casing = new global::Gtk.CheckButton (); 177 | this._casing.CanFocus = true; 178 | this._casing.Name = "_casing"; 179 | this._casing.Label = global::Mono.Unix.Catalog.GetString ("Convert to PascalCase"); 180 | this._casing.DrawIndicator = true; 181 | this._casing.UseUnderline = true; 182 | this.Add (this._casing); 183 | global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this [this._casing])); 184 | w9.Position = 2; 185 | w9.Expand = false; 186 | w9.Fill = false; 187 | 188 | ShowAll (); 189 | } 190 | 191 | } 192 | } 193 | 194 | -------------------------------------------------------------------------------- /SpecialCopyCore/gtk-gui/generated.cs: -------------------------------------------------------------------------------- 1 | 2 | // This file has been generated by the GUI designer. Do not modify. 3 | namespace Stetic 4 | { 5 | internal class Gui 6 | { 7 | private static bool initialized; 8 | 9 | internal static void Initialize (Gtk.Widget iconRenderer) 10 | { 11 | if ((Stetic.Gui.initialized == false)) { 12 | Stetic.Gui.initialized = true; 13 | } 14 | } 15 | } 16 | 17 | internal class ActionGroups 18 | { 19 | public static Gtk.ActionGroup GetActionGroup (System.Type type) 20 | { 21 | return Stetic.ActionGroups.GetActionGroup (type.FullName); 22 | } 23 | 24 | public static Gtk.ActionGroup GetActionGroup (string name) 25 | { 26 | return null; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SpecialCopyCore/gtk-gui/gui.stetic: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | .. 5 | 6 | -------------------------------------------------------------------------------- /SpecialCopyCore/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /System.Data.Entity.Design.PluralizationServices.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prashantvc/SpecialCopy/a39c0645f6343fd76f1def0102c07b653e90d5c8/System.Data.Entity.Design.PluralizationServices.dll -------------------------------------------------------------------------------- /Xamarin.SpecialCopy.userprefs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /addin-project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SpecialCopyCore/bin/Release/SpecialCopy.dll 5 | SpecialCopy.sln 6 | Release 7 | 8 | -------------------------------------------------------------------------------- /lib/Release/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prashantvc/SpecialCopy/a39c0645f6343fd76f1def0102c07b653e90d5c8/lib/Release/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /lib/Release/System.Data.Entity.Design.PluralizationServices.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prashantvc/SpecialCopy/a39c0645f6343fd76f1def0102c07b653e90d5c8/lib/Release/System.Data.Entity.Design.PluralizationServices.dll -------------------------------------------------------------------------------- /lib/Release/Xamasoft.JsonClassGenerator.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prashantvc/SpecialCopy/a39c0645f6343fd76f1def0102c07b653e90d5c8/lib/Release/Xamasoft.JsonClassGenerator.dll -------------------------------------------------------------------------------- /lib/Release/Xamasoft.JsonClassGenerator.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prashantvc/SpecialCopy/a39c0645f6343fd76f1def0102c07b653e90d5c8/lib/Release/Xamasoft.JsonClassGenerator.dll.mdb --------------------------------------------------------------------------------