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


C# CommandLineBuilder.AppendSwitchUnquotedIfNotNull方法代码示例

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


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

示例1: TestAppendSwitchUnquotedIfNotNull1

		public void TestAppendSwitchUnquotedIfNotNull1 ()
		{
			clb = new CommandLineBuilder ();
			
			clb.AppendSwitchUnquotedIfNotNull (null, "parameter");
		}
开发者ID:symform,项目名称:mono,代码行数:6,代码来源:CommandLineBuilderTest.cs

示例2: GenerateArgumentBool

 private void GenerateArgumentBool(CommandLineBuilder builder, BaseProperty property, string value)
 {
     if (value == "true")
     {
         builder.AppendSwitchUnquotedIfNotNull(m_parsedBuildRule.SwitchPrefix, property.Switch);
     }
     else if (value == "false" && ((BoolProperty)property).ReverseSwitch != null)
     {
         builder.AppendSwitchUnquotedIfNotNull(m_parsedBuildRule.SwitchPrefix, ((BoolProperty)property).ReverseSwitch);
     }
 }
开发者ID:udiavr,项目名称:nativeclient-sdk,代码行数:11,代码来源:XamlParser.cs

示例3: GenerateArgumentEnum

 private void GenerateArgumentEnum(CommandLineBuilder builder, BaseProperty property, string value)
 {
     var result = ((EnumProperty)property).AdmissibleValues.Find(x => (x.Name == value));
     if (result != null)
     {
         builder.AppendSwitchUnquotedIfNotNull(m_parsedBuildRule.SwitchPrefix, result.Switch);
     }
 }
开发者ID:udiavr,项目名称:nativeclient-sdk,代码行数:8,代码来源:XamlParser.cs

示例4: TestAppendUnquotedSwitchIfNotNull10

		public void TestAppendUnquotedSwitchIfNotNull10 ()
		{
			clb = new CommandLineBuilder ();
			
			clb.AppendSwitchUnquotedIfNotNull ("/switch:", (ITaskItem[]) null, ";");
			
			Assert.AreEqual (String.Empty, clb.ToString (), "A1");
			
			clb.AppendSwitchUnquotedIfNotNull ("/switch:", items, ";");
			
			Assert.AreEqual ("/switch:a;b", clb.ToString (), "A2");
		}
开发者ID:symform,项目名称:mono,代码行数:12,代码来源:CommandLineBuilderTest.cs

示例5: AppendIntegerSwitch

		protected void AppendIntegerSwitch(CommandLineBuilder commandLine, string @switch, int value)
		{
			commandLine.AppendSwitchUnquotedIfNotNull(@switch, value.ToString(NumberFormatInfo.InvariantInfo));
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:4,代码来源:MyToolTask.cs

示例6: TestAppendSwitchUnquotedIfNotNull4

		public void TestAppendSwitchUnquotedIfNotNull4 ()
		{
			string name = "/switch:";
			
			clb = new CommandLineBuilder ();
			
			clb.AppendSwitchUnquotedIfNotNull (name, (ITaskItem) null);
			
			Assert.AreEqual (String.Empty, clb.ToString (), "A1");
			
			clb.AppendSwitchUnquotedIfNotNull (name, items [0]);
			
			Assert.AreEqual (name + items [0].ItemSpec, clb.ToString (), "A2");
		}
开发者ID:symform,项目名称:mono,代码行数:14,代码来源:CommandLineBuilderTest.cs

示例7: TestAppendSwitchUnquotedIfNotNull8

		public void TestAppendSwitchUnquotedIfNotNull8 ()
		{
			clb = new CommandLineBuilder ();
			
			clb.AppendSwitchUnquotedIfNotNull (null, items, "delimiter");
		}
开发者ID:symform,项目名称:mono,代码行数:6,代码来源:CommandLineBuilderTest.cs

示例8: AppendIntValue

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

    private void AppendIntValue (CommandLineBuilder builder, BaseProperty property, string value)
    {
      value = value.Trim ();

      string switchName = m_parsedBuildRule.SwitchPrefix + property.Switch;

      switchName += property.Separator;

      builder.AppendSwitchUnquotedIfNotNull (switchName, value);
    }
开发者ID:ashumeow,项目名称:android-plus-plus,代码行数:14,代码来源:XamlParser.cs

示例9: AppendSwitchWithParameterArrayNoQuotingTaskItem

        public void AppendSwitchWithParameterArrayNoQuotingTaskItem()
        {
            CommandLineBuilder c = new CommandLineBuilder();
            c.AppendSwitch("/something");
            c.AppendSwitchUnquotedIfNotNull("/switch:", new TaskItem[] { new TaskItem("Mer cury.cs"), null, new TaskItem("Ve nus.cs"), new TaskItem("Ear th.cs") }, ",");

            // Managed compilers use this function to append sources files.
            Assert.Equal("/something /switch:Mer cury.cs,,Ve nus.cs,Ear th.cs", c.ToString());
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:9,代码来源:CommandLineBuilder_Tests.cs

示例10: 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

示例11: 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

示例12: EmitStringSwitch

        /// <summary>
        /// Generates the switches for switches that either have literal strings appended, or have 
        /// different switches based on what the property is set to.
        /// </summary>
        /// <remarks>The string switch emits a switch that depends on what the parameter is set to, with and
        /// arguments
        /// e.g., Optimization = "Full" will emit /Ox, whereas Optimization = "Disabled" will emit /Od</remarks>
        /// <param name="clb"></param>
        /// <param name="toolSwitch"></param>
        private void EmitStringSwitch(CommandLineBuilder clb, ToolSwitch toolSwitch)
        {
            String strSwitch = String.Empty;
            strSwitch += toolSwitch.SwitchValue + toolSwitch.Separator;
            
            StringBuilder val = new StringBuilder(GetEffectiveArgumentsValues(toolSwitch));
            String str = toolSwitch.Value;

            if (!toolSwitch.MultiValues)
            {

                str.Trim();

                if (!str.StartsWith("\""))
                {
                    str = "\"" + str;
                    if (str.EndsWith("\\") && !str.EndsWith("\\\\"))
                        str += "\\\"";
                    else
                        str += "\"";
                }
                val.Insert(0, str);
            }

            if ((strSwitch.Length == 0) && (val.ToString().Length == 0))
                return;

            clb.AppendSwitchUnquotedIfNotNull(strSwitch, val.ToString());
            
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:39,代码来源:DataDrivenToolTask.cs

示例13: EmitFileSwitch

        /// <summary>
        /// Generates the switches that have filenames attached to the end
        /// </summary>
        /// <remarks>For file switches (e.g., PrecompiledHeaderFile), the toolSwitchName (if it exists) is emitted
        /// along with the FileName which may or may not have quotes</remarks>
        /// e.g., PrecompiledHeaderFile = "File" will emit /FpFile
        /// <param name="clb"></param>
        /// <param name="toolSwitch"></param>
        private static void EmitFileSwitch(CommandLineBuilder clb, ToolSwitch toolSwitch)
        {
            if (!String.IsNullOrEmpty(toolSwitch.Value))
            {
                String str = toolSwitch.Value;
                str.Trim();

                if (!str.StartsWith("\""))
                {
                    str = "\"" + str;
                    if (str.EndsWith("\\") && !str.EndsWith("\\\\"))
                        str += "\\\"";
                    else
                        str += "\"";
                }

                //we want quotes always, AppendSwitchIfNotNull will add them on as needed bases 
                clb.AppendSwitchUnquotedIfNotNull(toolSwitch.SwitchValue + toolSwitch.Separator, str);
            }
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:28,代码来源:DataDrivenToolTask.cs

示例14: EmitStringSwitch

        /// <summary>
        /// Generates the switches for switches that either have literal strings appended, or have
        /// different switches based on what the property is set to.
        /// </summary>
        /// <remarks>The string switch emits a switch that depends on what the parameter is set to, with and
        /// arguments
        /// e.g., Optimization = "Full" will emit /Ox, whereas Optimization = "Disabled" will emit /Od</remarks>
        private void EmitStringSwitch(CommandLineBuilder clb, CommandLineToolSwitch commandLineToolSwitch)
        {
            if (PerformSwitchValueSubstition(clb, commandLineToolSwitch, commandLineToolSwitch.Value))
            {
                return;
            }

            String strSwitch = String.Empty;
            strSwitch += commandLineToolSwitch.SwitchValue + commandLineToolSwitch.Separator;

            String str = commandLineToolSwitch.Value;
            if (!commandLineToolSwitch.AllowMultipleValues)
            {
                str = str.Trim();
                if (str.Contains(' '))
                {
                    if (!str.StartsWith("\"", StringComparison.OrdinalIgnoreCase))
                    {
                        str = "\"" + str;
                        if (str.EndsWith(@"\", StringComparison.OrdinalIgnoreCase) && !str.EndsWith(@"\\", StringComparison.OrdinalIgnoreCase))
                        {
                            str += "\\\"";
                        }
                        else
                        {
                            str += "\"";
                        }
                    }
                }
            }
            else
            {
                strSwitch = String.Empty;
                str = commandLineToolSwitch.SwitchValue;
                string arguments = GatherArguments(commandLineToolSwitch.Name, commandLineToolSwitch.Arguments, commandLineToolSwitch.Separator);
                if (!String.IsNullOrEmpty(arguments))
                {
                    str = str + commandLineToolSwitch.Separator + arguments;
                }
            }

            clb.AppendSwitchUnquotedIfNotNull(strSwitch, str);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:50,代码来源:CommandLineGenerator.cs

示例15: TestAppendSwitchUnquotedIfNotNull2

		public void TestAppendSwitchUnquotedIfNotNull2 ()
		{
			string name = "/switch:";
			string parameter = "parameter";
			
			clb = new CommandLineBuilder ();
			
			clb.AppendSwitchUnquotedIfNotNull (name, (string) null);
			
			Assert.AreEqual (String.Empty, clb.ToString (), "A1");
			
			clb.AppendSwitchUnquotedIfNotNull (name, parameter);
			
			Assert.AreEqual (name + parameter, clb.ToString (), "A2");
		}
开发者ID:symform,项目名称:mono,代码行数:15,代码来源:CommandLineBuilderTest.cs


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