public static int Main(string[] args) { int rc = 0; Console.WriteLine("InstallerLinker: dotNetInstaller Packager ({0})", Assembly.GetExecutingAssembly().GetName().Version); Console.WriteLine(); InstallerLinkerArguments i_args = new InstallerLinkerArguments(); if (Parser.ParseArgumentsWithUsage(args, i_args)) { try { InstallerLib.InstallerLinker.CreateInstaller(i_args); } catch (Exception ex) { i_args.WriteError(string.Format("ERROR: {0}", ex.Message)); #if DEBUG i_args.WriteError(ex.StackTrace); #endif rc = -2; } } else { rc = -1; } return rc; }
/// <summary> /// Check whether all embedded files exist. /// </summary> /// <param name="args"></param> public void CheckFilesExist(InstallerLinkerArguments args) { List <String> filesMissing = new List <string>(); foreach (EmbedFilePair file in _files) { args.WriteLine(string.Format(" {0} ({1})", file.fullpath, file.relativepath)); if (!File.Exists(file.fullpath)) { string fullpath = Path.GetFullPath(file.fullpath); args.WriteError(string.Format("Embedded file '{0}' does not exist", fullpath)); filesMissing.Add(fullpath); } } if (filesMissing.Count > 0) { StringBuilder sb = new StringBuilder(); int max = 5; sb.AppendLine(string.Format("Missing {0} embedded file(s)", filesMissing.Count)); for (int i = 0; i < max && i < filesMissing.Count; i++) { sb.AppendLine(filesMissing[i]); } if (filesMissing.Count > max) { sb.AppendLine("..."); } throw new Exception(sb.ToString()); } }
/// <summary> /// Check whether all embedded files exist. /// </summary> /// <param name="args"></param> public void CheckFilesExist(InstallerLinkerArguments args) { int filesMissing = 0; foreach (ResourceFilePair file in _files) { args.WriteLine(string.Format(" {0} ({1})", file.id, file.path)); if (!File.Exists(file.path)) { args.WriteError(string.Format("Resource file '{0}' does not exist", file.path)); filesMissing++; } } if (filesMissing > 0) { throw new Exception(string.Format("Missing {0} resource file(s)", filesMissing)); } }