/// <summary> /// Instantiate a new Candle class. /// </summary> private Candle() { this.sourceFiles = new ArrayList(); this.parameters = new Hashtable(); this.includeSearchPaths = new StringCollection(); this.extensionList = new StringCollection(); this.showLogo = true; this.pedanticLevel = PedanticLevel.Easy; this.messageHandler = new MessageHandler("CNDL", "candle.exe"); // set the message handler this.Message += new MessageEventHandler(this.messageHandler.Display); }
/// <summary> /// Instantiate a new Candle class. /// </summary> private Candle() { this.sourceFiles = new ArrayList(); this.parameters = new Hashtable(); this.includeSearchPaths = new StringCollection(); this.extensionList = new StringCollection(); this.showLogo = true; this.pedanticLevel = PedanticLevel.Easy; this.messageHandler = new MessageHandler("CNDL", "candle.exe"); // set the message handler this.Message += new MessageEventHandler(this.messageHandler.Display); }
/// <summary> /// Instantiate a new Light class. /// </summary> private Light() { this.objectFiles = new ArrayList(); this.sourcePaths = new StringCollection(); this.basePaths = new StringCollection(); this.extensionList = new StringCollection(); this.showLogo = true; this.tidy = true; this.pedanticLevel = PedanticLevel.Easy; this.localizationFiles = new StringCollection(); this.messageHandler = new MessageHandler("LGHT", "light.exe"); // set the message handler this.Message += new MessageEventHandler(this.messageHandler.Display); }
/// <summary> /// Instantiate a new Light class. /// </summary> private Light() { this.objectFiles = new ArrayList(); this.sourcePaths = new StringCollection(); this.basePaths = new StringCollection(); this.extensionList = new StringCollection(); this.showLogo = true; this.tidy = true; this.pedanticLevel = PedanticLevel.Easy; this.localizationFiles = new StringCollection(); this.messageHandler = new MessageHandler("LGHT", "light.exe"); // set the message handler this.Message += new MessageEventHandler(this.messageHandler.Display); }
/// <summary> /// Parse the commandline arguments. /// </summary> /// <param name="args">Commandline arguments.</param> private void ParseCommandLine(string[] args) { for (int i = 0; i < args.Length; ++i) { string arg = args[i]; if (null == arg || 0 == arg.Length) // skip blank arguments { continue; } if ('-' == arg[0] || '/' == arg[0]) { string parameter = arg.Substring(1); if ('d' == parameter[0]) { parameter = arg.Substring(2); string[] value = parameter.Split("=".ToCharArray(), 2); if (1 == value.Length) { this.parameters.Add(value[0], ""); } else { this.parameters.Add(value[0], value[1]); } } else if ('I' == parameter[0]) { this.includeSearchPaths.Add(parameter.Substring(1)); } else if ("ext" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.TypeSpecificationForExtensionRequired("-ext")); return; } this.extensionList.Add(args[i]); } else if ("nologo" == parameter) { this.showLogo = false; } else if ("o" == parameter || "out" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.FileOrDirectoryPathRequired(String.Concat("-", parameter))); return; } if (0 <= args[i].IndexOf('\"')) { this.OnMessage(WixErrors.PathCannotContainQuote(args[i])); return; } else if (args[i].EndsWith("\\") || args[i].EndsWith("/")) { this.outputDirectory = new DirectoryInfo(args[i]); } else { this.outputFile = new FileInfo(args[i]); } } else if (parameter.StartsWith("pedantic")) { if ("pedantic:easy" == parameter) { this.pedanticLevel = PedanticLevel.Easy; } else if ("pedantic:heroic" == parameter) { this.pedanticLevel = PedanticLevel.Heroic; } else if ("pedantic:legendary" == parameter) { this.pedanticLevel = PedanticLevel.Legendary; } else // default is heroic { this.pedanticLevel = PedanticLevel.Heroic; } } else if ('p' == parameter[0]) { String file = arg.Substring(2); this.preprocessFile = file; this.preprocessToStdout = (0 == file.Length); } else if ("ss" == parameter) { this.suppressSchema = true; } else if ("sw" == parameter) { this.messageHandler.MinimumWarningLevel = WarningLevel.Deprecated; } else if ('s' == parameter[0] && 'w' == parameter[1]) { try { int suppressWarning = Convert.ToInt32(parameter.Substring(2), CultureInfo.InvariantCulture.NumberFormat); if (0 >= suppressWarning) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } this.messageHandler.SuppressWarningMessage(suppressWarning); } catch (FormatException) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } } else if ("ust" == parameter) { this.useSmallTables = true; } else if ("trace" == parameter) { this.messageHandler.SourceTrace = true; } else if ('v' == parameter[0]) { if (parameter.Length > 1) { parameter = arg.Substring(2); try { int userVerbosityLevel = Convert.ToInt32(parameter, CultureInfo.InvariantCulture.NumberFormat); if (0 > userVerbosityLevel || 3 < userVerbosityLevel) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); continue; } this.messageHandler.MaximumVerbosityLevel = (VerboseLevel)userVerbosityLevel; } catch (FormatException) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); } } else // verbosity level not specified; use default { this.messageHandler.MaximumVerbosityLevel = VerboseLevel.Verbose; } } else if ('w' == parameter[0]) { parameter = arg.Substring(2); if ("x" == parameter) { this.messageHandler.WarningAsError = true; } else { try { int userWarningLevel = Convert.ToInt32(parameter, CultureInfo.InvariantCulture.NumberFormat); if (0 > userWarningLevel || 3 < userWarningLevel) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); continue; } this.messageHandler.MinimumWarningLevel = (WarningLevel)userWarningLevel; } catch (FormatException) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); } } } else if ("zs" == parameter) { this.schemaOnly = true; } else if ("?" == parameter || "help" == parameter) { this.showHelp = true; } } else if ('@' == arg[0]) { this.ParseCommandLine(Common.ParseResponseFile(arg.Substring(1))); } else { this.sourceFiles.AddRange(Common.GetFiles(arg, "Source")); } } return; }
/// <summary> /// Parse the commandline arguments. /// </summary> /// <param name="args">Commandline arguments.</param> private void ParseCommandLine(string[] args) { for (int i = 0; i < args.Length; ++i) { string arg = args[i]; if (null == arg || 0 == arg.Length) // skip blank arguments { continue; } if ('-' == arg[0] || '/' == arg[0]) { string parameter = arg.Substring(1); if ("o" == parameter || "out" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.FilePathRequired(String.Concat("-", parameter))); return; } this.outputFile = new FileInfo(args[i]); } else if ("ai" == parameter) { this.allowIdenticalRows = true; } else if ("au" == parameter) { this.allowUnresolvedReferences = true; } else if ("b" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.DirectoryPathRequired(String.Concat("-", parameter))); return; } this.basePaths.Add(args[i]); } else if ("cc" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.DirectoryPathRequired(String.Concat("-", parameter))); return; } this.cabCachePath = args[i]; } else if ("ext" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.TypeSpecificationForExtensionRequired("-ext")); return; } this.extensionList.Add(args[i]); } else if ("fv" == parameter) { this.setMsiAssemblyNameFileVersion = true; } else if ("i" == parameter) { ++i; if (!((args[i]).EndsWith("\\"))) { this.imagebaseOutputPath = args[i] + "\\"; } else { this.imagebaseOutputPath = args[i]; } } else if ("nologo" == parameter) { this.showLogo = false; } else if ("notidy" == parameter) { this.tidy = false; } else if ("loc" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.FilePathRequired(String.Concat("-", parameter))); return; } this.localizationFiles.Add(args[i]); } else if ("xo" == parameter) { this.outputXml = true; } else if (parameter.StartsWith("pedantic")) { if ("pedantic:easy" == parameter) { this.pedanticLevel = PedanticLevel.Easy; } else if ("pedantic:heroic" == parameter) { this.pedanticLevel = PedanticLevel.Heroic; } else if ("pedantic:legendary" == parameter) { this.pedanticLevel = PedanticLevel.Legendary; } else // default is heroic { this.pedanticLevel = PedanticLevel.Heroic; } } else if ("reusecab" == parameter) { this.reuseCabinets = true; } else if ("sa" == parameter) { this.suppressAssemblies = true; } else if ("sacl" == parameter) { this.suppressAclReset = true; } else if ("sadmin" == parameter) { this.suppressAdminSequence = true; } else if ("sadv" == parameter) { this.suppressAdvertiseSequence = true; } else if ("sf" == parameter) { this.suppressFiles = true; } else if ("sh" == parameter) { this.suppressFileHashAndInfo = true; } else if ("sl" == parameter) { this.suppressLayout = true; } else if ("ss" == parameter) { this.suppressSchema = true; } else if ("sui" == parameter) { this.suppressUISequence = true; } else if ("sv" == parameter) { this.suppressVersionCheck = true; } else if ("sw" == parameter) { this.messageHandler.MinimumWarningLevel = WarningLevel.Deprecated; } else if ('s' == parameter[0] && 'w' == parameter[1]) { try { int suppressWarning = Convert.ToInt32(parameter.Substring(2), CultureInfo.InvariantCulture.NumberFormat); if (0 >= suppressWarning) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } this.messageHandler.SuppressWarningMessage(suppressWarning); } catch (FormatException) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } } else if ("ts" == parameter) { this.sectionIdOnTuples = true; } else if ("ust" == parameter) { this.useSmallTables = true; } else if ('v' == parameter[0]) { if (parameter.Length > 1) { parameter = arg.Substring(2); try { int userVerbosityLevel = Convert.ToInt32(parameter, CultureInfo.InvariantCulture.NumberFormat); if (0 > userVerbosityLevel || 3 < userVerbosityLevel) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); continue; } this.messageHandler.MaximumVerbosityLevel = (VerboseLevel)userVerbosityLevel; } catch (FormatException) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); } } else // verbosity level not specified; use default { this.messageHandler.MaximumVerbosityLevel = VerboseLevel.Verbose; } } else if ('w' == parameter[0]) { parameter = arg.Substring(2); if ("x" == parameter) { this.messageHandler.WarningAsError = true; } else { try { int userWarningLevel = Convert.ToInt32(parameter, CultureInfo.InvariantCulture.NumberFormat); if (0 > userWarningLevel || 3 < userWarningLevel) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); continue; } this.messageHandler.MinimumWarningLevel = (WarningLevel)userWarningLevel; } catch (FormatException) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); } } } else if ("?" == parameter || "help" == parameter) { this.showHelp = true; } } else if ('@' == arg[0]) { this.ParseCommandLine(Common.ParseResponseFile(arg.Substring(1))); } else { this.objectFiles.AddRange(Common.GetFiles(arg, "Source")); } } }
/// <summary> /// Parse the commandline arguments. /// </summary> /// <param name="args">Commandline arguments.</param> private void ParseCommandLine(string[] args) { for (int i = 0; i < args.Length; ++i) { string arg = args[i]; if (null == arg || 0 == arg.Length) // skip blank arguments { continue; } if ('-' == arg[0] || '/' == arg[0]) { string parameter = arg.Substring(1); if ("o" == parameter || "out" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.FilePathRequired(String.Concat("-", parameter))); return; } this.outputFile = new FileInfo(args[i]); } else if ("ai" == parameter) { this.allowIdenticalRows = true; } else if ("au" == parameter) { this.allowUnresolvedReferences = true; } else if ("b" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.DirectoryPathRequired(String.Concat("-", parameter))); return; } this.basePaths.Add(args[i]); } else if ("cc" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.DirectoryPathRequired(String.Concat("-", parameter))); return; } this.cabCachePath = args[i]; } else if ("ext" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.TypeSpecificationForExtensionRequired("-ext")); return; } this.extensionList.Add(args[i]); } else if ("fv" == parameter) { this.setMsiAssemblyNameFileVersion = true; } else if ("i" == parameter) { ++i; if (!((args[i]).EndsWith("\\"))) { this.imagebaseOutputPath = args[i] + "\\"; } else { this.imagebaseOutputPath = args[i]; } } else if ("nologo" == parameter) { this.showLogo = false; } else if ("notidy" == parameter) { this.tidy = false; } else if ("loc" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.FilePathRequired(String.Concat("-", parameter))); return; } this.localizationFiles.Add(args[i]); } else if ("xo" == parameter) { this.outputXml = true; } else if (parameter.StartsWith("pedantic")) { if ("pedantic:easy" == parameter) { this.pedanticLevel = PedanticLevel.Easy; } else if ("pedantic:heroic" == parameter) { this.pedanticLevel = PedanticLevel.Heroic; } else if ("pedantic:legendary" == parameter) { this.pedanticLevel = PedanticLevel.Legendary; } else // default is heroic { this.pedanticLevel = PedanticLevel.Heroic; } } else if ("reusecab" == parameter) { this.reuseCabinets = true; } else if ("sa" == parameter) { this.suppressAssemblies = true; } else if ("sacl" == parameter) { this.suppressAclReset = true; } else if ("sadmin" == parameter) { this.suppressAdminSequence = true; } else if ("sadv" == parameter) { this.suppressAdvertiseSequence = true; } else if ("sf" == parameter) { this.suppressFiles = true; } else if ("sh" == parameter) { this.suppressFileHashAndInfo = true; } else if ("sl" == parameter) { this.suppressLayout = true; } else if ("ss" == parameter) { this.suppressSchema = true; } else if ("sui" == parameter) { this.suppressUISequence = true; } else if ("sv" == parameter) { this.suppressVersionCheck = true; } else if ("sw" == parameter) { this.messageHandler.MinimumWarningLevel = WarningLevel.Deprecated; } else if ('s' == parameter[0] && 'w' == parameter[1]) { try { int suppressWarning = Convert.ToInt32(parameter.Substring(2), CultureInfo.InvariantCulture.NumberFormat); if (0 >= suppressWarning) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } this.messageHandler.SuppressWarningMessage(suppressWarning); } catch (FormatException) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } } else if ("ts" == parameter) { this.sectionIdOnTuples = true; } else if ("ust" == parameter) { this.useSmallTables = true; } else if ('v' == parameter[0]) { if (parameter.Length > 1) { parameter = arg.Substring(2); try { int userVerbosityLevel = Convert.ToInt32(parameter, CultureInfo.InvariantCulture.NumberFormat); if (0 > userVerbosityLevel || 3 < userVerbosityLevel) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); continue; } this.messageHandler.MaximumVerbosityLevel = (VerboseLevel)userVerbosityLevel; } catch (FormatException) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); } } else // verbosity level not specified; use default { this.messageHandler.MaximumVerbosityLevel = VerboseLevel.Verbose; } } else if ('w' == parameter[0]) { parameter = arg.Substring(2); if ("x" == parameter) { this.messageHandler.WarningAsError = true; } else { try { int userWarningLevel = Convert.ToInt32(parameter, CultureInfo.InvariantCulture.NumberFormat); if (0 > userWarningLevel || 3 < userWarningLevel) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); continue; } this.messageHandler.MinimumWarningLevel = (WarningLevel)userWarningLevel; } catch (FormatException) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); } } } else if ("?" == parameter || "help" == parameter) { this.showHelp = true; } } else if ('@' == arg[0]) { this.ParseCommandLine(Common.ParseResponseFile(arg.Substring(1))); } else { this.objectFiles.AddRange(Common.GetFiles(arg, "Source")); } } }
/// <summary> /// Parse the commandline arguments. /// </summary> /// <param name="args">Commandline arguments.</param> private void ParseCommandLine(string[] args) { for (int i = 0; i < args.Length; ++i) { string arg = args[i]; if (null == arg || 0 == arg.Length) // skip blank arguments { continue; } if ('-' == arg[0] || '/' == arg[0]) { string parameter = arg.Substring(1); if ('d' == parameter[0]) { parameter = arg.Substring(2); string[] value = parameter.Split("=".ToCharArray(), 2); if (1 == value.Length) { this.parameters.Add(value[0], ""); } else { this.parameters.Add(value[0], value[1]); } } else if ('I' == parameter[0]) { this.includeSearchPaths.Add(parameter.Substring(1)); } else if ("ext" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.TypeSpecificationForExtensionRequired("-ext")); return; } this.extensionList.Add(args[i]); } else if ("nologo" == parameter) { this.showLogo = false; } else if ("o" == parameter || "out" == parameter) { if (args.Length < ++i || '/' == args[i][0] || '-' == args[i][0]) { this.OnMessage(WixErrors.FileOrDirectoryPathRequired(String.Concat("-", parameter))); return; } if (0 <= args[i].IndexOf('\"')) { this.OnMessage(WixErrors.PathCannotContainQuote(args[i])); return; } else if (args[i].EndsWith("\\") || args[i].EndsWith("/")) { this.outputDirectory = new DirectoryInfo(args[i]); } else { this.outputFile = new FileInfo(args[i]); } } else if (parameter.StartsWith("pedantic")) { if ("pedantic:easy" == parameter) { this.pedanticLevel = PedanticLevel.Easy; } else if ("pedantic:heroic" == parameter) { this.pedanticLevel = PedanticLevel.Heroic; } else if ("pedantic:legendary" == parameter) { this.pedanticLevel = PedanticLevel.Legendary; } else // default is heroic { this.pedanticLevel = PedanticLevel.Heroic; } } else if ('p' == parameter[0]) { String file = arg.Substring(2); this.preprocessFile = file; this.preprocessToStdout = (0 == file.Length); } else if ("ss" == parameter) { this.suppressSchema = true; } else if ("sw" == parameter) { this.messageHandler.MinimumWarningLevel = WarningLevel.Deprecated; } else if ('s' == parameter[0] && 'w' == parameter[1]) { try { int suppressWarning = Convert.ToInt32(parameter.Substring(2), CultureInfo.InvariantCulture.NumberFormat); if (0 >= suppressWarning) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } this.messageHandler.SuppressWarningMessage(suppressWarning); } catch (FormatException) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalSuppressWarningId(parameter.Substring(2))); } } else if ("ust" == parameter) { this.useSmallTables = true; } else if ("trace" == parameter) { this.messageHandler.SourceTrace = true; } else if ('v' == parameter[0]) { if (parameter.Length > 1) { parameter = arg.Substring(2); try { int userVerbosityLevel = Convert.ToInt32(parameter, CultureInfo.InvariantCulture.NumberFormat); if (0 > userVerbosityLevel || 3 < userVerbosityLevel) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); continue; } this.messageHandler.MaximumVerbosityLevel = (VerboseLevel)userVerbosityLevel; } catch (FormatException) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalVerbosityLevel(parameter)); } } else // verbosity level not specified; use default { this.messageHandler.MaximumVerbosityLevel = VerboseLevel.Verbose; } } else if ('w' == parameter[0]) { parameter = arg.Substring(2); if ("x" == parameter) { this.messageHandler.WarningAsError = true; } else { try { int userWarningLevel = Convert.ToInt32(parameter, CultureInfo.InvariantCulture.NumberFormat); if (0 > userWarningLevel || 3 < userWarningLevel) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); continue; } this.messageHandler.MinimumWarningLevel = (WarningLevel)userWarningLevel; } catch (FormatException) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalWarningLevel(parameter)); } } } else if ("zs" == parameter) { this.schemaOnly = true; } else if ("?" == parameter || "help" == parameter) { this.showHelp = true; } } else if ('@' == arg[0]) { this.ParseCommandLine(Common.ParseResponseFile(arg.Substring(1))); } else { this.sourceFiles.AddRange(Common.GetFiles(arg, "Source")); } } return; }