当前位置: 首页>>代码示例>>C#>>正文


C# CommandLineBuilder.AppendTextUnquoted方法代码示例

本文整理汇总了C#中Microsoft.Build.Utilities.CommandLineBuilder.AppendTextUnquoted方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLineBuilder.AppendTextUnquoted方法的具体用法?C# CommandLineBuilder.AppendTextUnquoted怎么用?C# CommandLineBuilder.AppendTextUnquoted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Build.Utilities.CommandLineBuilder的用法示例。


在下文中一共展示了CommandLineBuilder.AppendTextUnquoted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateCommandLineCommands

 protected override String GenerateCommandLineCommands()
 {
     CommandLineBuilder builder = new CommandLineBuilder();
     if (Tie)
     {
         builder.AppendSwitch("--tie ");
     }
     builder.AppendTextUnquoted(String.Format(" {0}", base.GenerateCommandLineCommands()));
     return builder.ToString();
 }
开发者ID:alux-xu,项目名称:ice-builder-visualstudio,代码行数:10,代码来源:Tasks.cs

示例2: AppendStringValue

        // helper for string-based properties
        private void AppendStringValue(CommandLineBuilder builder, BaseProperty property, string subtype, string value)
        {
            value = value.Trim();

            // could cache this SubType test off in property wrapper or somewhere if performance were an issue
            string switchName = m_parsedBuildRule.SwitchPrefix + property.Switch;
            switchName += property.Separator;
            if (subtype == "file" || subtype == "folder")
            {
                // for switches that contains files or folders we need quoting
                builder.AppendSwitchIfNotNull(switchName, value);
            }
            else if (!string.IsNullOrEmpty(property.Switch))
            {
                builder.AppendSwitchUnquotedIfNotNull(switchName, value);
            }
            else if (!string.IsNullOrEmpty(value))
            {
                // for non-switches such as AdditionalOptions we just append the value
                builder.AppendTextUnquoted(" " + value);
            }
        }
开发者ID:udiavr,项目名称:nativeclient-sdk,代码行数:23,代码来源:XamlParser.cs

示例3: GenerateCommandLineCommands

        /// <summary>
        /// Returns a string value containing the command line arguments to pass directly to the executable file.
        /// </summary>
        /// <returns>
        /// A string value containing the command line arguments to pass directly to the executable file.
        /// </returns>
        protected override string GenerateCommandLineCommands()
        {
            var builder = new CommandLineBuilder();

              var c = Environment.OSVersion.Platform == PlatformID.Unix
            ? "-"
            : "--";

              if (EnableShadowCopy) builder.AppendSwitch(c + "shadowcopy");
              if (_testInNewThread.HasValue && !_testInNewThread.Value) builder.AppendSwitch(c + "nothread");
              if (Force32Bit) builder.AppendSwitch(c + "x86");
              if (NoHeader) builder.AppendSwitch(c + "noheader");
              if (NoColor) builder.AppendSwitch(c + "nocolor");
              if (Verbose) builder.AppendSwitch(c + "verbose");
              if (ReportProgressToTeamCity) builder.AppendSwitch(c + "teamcity");
              builder.AppendFileNamesIfNotNull(Assemblies, " ");
              builder.AppendSwitchIfNotNull(c + "config=", ProjectConfiguration);
              builder.AppendSwitchIfNotNull(c + "err=", ErrorOutputFile);
              builder.AppendSwitchIfNotNull(c + "out=", TextOutputFile);
              builder.AppendSwitchIfNotNull(c + "framework=", Framework);
              builder.AppendSwitchIfNotNull(c + "process=", Process);
              builder.AppendSwitchIfNotNull(c + "domain=", Domain);
              builder.AppendSwitchIfNotNull(c + "apartment=", Apartment);
              builder.AppendSwitchIfNotNull(c + "where=", Where);
              builder.AppendSwitchIfNotNull(c + "timeout=", TestTimeout);
              builder.AppendSwitchIfNotNull(c + "workers=", Workers);
              builder.AppendSwitchIfNotNull(c + "result=", OutputXmlFile);
              builder.AppendSwitchIfNotNull(c + "work=", WorkingDirectory);
              builder.AppendSwitchIfNotNull(c + "labels=", ShowLabels);
              builder.AppendSwitchIfNotNull(c + "trace=", InternalTrace);
              if(!string.IsNullOrWhiteSpace(AdditionalArguments)) builder.AppendTextUnquoted(" " + AdditionalArguments);

              return builder.ToString();
        }
开发者ID:DavidLievrouw,项目名称:Utils,代码行数:40,代码来源:NUnit3.cs

示例4: AppendStringListValue

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    private void AppendStringListValue (CommandLineBuilder builder, BaseProperty property, string subtype, string [] value, string delimiter)
    {
      string switchName = m_parsedBuildRule.SwitchPrefix + property.Switch;

      switchName += property.Separator;

      if (subtype == "file" || subtype == "folder")
      {
        builder.AppendSwitchUnquotedIfNotNull (switchName, value, delimiter);
      }
      else if (!string.IsNullOrEmpty (property.Switch))
      {
        builder.AppendSwitchUnquotedIfNotNull (switchName, value, delimiter);
      }
      else if (value.Length > 0)
      {
        foreach (string entry in value)
        {
          builder.AppendTextUnquoted (entry + delimiter);
        }
      }
    }
开发者ID:ashumeow,项目名称:android-plus-plus,代码行数:26,代码来源:XamlParser.cs

示例5: AppendStringValue

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    private void AppendStringValue (CommandLineBuilder builder, BaseProperty property, string subtype, string value)
    {
      string switchName = property.SwitchPrefix;

      if (string.IsNullOrEmpty (property.SwitchPrefix))
      {
        switchName = m_parsedBuildRule.SwitchPrefix;
      }

      switchName += property.Switch + property.Separator;

      if (subtype == "file" || subtype == "folder")
      {
        if (!string.IsNullOrWhiteSpace (switchName))
        {
          builder.AppendSwitchIfNotNull (switchName, value);
        }
        else
        {
          builder.AppendTextUnquoted (" " + PathUtils.QuoteIfNeeded (value));
        }
      }
      else if (!string.IsNullOrEmpty (property.Switch))
      {
        builder.AppendSwitchUnquotedIfNotNull (switchName, value);
      }
      else if (!string.IsNullOrEmpty (value))
      {
        builder.AppendTextUnquoted (" " + value);
      }
    }
开发者ID:ashumeow,项目名称:android-plus-plus,代码行数:35,代码来源:XamlParser.cs

示例6: GenerateTemplatedCommandLine

        /// <summary>
        /// Generates the command-line using the template specified.
        /// </summary>
        private void GenerateTemplatedCommandLine(CommandLineBuilder builder)
        {
            // Match all instances of [asdf], where "asdf" can be any combination of any 
            // characters *except* a [ or an ]. i.e., if "[ [ sdf ]" is passed, then we will 
            // match "[ sdf ]"
            string matchString = @"\[[^\[\]]+\]";
            Regex regex = new Regex(matchString, RegexOptions.ECMAScript);
            MatchCollection matches = regex.Matches(CommandLineTemplate);

            int indexOfEndOfLastSubstitution = 0;
            foreach (Match match in matches)
            {
                if (match.Length == 0)
                {
                    continue;
                }

                // Because we match non-greedily, in the case where we have input such as "[[[[[foo]", the match will
                // be "[foo]".  However, if there are multiple '[' in a row, we need to do some escaping logic, so we 
                // want to know what the first *consecutive* square bracket was.  
                int indexOfFirstBracketInMatch = match.Index;

                // Indexing using "indexOfFirstBracketInMatch - 1" is safe here because it will always be 
                // greater than indexOfEndOfLastSubstitution, which will always be 0 or greater. 
                while (indexOfFirstBracketInMatch > indexOfEndOfLastSubstitution && CommandLineTemplate[indexOfFirstBracketInMatch - 1].Equals('['))
                {
                    indexOfFirstBracketInMatch--;
                }

                // Append everything we know we want to add -- everything between where the last substitution ended and 
                // this match (including previous '[' that were not initially technically part of the match) begins. 
                if (indexOfFirstBracketInMatch != indexOfEndOfLastSubstitution)
                {
                    builder.AppendTextUnquoted(CommandLineTemplate.Substring(indexOfEndOfLastSubstitution, indexOfFirstBracketInMatch - indexOfEndOfLastSubstitution));
                }

                // Now replace every "[[" with a literal '['.  We can do this by simply counting the number of '[' between 
                // the first one and the start of the match, since by definition everything in between is an '['.  
                // + 1 because match.Index is also a bracket. 
                int openBracketsInARow = match.Index - indexOfFirstBracketInMatch + 1;

                if (openBracketsInARow % 2 == 0)
                {
                    // even number -- they all go away and the rest of the match is appended literally. 
                    for (int i = 0; i < openBracketsInARow / 2; i++)
                    {
                        builder.AppendTextUnquoted("[");
                    }

                    builder.AppendTextUnquoted(match.Value.Substring(1, match.Value.Length - 1));
                }
                else
                {
                    // odd number -- all but one get merged two at a time, and the rest of the match is substituted. 
                    for (int i = 0; i < (openBracketsInARow - 1) / 2; i++)
                    {
                        builder.AppendTextUnquoted("[");
                    }

                    // Determine which property the user has specified in the template.
                    string propertyName = match.Value.Substring(1, match.Value.Length - 2);
                    if (String.Equals(propertyName, "AllOptions", StringComparison.OrdinalIgnoreCase))
                    {
                        // When [AllOptions] is specified, we append all switch-type options.
                        CommandLineBuilder tempBuilder = new CommandLineBuilder(true);
                        GenerateStandardCommandLine(tempBuilder, true);
                        builder.AppendTextUnquoted(tempBuilder.ToString());
                    }
                    else if (String.Equals(propertyName, "AdditionalOptions", StringComparison.OrdinalIgnoreCase))
                    {
                        BuildAdditionalArgs(builder);
                    }
                    else if (IsPropertySet(propertyName))
                    {
                        CommandLineToolSwitch property = _activeCommandLineToolSwitches[propertyName];

                        // verify the dependencies
                        if (VerifyDependenciesArePresent(property) && VerifyRequiredArgumentsArePresent(property, false))
                        {
                            CommandLineBuilder tempBuilder = new CommandLineBuilder(true);
                            GenerateCommandsAccordingToType(tempBuilder, property, false);
                            builder.AppendTextUnquoted(tempBuilder.ToString());
                        }
                    }
                    else if (!PropertyExists(propertyName))
                    {
                        // If the thing enclosed in square brackets is not in fact a property, we 
                        // don't want to replace it. 
                        builder.AppendTextUnquoted('[' + propertyName + ']');
                    }
                }

                indexOfEndOfLastSubstitution = match.Index + match.Length;
            }

            builder.AppendTextUnquoted(CommandLineTemplate.Substring(indexOfEndOfLastSubstitution, CommandLineTemplate.Length - indexOfEndOfLastSubstitution));
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:100,代码来源:CommandLineGenerator.cs


注:本文中的Microsoft.Build.Utilities.CommandLineBuilder.AppendTextUnquoted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。