コード例 #1
0
 public override String GetText()
 {
     //comments
     if (HeaderComment != null)
     {
         Template = Template.Replace(headerCommentToken, HeaderComment.GetText());
     }
     if (HttpHeaderFunctionComment != null)
     {
         Template = Template.Replace(httpHeaderFunctionCommentToken, HttpHeaderFunctionComment.GetText());
     }
     if (ConstructorComment != null)
     {
         Template = Template.Replace(constructorCommentToken, ConstructorComment.GetText());
     }
     if (ConstructorParamters.Any())
     {
         Template = Template.Replace(ConstructorParamterTag, ConstructorParamters.Aggregate((a, b) => a + "," + b));
     }
     //class name
     Template = Template.Replace(classNameToken, Name);
     //Properties
     if (jsProperties.Any())
     {
         Template = Template.Replace(PropertiesToken, jsProperties.Select(x => x.GetText()).Aggregate((a, b) => a + "\r\n" + b));
     }
     //Methods
     if (Methods.Any())
     {
         Template = Template.Replace(MethodToken, Methods.Select(x => x.GetText()).Aggregate((a, b) => a + "\r\n" + b));
     }
     //remove unusedTokens
     CleanTemplateUp();
     return(Template);
 }
コード例 #2
0
 internal void Build(ProcessArgumentBuilder builder)
 {
     if (InputFile == null)
     {
         throw new ArgumentNullException(nameof(InputFile));
     }
     if (Generator != CodeGenerator.None || GeneratorSettings != null)
     {
         if (GeneratorSettings == null)
         {
             builder.AppendSwitch(ArgumentNames.Generator, Generator.ToGeneratorName());
         }
         else
         {
             builder.AppendSwitch(ArgumentNames.Generator,
                                  Generator == CodeGenerator.None
                 ? GeneratorSettings.Generator.ToGeneratorName()
                 : Generator.ToGeneratorName());
             builder.Append(string.Join(" ",
                                        GeneratorSettings.GetArguments()
                                        .Select(
                                            p =>
                                            $"{(p.Key.StartsWith(ArgumentNames.Separator) ? string.Empty : ArgumentNames.Separator)}{p.Key} {p.Value}")));
         }
     }
     if (Namespace.IsNotEmpty())
     {
         builder.AppendSwitch(ArgumentNames.Namespace, Namespace.Quote());
     }
     if (OutputDirectory != null)
     {
         builder.AppendSwitch(ArgumentNames.OutputDir, OutputDirectory.FullPath.Quote());
     }
     if (Modeler.IsNotEmpty())
     {
         builder.AppendSwitch(ArgumentNames.Modeler, Modeler);
     }
     if (ClientName.IsNotEmpty())
     {
         builder.AppendSwitch(ArgumentNames.ClientName, ClientName);
     }
     if (PayloadFlattenThreshold.HasValue)
     {
         builder.AppendSwitch(ArgumentNames.Threshold, PayloadFlattenThreshold.Value.ToString());
     }
     if (HeaderComment.IsNotEmpty())
     {
         builder.AppendSwitch(ArgumentNames.Header, HeaderComment.Quote());
     }
     if (AddCredentials)
     {
         builder.AppendSwitch(ArgumentNames.Credentials, "true");
     }
     if (OutputFileName.IsNotEmpty())
     {
         builder.AppendSwitch(ArgumentNames.OutputFile, OutputFileName.Quote());
     }
     if (Verbose)
     {
         builder.AppendSwitch(ArgumentNames.Verbose, "true");
     }
     builder.AppendSwitch(ArgumentNames.InputFile, InputFile.FullPath.Quote());
 }