Exemple #1
0
 public void cloneGenerator(JsonClassGenerator original, GenerateDescription clone)
 {
     clone.Namespace                  = original.Namespace;
     clone.UseProperties              = original.UseProperties;
     clone.InternalVisibility         = original.InternalVisibility;
     clone.ExplicitDeserialization    = original.ExplicitDeserialization;
     clone.NoHelperClass              = original.NoHelperClass;
     clone.MainClass                  = original.MainClass;
     clone.UsePascalCase              = original.UsePascalCase;
     clone.UseNestedClasses           = original.UseNestedClasses;
     clone.ApplyObfuscationAttributes = original.ApplyObfuscationAttributes;
     clone.SingleFile                 = original.SingleFile;
     clone.CodeWriter                 = original.CodeWriter;
     clone.HasSecondaryClasses        = original.HasSecondaryClasses;
     clone.AlwaysUseNullableValues    = original.AlwaysUseNullableValues;
     clone.UseNamespaces              = original.UseNamespaces;
     clone.ExamplesInDocumentation    = original.ExamplesInDocumentation;
     clone.Types         = original.Types;
     clone.UseNamespaces = original.UseNamespaces;
 }
Exemple #2
0
        private StringBuilder GenerateDescription(JsonClassGenerator generator)
        {
            GenerateDescription _jsonDescriptionGenerator = new GenerateDescription();

            cloneGenerator(generator, _jsonDescriptionGenerator);
            string codeWriterName = _jsonDescriptionGenerator.CodeWriter.DisplayName;

            if (codeWriterName == "C#")
            {
                _jsonDescriptionGenerator.CodeWriter = new CSharpCodeWriterToText();
            }
            else if (codeWriterName == "TypeScript")
            {
                _jsonDescriptionGenerator.CodeWriter = new TypeScriptCodeWriterToText();
            }

            StringBuilder _sb = new StringBuilder();

            _jsonDescriptionGenerator.WriteDescriptionToStringBuilder(_sb, _jsonDescriptionGenerator.Types);
            return(_sb);
        }