Пример #1
0
 protected bool VerifyRequiredArgumentsArePresent(ToolSwitch property, bool throwOnError)
 {
     if (property.ArgumentRelationList != null)
     {
         foreach (ArgumentRelation argumentRelation in property.ArgumentRelationList)
         {
             if (argumentRelation.Required && (property.Value == argumentRelation.Value || argumentRelation.Value == string.Empty) && !this.HasSwitch(argumentRelation.Argument))
             {
                 string message;
                 if (string.Empty == argumentRelation.Value)
                 {
                     message = this.Log.FormatResourceString("MissingRequiredArgument", (object)argumentRelation.Argument, (object)property.Name);
                 }
                 else
                 {
                     message = this.Log.FormatResourceString("MissingRequiredArgumentWithValue", (object)argumentRelation.Argument, (object)property.Name, (object)argumentRelation.Value);
                 }
                 this.Log.LogError(message);
                 if (throwOnError)
                 {
                     throw new LoggerException(message);
                 }
                 return(false);
             }
         }
     }
     return(true);
 }
Пример #2
0
 private static void EmitStringArraySwitch(CommandLineBuilder builder, ToolSwitch toolSwitch, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
 {
     string[] parameters = new string[toolSwitch.StringList.Length];
     for (int index = 0; index < toolSwitch.StringList.Length; ++index)
     {
         string str = !toolSwitch.StringList[index].StartsWith("\"", StringComparison.Ordinal) || !toolSwitch.StringList[index].EndsWith("\"", StringComparison.Ordinal) ? Environment.ExpandEnvironmentVariables(toolSwitch.StringList[index]) : Environment.ExpandEnvironmentVariables(toolSwitch.StringList[index].Substring(1, toolSwitch.StringList[index].Length - 2));
         if (!string.IsNullOrEmpty(str))
         {
             if (format == VCToolTask.CommandLineFormat.ForTracking)
             {
                 str = str.ToUpperInvariant();
             }
             if (escapeFormat.HasFlag((Enum)VCToolTask.EscapeFormat.EscapeTrailingSlash) && !str.Contains(" ") && (str.EndsWith("\\", StringComparison.Ordinal) && !str.EndsWith("\\\\", StringComparison.Ordinal)))
             {
                 str += "\\";
             }
             parameters[index] = str;
         }
     }
     if (string.IsNullOrEmpty(toolSwitch.Separator))
     {
         foreach (string parameter in parameters)
         {
             builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, parameter);
         }
     }
     else
     {
         builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, parameters, toolSwitch.Separator);
     }
 }
Пример #3
0
 private static void EmitTaskItemSwitch(CommandLineBuilder builder, ToolSwitch toolSwitch)
 {
     if (!string.IsNullOrEmpty(toolSwitch.Name))
     {
         builder.AppendSwitch(Environment.ExpandEnvironmentVariables(toolSwitch.Name + toolSwitch.Separator));
     }
 }
Пример #4
0
 private static void EmitStringArraySwitch(CommandLineBuilder builder, ToolSwitch toolSwitch, CommandLineFormat format = 0, EscapeFormat escapeFormat = 0)
 {
     string[] parameters = new string[toolSwitch.StringList.Length];
     char[]   anyOf      = new char[] { ' ', '|', '<', '>', ',', ';', '-', '\r', '\n', '\t', '\f' };
     for (int i = 0; i < toolSwitch.StringList.Length; i++)
     {
         string str = (!toolSwitch.StringList[i].StartsWith("\"", StringComparison.Ordinal) || !toolSwitch.StringList[i].EndsWith("\"", StringComparison.Ordinal)) ? Environment.ExpandEnvironmentVariables(toolSwitch.StringList[i]) : Environment.ExpandEnvironmentVariables(toolSwitch.StringList[i].Substring(1, toolSwitch.StringList[i].Length - 2));
         if (!string.IsNullOrEmpty(str))
         {
             if (format == CommandLineFormat.ForTracking)
             {
                 str = str.ToUpperInvariant();
             }
             if (escapeFormat.HasFlag(EscapeFormat.EscapeTrailingSlash) && ((str.IndexOfAny(anyOf) == -1) && (str.EndsWith(@"\", StringComparison.Ordinal) && !str.EndsWith(@"\\", StringComparison.Ordinal))))
             {
                 str = str + @"\";
             }
             parameters[i] = str;
         }
     }
     if (!string.IsNullOrEmpty(toolSwitch.Separator))
     {
         builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, parameters, toolSwitch.Separator);
     }
     else
     {
         foreach (string str2 in parameters)
         {
             builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, str2);
         }
     }
 }
Пример #5
0
 protected bool VerifyRequiredArgumentsArePresent(ToolSwitch property, bool throwOnError)
 {
     if (property.ArgumentRelationList != null)
     {
         foreach (ArgumentRelation current in property.ArgumentRelationList)
         {
             if ((current.Required && ((property.Value == current.Value) || (current.Value == string.Empty))) && !this.HasSwitch(current.Argument))
             {
                 string message = "";
                 if (string.Empty == current.Value)
                 {
                     object[] args = new object[] { current.Argument, property.Name };
                     message = base.Log.FormatResourceString("MissingRequiredArgument", args);
                 }
                 else
                 {
                     object[] args = new object[] { current.Argument, property.Name, current.Value };
                     message = base.Log.FormatResourceString("MissingRequiredArgumentWithValue", args);
                 }
                 base.Log.LogError(message, new object[0]);
                 if (throwOnError)
                 {
                     throw new LoggerException(message);
                 }
                 return(false);
             }
         }
     }
     return(true);
 }
Пример #6
0
        protected virtual string GenerateResponseFileCommandsExceptSwitches(
            string[] switchesToRemove,
            CommandLineFormat format  = CommandLineFormat.ForBuildLog,
            EscapeFormat escapeFormat = EscapeFormat.Default)
        {
            this.AddDefaultsToActiveSwitchList();
            this.AddFallbacksToActiveSwitchList();
            this.PostProcessSwitchList();

            CommandLineBuilder commandLineBuilder = new CommandLineBuilder(true);

            bool hasBuiltAdditionalArgs = false;

            foreach (string switchOrder in this.SwitchOrderList)
            {
                if (this.IsPropertySet(switchOrder))
                {
                    ToolSwitch activeToolSwitch = this.activeToolSwitches[switchOrder];
                    if (this.VerifyDependenciesArePresent(activeToolSwitch) && this.VerifyRequiredArgumentsArePresent(activeToolSwitch, false))
                    {
                        bool notRemove = true;

                        if (switchesToRemove != null)
                        {
                            foreach (string strRemove in switchesToRemove)
                            {
                                if (switchOrder.Equals(strRemove, StringComparison.OrdinalIgnoreCase))
                                {
                                    notRemove = false;
                                    break;
                                }
                            }
                        }

                        if (notRemove)
                        {
                            this.GenerateCommandsAccordingToType(commandLineBuilder, activeToolSwitch, false, format, escapeFormat);
                        }
                    }
                }
                else if (string.Equals(switchOrder, "additionaloptions", StringComparison.OrdinalIgnoreCase))
                {
                    this.BuildAdditionalArgs(commandLineBuilder);
                    hasBuiltAdditionalArgs = true;
                }
                else if (string.Equals(switchOrder, "AlwaysAppend", StringComparison.OrdinalIgnoreCase))
                {
                    commandLineBuilder.AppendSwitch(this.AlwaysAppend);
                }
            }

            if (!hasBuiltAdditionalArgs)
            {
                this.BuildAdditionalArgs(commandLineBuilder);
            }

            return(commandLineBuilder.ToString());
        }
Пример #7
0
 protected void RemoveSwitchToolBasedOnValue(string switchValue)
 {
     if ((this.ActiveToolSwitchesValues.Count > 0) && this.ActiveToolSwitchesValues.ContainsKey("/" + switchValue))
     {
         ToolSwitch switch2 = this.ActiveToolSwitchesValues["/" + switchValue];
         if (switch2 != null)
         {
             this.ActiveToolSwitches.Remove(switch2.Name);
         }
     }
 }
Пример #8
0
        protected void GenerateCommandsAccordingToType(CommandLineBuilder builder, ToolSwitch toolSwitch, bool recursive, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
        {
            if (toolSwitch.Parents.Count > 0 && !recursive)
            {
                return;
            }
            switch (toolSwitch.Type)
            {
            case ToolSwitchType.Boolean:
                this.EmitBooleanSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.Integer:
                this.EmitIntegerSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.String:
                this.EmitStringSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.StringArray:
                VCToolTask.EmitStringArraySwitch(builder, toolSwitch, VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat.Default);
                break;

            case ToolSwitchType.File:
                VCToolTask.EmitFileSwitch(builder, toolSwitch, format);
                break;

            case ToolSwitchType.Directory:
                VCToolTask.EmitDirectorySwitch(builder, toolSwitch, format);
                break;

            case ToolSwitchType.ITaskItem:
                VCToolTask.EmitTaskItemSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.ITaskItemArray:
                VCToolTask.EmitTaskItemArraySwitch(builder, toolSwitch, format);
                break;

            case ToolSwitchType.AlwaysAppend:
                VCToolTask.EmitAlwaysAppendSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.StringPathArray:
                VCToolTask.EmitStringArraySwitch(builder, toolSwitch, format, escapeFormat);
                break;

            default:
                ErrorUtilities.VerifyThrow(false, "InternalError");
                break;
            }
        }
Пример #9
0
 private void EmitReversibleBooleanSwitch(CommandLineBuilder builder, ToolSwitch toolSwitch)
 {
     if (!string.IsNullOrEmpty(toolSwitch.ReverseSwitchValue))
     {
         StringBuilder builder2 = new StringBuilder(this.GetEffectiveArgumentsValues(toolSwitch));
         builder2.Insert(0, toolSwitch.BooleanValue ? toolSwitch.TrueSuffix : toolSwitch.FalseSuffix);
         builder2.Insert(0, toolSwitch.Separator);
         builder2.Insert(0, toolSwitch.TrueSuffix);
         builder2.Insert(0, toolSwitch.ReverseSwitchValue);
         builder.AppendSwitch(builder2.ToString());
     }
 }
Пример #10
0
 protected void AddActiveSwitchToolValue(ToolSwitch switchToAdd)
 {
     if ((switchToAdd.Type == ToolSwitchType.Boolean) && !switchToAdd.BooleanValue)
     {
         if (switchToAdd.ReverseSwitchValue != string.Empty)
         {
             this.ActiveToolSwitchesValues.Add(switchToAdd.ReverseSwitchValue, switchToAdd);
         }
     }
     else if (switchToAdd.SwitchValue != string.Empty)
     {
         this.ActiveToolSwitchesValues.Add(switchToAdd.SwitchValue, switchToAdd);
     }
 }
Пример #11
0
 private void EmitIntegerSwitch(CommandLineBuilder builder, ToolSwitch toolSwitch)
 {
     if (toolSwitch.IsValid)
     {
         if (!string.IsNullOrEmpty(toolSwitch.Separator))
         {
             builder.AppendSwitch(toolSwitch.SwitchValue + toolSwitch.Separator + toolSwitch.Number.ToString(CultureInfo.InvariantCulture) + this.GetEffectiveArgumentsValues(toolSwitch));
         }
         else
         {
             builder.AppendSwitch(toolSwitch.SwitchValue + toolSwitch.Number.ToString(CultureInfo.InvariantCulture) + this.GetEffectiveArgumentsValues(toolSwitch));
         }
     }
 }
Пример #12
0
 private static void EmitDirectorySwitch(CommandLineBuilder builder, ToolSwitch toolSwitch, CommandLineFormat format = 0)
 {
     if (!string.IsNullOrEmpty(toolSwitch.SwitchValue))
     {
         if (format == CommandLineFormat.ForBuildLog)
         {
             builder.AppendSwitch(toolSwitch.SwitchValue + toolSwitch.Separator);
         }
         else
         {
             builder.AppendSwitch(toolSwitch.SwitchValue.ToUpperInvariant() + toolSwitch.Separator);
         }
     }
 }
Пример #13
0
        protected void RemoveSwitchToolBasedOnValue(string switchValue)
        {
            if (this.ActiveToolSwitchesValues.Count <= 0 || !this.ActiveToolSwitchesValues.ContainsKey("/" + switchValue))
            {
                return;
            }
            ToolSwitch toolSwitch = this.ActiveToolSwitchesValues["/" + switchValue];

            if (toolSwitch == null)
            {
                return;
            }
            this.ActiveToolSwitches.Remove(toolSwitch.Name);
        }
Пример #14
0
        protected virtual bool VerifyDependenciesArePresent(ToolSwitch value)
        {
            if (value.Parents.Count <= 0)
            {
                return(true);
            }
            bool flag = false;

            foreach (string propertyName in value.Parents)
            {
                flag = flag || this.HasSwitch(propertyName);
            }
            return(flag);
        }
Пример #15
0
        protected virtual string GenerateResponseFileCommandsExceptSwitches(string[] switchesToRemove, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
        {
            bool flag1 = false;

            this.AddDefaultsToActiveSwitchList();
            this.AddFallbacksToActiveSwitchList();
            this.PostProcessSwitchList();
            CommandLineBuilder commandLineBuilder = new CommandLineBuilder(true);

            foreach (string index in this.SwitchOrderList)
            {
                if (this.IsPropertySet(index))
                {
                    ToolSwitch toolSwitch = this.activeToolSwitches[index];
                    if (this.VerifyDependenciesArePresent(toolSwitch) && this.VerifyRequiredArgumentsArePresent(toolSwitch, false))
                    {
                        bool flag2 = true;
                        if (switchesToRemove != null)
                        {
                            foreach (string str in switchesToRemove)
                            {
                                if (index.Equals(str, StringComparison.OrdinalIgnoreCase))
                                {
                                    flag2 = false;
                                    break;
                                }
                            }
                        }
                        if (flag2)
                        {
                            this.GenerateCommandsAccordingToType(commandLineBuilder, toolSwitch, false, format, escapeFormat);
                        }
                    }
                }
                else if (string.Equals(index, "additionaloptions", StringComparison.OrdinalIgnoreCase))
                {
                    this.BuildAdditionalArgs(commandLineBuilder);
                    flag1 = true;
                }
                else if (string.Equals(index, "AlwaysAppend", StringComparison.OrdinalIgnoreCase))
                {
                    commandLineBuilder.AppendSwitch(this.AlwaysAppend);
                }
            }
            if (!flag1)
            {
                this.BuildAdditionalArgs(commandLineBuilder);
            }
            return(commandLineBuilder.ToString());
        }
Пример #16
0
 private static void EmitFileSwitch(CommandLineBuilder builder, ToolSwitch toolSwitch, CommandLineFormat format = 0)
 {
     if (!string.IsNullOrEmpty(toolSwitch.Value))
     {
         string parameter = Environment.ExpandEnvironmentVariables(toolSwitch.Value).Trim();
         if (format == CommandLineFormat.ForTracking)
         {
             parameter = parameter.ToUpperInvariant();
         }
         if (!parameter.StartsWith("\"", StringComparison.Ordinal))
         {
             parameter = "\"" + parameter;
             parameter = (!parameter.EndsWith(@"\", StringComparison.Ordinal) || parameter.EndsWith(@"\\", StringComparison.Ordinal)) ? (parameter + "\"") : (parameter + "\\\"");
         }
         builder.AppendSwitchUnquotedIfNotNull(toolSwitch.SwitchValue + toolSwitch.Separator, parameter);
     }
 }
Пример #17
0
 private void EmitBooleanSwitch(CommandLineBuilder builder, ToolSwitch toolSwitch)
 {
     if (toolSwitch.BooleanValue)
     {
         if (string.IsNullOrEmpty(toolSwitch.SwitchValue))
         {
             return;
         }
         StringBuilder stringBuilder = new StringBuilder(this.GetEffectiveArgumentsValues(toolSwitch));
         stringBuilder.Insert(0, toolSwitch.Separator);
         stringBuilder.Insert(0, toolSwitch.TrueSuffix);
         stringBuilder.Insert(0, toolSwitch.SwitchValue);
         builder.AppendSwitch(stringBuilder.ToString());
     }
     else
     {
         this.EmitReversibleBooleanSwitch(builder, toolSwitch);
     }
 }
Пример #18
0
 protected void AddActiveSwitchToolValue(ToolSwitch switchToAdd)
 {
     if (switchToAdd.Type != ToolSwitchType.Boolean || switchToAdd.BooleanValue)
     {
         if (!(switchToAdd.SwitchValue != string.Empty))
         {
             return;
         }
         this.ActiveToolSwitchesValues.Add(switchToAdd.SwitchValue, switchToAdd);
     }
     else
     {
         if (!(switchToAdd.ReverseSwitchValue != string.Empty))
         {
             return;
         }
         this.ActiveToolSwitchesValues.Add(switchToAdd.ReverseSwitchValue, switchToAdd);
     }
 }
Пример #19
0
        private void EmitStringSwitch(CommandLineBuilder builder, ToolSwitch toolSwitch)
        {
            string        switchName = string.Empty + toolSwitch.SwitchValue + toolSwitch.Separator;
            StringBuilder builder2   = new StringBuilder(this.GetEffectiveArgumentsValues(toolSwitch));
            string        str2       = toolSwitch.Value;

            if (!toolSwitch.MultipleValues)
            {
                str2 = str2.Trim();
                if (!str2.StartsWith("\"", StringComparison.Ordinal))
                {
                    str2 = "\"" + str2;
                    str2 = (!str2.EndsWith(@"\", StringComparison.Ordinal) || str2.EndsWith(@"\\", StringComparison.Ordinal)) ? (str2 + "\"") : (str2 + "\\\"");
                }
                builder2.Insert(0, str2);
            }
            if ((switchName.Length != 0) || (builder2.ToString().Length != 0))
            {
                builder.AppendSwitchUnquotedIfNotNull(switchName, builder2.ToString());
            }
        }
Пример #20
0
        private void EmitStringSwitch(CommandLineBuilder builder, ToolSwitch toolSwitch)
        {
            string        switchName    = string.Empty + toolSwitch.SwitchValue + toolSwitch.Separator;
            StringBuilder stringBuilder = new StringBuilder(this.GetEffectiveArgumentsValues(toolSwitch));
            string        str1          = toolSwitch.Value;

            if (!toolSwitch.MultipleValues)
            {
                string str2 = str1.Trim();
                if (!str2.StartsWith("\"", StringComparison.Ordinal))
                {
                    string str3 = "\"" + str2;
                    str2 = !str3.EndsWith("\\", StringComparison.Ordinal) || str3.EndsWith("\\\\", StringComparison.Ordinal) ? str3 + "\"" : str3 + "\\\"";
                }
                stringBuilder.Insert(0, str2);
            }
            if (switchName.Length == 0 && stringBuilder.ToString().Length == 0)
            {
                return;
            }
            builder.AppendSwitchUnquotedIfNotNull(switchName, stringBuilder.ToString());
        }
Пример #21
0
 private static void EmitTaskItemArraySwitch(CommandLineBuilder builder, ToolSwitch toolSwitch, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog)
 {
     if (string.IsNullOrEmpty(toolSwitch.Separator))
     {
         foreach (ITaskItem taskItem in toolSwitch.TaskItemArray)
         {
             builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, Environment.ExpandEnvironmentVariables(taskItem.ItemSpec));
         }
     }
     else
     {
         ITaskItem[] parameters = new ITaskItem[toolSwitch.TaskItemArray.Length];
         for (int index = 0; index < toolSwitch.TaskItemArray.Length; ++index)
         {
             parameters[index] = (ITaskItem) new TaskItem(Environment.ExpandEnvironmentVariables(toolSwitch.TaskItemArray[index].ItemSpec));
             if (format == VCToolTask.CommandLineFormat.ForTracking)
             {
                 parameters[index].ItemSpec = parameters[index].ItemSpec.ToUpperInvariant();
             }
         }
         builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, parameters, toolSwitch.Separator);
     }
 }
Пример #22
0
        protected string GetEffectiveArgumentsValues(ToolSwitch property)
        {
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = false;
            string        str           = string.Empty;

            if (property.ArgumentRelationList != null)
            {
                foreach (ArgumentRelation argumentRelation in property.ArgumentRelationList)
                {
                    if (str != string.Empty && str != argumentRelation.Argument)
                    {
                        flag = true;
                    }
                    str = argumentRelation.Argument;
                    if ((property.Value == argumentRelation.Value || argumentRelation.Value == string.Empty || property.Type == ToolSwitchType.Boolean && property.BooleanValue) && this.HasSwitch(argumentRelation.Argument))
                    {
                        ToolSwitch toolSwitch = this.ActiveToolSwitches[argumentRelation.Argument];
                        stringBuilder.Append(argumentRelation.Separator);
                        CommandLineBuilder builder = new CommandLineBuilder();
                        this.GenerateCommandsAccordingToType(builder, toolSwitch, true, VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat.Default);
                        stringBuilder.Append(builder.ToString());
                    }
                }
            }
            CommandLineBuilder commandLineBuilder = new CommandLineBuilder();

            if (flag)
            {
                commandLineBuilder.AppendSwitchIfNotNull("", stringBuilder.ToString());
            }
            else
            {
                commandLineBuilder.AppendSwitchUnquotedIfNotNull("", stringBuilder.ToString());
            }
            return(commandLineBuilder.ToString());
        }
Пример #23
0
        protected string GetEffectiveArgumentsValues(ToolSwitch property)
        {
            StringBuilder builder  = new StringBuilder();
            bool          flag     = false;
            string        argument = string.Empty;

            if (property.ArgumentRelationList != null)
            {
                foreach (ArgumentRelation relation in property.ArgumentRelationList)
                {
                    if ((argument != string.Empty) && (argument != relation.Argument))
                    {
                        flag = true;
                    }
                    argument = relation.Argument;
                    if (((property.Value == relation.Value) || ((relation.Value == string.Empty) || ((property.Type == ToolSwitchType.Boolean) && property.BooleanValue))) && this.HasSwitch(relation.Argument))
                    {
                        builder.Append(relation.Separator);
                        CommandLineBuilder builder3 = new CommandLineBuilder();
                        this.GenerateCommandsAccordingToType(builder3, this.ActiveToolSwitches[relation.Argument], true, CommandLineFormat.ForBuildLog, EscapeFormat.Default);
                        builder.Append(builder3.ToString());
                    }
                }
            }
            CommandLineBuilder builder2 = new CommandLineBuilder();

            if (flag)
            {
                builder2.AppendSwitchIfNotNull("", builder.ToString());
            }
            else
            {
                builder2.AppendSwitchUnquotedIfNotNull("", builder.ToString());
            }
            return(builder2.ToString());
        }
Пример #24
0
 private static void EmitAlwaysAppendSwitch(CommandLineBuilder builder, ToolSwitch toolSwitch)
 {
     builder.AppendSwitch(toolSwitch.Name);
 }
Пример #25
0
        protected virtual void GenerateCommandsAccordingToType(CommandLineBuilder builder, ToolSwitch toolSwitch, bool recursive, CommandLineFormat format = 0, EscapeFormat escapeFormat = 0)
        {
            if ((toolSwitch.Parents.Count <= 0) || recursive)
            {
                switch (toolSwitch.Type)
                {
                case ToolSwitchType.Boolean:
                    this.EmitBooleanSwitch(builder, toolSwitch);
                    return;

                case ToolSwitchType.Integer:
                    this.EmitIntegerSwitch(builder, toolSwitch);
                    return;

                case ToolSwitchType.String:
                    this.EmitStringSwitch(builder, toolSwitch);
                    return;

                case ToolSwitchType.StringArray:
                    EmitStringArraySwitch(builder, toolSwitch, CommandLineFormat.ForBuildLog, EscapeFormat.Default);
                    return;

                case ToolSwitchType.File:
                    EmitFileSwitch(builder, toolSwitch, format);
                    return;

                case ToolSwitchType.Directory:
                    EmitDirectorySwitch(builder, toolSwitch, format);
                    return;

                case ToolSwitchType.ITaskItem:
                    EmitTaskItemSwitch(builder, toolSwitch);
                    return;

                case ToolSwitchType.ITaskItemArray:
                    EmitTaskItemArraySwitch(builder, toolSwitch, format);
                    return;

                case ToolSwitchType.AlwaysAppend:
                    EmitAlwaysAppendSwitch(builder, toolSwitch);
                    return;

                case ToolSwitchType.StringPathArray:
                    EmitStringArraySwitch(builder, toolSwitch, format, escapeFormat);
                    return;
                }
                ErrorUtilities.VerifyThrow(false, "InternalError");
            }
        }