添加middleware
This commit is contained in:
@@ -0,0 +1,302 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator.CodeWriters
|
||||
{
|
||||
public class CSharpCodeWriter : ICodeWriter
|
||||
{
|
||||
public string FileExtension
|
||||
{
|
||||
get { return ".cs"; }
|
||||
}
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get { return "C#"; }
|
||||
}
|
||||
|
||||
|
||||
private const string NoRenameAttribute = "[Obfuscation(Feature = \"renaming\", Exclude = true)]";
|
||||
private const string NoPruneAttribute = "[Obfuscation(Feature = \"trigger\", Exclude = false)]";
|
||||
|
||||
public string GetTypeName(JsonType type, IJsonClassGeneratorConfig config)
|
||||
{
|
||||
var arraysAsLists = !config.ExplicitDeserialization;
|
||||
|
||||
switch (type.Type)
|
||||
{
|
||||
case JsonTypeEnum.Anything: return "object";
|
||||
case JsonTypeEnum.Array: return arraysAsLists ? "IList<" + GetTypeName(type.InternalType, config) + ">" : GetTypeName(type.InternalType, config) + "[]";
|
||||
case JsonTypeEnum.Dictionary: return "Dictionary<string, " + GetTypeName(type.InternalType, config) + ">";
|
||||
case JsonTypeEnum.Boolean: return "bool";
|
||||
case JsonTypeEnum.Float: return "double";
|
||||
case JsonTypeEnum.Integer: return "int";
|
||||
case JsonTypeEnum.Long: return "long";
|
||||
case JsonTypeEnum.Date: return "DateTime";
|
||||
case JsonTypeEnum.NonConstrained: return "object";
|
||||
case JsonTypeEnum.NullableBoolean: return "bool?";
|
||||
case JsonTypeEnum.NullableFloat: return "double?";
|
||||
case JsonTypeEnum.NullableInteger: return "int?";
|
||||
case JsonTypeEnum.NullableLong: return "long?";
|
||||
case JsonTypeEnum.NullableDate: return "DateTime?";
|
||||
case JsonTypeEnum.NullableSomething: return "object";
|
||||
case JsonTypeEnum.Object: return type.AssignedName;
|
||||
case JsonTypeEnum.String: return "string";
|
||||
default: throw new System.NotSupportedException("Unsupported json type");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldApplyNoRenamingAttribute(IJsonClassGeneratorConfig config)
|
||||
{
|
||||
return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && !config.UsePascalCase;
|
||||
}
|
||||
private bool ShouldApplyNoPruneAttribute(IJsonClassGeneratorConfig config)
|
||||
{
|
||||
return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && config.UseProperties;
|
||||
}
|
||||
|
||||
public void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw)
|
||||
{
|
||||
if (config.UseNamespaces)
|
||||
{
|
||||
foreach (var line in JsonClassGenerator.FileHeader)
|
||||
{
|
||||
sw.WriteLine("// " + line);
|
||||
}
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("using System;");
|
||||
sw.WriteLine("using System.Collections.Generic;");
|
||||
if (ShouldApplyNoPruneAttribute(config) || ShouldApplyNoRenamingAttribute(config))
|
||||
sw.WriteLine("using System.Reflection;");
|
||||
if (!config.ExplicitDeserialization && config.UsePascalCase)
|
||||
sw.WriteLine("using Newtonsoft.Json;");
|
||||
sw.WriteLine("using Newtonsoft.Json.Linq;");
|
||||
if (config.ExplicitDeserialization)
|
||||
sw.WriteLine("using JsonCSharpClassGenerator;");
|
||||
if (config.SecondaryNamespace != null && config.HasSecondaryClasses && !config.UseNestedClasses)
|
||||
{
|
||||
sw.WriteLine("using {0};", config.SecondaryNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.UseNestedClasses)
|
||||
{
|
||||
sw.WriteLine(" {0} class {1}", config.InternalVisibility ? "internal" : "public", config.MainClass);
|
||||
sw.WriteLine(" {");
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw)
|
||||
{
|
||||
if (config.UseNestedClasses)
|
||||
{
|
||||
sw.WriteLine(" }");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
|
||||
{
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("namespace {0}", root && !config.UseNestedClasses ? config.Namespace : (config.SecondaryNamespace ?? config.Namespace));
|
||||
sw.WriteLine("{");
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
public void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
|
||||
{
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
|
||||
public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type)
|
||||
{
|
||||
var visibility = config.InternalVisibility ? "internal" : "public";
|
||||
|
||||
|
||||
|
||||
if (config.UseNestedClasses)
|
||||
{
|
||||
if (!type.IsRoot)
|
||||
{
|
||||
if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute);
|
||||
if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute);
|
||||
sw.WriteLine(" {0} class {1}", visibility, type.AssignedName);
|
||||
sw.WriteLine(" {");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute);
|
||||
if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute);
|
||||
sw.WriteLine(" {0} class {1}", visibility, type.AssignedName);
|
||||
sw.WriteLine(" {");
|
||||
}
|
||||
|
||||
var prefix = config.UseNestedClasses && !type.IsRoot ? " " : " ";
|
||||
|
||||
|
||||
var shouldSuppressWarning = config.InternalVisibility && !config.UseProperties && !config.ExplicitDeserialization;
|
||||
if (shouldSuppressWarning)
|
||||
{
|
||||
sw.WriteLine("#pragma warning disable 0649");
|
||||
if (!config.UsePascalCase) sw.WriteLine();
|
||||
}
|
||||
|
||||
if (type.IsRoot && config.ExplicitDeserialization) WriteStringConstructorExplicitDeserialization(config, sw, type, prefix);
|
||||
|
||||
if (config.ExplicitDeserialization)
|
||||
{
|
||||
if (config.UseProperties) WriteClassWithPropertiesExplicitDeserialization(sw, type, prefix);
|
||||
else WriteClassWithFieldsExplicitDeserialization(sw, type, prefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteClassMembers(config, sw, type, prefix);
|
||||
}
|
||||
|
||||
if (shouldSuppressWarning)
|
||||
{
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("#pragma warning restore 0649");
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
|
||||
if (config.UseNestedClasses && !type.IsRoot)
|
||||
sw.WriteLine(" }");
|
||||
|
||||
if (!config.UseNestedClasses)
|
||||
sw.WriteLine(" }");
|
||||
|
||||
sw.WriteLine();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void WriteClassMembers(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type, string prefix)
|
||||
{
|
||||
IList<FieldInfo> theFields = type.Fields;
|
||||
if (config.SortMemberFields) theFields = theFields.OrderBy(f => f.JsonMemberName).ToList();
|
||||
foreach (var field in theFields)
|
||||
{
|
||||
if (config.UsePascalCase || config.ExamplesInDocumentation) sw.WriteLine();
|
||||
|
||||
if (config.ExamplesInDocumentation)
|
||||
{
|
||||
sw.WriteLine(prefix + "/// <summary>");
|
||||
sw.WriteLine(prefix + "/// Examples: " + field.GetExamplesText());
|
||||
sw.WriteLine(prefix + "/// </summary>");
|
||||
}
|
||||
|
||||
if (config.UsePascalCase)
|
||||
{
|
||||
|
||||
sw.WriteLine(prefix + "[JsonProperty(\"{0}\")]", field.JsonMemberName);
|
||||
}
|
||||
|
||||
if (config.UseProperties)
|
||||
{
|
||||
sw.WriteLine(prefix + "public {0} {1} {{ get; set; }}", field.Type.GetTypeName(), field.MemberName);
|
||||
}
|
||||
else
|
||||
{
|
||||
sw.WriteLine(prefix + "public {0} {1};", field.Type.GetTypeName(), field.MemberName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region Code for (obsolete) explicit deserialization
|
||||
private void WriteClassWithPropertiesExplicitDeserialization(TextWriter sw, JsonType type, string prefix)
|
||||
{
|
||||
|
||||
sw.WriteLine(prefix + "private JObject __jobject;");
|
||||
sw.WriteLine(prefix + "public {0}(JObject obj)", type.AssignedName);
|
||||
sw.WriteLine(prefix + "{");
|
||||
sw.WriteLine(prefix + " this.__jobject = obj;");
|
||||
sw.WriteLine(prefix + "}");
|
||||
sw.WriteLine();
|
||||
|
||||
foreach (var field in type.Fields)
|
||||
{
|
||||
|
||||
string variable = null;
|
||||
if (field.Type.MustCache)
|
||||
{
|
||||
variable = "_" + char.ToLower(field.MemberName[0]) + field.MemberName.Substring(1);
|
||||
sw.WriteLine(prefix + "[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]");
|
||||
sw.WriteLine(prefix + "private {0} {1};", field.Type.GetTypeName(), variable);
|
||||
}
|
||||
|
||||
|
||||
sw.WriteLine(prefix + "public {0} {1}", field.Type.GetTypeName(), field.MemberName);
|
||||
sw.WriteLine(prefix + "{");
|
||||
sw.WriteLine(prefix + " get");
|
||||
sw.WriteLine(prefix + " {");
|
||||
if (field.Type.MustCache)
|
||||
{
|
||||
sw.WriteLine(prefix + " if ({0} == null)", variable);
|
||||
sw.WriteLine(prefix + " {0} = {1};", variable, field.GetGenerationCode("__jobject"));
|
||||
sw.WriteLine(prefix + " return {0};", variable);
|
||||
}
|
||||
else
|
||||
{
|
||||
sw.WriteLine(prefix + " return {0};", field.GetGenerationCode("__jobject"));
|
||||
}
|
||||
sw.WriteLine(prefix + " }");
|
||||
sw.WriteLine(prefix + "}");
|
||||
sw.WriteLine();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void WriteStringConstructorExplicitDeserialization(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type, string prefix)
|
||||
{
|
||||
sw.WriteLine();
|
||||
sw.WriteLine(prefix + "public {1}(string json)", config.InternalVisibility ? "internal" : "public", type.AssignedName);
|
||||
sw.WriteLine(prefix + " : this(JObject.Parse(json))");
|
||||
sw.WriteLine(prefix + "{");
|
||||
sw.WriteLine(prefix + "}");
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
private void WriteClassWithFieldsExplicitDeserialization(TextWriter sw, JsonType type, string prefix)
|
||||
{
|
||||
|
||||
|
||||
sw.WriteLine(prefix + "public {0}(JObject obj)", type.AssignedName);
|
||||
sw.WriteLine(prefix + "{");
|
||||
|
||||
foreach (var field in type.Fields)
|
||||
{
|
||||
sw.WriteLine(prefix + " this.{0} = {1};", field.MemberName, field.GetGenerationCode("obj"));
|
||||
|
||||
}
|
||||
|
||||
sw.WriteLine(prefix + "}");
|
||||
sw.WriteLine();
|
||||
|
||||
foreach (var field in type.Fields)
|
||||
{
|
||||
sw.WriteLine(prefix + "public readonly {0} {1};", field.Type.GetTypeName(), field.MemberName);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Xamasoft.JsonClassGenerator.Utils;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator.CodeWriters
|
||||
{
|
||||
public class JavaCodeWriter : ICodeWriter
|
||||
{
|
||||
public string FileExtension
|
||||
{
|
||||
get { return ".java"; }
|
||||
}
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get { return "Java"; }
|
||||
}
|
||||
|
||||
public string GetTypeName(JsonType type, IJsonClassGeneratorConfig config)
|
||||
{
|
||||
var arraysAsLists = !config.ExplicitDeserialization;
|
||||
|
||||
switch (type.Type)
|
||||
{
|
||||
case JsonTypeEnum.Anything: return "Object";
|
||||
case JsonTypeEnum.Array: return arraysAsLists ? "IList<" + GetTypeName(type.InternalType, config) + ">" : GetTypeName(type.InternalType, config) + "[]";
|
||||
case JsonTypeEnum.Dictionary: return "Map<string, " + GetTypeName(type.InternalType, config) + ">";
|
||||
case JsonTypeEnum.Boolean: return "boolean";
|
||||
case JsonTypeEnum.Float: return "float";
|
||||
case JsonTypeEnum.Double: return "double";
|
||||
case JsonTypeEnum.Integer: return "int";
|
||||
case JsonTypeEnum.Long: return "long";
|
||||
case JsonTypeEnum.Date: return "Date";
|
||||
case JsonTypeEnum.NonConstrained: return "Object";
|
||||
case JsonTypeEnum.NullableBoolean: return "Boolean";
|
||||
case JsonTypeEnum.NullableFloat: return "Double";
|
||||
case JsonTypeEnum.NullableInteger: return "Integer";
|
||||
case JsonTypeEnum.NullableLong: return "Long";
|
||||
case JsonTypeEnum.NullableDate: return "Date";
|
||||
case JsonTypeEnum.NullableSomething: return "Object";
|
||||
case JsonTypeEnum.Object: return type.AssignedName;
|
||||
case JsonTypeEnum.String: return "String";
|
||||
default: throw new System.NotSupportedException("Unsupported json type");
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type)
|
||||
{
|
||||
sw.WriteLine("/**");
|
||||
sw.WriteLine(" * Description");
|
||||
sw.WriteLine(" * ");
|
||||
sw.WriteLine(" * @author Dincat@WorrilessGo");
|
||||
sw.WriteLine(" */");
|
||||
|
||||
var visibility = config.InternalVisibility ? "internal" : "public";
|
||||
|
||||
|
||||
if (config.UseNestedClasses)
|
||||
{
|
||||
if (!type.IsRoot)
|
||||
{
|
||||
sw.WriteLine("{0} class {1}", visibility, type.AssignedName);
|
||||
sw.WriteLine("{");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sw.WriteLine("{0} class {1}", visibility, type.AssignedName);
|
||||
sw.WriteLine("{");
|
||||
}
|
||||
|
||||
var prefix =" ";
|
||||
|
||||
WriteClassMembers(config, sw, type, prefix);
|
||||
|
||||
|
||||
if (config.UseNestedClasses && !type.IsRoot)
|
||||
sw.WriteLine("}");
|
||||
|
||||
if (!config.UseNestedClasses)
|
||||
sw.WriteLine("}");
|
||||
|
||||
//sw.WriteLine();
|
||||
}
|
||||
|
||||
public void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw)
|
||||
{
|
||||
if (config.UseNestedClasses)
|
||||
{
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
|
||||
{
|
||||
if (string.IsNullOrEmpty(config.Namespace))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("package ", config.Namespace);
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
public void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void WriteClassMembers(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type, string prefix)
|
||||
{
|
||||
IList<FieldInfo> theFields = type.Fields;
|
||||
if (config.SortMemberFields) theFields = theFields.OrderBy(f => f.JsonMemberName).ToList();
|
||||
foreach (var field in theFields)
|
||||
{
|
||||
if (config.UsePascalCase || config.ExamplesInDocumentation) sw.WriteLine();
|
||||
|
||||
if (config.ExamplesInDocumentation)
|
||||
{
|
||||
sw.WriteLine(prefix + "/**");
|
||||
sw.WriteLine(prefix + " * Examples: " + field.GetExamplesText());
|
||||
sw.WriteLine(prefix + "*/");
|
||||
}
|
||||
|
||||
if (config.UsePascalCase)
|
||||
{
|
||||
sw.WriteLine(prefix + "@JsonProperty(value=\"{0}\")", field.JsonMemberName);
|
||||
}
|
||||
|
||||
var lowCaseName = StringUtils.LowerCaseFirstLetter(field.MemberName);
|
||||
sw.WriteLine(prefix + "private {0} {1};", field.Type.GetTypeName(), lowCaseName);
|
||||
sw.WriteLine();
|
||||
sw.WriteLine(prefix + "public {0} get{1}(){{ return {2}; }}", field.Type.GetTypeName(), field.MemberName, lowCaseName);
|
||||
sw.WriteLine();
|
||||
sw.WriteLine(prefix + "private {0} set{1}({2}){{ this.{3}={4} }}", field.Type.GetTypeName(), field.MemberName, lowCaseName, lowCaseName, lowCaseName);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator.CodeWriters
|
||||
{
|
||||
public class TypeScriptCodeWriter : ICodeWriter
|
||||
{
|
||||
public string FileExtension
|
||||
{
|
||||
get { return ".ts"; }
|
||||
}
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get { return "TypeScript"; }
|
||||
}
|
||||
|
||||
public string GetTypeName(JsonType type, IJsonClassGeneratorConfig config)
|
||||
{
|
||||
switch (type.Type)
|
||||
{
|
||||
case JsonTypeEnum.Anything: return "any";
|
||||
case JsonTypeEnum.String: return "string";
|
||||
case JsonTypeEnum.Boolean: return "bool";
|
||||
case JsonTypeEnum.Integer:
|
||||
case JsonTypeEnum.Long:
|
||||
case JsonTypeEnum.Float: return "number";
|
||||
case JsonTypeEnum.Date: return "Date";
|
||||
case JsonTypeEnum.NullableInteger:
|
||||
case JsonTypeEnum.NullableLong:
|
||||
case JsonTypeEnum.NullableFloat: return "number";
|
||||
case JsonTypeEnum.NullableBoolean: return "bool";
|
||||
case JsonTypeEnum.NullableDate: return "Date";
|
||||
case JsonTypeEnum.Object: return type.AssignedName;
|
||||
case JsonTypeEnum.Array: return GetTypeName(type.InternalType, config) + "[]";
|
||||
case JsonTypeEnum.Dictionary: return "{ [key: string]: " + GetTypeName(type.InternalType, config) + "; }";
|
||||
case JsonTypeEnum.NullableSomething: return "any";
|
||||
case JsonTypeEnum.NonConstrained: return "any";
|
||||
default: throw new NotSupportedException("Unsupported type");
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type)
|
||||
{
|
||||
var prefix = GetNamespace(config, type.IsRoot) != null ? " " : "";
|
||||
var exported = !config.InternalVisibility || config.SecondaryNamespace != null;
|
||||
sw.WriteLine(prefix + (exported ? "export " : string.Empty) + "interface " + type.AssignedName + " {");
|
||||
foreach (var field in type.Fields)
|
||||
{
|
||||
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));
|
||||
if (config.ExamplesInDocumentation)
|
||||
{
|
||||
sw.WriteLine();
|
||||
sw.WriteLine(prefix + " /**");
|
||||
sw.WriteLine(prefix + " * Examples: " + field.GetExamplesText());
|
||||
sw.WriteLine(prefix + " */");
|
||||
}
|
||||
|
||||
|
||||
sw.WriteLine(prefix + " " + field.JsonMemberName + (IsNullable(field.Type.Type) ? "?" : "") + ": " + (shouldDefineNamespace ? config.SecondaryNamespace + "." : string.Empty) + GetTypeName(field.Type, config) + ";");
|
||||
}
|
||||
sw.WriteLine(prefix + "}");
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
private bool IsNullable(JsonTypeEnum type)
|
||||
{
|
||||
return
|
||||
type == JsonTypeEnum.NullableBoolean ||
|
||||
type == JsonTypeEnum.NullableDate ||
|
||||
type == JsonTypeEnum.NullableFloat ||
|
||||
type == JsonTypeEnum.NullableInteger ||
|
||||
type == JsonTypeEnum.NullableLong ||
|
||||
type == JsonTypeEnum.NullableSomething;
|
||||
}
|
||||
|
||||
public void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw)
|
||||
{
|
||||
foreach (var line in JsonClassGenerator.FileHeader)
|
||||
{
|
||||
sw.WriteLine("// " + line);
|
||||
}
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
public void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw)
|
||||
{
|
||||
}
|
||||
|
||||
private string GetNamespace(IJsonClassGeneratorConfig config, bool root)
|
||||
{
|
||||
return root ? config.Namespace : (config.SecondaryNamespace ?? config.Namespace);
|
||||
}
|
||||
|
||||
public void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
|
||||
{
|
||||
if (GetNamespace(config, root) != null)
|
||||
{
|
||||
|
||||
sw.WriteLine("module " + GetNamespace(config, root) + " {");
|
||||
sw.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
|
||||
{
|
||||
if (GetNamespace(config, root) != null)
|
||||
{
|
||||
sw.WriteLine("}");
|
||||
sw.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator.CodeWriters
|
||||
{
|
||||
public class VisualBasicCodeWriter : ICodeWriter
|
||||
{
|
||||
public string FileExtension
|
||||
{
|
||||
get { return ".vb"; }
|
||||
}
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get { return "Visual Basic .NET"; }
|
||||
}
|
||||
|
||||
private const string NoRenameAttribute = "<Obfuscation(Feature:=\"renaming\", Exclude:=true)>";
|
||||
private const string NoPruneAttribute = "<Obfuscation(Feature:=\"trigger\", Exclude:=false)>";
|
||||
|
||||
public string GetTypeName(JsonType type, IJsonClassGeneratorConfig config)
|
||||
{
|
||||
var arraysAsLists = config.ExplicitDeserialization;
|
||||
|
||||
switch (type.Type)
|
||||
{
|
||||
case JsonTypeEnum.Anything: return "Object";
|
||||
case JsonTypeEnum.Array: return arraysAsLists ? "IList(Of " + GetTypeName(type.InternalType, config) + ")" : GetTypeName(type.InternalType, config) + "()";
|
||||
case JsonTypeEnum.Dictionary: return "Dictionary(Of String, " + GetTypeName(type.InternalType, config) + ")";
|
||||
case JsonTypeEnum.Boolean: return "Boolean";
|
||||
case JsonTypeEnum.Float: return "Double";
|
||||
case JsonTypeEnum.Integer: return "Integer";
|
||||
case JsonTypeEnum.Long: return "Long";
|
||||
case JsonTypeEnum.Date: return "DateTime";
|
||||
case JsonTypeEnum.NonConstrained: return "Object";
|
||||
case JsonTypeEnum.NullableBoolean: return "Boolean?";
|
||||
case JsonTypeEnum.NullableFloat: return "Double?";
|
||||
case JsonTypeEnum.NullableInteger: return "Integer?";
|
||||
case JsonTypeEnum.NullableLong: return "Long?";
|
||||
case JsonTypeEnum.NullableDate: return "DateTime?";
|
||||
case JsonTypeEnum.NullableSomething: return "Object";
|
||||
case JsonTypeEnum.Object: return type.AssignedName;
|
||||
case JsonTypeEnum.String: return "String";
|
||||
default: throw new System.NotSupportedException("Unsupported json type");
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShouldApplyNoRenamingAttribute(IJsonClassGeneratorConfig config)
|
||||
{
|
||||
return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && !config.UsePascalCase;
|
||||
}
|
||||
private bool ShouldApplyNoPruneAttribute(IJsonClassGeneratorConfig config)
|
||||
{
|
||||
return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && config.UseProperties;
|
||||
}
|
||||
|
||||
public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type)
|
||||
{
|
||||
var visibility = config.InternalVisibility ? "Friend" : "Public";
|
||||
|
||||
if (config.UseNestedClasses)
|
||||
{
|
||||
sw.WriteLine(" {0} Partial Class {1}", visibility, config.MainClass);
|
||||
if (!type.IsRoot)
|
||||
{
|
||||
if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute);
|
||||
if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute);
|
||||
sw.WriteLine(" {0} Class {1}", visibility, type.AssignedName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute);
|
||||
if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute);
|
||||
sw.WriteLine(" {0} Class {1}", visibility, type.AssignedName);
|
||||
}
|
||||
|
||||
var prefix = config.UseNestedClasses && !type.IsRoot ? " " : " ";
|
||||
|
||||
WriteClassMembers(config, sw, type, prefix);
|
||||
|
||||
if (config.UseNestedClasses && !type.IsRoot)
|
||||
sw.WriteLine(" End Class");
|
||||
|
||||
sw.WriteLine(" End Class");
|
||||
sw.WriteLine();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void WriteClassMembers(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type, string prefix)
|
||||
{
|
||||
foreach (var field in type.Fields)
|
||||
{
|
||||
if (config.UsePascalCase || config.ExamplesInDocumentation) sw.WriteLine();
|
||||
|
||||
if (config.ExamplesInDocumentation)
|
||||
{
|
||||
sw.WriteLine(prefix + "''' <summary>");
|
||||
sw.WriteLine(prefix + "''' Examples: " + field.GetExamplesText());
|
||||
sw.WriteLine(prefix + "''' </summary>");
|
||||
}
|
||||
|
||||
|
||||
if (config.UsePascalCase)
|
||||
{
|
||||
sw.WriteLine(prefix + "<JsonProperty(\"{0}\")>", field.JsonMemberName);
|
||||
}
|
||||
|
||||
if (config.UseProperties)
|
||||
{
|
||||
sw.WriteLine(prefix + "Public Property {1} As {0}", field.Type.GetTypeName(), field.MemberName);
|
||||
}
|
||||
else
|
||||
{
|
||||
sw.WriteLine(prefix + "Public {1} As {0}", field.Type.GetTypeName(), field.MemberName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw)
|
||||
{
|
||||
foreach (var line in JsonClassGenerator.FileHeader)
|
||||
{
|
||||
sw.WriteLine("' " + line);
|
||||
}
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("Imports System");
|
||||
sw.WriteLine("Imports System.Collections.Generic");
|
||||
if (ShouldApplyNoRenamingAttribute(config) || ShouldApplyNoPruneAttribute(config))
|
||||
sw.WriteLine("Imports System.Reflection");
|
||||
if (config.UsePascalCase)
|
||||
sw.WriteLine("Imports Newtonsoft.Json");
|
||||
sw.WriteLine("Imports Newtonsoft.Json.Linq");
|
||||
if (config.SecondaryNamespace != null && config.HasSecondaryClasses && !config.UseNestedClasses)
|
||||
{
|
||||
sw.WriteLine("Imports {0}", config.SecondaryNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
|
||||
{
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("Namespace Global.{0}", root && !config.UseNestedClasses ? config.Namespace : (config.SecondaryNamespace ?? config.Namespace));
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
public void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
|
||||
{
|
||||
|
||||
sw.WriteLine("End Namespace");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
83
middleware/JsonCSharpClassGeneratorLib/FieldInfo.cs
Normal file
83
middleware/JsonCSharpClassGeneratorLib/FieldInfo.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
// Copyright © 2010 Xamasoft
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator
|
||||
{
|
||||
[DebuggerDisplay("MemberName = {MemberName}/{JsonMemberName}")]
|
||||
public class FieldInfo
|
||||
{
|
||||
|
||||
public FieldInfo(IJsonClassGeneratorConfig generator, string jsonMemberName, JsonType type, bool usePascalCase, IList<object> Examples)
|
||||
{
|
||||
this.generator = generator;
|
||||
this.JsonMemberName = jsonMemberName;
|
||||
this.MemberName = jsonMemberName;
|
||||
if (usePascalCase) MemberName = JsonClassGenerator.ToTitleCase(MemberName);
|
||||
this.Type = type;
|
||||
this.Examples = Examples;
|
||||
}
|
||||
private IJsonClassGeneratorConfig generator;
|
||||
public string MemberName { get; private set; }
|
||||
public string JsonMemberName { get; private set; }
|
||||
public JsonType Type { get; private set; }
|
||||
public IList<object> Examples { get; private set; }
|
||||
|
||||
public void UpdateMemberName(string newMemberName)
|
||||
{
|
||||
MemberName = newMemberName;
|
||||
JsonMemberName = newMemberName;
|
||||
}
|
||||
|
||||
public string GetGenerationCode(string jobject)
|
||||
{
|
||||
var field = this;
|
||||
if (field.Type.Type == JsonTypeEnum.Array)
|
||||
{
|
||||
var innermost = field.Type.GetInnermostType();
|
||||
return string.Format("({1})JsonClassHelper.ReadArray<{5}>(JsonClassHelper.GetJToken<JArray>({0}, \"{2}\"), JsonClassHelper.{3}, typeof({6}))",
|
||||
jobject,
|
||||
field.Type.GetTypeName(),
|
||||
field.JsonMemberName,
|
||||
innermost.GetReaderName(),
|
||||
-1,
|
||||
innermost.GetTypeName(),
|
||||
field.Type.GetTypeName()
|
||||
);
|
||||
}
|
||||
else if (field.Type.Type == JsonTypeEnum.Dictionary)
|
||||
{
|
||||
|
||||
return string.Format("({1})JsonClassHelper.ReadDictionary<{2}>(JsonClassHelper.GetJToken<JObject>({0}, \"{3}\"))",
|
||||
jobject,
|
||||
field.Type.GetTypeName(),
|
||||
field.Type.InternalType.GetTypeName(),
|
||||
field.JsonMemberName,
|
||||
field.Type.GetTypeName()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Format("JsonClassHelper.{1}(JsonClassHelper.GetJToken<{2}>({0}, \"{3}\"))",
|
||||
jobject,
|
||||
field.Type.GetReaderName(),
|
||||
field.Type.GetJTokenType(),
|
||||
field.JsonMemberName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetExamplesText()
|
||||
{
|
||||
return string.Join(", ", Examples.Take(5).Select(x => JsonConvert.SerializeObject(x)).ToArray());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
20
middleware/JsonCSharpClassGeneratorLib/ICodeWriter.cs
Normal file
20
middleware/JsonCSharpClassGeneratorLib/ICodeWriter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator
|
||||
{
|
||||
public interface ICodeWriter
|
||||
{
|
||||
string FileExtension { get; }
|
||||
string DisplayName { get; }
|
||||
string GetTypeName(JsonType type, IJsonClassGeneratorConfig config);
|
||||
void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type);
|
||||
void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw);
|
||||
void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw);
|
||||
void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root);
|
||||
void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator
|
||||
{
|
||||
public interface IJsonClassGeneratorConfig
|
||||
{
|
||||
string Namespace { get; set; }
|
||||
string SecondaryNamespace { get; set; }
|
||||
bool UseProperties { get; set; }
|
||||
bool InternalVisibility { get; set; }
|
||||
bool ExplicitDeserialization { get; set; }
|
||||
bool NoHelperClass { get; set; }
|
||||
string MainClass { get; set; }
|
||||
bool SortMemberFields { get; set; }
|
||||
bool UsePascalCase { get; set; }
|
||||
bool UseNestedClasses { get; set; }
|
||||
bool ApplyObfuscationAttributes { get; set; }
|
||||
bool SingleFile { get; set; }
|
||||
ICodeWriter CodeWriter { get; set; }
|
||||
bool HasSecondaryClasses { get; }
|
||||
bool AlwaysUseNullableValues { get; set; }
|
||||
bool UseNamespaces { get; }
|
||||
bool ExamplesInDocumentation { get; set; }
|
||||
}
|
||||
}
|
||||
461
middleware/JsonCSharpClassGeneratorLib/JsonClassGenerator.cs
Normal file
461
middleware/JsonCSharpClassGeneratorLib/JsonClassGenerator.cs
Normal file
@@ -0,0 +1,461 @@
|
||||
// Copyright © 2010 Xamasoft
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using Xamasoft.JsonClassGenerator.CodeWriters;
|
||||
using System.Data.Entity.Design.PluralizationServices;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator
|
||||
{
|
||||
public class JsonClassGenerator : IJsonClassGeneratorConfig
|
||||
{
|
||||
public string Example { get; set; }
|
||||
public string TargetFolder { get; set; }
|
||||
public string Namespace { get; set; }
|
||||
public string SecondaryNamespace { get; set; }
|
||||
public bool UseProperties { get; set; }
|
||||
public bool InternalVisibility { get; set; }
|
||||
public bool ExplicitDeserialization { get; set; }
|
||||
public bool NoHelperClass { get; set; }
|
||||
public string MainClass { get; set; }
|
||||
public bool SortMemberFields { get; set; }
|
||||
public bool UsePascalCase { get; set; }
|
||||
public bool UseNestedClasses { get; set; }
|
||||
public bool ApplyObfuscationAttributes { get; set; }
|
||||
public bool SingleFile { get; set; }
|
||||
public ICodeWriter CodeWriter { get; set; }
|
||||
public TextWriter OutputStream { get; set; }
|
||||
public bool AlwaysUseNullableValues { get; set; }
|
||||
public bool ExamplesInDocumentation { get; set; }
|
||||
public bool DeduplicateClasses { get; set; }
|
||||
|
||||
private PluralizationService pluralizationService = PluralizationService.CreateService(new CultureInfo("en-us"));
|
||||
|
||||
public Action<string> FeedBack { get; set; }
|
||||
|
||||
private bool used = false;
|
||||
public bool UseNamespaces { get { return Namespace != null; } }
|
||||
|
||||
public void GenerateClasses()
|
||||
{
|
||||
if (CodeWriter == null) CodeWriter = new CSharpCodeWriter();
|
||||
if (ExplicitDeserialization && !(CodeWriter is CSharpCodeWriter)) throw new ArgumentException("Explicit deserialization is obsolete and is only supported by the C# provider.");
|
||||
|
||||
if (used) throw new InvalidOperationException("This instance of JsonClassGenerator has already been used. Please create a new instance.");
|
||||
used = true;
|
||||
|
||||
|
||||
var writeToDisk = TargetFolder != null;
|
||||
if (writeToDisk && !Directory.Exists(TargetFolder)) Directory.CreateDirectory(TargetFolder);
|
||||
|
||||
|
||||
JObject[] examples;
|
||||
var example = Example.StartsWith("HTTP/") ? Example.Substring(Example.IndexOf("\r\n\r\n")) : Example;
|
||||
using (var sr = new StringReader(example))
|
||||
using (var reader = new JsonTextReader(sr))
|
||||
{
|
||||
var json = JToken.ReadFrom(reader);
|
||||
if (json is JArray)
|
||||
{
|
||||
examples = ((JArray)json).Cast<JObject>().ToArray();
|
||||
}
|
||||
else if (json is JObject)
|
||||
{
|
||||
examples = new[] { (JObject)json };
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Sample JSON must be either a JSON array, or a JSON object.");
|
||||
}
|
||||
}
|
||||
|
||||
Types = new List<JsonType>();
|
||||
Names.Add(MainClass);
|
||||
var rootType = new JsonType(this, examples[0]);
|
||||
rootType.IsRoot = true;
|
||||
rootType.AssignName(MainClass, MainClass);
|
||||
GenerateClass(examples, rootType);
|
||||
|
||||
if (DeduplicateClasses)
|
||||
{
|
||||
FeedBack?.Invoke("De-duplicating classes");
|
||||
DeDuplicateClasses();
|
||||
}
|
||||
|
||||
FeedBack?.Invoke("Writing classes to disk.");
|
||||
if (writeToDisk)
|
||||
{
|
||||
|
||||
var parentFolder = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
if (writeToDisk && !NoHelperClass && ExplicitDeserialization) File.WriteAllBytes(Path.Combine(TargetFolder, "JsonClassHelper.cs"), Properties.Resources.JsonClassHelper);
|
||||
if (SingleFile)
|
||||
{
|
||||
WriteClassesToFile(Path.Combine(TargetFolder, MainClass + CodeWriter.FileExtension), Types);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
foreach (var type in Types)
|
||||
{
|
||||
var folder = TargetFolder;
|
||||
if (!UseNestedClasses && !type.IsRoot && SecondaryNamespace != null)
|
||||
{
|
||||
var s = SecondaryNamespace;
|
||||
if (s.StartsWith(Namespace + ".")) s = s.Substring(Namespace.Length + 1);
|
||||
folder = Path.Combine(folder, s);
|
||||
Directory.CreateDirectory(folder);
|
||||
}
|
||||
WriteClassesToFile(Path.Combine(folder, (UseNestedClasses && !type.IsRoot ? MainClass + "." : string.Empty) + type.AssignedName + CodeWriter.FileExtension), new[] { type });
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (OutputStream != null)
|
||||
{
|
||||
WriteClassesToFile(OutputStream, Types);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// De-duplicate classes.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// So, we have a bunch of classes. Th eproblem is, if structures have been nested, we might end up with
|
||||
/// many classes which are all duplicates in everything but name. This bit of logic is intended to clean
|
||||
/// this up as best it can.
|
||||
///
|
||||
/// First, we get all of the "base" classes. These are all of the classes that were the first generated
|
||||
/// classes. The first occurrence of any class. We alwys want these.
|
||||
///
|
||||
/// Next we may (or may not) have a list of classes that may (or may not) be duplicates of the first occurrence
|
||||
/// class. For example, assume we have a first occurrence class called "Wombat". Nested clases may have been
|
||||
/// generated called "Womnats2" or "Wombats3". All three classes may have the same content, so we need to
|
||||
/// discard the copy classes and replace any references to them with the original Wonbats class.
|
||||
///
|
||||
/// This is fun.
|
||||
///
|
||||
/// </remarks>
|
||||
private void DeDuplicateClasses()
|
||||
{
|
||||
// Get the first occurrence classes (original name = assigned name) as we always want these
|
||||
var newTypes = (from tt in Types
|
||||
where string.Compare(tt.OriginalName, tt.AssignedName, StringComparison.InvariantCultureIgnoreCase) == 0
|
||||
select tt).ToList();
|
||||
|
||||
// If we replace references to classes (Say "Wombats2" with "Womnbats", we need to know it has
|
||||
// happen4ed and we need to fix the fields. This is the list of translations.
|
||||
var typeNameReplacements = new Dictionary<string, string>();
|
||||
|
||||
// Get the potential duplicate classes. These are classes where the class name does not match
|
||||
// the original name (i.e. we added a count to it).
|
||||
var possibleDuplicates = from tt in Types
|
||||
where string.Compare(tt.OriginalName, tt.AssignedName, StringComparison.InvariantCultureIgnoreCase) != 0
|
||||
select tt;
|
||||
|
||||
try
|
||||
{
|
||||
// Check the dupliates to see if they are the same as the first occurrence classes. Add to the first
|
||||
// occurrence list if they are different or create field fixup's if they are the same. We are very
|
||||
// simplistic in testing for the "same" or "different". Do they hae the same number of fields and
|
||||
// are the field names the same. (Note, cannot use field types as these may be one of our classes that
|
||||
// we are foing to replace e.g. Wombats2 that will be replaced with Wombats).
|
||||
foreach (var duplicate in possibleDuplicates)
|
||||
{
|
||||
var original = newTypes.FirstOrDefault(tt => tt.OriginalName == duplicate.OriginalName);
|
||||
|
||||
if (FirstOccurrenceClassNotFound(original))
|
||||
{
|
||||
newTypes.Add(duplicate);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Classes are the same - Merge the fields
|
||||
MergeFieldFromDuplicateToOriginal(original, duplicate);
|
||||
|
||||
// Two objects are the 'same', so we want to replace the duplicate with the original. We will
|
||||
// need to fix-up the field types when we are done.
|
||||
typeNameReplacements.Add(duplicate.AssignedName, original.AssignedName);
|
||||
}
|
||||
|
||||
// We now need to apply our class name translations to the new base types list. So, something that
|
||||
// might currently be referring to Wombats2 wil be changed to refer to Wombats.
|
||||
foreach (var jsonType in newTypes)
|
||||
{
|
||||
foreach (var field in jsonType.Fields)
|
||||
{
|
||||
var internalTypeName = GetInternalTypeName(field);
|
||||
if (internalTypeName != null && typeNameReplacements.ContainsKey(internalTypeName))
|
||||
{
|
||||
field.Type.InternalType.AssignName(typeNameReplacements[internalTypeName], typeNameReplacements[internalTypeName]);
|
||||
}
|
||||
|
||||
var typeName = GetTypeName(field);
|
||||
if (typeName != null && typeNameReplacements.ContainsKey(typeName))
|
||||
{
|
||||
field.Type.AssignName(typeNameReplacements[typeName], typeNameReplacements[typeName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Replace the previous type list with the new type list
|
||||
Types.Clear();
|
||||
newTypes.ForEach(tt => Types.Add(tt));
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
// Worst case scenario - deduplication failed, so generate all the classes.
|
||||
Debug.Print($"Deduplication failed:\r\n\n{ex.Message}\r\n\r\n{ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
private void MergeFieldFromDuplicateToOriginal(JsonType original, JsonType duplicate)
|
||||
{
|
||||
var fieldDifferences = GetFieldDifferences(original.Fields, duplicate.Fields, x => x.MemberName);
|
||||
foreach (var fieldDifference in fieldDifferences)
|
||||
{
|
||||
original.Fields.Add(duplicate.Fields.First(fld => fld.MemberName == fieldDifference));
|
||||
}
|
||||
}
|
||||
|
||||
private string GetInternalTypeName(FieldInfo field)
|
||||
{
|
||||
// Sorry about this, but we can get nulls at all sorts of levels. Quite irritating really. So we have to
|
||||
// check all the way down to get the assigned name. Returns blank if we fail at any point.
|
||||
return field?.Type?.InternalType?.AssignedName;
|
||||
}
|
||||
|
||||
private string GetTypeName(FieldInfo field)
|
||||
{
|
||||
// Sorry about this, but we can get nulls at all sorts of levels. Quite irritating really. So we have to
|
||||
// check all the way down to get the assigned name. Returns blank if we fail at any point.
|
||||
return field?.Type?.AssignedName;
|
||||
}
|
||||
|
||||
private bool FirstOccurrenceClassNotFound(JsonType original) { return original == null; }
|
||||
|
||||
public IEnumerable<string> GetFieldDifferences(IEnumerable<FieldInfo> source, IEnumerable<FieldInfo> other, Func<FieldInfo, string> keySelector)
|
||||
{
|
||||
var setSource = new HashSet<string>(source.Select(keySelector));
|
||||
var setOther = new HashSet<string>(other.Select(keySelector));
|
||||
|
||||
return setOther.Except(setSource);
|
||||
}
|
||||
|
||||
private void WriteClassesToFile(string path, IEnumerable<JsonType> types)
|
||||
{
|
||||
FeedBack?.Invoke($"Writing {path}");
|
||||
using (var sw = new StreamWriter(path, false, Encoding.UTF8))
|
||||
{
|
||||
WriteClassesToFile(sw, types);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteClassesToFile(TextWriter sw, IEnumerable<JsonType> types)
|
||||
{
|
||||
var inNamespace = false;
|
||||
var rootNamespace = false;
|
||||
|
||||
CodeWriter.WriteFileStart(this, sw);
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (UseNamespaces && inNamespace && rootNamespace != type.IsRoot && SecondaryNamespace != null) { CodeWriter.WriteNamespaceEnd(this, sw, rootNamespace); inNamespace = false; }
|
||||
if (UseNamespaces && !inNamespace) { CodeWriter.WriteNamespaceStart(this, sw, type.IsRoot); inNamespace = true; rootNamespace = type.IsRoot; }
|
||||
CodeWriter.WriteClass(this, sw, type);
|
||||
}
|
||||
if (UseNamespaces && inNamespace) CodeWriter.WriteNamespaceEnd(this, sw, rootNamespace);
|
||||
CodeWriter.WriteFileEnd(this, sw);
|
||||
}
|
||||
|
||||
|
||||
private void GenerateClass(JObject[] examples, JsonType type)
|
||||
{
|
||||
var jsonFields = new Dictionary<string, JsonType>();
|
||||
var fieldExamples = new Dictionary<string, IList<object>>();
|
||||
|
||||
var first = true;
|
||||
|
||||
foreach (var obj in examples)
|
||||
{
|
||||
foreach (var prop in obj.Properties())
|
||||
{
|
||||
JsonType fieldType;
|
||||
var currentType = new JsonType(this, prop.Value);
|
||||
var propName = prop.Name;
|
||||
if (jsonFields.TryGetValue(propName, out fieldType))
|
||||
{
|
||||
|
||||
var commonType = fieldType.GetCommonType(currentType);
|
||||
|
||||
jsonFields[propName] = commonType;
|
||||
}
|
||||
else
|
||||
{
|
||||
var commonType = currentType;
|
||||
if (first) commonType = commonType.MaybeMakeNullable(this);
|
||||
else commonType = commonType.GetCommonType(JsonType.GetNull(this));
|
||||
jsonFields.Add(propName, commonType);
|
||||
fieldExamples[propName] = new List<object>();
|
||||
}
|
||||
var fe = fieldExamples[propName];
|
||||
var val = prop.Value;
|
||||
if (val.Type == JTokenType.Null || val.Type == JTokenType.Undefined)
|
||||
{
|
||||
if (!fe.Contains(null))
|
||||
{
|
||||
fe.Insert(0, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var v = val.Type == JTokenType.Array || val.Type == JTokenType.Object ? val : val.Value<object>();
|
||||
if (!fe.Any(x => v.Equals(x)))
|
||||
fe.Add(v);
|
||||
}
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
||||
if (UseNestedClasses)
|
||||
{
|
||||
foreach (var field in jsonFields)
|
||||
{
|
||||
Names.Add(field.Key.ToLower());
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var field in jsonFields)
|
||||
{
|
||||
var fieldType = field.Value;
|
||||
if (fieldType.Type == JsonTypeEnum.Object)
|
||||
{
|
||||
var subexamples = new List<JObject>(examples.Length);
|
||||
foreach (var obj in examples)
|
||||
{
|
||||
JToken value;
|
||||
if (obj.TryGetValue(field.Key, out value))
|
||||
{
|
||||
if (value.Type == JTokenType.Object)
|
||||
{
|
||||
subexamples.Add((JObject)value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fieldType.AssignName(CreateUniqueClassName(field.Key), field.Key);
|
||||
GenerateClass(subexamples.ToArray(), fieldType);
|
||||
}
|
||||
|
||||
if (fieldType.InternalType != null && fieldType.InternalType.Type == JsonTypeEnum.Object)
|
||||
{
|
||||
var subexamples = new List<JObject>(examples.Length);
|
||||
foreach (var obj in examples)
|
||||
{
|
||||
JToken value;
|
||||
if (obj.TryGetValue(field.Key, out value))
|
||||
{
|
||||
if (value.Type == JTokenType.Array)
|
||||
{
|
||||
foreach (var item in (JArray)value)
|
||||
{
|
||||
if (!(item is JObject)) throw new NotSupportedException("Arrays of non-objects are not supported yet.");
|
||||
subexamples.Add((JObject)item);
|
||||
}
|
||||
|
||||
}
|
||||
else if (value.Type == JTokenType.Object)
|
||||
{
|
||||
foreach (var item in (JObject)value)
|
||||
{
|
||||
if (!(item.Value is JObject)) throw new NotSupportedException("Arrays of non-objects are not supported yet.");
|
||||
|
||||
subexamples.Add((JObject)item.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
field.Value.InternalType.AssignName(CreateUniqueClassNameFromPlural(field.Key),
|
||||
ConvertPluralToSingle(field.Key));
|
||||
GenerateClass(subexamples.ToArray(), field.Value.InternalType);
|
||||
}
|
||||
}
|
||||
|
||||
type.Fields = jsonFields.Select(x => new FieldInfo(this, x.Key, x.Value, UsePascalCase, fieldExamples[x.Key])).ToList();
|
||||
|
||||
FeedBack?.Invoke($"Generating class {type.AssignedName}");
|
||||
Types.Add(type);
|
||||
}
|
||||
|
||||
public IList<JsonType> Types { get; private set; }
|
||||
private HashSet<string> Names = new HashSet<string>();
|
||||
|
||||
private string CreateUniqueClassName(string name)
|
||||
{
|
||||
name = ToTitleCase(name);
|
||||
|
||||
var finalName = name;
|
||||
var i = 2;
|
||||
while (Names.Any(x => x.Equals(finalName, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
finalName = name + i.ToString();
|
||||
i++;
|
||||
}
|
||||
|
||||
Names.Add(finalName);
|
||||
return finalName;
|
||||
}
|
||||
|
||||
private string CreateUniqueClassNameFromPlural(string plural)
|
||||
{
|
||||
plural = ToTitleCase(plural);
|
||||
return CreateUniqueClassName(pluralizationService.Singularize(plural));
|
||||
}
|
||||
|
||||
private string ConvertPluralToSingle(string plural)
|
||||
{
|
||||
plural = ToTitleCase(plural);
|
||||
return pluralizationService.Singularize(plural);
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal static string ToTitleCase(string str)
|
||||
{
|
||||
var sb = new StringBuilder(str.Length);
|
||||
var flag = true;
|
||||
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
var c = str[i];
|
||||
if (char.IsLetterOrDigit(c))
|
||||
{
|
||||
sb.Append(flag ? char.ToUpper(c) : c);
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public bool HasSecondaryClasses
|
||||
{
|
||||
get { return Types.Count > 1; }
|
||||
}
|
||||
|
||||
public static readonly string[] FileHeader = new[] {
|
||||
"Generated by Xamasoft JSON Class Generator",
|
||||
"http://www.xamasoft.com/json-class-generator"
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7BEF7EAA-DE37-40FB-BD33-3DEF0685031F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Xamasoft.JsonClassGenerator</RootNamespace>
|
||||
<AssemblyName>Xamasoft.JsonClassGenerator</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EasyModbus, Version=5.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EasyModbusTCP.5.6.0\lib\net40\EasyModbus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.Entity.Design" />
|
||||
<Reference Include="System.Data.Entity.Design.PluralizationServices">
|
||||
<HintPath>..\References\System.Data.Entity.Design.PluralizationServices.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Xamasoft.BetterLinkLabel">
|
||||
<HintPath>..\References\Xamasoft.BetterLinkLabel.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CodeWriters\JavaCodeWriter.cs" />
|
||||
<Compile Include="CodeWriters\TypeScriptCodeWriter.cs" />
|
||||
<Compile Include="CodeWriters\VisualBasicCodeWriter.cs" />
|
||||
<Compile Include="CodeWriters\CSharpCodeWriter.cs" />
|
||||
<Compile Include="FieldInfo.cs" />
|
||||
<Compile Include="ICodeWriter.cs" />
|
||||
<Compile Include="IJsonClassGeneratorConfig.cs" />
|
||||
<Compile Include="JsonClassGenerator.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utils\StringUtils.cs" />
|
||||
<None Include="JsonClassHelper.cs" />
|
||||
<Compile Include="JsonType.cs" />
|
||||
<Compile Include="JsonTypeEnum.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
198
middleware/JsonCSharpClassGeneratorLib/JsonClassHelper.cs
Normal file
198
middleware/JsonCSharpClassGeneratorLib/JsonClassHelper.cs
Normal file
@@ -0,0 +1,198 @@
|
||||
// JSON C# Class Generator
|
||||
// http://www.xamasoft.com/json-class-generator
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace JsonCSharpClassGenerator
|
||||
{
|
||||
internal static class JsonClassHelper
|
||||
{
|
||||
|
||||
public static T GetJToken<T>(JObject obj, string field) where T : JToken
|
||||
{
|
||||
JToken value;
|
||||
if (obj.TryGetValue(field, out value)) return GetJToken<T>(value);
|
||||
else return null;
|
||||
}
|
||||
|
||||
private static T GetJToken<T>(JToken token) where T : JToken
|
||||
{
|
||||
if (token == null) return null;
|
||||
if (token.Type == JTokenType.Null) return null;
|
||||
if (token.Type == JTokenType.Undefined) return null;
|
||||
return (T)token;
|
||||
}
|
||||
|
||||
public static string ReadString(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) return null;
|
||||
return (string)value.Value;
|
||||
}
|
||||
|
||||
|
||||
public static bool ReadBoolean(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) throw new Newtonsoft.Json.JsonSerializationException();
|
||||
return Convert.ToBoolean(value.Value);
|
||||
|
||||
}
|
||||
|
||||
public static bool? ReadNullableBoolean(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) return null;
|
||||
return Convert.ToBoolean(value.Value);
|
||||
}
|
||||
|
||||
|
||||
public static int ReadInteger(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) throw new Newtonsoft.Json.JsonSerializationException();
|
||||
return Convert.ToInt32((long)value.Value);
|
||||
|
||||
}
|
||||
|
||||
public static int? ReadNullableInteger(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) return null;
|
||||
return Convert.ToInt32((long)value.Value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static long ReadLong(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) throw new Newtonsoft.Json.JsonSerializationException();
|
||||
return Convert.ToInt64(value.Value);
|
||||
|
||||
}
|
||||
|
||||
public static long? ReadNullableLong(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) return null;
|
||||
return Convert.ToInt64(value.Value);
|
||||
}
|
||||
|
||||
|
||||
public static double ReadFloat(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) throw new Newtonsoft.Json.JsonSerializationException();
|
||||
return Convert.ToDouble(value.Value);
|
||||
|
||||
}
|
||||
|
||||
public static double? ReadNullableFloat(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) return null;
|
||||
return Convert.ToDouble(value.Value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static DateTime ReadDate(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) throw new Newtonsoft.Json.JsonSerializationException();
|
||||
return Convert.ToDateTime(value.Value);
|
||||
|
||||
}
|
||||
|
||||
public static DateTime? ReadNullableDate(JToken token)
|
||||
{
|
||||
var value = GetJToken<JValue>(token);
|
||||
if (value == null) return null;
|
||||
return Convert.ToDateTime(value.Value);
|
||||
|
||||
}
|
||||
|
||||
public static object ReadObject(JToken token)
|
||||
{
|
||||
var value = GetJToken<JToken>(token);
|
||||
if (value == null) return null;
|
||||
if (value.Type == JTokenType.Object) return value;
|
||||
if (value.Type == JTokenType.Array) return ReadArray<object>(value, ReadObject);
|
||||
|
||||
var jvalue = value as JValue;
|
||||
if (jvalue != null) return jvalue.Value;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static T ReadStronglyTypedObject<T>(JToken token) where T : class
|
||||
{
|
||||
var value = GetJToken<JObject>(token);
|
||||
if (value == null) return null;
|
||||
return (T)Activator.CreateInstance(typeof(T), new object[] { token });
|
||||
|
||||
}
|
||||
|
||||
|
||||
public delegate T ValueReader<T>(JToken token);
|
||||
|
||||
|
||||
|
||||
public static T[] ReadArray<T>(JToken token, ValueReader<T> reader)
|
||||
{
|
||||
var value = GetJToken<JArray>(token);
|
||||
if (value == null) return null;
|
||||
|
||||
var array = new T[value.Count];
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
array[i] = reader(value[i]);
|
||||
}
|
||||
return array;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Dictionary<string, T> ReadDictionary<T>(JToken token)
|
||||
{
|
||||
var value = GetJToken<JObject>(token);
|
||||
if (value == null) return null;
|
||||
|
||||
var dict = new Dictionary<string, T>();
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
public static Array ReadArray<K>(JArray jArray, ValueReader<K> reader, Type type)
|
||||
{
|
||||
if (jArray == null) return null;
|
||||
|
||||
var elemType = type.GetElementType();
|
||||
|
||||
var array = Array.CreateInstance(elemType, jArray.Count);
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (elemType.IsArray)
|
||||
{
|
||||
array.SetValue(ReadArray<K>(GetJToken<JArray>(jArray[i]), reader, elemType), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
array.SetValue(reader(jArray[i]), i);
|
||||
}
|
||||
|
||||
}
|
||||
return array;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
325
middleware/JsonCSharpClassGeneratorLib/JsonType.cs
Normal file
325
middleware/JsonCSharpClassGeneratorLib/JsonType.cs
Normal file
@@ -0,0 +1,325 @@
|
||||
// Copyright © 2010 Xamasoft
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Data.Entity.Design.PluralizationServices;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator
|
||||
{
|
||||
public class JsonType
|
||||
{
|
||||
|
||||
|
||||
private JsonType(IJsonClassGeneratorConfig generator)
|
||||
{
|
||||
this.generator = generator;
|
||||
}
|
||||
|
||||
public JsonType(IJsonClassGeneratorConfig generator, JToken token)
|
||||
: this(generator)
|
||||
{
|
||||
|
||||
Type = GetFirstTypeEnum(token);
|
||||
|
||||
if (Type == JsonTypeEnum.Array)
|
||||
{
|
||||
var array = (JArray)token;
|
||||
InternalType = GetCommonType(generator, array.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
internal static JsonType GetNull(IJsonClassGeneratorConfig generator)
|
||||
{
|
||||
return new JsonType(generator, JsonTypeEnum.NullableSomething);
|
||||
}
|
||||
|
||||
private IJsonClassGeneratorConfig generator;
|
||||
|
||||
internal JsonType(IJsonClassGeneratorConfig generator, JsonTypeEnum type)
|
||||
: this(generator)
|
||||
{
|
||||
this.Type = type;
|
||||
}
|
||||
|
||||
|
||||
public static JsonType GetCommonType(IJsonClassGeneratorConfig generator, JToken[] tokens)
|
||||
{
|
||||
|
||||
if (tokens.Length == 0) return new JsonType(generator, JsonTypeEnum.NonConstrained);
|
||||
|
||||
var common = new JsonType(generator, tokens[0]).MaybeMakeNullable(generator);
|
||||
|
||||
for (int i = 1; i < tokens.Length; i++)
|
||||
{
|
||||
var current = new JsonType(generator, tokens[i]);
|
||||
common = common.GetCommonType(current);
|
||||
}
|
||||
|
||||
return common;
|
||||
|
||||
}
|
||||
|
||||
internal JsonType MaybeMakeNullable(IJsonClassGeneratorConfig generator)
|
||||
{
|
||||
if (!generator.AlwaysUseNullableValues) return this;
|
||||
return this.GetCommonType(JsonType.GetNull(generator));
|
||||
}
|
||||
|
||||
|
||||
public JsonTypeEnum Type { get; private set; }
|
||||
public JsonType InternalType { get; private set; }
|
||||
public string AssignedName { get; private set; }
|
||||
public string OriginalName { get; private set; }
|
||||
|
||||
public void AssignName(string name, string originalName)
|
||||
{
|
||||
AssignedName = name;
|
||||
OriginalName = originalName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool MustCache
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case JsonTypeEnum.Array: return true;
|
||||
case JsonTypeEnum.Object: return true;
|
||||
case JsonTypeEnum.Anything: return true;
|
||||
case JsonTypeEnum.Dictionary: return true;
|
||||
case JsonTypeEnum.NonConstrained: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetReaderName()
|
||||
{
|
||||
if (Type == JsonTypeEnum.Anything || Type == JsonTypeEnum.NullableSomething || Type == JsonTypeEnum.NonConstrained)
|
||||
{
|
||||
return "ReadObject";
|
||||
}
|
||||
if (Type == JsonTypeEnum.Object)
|
||||
{
|
||||
return string.Format("ReadStronglyTypedObject<{0}>", AssignedName);
|
||||
}
|
||||
else if (Type == JsonTypeEnum.Array)
|
||||
{
|
||||
return string.Format("ReadArray<{0}>", InternalType.GetTypeName());
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Format("Read{0}", Enum.GetName(typeof(JsonTypeEnum), Type));
|
||||
}
|
||||
}
|
||||
|
||||
public JsonType GetInnermostType()
|
||||
{
|
||||
if (Type != JsonTypeEnum.Array) throw new InvalidOperationException();
|
||||
if (InternalType.Type != JsonTypeEnum.Array) return InternalType;
|
||||
return InternalType.GetInnermostType();
|
||||
}
|
||||
|
||||
|
||||
public string GetTypeName()
|
||||
{
|
||||
return generator.CodeWriter.GetTypeName(this, generator);
|
||||
}
|
||||
|
||||
public string GetJTokenType()
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case JsonTypeEnum.Boolean:
|
||||
case JsonTypeEnum.Integer:
|
||||
case JsonTypeEnum.Long:
|
||||
case JsonTypeEnum.Float:
|
||||
case JsonTypeEnum.Date:
|
||||
case JsonTypeEnum.NullableBoolean:
|
||||
case JsonTypeEnum.NullableInteger:
|
||||
case JsonTypeEnum.NullableLong:
|
||||
case JsonTypeEnum.NullableFloat:
|
||||
case JsonTypeEnum.NullableDate:
|
||||
case JsonTypeEnum.String:
|
||||
return "JValue";
|
||||
case JsonTypeEnum.Array:
|
||||
return "JArray";
|
||||
case JsonTypeEnum.Dictionary:
|
||||
return "JObject";
|
||||
case JsonTypeEnum.Object:
|
||||
return "JObject";
|
||||
default:
|
||||
return "JToken";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public JsonType GetCommonType(JsonType type2)
|
||||
{
|
||||
var commonType = GetCommonTypeEnum(this.Type, type2.Type);
|
||||
|
||||
if (commonType == JsonTypeEnum.Array)
|
||||
{
|
||||
if (type2.Type == JsonTypeEnum.NullableSomething) return this;
|
||||
if (this.Type == JsonTypeEnum.NullableSomething) return type2;
|
||||
var commonInternalType = InternalType.GetCommonType(type2.InternalType).MaybeMakeNullable(generator);
|
||||
if (commonInternalType != InternalType) return new JsonType(generator, JsonTypeEnum.Array) { InternalType = commonInternalType };
|
||||
}
|
||||
|
||||
|
||||
//if (commonType == JsonTypeEnum.Dictionary)
|
||||
//{
|
||||
// var commonInternalType = InternalType.GetCommonType(type2.InternalType);
|
||||
// if (commonInternalType != InternalType) return new JsonType(JsonTypeEnum.Dictionary) { InternalType = commonInternalType };
|
||||
//}
|
||||
|
||||
|
||||
if (this.Type == commonType) return this;
|
||||
return new JsonType(generator, commonType).MaybeMakeNullable(generator);
|
||||
}
|
||||
|
||||
|
||||
private static bool IsNull(JsonTypeEnum type)
|
||||
{
|
||||
return type == JsonTypeEnum.NullableSomething;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private JsonTypeEnum GetCommonTypeEnum(JsonTypeEnum type1, JsonTypeEnum type2)
|
||||
{
|
||||
if (type1 == JsonTypeEnum.NonConstrained) return type2;
|
||||
if (type2 == JsonTypeEnum.NonConstrained) return type1;
|
||||
|
||||
switch (type1)
|
||||
{
|
||||
case JsonTypeEnum.Boolean:
|
||||
if (IsNull(type2)) return JsonTypeEnum.NullableBoolean;
|
||||
if (type2 == JsonTypeEnum.Boolean) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.NullableBoolean:
|
||||
if (IsNull(type2)) return type1;
|
||||
if (type2 == JsonTypeEnum.Boolean) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.Integer:
|
||||
if (IsNull(type2)) return JsonTypeEnum.NullableInteger;
|
||||
if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.Float;
|
||||
if (type2 == JsonTypeEnum.Long) return JsonTypeEnum.Long;
|
||||
if (type2 == JsonTypeEnum.Integer) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.NullableInteger:
|
||||
if (IsNull(type2)) return type1;
|
||||
if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.NullableFloat;
|
||||
if (type2 == JsonTypeEnum.Long) return JsonTypeEnum.NullableLong;
|
||||
if (type2 == JsonTypeEnum.Integer) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.Float:
|
||||
if (IsNull(type2)) return JsonTypeEnum.NullableFloat;
|
||||
if (type2 == JsonTypeEnum.Float) return type1;
|
||||
if (type2 == JsonTypeEnum.Integer) return type1;
|
||||
if (type2 == JsonTypeEnum.Long) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.NullableFloat:
|
||||
if (IsNull(type2)) return type1;
|
||||
if (type2 == JsonTypeEnum.Float) return type1;
|
||||
if (type2 == JsonTypeEnum.Integer) return type1;
|
||||
if (type2 == JsonTypeEnum.Long) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.Long:
|
||||
if (IsNull(type2)) return JsonTypeEnum.NullableLong;
|
||||
if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.Float;
|
||||
if (type2 == JsonTypeEnum.Integer) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.NullableLong:
|
||||
if (IsNull(type2)) return type1;
|
||||
if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.NullableFloat;
|
||||
if (type2 == JsonTypeEnum.Integer) return type1;
|
||||
if (type2 == JsonTypeEnum.Long) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.Date:
|
||||
if (IsNull(type2)) return JsonTypeEnum.NullableDate;
|
||||
if (type2 == JsonTypeEnum.Date) return JsonTypeEnum.Date;
|
||||
break;
|
||||
case JsonTypeEnum.NullableDate:
|
||||
if (IsNull(type2)) return type1;
|
||||
if (type2 == JsonTypeEnum.Date) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.NullableSomething:
|
||||
if (IsNull(type2)) return type1;
|
||||
if (type2 == JsonTypeEnum.String) return JsonTypeEnum.String;
|
||||
if (type2 == JsonTypeEnum.Integer) return JsonTypeEnum.NullableInteger;
|
||||
if (type2 == JsonTypeEnum.Float) return JsonTypeEnum.NullableFloat;
|
||||
if (type2 == JsonTypeEnum.Long) return JsonTypeEnum.NullableLong;
|
||||
if (type2 == JsonTypeEnum.Boolean) return JsonTypeEnum.NullableBoolean;
|
||||
if (type2 == JsonTypeEnum.Date) return JsonTypeEnum.NullableDate;
|
||||
if (type2 == JsonTypeEnum.Array) return JsonTypeEnum.Array;
|
||||
if (type2 == JsonTypeEnum.Object) return JsonTypeEnum.Object;
|
||||
break;
|
||||
case JsonTypeEnum.Object:
|
||||
if (IsNull(type2)) return type1;
|
||||
if (type2 == JsonTypeEnum.Object) return type1;
|
||||
if (type2 == JsonTypeEnum.Dictionary) throw new ArgumentException();
|
||||
break;
|
||||
case JsonTypeEnum.Dictionary:
|
||||
throw new ArgumentException();
|
||||
//if (IsNull(type2)) return type1;
|
||||
//if (type2 == JsonTypeEnum.Object) return type1;
|
||||
//if (type2 == JsonTypeEnum.Dictionary) return type1;
|
||||
// break;
|
||||
case JsonTypeEnum.Array:
|
||||
if (IsNull(type2)) return type1;
|
||||
if (type2 == JsonTypeEnum.Array) return type1;
|
||||
break;
|
||||
case JsonTypeEnum.String:
|
||||
if (IsNull(type2)) return type1;
|
||||
if (type2 == JsonTypeEnum.String) return type1;
|
||||
break;
|
||||
}
|
||||
|
||||
return JsonTypeEnum.Anything;
|
||||
|
||||
}
|
||||
|
||||
private static bool IsNull(JTokenType type)
|
||||
{
|
||||
return type == JTokenType.Null || type == JTokenType.Undefined;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static JsonTypeEnum GetFirstTypeEnum(JToken token)
|
||||
{
|
||||
var type = token.Type;
|
||||
if (type == JTokenType.Integer)
|
||||
{
|
||||
if ((long)((JValue)token).Value < int.MaxValue) return JsonTypeEnum.Integer;
|
||||
else return JsonTypeEnum.Long;
|
||||
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case JTokenType.Array: return JsonTypeEnum.Array;
|
||||
case JTokenType.Boolean: return JsonTypeEnum.Boolean;
|
||||
case JTokenType.Float: return JsonTypeEnum.Float;
|
||||
case JTokenType.Null: return JsonTypeEnum.NullableSomething;
|
||||
case JTokenType.Undefined: return JsonTypeEnum.NullableSomething;
|
||||
case JTokenType.String: return JsonTypeEnum.String;
|
||||
case JTokenType.Object: return JsonTypeEnum.Object;
|
||||
case JTokenType.Date: return JsonTypeEnum.Date;
|
||||
|
||||
default: return JsonTypeEnum.Anything;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public IList<FieldInfo> Fields { get; internal set; }
|
||||
public bool IsRoot { get; internal set; }
|
||||
}
|
||||
}
|
||||
33
middleware/JsonCSharpClassGeneratorLib/JsonTypeEnum.cs
Normal file
33
middleware/JsonCSharpClassGeneratorLib/JsonTypeEnum.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright © 2010 Xamasoft
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator
|
||||
{
|
||||
public enum JsonTypeEnum
|
||||
{
|
||||
Anything,
|
||||
String,
|
||||
Boolean,
|
||||
Integer,
|
||||
Long,
|
||||
Float,
|
||||
Double,
|
||||
Date,
|
||||
NullableInteger,
|
||||
NullableLong,
|
||||
NullableFloat,
|
||||
NullableBoolean,
|
||||
NullableDate,
|
||||
Object,
|
||||
Array,
|
||||
Dictionary,
|
||||
NullableSomething,
|
||||
NonConstrained
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Json Class Generator")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Xamasoft")]
|
||||
[assembly: AssemblyProduct("Json Class Generator")]
|
||||
[assembly: AssemblyCopyright("Copyright © Xamasoft 2010-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("d85f4fb4-29b8-4315-ad2d-74f24098c968")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.5.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.5.1.0")]
|
||||
73
middleware/JsonCSharpClassGeneratorLib/Properties/Resources.Designer.cs
generated
Normal file
73
middleware/JsonCSharpClassGeneratorLib/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Xamasoft.JsonClassGenerator.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Byte[] 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static byte[] JsonClassHelper {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("JsonClassHelper", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
104
middleware/JsonCSharpClassGeneratorLib/Properties/Resources.resx
Normal file
104
middleware/JsonCSharpClassGeneratorLib/Properties/Resources.resx
Normal file
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="JsonClassHelper" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\jsonclasshelper.cs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
334
middleware/JsonCSharpClassGeneratorLib/Utils/StringUtils.cs
Normal file
334
middleware/JsonCSharpClassGeneratorLib/Utils/StringUtils.cs
Normal file
@@ -0,0 +1,334 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Xamasoft.JsonClassGenerator.Utils
|
||||
{
|
||||
internal static class StringUtils
|
||||
{
|
||||
|
||||
public static string RemoveText(this string source, String removeText)
|
||||
{
|
||||
string result = string.Empty;
|
||||
int i = source.IndexOf(removeText);
|
||||
if (i >= 0)
|
||||
{
|
||||
result = source.Remove(i, removeText.Length);
|
||||
return result;
|
||||
}
|
||||
return source;
|
||||
}
|
||||
|
||||
public static string GetSafeFilename(string arbitraryString)
|
||||
{
|
||||
var invalidChars = System.IO.Path.GetInvalidFileNameChars();
|
||||
var replaceIndex = arbitraryString.IndexOfAny(invalidChars, 0);
|
||||
if (replaceIndex == -1) return arbitraryString;
|
||||
|
||||
var r = new StringBuilder();
|
||||
var i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
r.Append(arbitraryString, i, replaceIndex - i);
|
||||
|
||||
switch (arbitraryString[replaceIndex])
|
||||
{
|
||||
case '"':
|
||||
r.Append("''");
|
||||
break;
|
||||
case '<':
|
||||
r.Append('\u02c2'); // '˂' (modifier letter left arrowhead)
|
||||
break;
|
||||
case '>':
|
||||
r.Append('\u02c3'); // '˃' (modifier letter right arrowhead)
|
||||
break;
|
||||
case '|':
|
||||
r.Append('\u2223'); // '∣' (divides)
|
||||
break;
|
||||
case ':':
|
||||
r.Append('-');
|
||||
break;
|
||||
case '*':
|
||||
r.Append('\u2217'); // '∗' (asterisk operator)
|
||||
break;
|
||||
case '\\':
|
||||
case '/':
|
||||
r.Append('\u2044'); // '⁄' (fraction slash)
|
||||
break;
|
||||
case '\0':
|
||||
case '\f':
|
||||
case '?':
|
||||
break;
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\v':
|
||||
r.Append(' ');
|
||||
break;
|
||||
default:
|
||||
r.Append('_');
|
||||
break;
|
||||
}
|
||||
|
||||
i = replaceIndex + 1;
|
||||
replaceIndex = arbitraryString.IndexOfAny(invalidChars, i);
|
||||
} while (replaceIndex != -1);
|
||||
|
||||
r.Append(arbitraryString, i, arbitraryString.Length - i);
|
||||
|
||||
return r.ToString();
|
||||
}
|
||||
|
||||
public static int StringToInt(string str)
|
||||
{
|
||||
str = "" + str;
|
||||
int val = 0;
|
||||
int.TryParse(str, out val);
|
||||
return val;
|
||||
}
|
||||
|
||||
public static int TryParseInt(this string str)
|
||||
{
|
||||
str = "" + str;
|
||||
int val = 0;
|
||||
int.TryParse(str, out val);
|
||||
return val;
|
||||
}
|
||||
|
||||
public static double TryParseDouble(this string str)
|
||||
{
|
||||
str = "" + str;
|
||||
double val = 0;
|
||||
double.TryParse(str, out val);
|
||||
return val;
|
||||
}
|
||||
|
||||
public static string[] split(this String source, String spString)
|
||||
{
|
||||
string[] rt = null;
|
||||
rt = source.Split(new string[] { spString }, StringSplitOptions.RemoveEmptyEntries);
|
||||
return rt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 数据库命名法转化为驼峰命名法
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="isBigCamelCaes">is Big Camel Caes</param>
|
||||
/// <returns></returns>
|
||||
public static string DBNamingToCamelCase(string name, bool isBigCamelCaes = false)
|
||||
{
|
||||
if (name == null || name.Length == 0) { return ""; }
|
||||
if (name.Contains("_"))
|
||||
{
|
||||
string[] words = name.Split('_');
|
||||
string result = string.Empty;
|
||||
for (int i = 0; i < words.Length; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
result = words[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
result += UpperCaseFirstLetter(words[i]);
|
||||
}
|
||||
}
|
||||
if (isBigCamelCaes == true)
|
||||
{
|
||||
return UpperCaseFirstLetter(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isBigCamelCaes == true)
|
||||
{
|
||||
return UpperCaseFirstLetter(name);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 驼峰命名法转化为数据库命名法
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="isBigCamelCaes">is Big Camel Caes</param>
|
||||
/// <returns></returns>
|
||||
public static string CamelCaseToDBnameing(string name, bool isBigCamelCaes = false)
|
||||
{
|
||||
if (name != null && name.Length > 0)
|
||||
{
|
||||
if (isBigCamelCaes == true)
|
||||
{
|
||||
name = LowerCaseFirstLetter(name);
|
||||
}
|
||||
char[] array = name.ToCharArray();
|
||||
string result = string.Empty;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
result += array[i].ToString().ToLower();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isUpper(array[i]))
|
||||
{
|
||||
result += "_" + array[i].ToString().ToLower();
|
||||
}
|
||||
else if (IsInt(array[i].ToString()))
|
||||
{
|
||||
result += "_" + array[i].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
result += array[i].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否为整型
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInt(string value)
|
||||
{
|
||||
return Regex.IsMatch(value, @"^[+-]?/d*$");
|
||||
}
|
||||
/// <summary>
|
||||
/// Json 命名改为数据库命名
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
/// <returns></returns>
|
||||
public static string JsonCamelCaseToDBnameing(string json)
|
||||
{
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string resultString = string.Empty;
|
||||
string pattern = "([\"](\\w+?)[\"][:]{1}?)";
|
||||
MatchCollection colls = Regex.Matches(json, pattern);
|
||||
for (int i = 0; i < colls.Count; i++)
|
||||
{
|
||||
json = json.Replace(colls[i].ToString(), DBNamingToCamelCase(colls[i].ToString()));
|
||||
}
|
||||
return json;
|
||||
}
|
||||
/// <summary>
|
||||
/// Json 命名改为驼峰命名
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
/// <returns></returns>
|
||||
public static string JsonDBnameingToCamelCase(string json)
|
||||
{
|
||||
if (string.IsNullOrEmpty(json))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string resultString = string.Empty;
|
||||
string pattern = "([\"](\\w+?)[\"][:]{1}?)";
|
||||
MatchCollection colls = Regex.Matches(json, pattern);
|
||||
for (int i = 0; i < colls.Count; i++)
|
||||
{
|
||||
json = json.Replace(colls[i].ToString(), CamelCaseToDBnameing(colls[i].ToString()));
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 数据库表名转化为类名
|
||||
/// </summary>
|
||||
/// <param name="dbname"> 数据库表名</param>
|
||||
/// <param name="removeStr"> 要替换的字符</param>
|
||||
/// <returns>类名</returns>
|
||||
public static string dbNameToClassName(string dbname, string removeStr)
|
||||
{
|
||||
return upperCaseFirstLetter(dbname, removeStr);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据库表名转化为类名
|
||||
/// </summary>
|
||||
/// <param name="dbname"> 数据库表名</param>
|
||||
/// <returns>类名</returns>
|
||||
public static string dbNameToClassName(string dbname)
|
||||
{
|
||||
return UpperCaseFirstLetter(dbname);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据库表名转小写
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <param name="removeStr"></param>
|
||||
/// <returns></returns>
|
||||
public static string dbNameToLowCase(string str, string removeStr)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str)) return "";
|
||||
|
||||
str = str.Replace(removeStr, "");
|
||||
|
||||
return str.ToLower();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 将一个单词的第一个字母变为大写
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string upperCaseFirstLetter(string str, string removeStr)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str)) return "";
|
||||
|
||||
str = str.Replace(removeStr, "");
|
||||
|
||||
return str.Substring(0, 1).ToUpper() + str.Substring(1);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 将一个单词的第一个字母变为大写
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string UpperCaseFirstLetter(string str)
|
||||
{
|
||||
return str.Substring(0, 1).ToUpper() + str.Substring(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将一个单词的第一个字母变为小写
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string LowerCaseFirstLetter(string str)
|
||||
{
|
||||
return str.Substring(0, 1).ToLower() + str.Substring(1);
|
||||
}
|
||||
/// <summary>
|
||||
/// 判断字符是否为大写字母
|
||||
/// </summary>
|
||||
/// <param name="c"></param>
|
||||
/// <returns></returns>
|
||||
public static bool isUpper(char c)
|
||||
{
|
||||
return c > 'A' && c < 'Z';
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
middleware/JsonCSharpClassGeneratorLib/bin/Debug/EasyModbus.dll
Normal file
BIN
middleware/JsonCSharpClassGeneratorLib/bin/Debug/EasyModbus.dll
Normal file
Binary file not shown.
425
middleware/JsonCSharpClassGeneratorLib/bin/Debug/EasyModbus.xml
Normal file
425
middleware/JsonCSharpClassGeneratorLib/bin/Debug/EasyModbus.xml
Normal file
@@ -0,0 +1,425 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>EasyModbus</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:EasyModbus.ModbusClient">
|
||||
<summary>
|
||||
Implements a ModbusClient.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.#ctor(System.String,System.Int32)">
|
||||
<summary>
|
||||
Constructor which determines the Master ip-address and the Master Port.
|
||||
</summary>
|
||||
<param name="ipAddress">IP-Address of the Master device</param>
|
||||
<param name="port">Listening port of the Master device (should be 502)</param>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.#ctor(System.String)">
|
||||
<summary>
|
||||
Constructor which determines the Serial-Port
|
||||
</summary>
|
||||
<param name="serialPort">Serial-Port Name e.G. "COM1"</param>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.#ctor">
|
||||
<summary>
|
||||
Parameterless constructor
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.Connect">
|
||||
<summary>
|
||||
Establish connection to Master device in case of Modbus TCP. Opens COM-Port in case of Modbus RTU
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.Connect(System.String,System.Int32)">
|
||||
<summary>
|
||||
Establish connection to Master device in case of Modbus TCP.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertRegistersToFloat(System.Int32[])">
|
||||
<summary>
|
||||
Converts two ModbusRegisters to Float - Example: EasyModbus.ModbusClient.ConvertRegistersToFloat(modbusClient.ReadHoldingRegisters(19,2))
|
||||
</summary>
|
||||
<param name="registers">Two Register values received from Modbus</param>
|
||||
<returns>Connected float value</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertRegistersToFloat(System.Int32[],EasyModbus.ModbusClient.RegisterOrder)">
|
||||
<summary>
|
||||
Converts two ModbusRegisters to Float, Registers can by swapped
|
||||
</summary>
|
||||
<param name="registers">Two Register values received from Modbus</param>
|
||||
<param name="registerOrder">Desired Word Order (Low Register first or High Register first</param>
|
||||
<returns>Connected float value</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertRegistersToInt(System.Int32[])">
|
||||
<summary>
|
||||
Converts two ModbusRegisters to 32 Bit Integer value
|
||||
</summary>
|
||||
<param name="registers">Two Register values received from Modbus</param>
|
||||
<returns>Connected 32 Bit Integer value</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertRegistersToInt(System.Int32[],EasyModbus.ModbusClient.RegisterOrder)">
|
||||
<summary>
|
||||
Converts two ModbusRegisters to 32 Bit Integer Value - Registers can be swapped
|
||||
</summary>
|
||||
<param name="registers">Two Register values received from Modbus</param>
|
||||
<param name="registerOrder">Desired Word Order (Low Register first or High Register first</param>
|
||||
<returns>Connecteds 32 Bit Integer value</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertRegistersToLong(System.Int32[])">
|
||||
<summary>
|
||||
Convert four 16 Bit Registers to 64 Bit Integer value Register Order "LowHigh": Reg0: Low Word.....Reg3: High Word, "HighLow": Reg0: High Word.....Reg3: Low Word
|
||||
</summary>
|
||||
<param name="registers">four Register values received from Modbus</param>
|
||||
<returns>64 bit value</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertRegistersToLong(System.Int32[],EasyModbus.ModbusClient.RegisterOrder)">
|
||||
<summary>
|
||||
Convert four 16 Bit Registers to 64 Bit Integer value - Registers can be swapped
|
||||
</summary>
|
||||
<param name="registers">four Register values received from Modbus</param>
|
||||
<param name="registerOrder">Desired Word Order (Low Register first or High Register first</param>
|
||||
<returns>Connected 64 Bit Integer value</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertRegistersToDouble(System.Int32[])">
|
||||
<summary>
|
||||
Convert four 16 Bit Registers to 64 Bit double prec. value Register Order "LowHigh": Reg0: Low Word.....Reg3: High Word, "HighLow": Reg0: High Word.....Reg3: Low Word
|
||||
</summary>
|
||||
<param name="registers">four Register values received from Modbus</param>
|
||||
<returns>64 bit value</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertRegistersToDouble(System.Int32[],EasyModbus.ModbusClient.RegisterOrder)">
|
||||
<summary>
|
||||
Convert four 16 Bit Registers to 64 Bit double prec. value - Registers can be swapped
|
||||
</summary>
|
||||
<param name="registers">four Register values received from Modbus</param>
|
||||
<param name="registerOrder">Desired Word Order (Low Register first or High Register first</param>
|
||||
<returns>Connected double prec. float value</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertFloatToRegisters(System.Single)">
|
||||
<summary>
|
||||
Converts float to two ModbusRegisters - Example: modbusClient.WriteMultipleRegisters(24, EasyModbus.ModbusClient.ConvertFloatToTwoRegisters((float)1.22));
|
||||
</summary>
|
||||
<param name="floatValue">Float value which has to be converted into two registers</param>
|
||||
<returns>Register values</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertFloatToRegisters(System.Single,EasyModbus.ModbusClient.RegisterOrder)">
|
||||
<summary>
|
||||
Converts float to two ModbusRegisters Registers - Registers can be swapped
|
||||
</summary>
|
||||
<param name="floatValue">Float value which has to be converted into two registers</param>
|
||||
<param name="registerOrder">Desired Word Order (Low Register first or High Register first</param>
|
||||
<returns>Register values</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertIntToRegisters(System.Int32)">
|
||||
<summary>
|
||||
Converts 32 Bit Value to two ModbusRegisters
|
||||
</summary>
|
||||
<param name="intValue">Int value which has to be converted into two registers</param>
|
||||
<returns>Register values</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertIntToRegisters(System.Int32,EasyModbus.ModbusClient.RegisterOrder)">
|
||||
<summary>
|
||||
Converts 32 Bit Value to two ModbusRegisters Registers - Registers can be swapped
|
||||
</summary>
|
||||
<param name="intValue">Double value which has to be converted into two registers</param>
|
||||
<param name="registerOrder">Desired Word Order (Low Register first or High Register first</param>
|
||||
<returns>Register values</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertLongToRegisters(System.Int64)">
|
||||
<summary>
|
||||
Converts 64 Bit Value to four ModbusRegisters
|
||||
</summary>
|
||||
<param name="longValue">long value which has to be converted into four registers</param>
|
||||
<returns>Register values</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertLongToRegisters(System.Int64,EasyModbus.ModbusClient.RegisterOrder)">
|
||||
<summary>
|
||||
Converts 64 Bit Value to four ModbusRegisters - Registers can be swapped
|
||||
</summary>
|
||||
<param name="longValue">long value which has to be converted into four registers</param>
|
||||
<param name="registerOrder">Desired Word Order (Low Register first or High Register first</param>
|
||||
<returns>Register values</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertDoubleToRegisters(System.Double)">
|
||||
<summary>
|
||||
Converts 64 Bit double prec Value to four ModbusRegisters
|
||||
</summary>
|
||||
<param name="doubleValue">double value which has to be converted into four registers</param>
|
||||
<returns>Register values</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertDoubleToRegisters(System.Double,EasyModbus.ModbusClient.RegisterOrder)">
|
||||
<summary>
|
||||
Converts 64 Bit double prec. Value to four ModbusRegisters - Registers can be swapped
|
||||
</summary>
|
||||
<param name="doubleValue">double value which has to be converted into four registers</param>
|
||||
<param name="registerOrder">Desired Word Order (Low Register first or High Register first</param>
|
||||
<returns>Register values</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertRegistersToString(System.Int32[],System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Converts 16 - Bit Register values to String
|
||||
</summary>
|
||||
<param name="registers">Register array received via Modbus</param>
|
||||
<param name="offset">First Register containing the String to convert</param>
|
||||
<param name="stringLength">number of characters in String (must be even)</param>
|
||||
<returns>Converted String</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ConvertStringToRegisters(System.String)">
|
||||
<summary>
|
||||
Converts a String to 16 - Bit Registers
|
||||
</summary>
|
||||
<param name="registers">Register array received via Modbus</param>
|
||||
<returns>Converted String</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.calculateCRC(System.Byte[],System.UInt16,System.Int32)">
|
||||
<summary>
|
||||
Calculates the CRC16 for Modbus-RTU
|
||||
</summary>
|
||||
<param name="data">Byte buffer to send</param>
|
||||
<param name="numberOfBytes">Number of bytes to calculate CRC</param>
|
||||
<param name="startByte">First byte in buffer to start calculating CRC</param>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ReadDiscreteInputs(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Read Discrete Inputs from Server device (FC2).
|
||||
</summary>
|
||||
<param name="startingAddress">First discrete input to read</param>
|
||||
<param name="quantity">Number of discrete Inputs to read</param>
|
||||
<returns>Boolean Array which contains the discrete Inputs</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ReadCoils(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Read Coils from Server device (FC1).
|
||||
</summary>
|
||||
<param name="startingAddress">First coil to read</param>
|
||||
<param name="quantity">Numer of coils to read</param>
|
||||
<returns>Boolean Array which contains the coils</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ReadHoldingRegisters(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Read Holding Registers from Master device (FC3).
|
||||
</summary>
|
||||
<param name="startingAddress">First holding register to be read</param>
|
||||
<param name="quantity">Number of holding registers to be read</param>
|
||||
<returns>Int Array which contains the holding registers</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ReadInputRegisters(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Read Input Registers from Master device (FC4).
|
||||
</summary>
|
||||
<param name="startingAddress">First input register to be read</param>
|
||||
<param name="quantity">Number of input registers to be read</param>
|
||||
<returns>Int Array which contains the input registers</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.WriteSingleCoil(System.Int32,System.Boolean)">
|
||||
<summary>
|
||||
Write single Coil to Master device (FC5).
|
||||
</summary>
|
||||
<param name="startingAddress">Coil to be written</param>
|
||||
<param name="value">Coil Value to be written</param>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.WriteSingleRegister(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Write single Register to Master device (FC6).
|
||||
</summary>
|
||||
<param name="startingAddress">Register to be written</param>
|
||||
<param name="value">Register Value to be written</param>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.WriteMultipleCoils(System.Int32,System.Boolean[])">
|
||||
<summary>
|
||||
Write multiple coils to Master device (FC15).
|
||||
</summary>
|
||||
<param name="startingAddress">First coil to be written</param>
|
||||
<param name="values">Coil Values to be written</param>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.WriteMultipleRegisters(System.Int32,System.Int32[])">
|
||||
<summary>
|
||||
Write multiple registers to Master device (FC16).
|
||||
</summary>
|
||||
<param name="startingAddress">First register to be written</param>
|
||||
<param name="values">register Values to be written</param>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.ReadWriteMultipleRegisters(System.Int32,System.Int32,System.Int32,System.Int32[])">
|
||||
<summary>
|
||||
Read/Write Multiple Registers (FC23).
|
||||
</summary>
|
||||
<param name="startingAddressRead">First input register to read</param>
|
||||
<param name="quantityRead">Number of input registers to read</param>
|
||||
<param name="startingAddressWrite">First input register to write</param>
|
||||
<param name="values">Values to write</param>
|
||||
<returns>Int Array which contains the Holding registers</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.Disconnect">
|
||||
<summary>
|
||||
Close connection to Master Device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:EasyModbus.ModbusClient.Finalize">
|
||||
<summary>
|
||||
Destructor - Close connection to Master Device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.Connected">
|
||||
<summary>
|
||||
Returns "TRUE" if Client is connected to Server and "FALSE" if not. In case of Modbus RTU returns if COM-Port is opened
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.IPAddress">
|
||||
<summary>
|
||||
Gets or Sets the IP-Address of the Server.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.Port">
|
||||
<summary>
|
||||
Gets or Sets the Port were the Modbus-TCP Server is reachable (Standard is 502).
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.UDPFlag">
|
||||
<summary>
|
||||
Gets or Sets the UDP-Flag to activate Modbus UDP.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.UnitIdentifier">
|
||||
<summary>
|
||||
Gets or Sets the Unit identifier in case of serial connection (Default = 0)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.Baudrate">
|
||||
<summary>
|
||||
Gets or Sets the Baudrate for serial connection (Default = 9600)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.Parity">
|
||||
<summary>
|
||||
Gets or Sets the of Parity in case of serial connection
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.StopBits">
|
||||
<summary>
|
||||
Gets or Sets the number of stopbits in case of serial connection
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.ConnectionTimeout">
|
||||
<summary>
|
||||
Gets or Sets the connection Timeout in case of ModbusTCP connection
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.SerialPort">
|
||||
<summary>
|
||||
Gets or Sets the serial Port
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusClient.LogFileFilename">
|
||||
<summary>
|
||||
Gets or Sets the Filename for the LogFile
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:EasyModbus.Exceptions.SerialPortNotOpenedException">
|
||||
<summary>
|
||||
Exception to be thrown if serial port is not opened
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:EasyModbus.Exceptions.ConnectionException">
|
||||
<summary>
|
||||
Exception to be thrown if Connection to Modbus device failed
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:EasyModbus.Exceptions.FunctionCodeNotSupportedException">
|
||||
<summary>
|
||||
Exception to be thrown if Modbus Server returns error code "Function code not supported"
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:EasyModbus.Exceptions.QuantityInvalidException">
|
||||
<summary>
|
||||
Exception to be thrown if Modbus Server returns error code "quantity invalid"
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:EasyModbus.Exceptions.StartingAddressInvalidException">
|
||||
<summary>
|
||||
Exception to be thrown if Modbus Server returns error code "starting adddress and quantity invalid"
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:EasyModbus.Exceptions.ModbusException">
|
||||
<summary>
|
||||
Exception to be thrown if Modbus Server returns error code "Function Code not executed (0x04)"
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:EasyModbus.Exceptions.CRCCheckFailedException">
|
||||
<summary>
|
||||
Exception to be thrown if CRC Check failed
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:EasyModbus.ModbusProtocol">
|
||||
<summary>
|
||||
Modbus Protocol informations.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.TCPHandler.LocalIPAddress">
|
||||
When making a server TCP listen socket, will listen to this IP address.
|
||||
</member>
|
||||
<member name="M:EasyModbus.TCPHandler.#ctor(System.Int32)">
|
||||
<summary>
|
||||
Listen to all network interfaces.
|
||||
</summary>
|
||||
<param name="port">TCP port to listen</param>
|
||||
</member>
|
||||
<member name="M:EasyModbus.TCPHandler.#ctor(System.Net.IPAddress,System.Int32)">
|
||||
<summary>
|
||||
Listen to a specific network interface.
|
||||
</summary>
|
||||
<param name="localIPAddress">IP address of network interface to listen</param>
|
||||
<param name="port">TCP port to listen</param>
|
||||
</member>
|
||||
<member name="T:EasyModbus.ModbusServer">
|
||||
<summary>
|
||||
Modbus TCP Server.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusServer.LocalIPAddress">
|
||||
<summary>
|
||||
When creating a TCP or UDP socket, the local IP address to attach to.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.ModbusServer.LogFileFilename">
|
||||
<summary>
|
||||
Gets or Sets the Filename for the LogFile
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:EasyModbus.StoreLogData">
|
||||
<summary>
|
||||
Store Log-Data in a File
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:EasyModbus.StoreLogData.#ctor">
|
||||
<summary>
|
||||
Private constructor; Ensures the access of the class only via "instance"
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:EasyModbus.StoreLogData.Instance">
|
||||
<summary>
|
||||
Returns the instance of the class (singleton)
|
||||
</summary>
|
||||
<returns>instance (Singleton)</returns>
|
||||
</member>
|
||||
<member name="M:EasyModbus.StoreLogData.Store(System.String)">
|
||||
<summary>
|
||||
Store message in Log-File
|
||||
</summary>
|
||||
<param name="message">Message to append to the Log-File</param>
|
||||
</member>
|
||||
<member name="M:EasyModbus.StoreLogData.Store(System.String,System.DateTime)">
|
||||
<summary>
|
||||
Store message in Log-File including Timestamp
|
||||
</summary>
|
||||
<param name="message">Message to append to the Log-File</param>
|
||||
<param name="timestamp">Timestamp to add to the same Row</param>
|
||||
</member>
|
||||
<member name="P:EasyModbus.StoreLogData.Filename">
|
||||
<summary>
|
||||
Gets or Sets the Filename to Store Strings in a File
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")]
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
b5dbd2e9c9b46f20a278ab3b93a0f4c0f1714f7b
|
||||
@@ -0,0 +1,41 @@
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\bin\Debug\Xamasoft.JsonClassGenerator.dll
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\bin\Debug\Xamasoft.JsonClassGenerator.pdb
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\bin\Debug\Newtonsoft.Json.dll
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.Properties.Resources.resources
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.GenerateResource.cache
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.CoreCompileInputs.cache
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.CopyComplete
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.dll
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.pdb
|
||||
F:\CSharp\Project\20230829shiyanshi\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\Xamasoft.JsonClassGenerator.dll
|
||||
F:\CSharp\Project\20230829shiyanshi\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\Xamasoft.JsonClassGenerator.pdb
|
||||
F:\CSharp\Project\20230829shiyanshi\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\Newtonsoft.Json.dll
|
||||
F:\CSharp\Project\20230829shiyanshi\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.Properties.Resources.resources
|
||||
F:\CSharp\Project\20230829shiyanshi\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.GenerateResource.cache
|
||||
F:\CSharp\Project\20230829shiyanshi\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.CoreCompileInputs.cache
|
||||
F:\CSharp\Project\20230829shiyanshi\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.CopyComplete
|
||||
F:\CSharp\Project\20230829shiyanshi\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.dll
|
||||
F:\CSharp\Project\20230829shiyanshi\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.pdb
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\Xamasoft.JsonClassGenerator.dll
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\Xamasoft.JsonClassGenerator.pdb
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\Newtonsoft.Json.dll
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.AssemblyReference.cache
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.Properties.Resources.resources
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.GenerateResource.cache
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.CoreCompileInputs.cache
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.CopyComplete
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.dll
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.pdb
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\EasyModbus.dll
|
||||
C:\Users\Administrator\Desktop\zdhsys20231228\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\EasyModbus.xml
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\Xamasoft.JsonClassGenerator.dll
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\Xamasoft.JsonClassGenerator.pdb
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\EasyModbus.dll
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\bin\Debug\EasyModbus.xml
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.AssemblyReference.cache
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.Properties.Resources.resources
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.GenerateResource.cache
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.CoreCompileInputs.cache
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\JsonClassGeneratorLib.csproj.CopyComplete
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.dll
|
||||
C:\Users\Administrator\Desktop\zdhsys20250116\zdhsys\JsonCSharpClassGeneratorLib\obj\Debug\Xamasoft.JsonClassGenerator.pdb
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")]
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
d850a0e32f3df46e9695ba932ef235ed248c0afe
|
||||
@@ -0,0 +1,9 @@
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\bin\Release\Xamasoft.JsonClassGenerator.dll
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\bin\Release\Xamasoft.JsonClassGenerator.pdb
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\bin\Release\Newtonsoft.Json.dll
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Release\Xamasoft.JsonClassGenerator.Properties.Resources.resources
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Release\JsonClassGeneratorLib.csproj.GenerateResource.cache
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Release\JsonClassGeneratorLib.csproj.CoreCompileInputs.cache
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Release\JsonClassGeneratorLib.csproj.CopyComplete
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Release\Xamasoft.JsonClassGenerator.dll
|
||||
F:\CSharp\recCode\20231202\JsonTool-main\JsonCSharpClassGeneratorLib\obj\Release\Xamasoft.JsonClassGenerator.pdb
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5
middleware/JsonCSharpClassGeneratorLib/packages.config
Normal file
5
middleware/JsonCSharpClassGeneratorLib/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EasyModbusTCP" version="5.6.0" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
|
||||
</packages>
|
||||
BIN
middleware/packages/AvalonEdit.6.3.0.90/.signature.p7s
vendored
Normal file
BIN
middleware/packages/AvalonEdit.6.3.0.90/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/AvalonEdit.6.3.0.90/AvalonEdit.6.3.0.90.nupkg
vendored
Normal file
BIN
middleware/packages/AvalonEdit.6.3.0.90/AvalonEdit.6.3.0.90.nupkg
vendored
Normal file
Binary file not shown.
8
middleware/packages/AvalonEdit.6.3.0.90/PackageReadme.md
vendored
Normal file
8
middleware/packages/AvalonEdit.6.3.0.90/PackageReadme.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
## About
|
||||
|
||||
Check out the [official documentation](http://avalonedit.net/documentation/) and the
|
||||
[samples and articles wiki page](https://github.com/icsharpcode/AvalonEdit/wiki/Samples-and-Articles)
|
||||
|
||||
Make sure to try the AvalonEdit sample application in the repository - its project has additional documentation included.
|
||||
|
||||
OSS projects using AvalonEdit are listed on the repository main page.
|
||||
BIN
middleware/packages/AvalonEdit.6.3.0.90/images/AvalonEditNuGetPackageIcon.png
vendored
Normal file
BIN
middleware/packages/AvalonEdit.6.3.0.90/images/AvalonEditNuGetPackageIcon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
middleware/packages/EasyModbusTCP.5.6.0/.signature.p7s
vendored
Normal file
BIN
middleware/packages/EasyModbusTCP.5.6.0/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/EasyModbusTCP.5.6.0/EasyModbusTCP.5.6.0.nupkg
vendored
Normal file
BIN
middleware/packages/EasyModbusTCP.5.6.0/EasyModbusTCP.5.6.0.nupkg
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/Microsoft.Xaml.Behaviors.Wpf.1.1.77/.signature.p7s
vendored
Normal file
BIN
middleware/packages/Microsoft.Xaml.Behaviors.Wpf.1.1.77/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/Microsoft.Xaml.Behaviors.Wpf.1.1.77/Microsoft.Xaml.Behaviors.Wpf.1.1.77.nupkg
vendored
Normal file
BIN
middleware/packages/Microsoft.Xaml.Behaviors.Wpf.1.1.77/Microsoft.Xaml.Behaviors.Wpf.1.1.77.nupkg
vendored
Normal file
Binary file not shown.
5
middleware/packages/Microsoft.Xaml.Behaviors.Wpf.1.1.77/tools/Install.ps1
vendored
Normal file
5
middleware/packages/Microsoft.Xaml.Behaviors.Wpf.1.1.77/tools/Install.ps1
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
# Remove the reference to the .Design.dll, which is incorrectly referenced during
|
||||
# the NuGet package installation in .NET Framework applications (not .NET Core).
|
||||
$project.Object.References | Where-Object { $_.Name -eq 'Microsoft.Xaml.Behaviors.Design' -or $_.Name -eq 'Microsoft.Xaml.Behaviors.DesignTools' } | ForEach-Object { $_.Remove() }
|
||||
BIN
middleware/packages/Newtonsoft.Json.13.0.1/.signature.p7s
vendored
Normal file
BIN
middleware/packages/Newtonsoft.Json.13.0.1/.signature.p7s
vendored
Normal file
Binary file not shown.
20
middleware/packages/Newtonsoft.Json.13.0.1/LICENSE.md
vendored
Normal file
20
middleware/packages/Newtonsoft.Json.13.0.1/LICENSE.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007 James Newton-King
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
BIN
middleware/packages/Newtonsoft.Json.13.0.1/Newtonsoft.Json.13.0.1.nupkg
vendored
Normal file
BIN
middleware/packages/Newtonsoft.Json.13.0.1/Newtonsoft.Json.13.0.1.nupkg
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/Newtonsoft.Json.13.0.1/packageIcon.png
vendored
Normal file
BIN
middleware/packages/Newtonsoft.Json.13.0.1/packageIcon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
BIN
middleware/packages/Newtonsoft.Json.13.0.3/.signature.p7s
vendored
Normal file
BIN
middleware/packages/Newtonsoft.Json.13.0.3/.signature.p7s
vendored
Normal file
Binary file not shown.
20
middleware/packages/Newtonsoft.Json.13.0.3/LICENSE.md
vendored
Normal file
20
middleware/packages/Newtonsoft.Json.13.0.3/LICENSE.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007 James Newton-King
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
BIN
middleware/packages/Newtonsoft.Json.13.0.3/Newtonsoft.Json.13.0.3.nupkg
vendored
Normal file
BIN
middleware/packages/Newtonsoft.Json.13.0.3/Newtonsoft.Json.13.0.3.nupkg
vendored
Normal file
Binary file not shown.
71
middleware/packages/Newtonsoft.Json.13.0.3/README.md
vendored
Normal file
71
middleware/packages/Newtonsoft.Json.13.0.3/README.md
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
#  Json.NET
|
||||
|
||||
[](https://www.nuget.org/packages/Newtonsoft.Json/)
|
||||
[](https://dev.azure.com/jamesnk/Public/_build/latest?definitionId=8)
|
||||
|
||||
Json.NET is a popular high-performance JSON framework for .NET
|
||||
|
||||
## Serialize JSON
|
||||
|
||||
```csharp
|
||||
Product product = new Product();
|
||||
product.Name = "Apple";
|
||||
product.Expiry = new DateTime(2008, 12, 28);
|
||||
product.Sizes = new string[] { "Small" };
|
||||
|
||||
string json = JsonConvert.SerializeObject(product);
|
||||
// {
|
||||
// "Name": "Apple",
|
||||
// "Expiry": "2008-12-28T00:00:00",
|
||||
// "Sizes": [
|
||||
// "Small"
|
||||
// ]
|
||||
// }
|
||||
```
|
||||
|
||||
## Deserialize JSON
|
||||
|
||||
```csharp
|
||||
string json = @"{
|
||||
'Name': 'Bad Boys',
|
||||
'ReleaseDate': '1995-4-7T00:00:00',
|
||||
'Genres': [
|
||||
'Action',
|
||||
'Comedy'
|
||||
]
|
||||
}";
|
||||
|
||||
Movie m = JsonConvert.DeserializeObject<Movie>(json);
|
||||
|
||||
string name = m.Name;
|
||||
// Bad Boys
|
||||
```
|
||||
|
||||
## LINQ to JSON
|
||||
|
||||
```csharp
|
||||
JArray array = new JArray();
|
||||
array.Add("Manual text");
|
||||
array.Add(new DateTime(2000, 5, 23));
|
||||
|
||||
JObject o = new JObject();
|
||||
o["MyArray"] = array;
|
||||
|
||||
string json = o.ToString();
|
||||
// {
|
||||
// "MyArray": [
|
||||
// "Manual text",
|
||||
// "2000-05-23T00:00:00"
|
||||
// ]
|
||||
// }
|
||||
```
|
||||
|
||||
## Links
|
||||
|
||||
- [Homepage](https://www.newtonsoft.com/json)
|
||||
- [Documentation](https://www.newtonsoft.com/json/help)
|
||||
- [NuGet Package](https://www.nuget.org/packages/Newtonsoft.Json)
|
||||
- [Release Notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
|
||||
- [Contributing Guidelines](https://github.com/JamesNK/Newtonsoft.Json/blob/master/CONTRIBUTING.md)
|
||||
- [License](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md)
|
||||
- [Stack Overflow](https://stackoverflow.com/questions/tagged/json.net)
|
||||
BIN
middleware/packages/Newtonsoft.Json.13.0.3/packageIcon.png
vendored
Normal file
BIN
middleware/packages/Newtonsoft.Json.13.0.3/packageIcon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
BIN
middleware/packages/SQLitePCLRaw.bundle_green.2.0.4/.signature.p7s
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.bundle_green.2.0.4/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.bundle_green.2.0.4/SQLitePCLRaw.bundle_green.2.0.4.nupkg
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.bundle_green.2.0.4/SQLitePCLRaw.bundle_green.2.0.4.nupkg
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.core.2.0.4/.signature.p7s
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.core.2.0.4/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.core.2.0.4/SQLitePCLRaw.core.2.0.4.nupkg
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.core.2.0.4/SQLitePCLRaw.core.2.0.4.nupkg
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/.signature.p7s
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/SQLitePCLRaw.lib.e_sqlite3.2.0.4.nupkg
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/SQLitePCLRaw.lib.e_sqlite3.2.0.4.nupkg
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/osx-x64/native/libe_sqlite3.dylib
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/osx-x64/native/libe_sqlite3.dylib
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/win-arm/native/e_sqlite3.dll
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/win-arm/native/e_sqlite3.dll
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/win-arm64/native/e_sqlite3.dll
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/win-arm64/native/e_sqlite3.dll
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/win-x64/native/e_sqlite3.dll
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/win-x64/native/e_sqlite3.dll
vendored
Normal file
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/win-x86/native/e_sqlite3.dll
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.lib.e_sqlite3.2.0.4/runtimes/win-x86/native/e_sqlite3.dll
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
middleware/packages/SQLitePCLRaw.provider.dynamic_cdecl.2.0.4/.signature.p7s
vendored
Normal file
BIN
middleware/packages/SQLitePCLRaw.provider.dynamic_cdecl.2.0.4/.signature.p7s
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
middleware/packages/System.Buffers.4.4.0/.signature.p7s
vendored
Normal file
BIN
middleware/packages/System.Buffers.4.4.0/.signature.p7s
vendored
Normal file
Binary file not shown.
23
middleware/packages/System.Buffers.4.4.0/LICENSE.TXT
vendored
Normal file
23
middleware/packages/System.Buffers.4.4.0/LICENSE.TXT
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) .NET Foundation and Contributors
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
BIN
middleware/packages/System.Buffers.4.4.0/System.Buffers.4.4.0.nupkg
vendored
Normal file
BIN
middleware/packages/System.Buffers.4.4.0/System.Buffers.4.4.0.nupkg
vendored
Normal file
Binary file not shown.
226
middleware/packages/System.Buffers.4.4.0/THIRD-PARTY-NOTICES.TXT
vendored
Normal file
226
middleware/packages/System.Buffers.4.4.0/THIRD-PARTY-NOTICES.TXT
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
.NET Core uses third-party libraries or other resources that may be
|
||||
distributed under licenses different than the .NET Core software.
|
||||
|
||||
In the event that we accidentally failed to list a required notice, please
|
||||
bring it to our attention. Post an issue or email us:
|
||||
|
||||
dotnet@microsoft.com
|
||||
|
||||
The attached notices are provided for information only.
|
||||
|
||||
License notice for Slicing-by-8
|
||||
-------------------------------
|
||||
|
||||
http://sourceforge.net/projects/slicing-by-8/
|
||||
|
||||
Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved
|
||||
|
||||
|
||||
This software program is licensed subject to the BSD License, available at
|
||||
http://www.opensource.org/licenses/bsd-license.html.
|
||||
|
||||
|
||||
License notice for Unicode data
|
||||
-------------------------------
|
||||
|
||||
http://www.unicode.org/copyright.html#License
|
||||
|
||||
Copyright © 1991-2017 Unicode, Inc. All rights reserved.
|
||||
Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Unicode data files and any associated documentation
|
||||
(the "Data Files") or Unicode software and any associated documentation
|
||||
(the "Software") to deal in the Data Files or Software
|
||||
without restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, and/or sell copies of
|
||||
the Data Files or Software, and to permit persons to whom the Data Files
|
||||
or Software are furnished to do so, provided that either
|
||||
(a) this copyright and permission notice appear with all copies
|
||||
of the Data Files or Software, or
|
||||
(b) this copyright and permission notice appear in associated
|
||||
Documentation.
|
||||
|
||||
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
|
||||
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale,
|
||||
use or other dealings in these Data Files or Software without prior
|
||||
written authorization of the copyright holder.
|
||||
|
||||
License notice for Zlib
|
||||
-----------------------
|
||||
|
||||
https://github.com/madler/zlib
|
||||
http://zlib.net/zlib_license.html
|
||||
|
||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
version 1.2.11, January 15th, 2017
|
||||
|
||||
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
|
||||
*/
|
||||
|
||||
License notice for Mono
|
||||
-------------------------------
|
||||
|
||||
http://www.mono-project.com/docs/about-mono/
|
||||
|
||||
Copyright (c) .NET Foundation Contributors
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the Software), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
License notice for International Organization for Standardization
|
||||
-----------------------------------------------------------------
|
||||
|
||||
Portions (C) International Organization for Standardization 1986:
|
||||
Permission to copy in any form is granted for use with
|
||||
conforming SGML systems and applications as defined in
|
||||
ISO 8879, provided this notice is included in all copies.
|
||||
|
||||
License notice for Intel
|
||||
------------------------
|
||||
|
||||
"Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
License notice for Xamarin and Novell
|
||||
-------------------------------------
|
||||
|
||||
Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Copyright (c) 2011 Novell, Inc (http://www.novell.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Third party notice for W3C
|
||||
--------------------------
|
||||
|
||||
"W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE
|
||||
Status: This license takes effect 13 May, 2015.
|
||||
This work is being provided by the copyright holders under the following license.
|
||||
License
|
||||
By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
|
||||
Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the work or portions thereof, including modifications:
|
||||
The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
|
||||
Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included.
|
||||
Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)."
|
||||
Disclaimers
|
||||
THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
|
||||
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
|
||||
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. Title to copyright in this work will at all times remain with copyright holders."
|
||||
|
||||
License notice for Bit Twiddling Hacks
|
||||
--------------------------------------
|
||||
|
||||
Bit Twiddling Hacks
|
||||
|
||||
By Sean Eron Anderson
|
||||
seander@cs.stanford.edu
|
||||
|
||||
Individually, the code snippets here are in the public domain (unless otherwise
|
||||
noted) — feel free to use them however you please. The aggregate collection and
|
||||
descriptions are © 1997-2005 Sean Eron Anderson. The code and descriptions are
|
||||
distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY and
|
||||
without even the implied warranty of merchantability or fitness for a particular
|
||||
purpose.
|
||||
0
middleware/packages/System.Buffers.4.4.0/ref/netcoreapp2.0/_._
vendored
Normal file
0
middleware/packages/System.Buffers.4.4.0/ref/netcoreapp2.0/_._
vendored
Normal file
BIN
middleware/packages/System.Buffers.4.4.0/ref/netstandard1.1/System.Buffers.dll
vendored
Normal file
BIN
middleware/packages/System.Buffers.4.4.0/ref/netstandard1.1/System.Buffers.dll
vendored
Normal file
Binary file not shown.
39
middleware/packages/System.Buffers.4.4.0/ref/netstandard1.1/System.Buffers.xml
vendored
Normal file
39
middleware/packages/System.Buffers.4.4.0/ref/netstandard1.1/System.Buffers.xml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><span>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>System.Buffers</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:System.Buffers.ArrayPool`1">
|
||||
<summary>Provides a resource pool that enables reusing instances of type <see cref="T[]"></see>.</summary>
|
||||
<typeparam name="T">The type of the objects that are in the resource pool.</typeparam>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.#ctor">
|
||||
<summary>Initializes a new instance of the <see cref="ArrayPool{T}"></see> class.</summary>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.Create">
|
||||
<summary>Creates a new instance of the <see cref="ArrayPool{T}"></see> class.</summary>
|
||||
<returns>A new instance of the <see cref="ArrayPool{T}"></see> class.</returns>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.Create(System.Int32,System.Int32)">
|
||||
<summary>Creates a new instance of the <see cref="ArrayPool{T}"></see> class using the specifed configuration.</summary>
|
||||
<param name="maxArrayLength">The maximum length of an array instance that may be stored in the pool.</param>
|
||||
<param name="maxArraysPerBucket">The maximum number of array instances that may be stored in each bucket in the pool. The pool groups arrays of similar lengths into buckets for faster access.</param>
|
||||
<returns>A new instance of the <see cref="ArrayPool{T}"></see> class with the specified configuration.</returns>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.Rent(System.Int32)">
|
||||
<summary>Retrieves a buffer that is at least the requested length.</summary>
|
||||
<param name="minimumLength">The minimum length of the array.</param>
|
||||
<returns>An array of type <see cref="T[]"></see> that is at least <paramref name="minimumLength">minimumLength</paramref> in length.</returns>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.Return(`0[],System.Boolean)">
|
||||
<summary>Returns an array to the pool that was previously obtained using the <see cref="Rent"></see> method on the same <see cref="ArrayPool{T}"></see> instance.</summary>
|
||||
<param name="array">A buffer to return to the pool that was previously obtained using the <see cref="Rent"></see> method.</param>
|
||||
<param name="clearArray">Indicates whether the contents of the buffer should be cleared before reuse. If <paramref name="bufferLength">bufferLength</paramref> is set to true, and if the pool will store the buffer to enable subsequent reuse, the <see cref="Return"></see> method will clear the <paramref name="array">array</paramref> of its contents so that a subsequent caller using the <see cref="Rent"></see> method will not see the content of the previous caller. If <paramref name="bufferLength">bufferLength</paramref> is set to false or if the pool will release the buffer, the array's contents are left unchanged.</param>
|
||||
</member>
|
||||
<member name="P:System.Buffers.ArrayPool`1.Shared">
|
||||
<summary>Gets a shared <see cref="ArrayPool{T}"></see> instance.</summary>
|
||||
<returns>A shared <see cref="ArrayPool{T}"></see> instance.</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc></span>
|
||||
BIN
middleware/packages/System.Buffers.4.4.0/ref/netstandard2.0/System.Buffers.dll
vendored
Normal file
BIN
middleware/packages/System.Buffers.4.4.0/ref/netstandard2.0/System.Buffers.dll
vendored
Normal file
Binary file not shown.
39
middleware/packages/System.Buffers.4.4.0/ref/netstandard2.0/System.Buffers.xml
vendored
Normal file
39
middleware/packages/System.Buffers.4.4.0/ref/netstandard2.0/System.Buffers.xml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><span>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>System.Buffers</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:System.Buffers.ArrayPool`1">
|
||||
<summary>Provides a resource pool that enables reusing instances of type <see cref="T[]"></see>.</summary>
|
||||
<typeparam name="T">The type of the objects that are in the resource pool.</typeparam>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.#ctor">
|
||||
<summary>Initializes a new instance of the <see cref="ArrayPool{T}"></see> class.</summary>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.Create">
|
||||
<summary>Creates a new instance of the <see cref="ArrayPool{T}"></see> class.</summary>
|
||||
<returns>A new instance of the <see cref="ArrayPool{T}"></see> class.</returns>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.Create(System.Int32,System.Int32)">
|
||||
<summary>Creates a new instance of the <see cref="ArrayPool{T}"></see> class using the specifed configuration.</summary>
|
||||
<param name="maxArrayLength">The maximum length of an array instance that may be stored in the pool.</param>
|
||||
<param name="maxArraysPerBucket">The maximum number of array instances that may be stored in each bucket in the pool. The pool groups arrays of similar lengths into buckets for faster access.</param>
|
||||
<returns>A new instance of the <see cref="ArrayPool{T}"></see> class with the specified configuration.</returns>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.Rent(System.Int32)">
|
||||
<summary>Retrieves a buffer that is at least the requested length.</summary>
|
||||
<param name="minimumLength">The minimum length of the array.</param>
|
||||
<returns>An array of type <see cref="T[]"></see> that is at least <paramref name="minimumLength">minimumLength</paramref> in length.</returns>
|
||||
</member>
|
||||
<member name="M:System.Buffers.ArrayPool`1.Return(`0[],System.Boolean)">
|
||||
<summary>Returns an array to the pool that was previously obtained using the <see cref="Rent"></see> method on the same <see cref="ArrayPool{T}"></see> instance.</summary>
|
||||
<param name="array">A buffer to return to the pool that was previously obtained using the <see cref="Rent"></see> method.</param>
|
||||
<param name="clearArray">Indicates whether the contents of the buffer should be cleared before reuse. If <paramref name="bufferLength">bufferLength</paramref> is set to true, and if the pool will store the buffer to enable subsequent reuse, the <see cref="Return"></see> method will clear the <paramref name="array">array</paramref> of its contents so that a subsequent caller using the <see cref="Rent"></see> method will not see the content of the previous caller. If <paramref name="bufferLength">bufferLength</paramref> is set to false or if the pool will release the buffer, the array's contents are left unchanged.</param>
|
||||
</member>
|
||||
<member name="P:System.Buffers.ArrayPool`1.Shared">
|
||||
<summary>Gets a shared <see cref="ArrayPool{T}"></see> instance.</summary>
|
||||
<returns>A shared <see cref="ArrayPool{T}"></see> instance.</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc></span>
|
||||
0
middleware/packages/System.Buffers.4.4.0/useSharedDesignerContext.txt
vendored
Normal file
0
middleware/packages/System.Buffers.4.4.0/useSharedDesignerContext.txt
vendored
Normal file
1
middleware/packages/System.Buffers.4.4.0/version.txt
vendored
Normal file
1
middleware/packages/System.Buffers.4.4.0/version.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
8321c729934c0f8be754953439b88e6e1c120c24
|
||||
BIN
middleware/packages/System.Memory.4.5.3/.signature.p7s
vendored
Normal file
BIN
middleware/packages/System.Memory.4.5.3/.signature.p7s
vendored
Normal file
Binary file not shown.
23
middleware/packages/System.Memory.4.5.3/LICENSE.TXT
vendored
Normal file
23
middleware/packages/System.Memory.4.5.3/LICENSE.TXT
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) .NET Foundation and Contributors
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
BIN
middleware/packages/System.Memory.4.5.3/System.Memory.4.5.3.nupkg
vendored
Normal file
BIN
middleware/packages/System.Memory.4.5.3/System.Memory.4.5.3.nupkg
vendored
Normal file
Binary file not shown.
309
middleware/packages/System.Memory.4.5.3/THIRD-PARTY-NOTICES.TXT
vendored
Normal file
309
middleware/packages/System.Memory.4.5.3/THIRD-PARTY-NOTICES.TXT
vendored
Normal file
@@ -0,0 +1,309 @@
|
||||
.NET Core uses third-party libraries or other resources that may be
|
||||
distributed under licenses different than the .NET Core software.
|
||||
|
||||
In the event that we accidentally failed to list a required notice, please
|
||||
bring it to our attention. Post an issue or email us:
|
||||
|
||||
dotnet@microsoft.com
|
||||
|
||||
The attached notices are provided for information only.
|
||||
|
||||
License notice for Slicing-by-8
|
||||
-------------------------------
|
||||
|
||||
http://sourceforge.net/projects/slicing-by-8/
|
||||
|
||||
Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved
|
||||
|
||||
|
||||
This software program is licensed subject to the BSD License, available at
|
||||
http://www.opensource.org/licenses/bsd-license.html.
|
||||
|
||||
|
||||
License notice for Unicode data
|
||||
-------------------------------
|
||||
|
||||
http://www.unicode.org/copyright.html#License
|
||||
|
||||
Copyright © 1991-2017 Unicode, Inc. All rights reserved.
|
||||
Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Unicode data files and any associated documentation
|
||||
(the "Data Files") or Unicode software and any associated documentation
|
||||
(the "Software") to deal in the Data Files or Software
|
||||
without restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, and/or sell copies of
|
||||
the Data Files or Software, and to permit persons to whom the Data Files
|
||||
or Software are furnished to do so, provided that either
|
||||
(a) this copyright and permission notice appear with all copies
|
||||
of the Data Files or Software, or
|
||||
(b) this copyright and permission notice appear in associated
|
||||
Documentation.
|
||||
|
||||
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
|
||||
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale,
|
||||
use or other dealings in these Data Files or Software without prior
|
||||
written authorization of the copyright holder.
|
||||
|
||||
License notice for Zlib
|
||||
-----------------------
|
||||
|
||||
https://github.com/madler/zlib
|
||||
http://zlib.net/zlib_license.html
|
||||
|
||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
version 1.2.11, January 15th, 2017
|
||||
|
||||
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
|
||||
*/
|
||||
|
||||
License notice for Mono
|
||||
-------------------------------
|
||||
|
||||
http://www.mono-project.com/docs/about-mono/
|
||||
|
||||
Copyright (c) .NET Foundation Contributors
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the Software), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
License notice for International Organization for Standardization
|
||||
-----------------------------------------------------------------
|
||||
|
||||
Portions (C) International Organization for Standardization 1986:
|
||||
Permission to copy in any form is granted for use with
|
||||
conforming SGML systems and applications as defined in
|
||||
ISO 8879, provided this notice is included in all copies.
|
||||
|
||||
License notice for Intel
|
||||
------------------------
|
||||
|
||||
"Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
License notice for Xamarin and Novell
|
||||
-------------------------------------
|
||||
|
||||
Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Copyright (c) 2011 Novell, Inc (http://www.novell.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Third party notice for W3C
|
||||
--------------------------
|
||||
|
||||
"W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE
|
||||
Status: This license takes effect 13 May, 2015.
|
||||
This work is being provided by the copyright holders under the following license.
|
||||
License
|
||||
By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
|
||||
Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the work or portions thereof, including modifications:
|
||||
The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
|
||||
Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included.
|
||||
Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)."
|
||||
Disclaimers
|
||||
THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
|
||||
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
|
||||
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. Title to copyright in this work will at all times remain with copyright holders."
|
||||
|
||||
License notice for Bit Twiddling Hacks
|
||||
--------------------------------------
|
||||
|
||||
Bit Twiddling Hacks
|
||||
|
||||
By Sean Eron Anderson
|
||||
seander@cs.stanford.edu
|
||||
|
||||
Individually, the code snippets here are in the public domain (unless otherwise
|
||||
noted) — feel free to use them however you please. The aggregate collection and
|
||||
descriptions are © 1997-2005 Sean Eron Anderson. The code and descriptions are
|
||||
distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY and
|
||||
without even the implied warranty of merchantability or fitness for a particular
|
||||
purpose.
|
||||
|
||||
License notice for Brotli
|
||||
--------------------------------------
|
||||
|
||||
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
compress_fragment.c:
|
||||
Copyright (c) 2011, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
decode_fuzzer.c:
|
||||
Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
|
||||
0
middleware/packages/System.Memory.4.5.3/ref/netcoreapp2.1/_._
vendored
Normal file
0
middleware/packages/System.Memory.4.5.3/ref/netcoreapp2.1/_._
vendored
Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user