public static int Main (string[] args) { ProcessProgressStatus monitor = new ProcessProgressStatus (args[0] == "v"); try { string registryPath = Console.In.ReadLine (); string startupDir = Console.In.ReadLine (); AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry (registryPath, startupDir); switch (args [1]) { case "scan": reg.ScanFolders (monitor, args.Length > 2 ? args [2] : null); break; case "get-desc": reg.ParseAddin (monitor, args[2], args[3]); break; } } catch (Exception ex) { monitor.ReportError ("Unexpected error in setup process", ex); return 1; } return 0; }
public static int Main(string[] args) { ProcessProgressStatus monitor = new ProcessProgressStatus(args[0] == "v"); try { string registryPath = Console.In.ReadLine(); string startupDir = Console.In.ReadLine(); AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry(registryPath, startupDir); switch (args [1]) { case "scan": reg.ScanFolders(monitor, args.Length > 2 ? args [2] : null); break; case "get-desc": reg.ParseAddin(monitor, args[2], args[3]); break; } } catch (Exception ex) { monitor.ReportError("Unexpected error in setup process", ex); return(1); } return(0); }
internal static void ExecuteCommand(IProgressStatus monitor, string registryPath, string startupDir, string name, params string[] args) { string asm = new Uri(typeof(SetupProcess).Assembly.CodeBase).LocalPath; string verboseParam = monitor.LogLevel.ToString(); // Arguments string StringBuilder sb = new StringBuilder(); sb.Append(verboseParam).Append(' ').Append(name); foreach (string arg in args) { sb.Append(" \"").Append(arg).Append("\""); } Process process = new Process(); if (Util.IsWindows) { process.StartInfo = new ProcessStartInfo(asm, sb.ToString()); } else { asm = asm.Replace(" ", @"\ "); process.StartInfo = new ProcessStartInfo("mono", "--debug " + asm + " " + sb.ToString()); } process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.EnableRaisingEvents = true; try { process.Start(); } catch (Exception ex) { Console.WriteLine(ex); throw; } process.StandardInput.WriteLine(registryPath); process.StandardInput.WriteLine(startupDir); process.StandardInput.Flush(); // string rr = process.StandardOutput.ReadToEnd (); // Console.WriteLine (rr); StringCollection progessLog = new StringCollection(); ProcessProgressStatus.MonitorProcessStatus(monitor, process.StandardOutput, progessLog); process.WaitForExit(); if (process.ExitCode != 0) { throw new ProcessFailedException(progessLog); } }
public static int Main(string [] args) { ProcessProgressStatus monitor = new ProcessProgressStatus(int.Parse(args [0])); try { string registryPath = Console.In.ReadLine(); string startupDir = Console.In.ReadLine(); string addinsDir = Console.In.ReadLine(); string databaseDir = Console.In.ReadLine(); AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry(registryPath, startupDir, addinsDir, databaseDir); switch (args [1]) { case "scan": { string folder = args.Length > 2 ? args [2] : null; if (folder.Length == 0) { folder = null; } var context = new ScanOptions(); context.Read(Console.In); reg.ScanFolders(monitor, folder, context); break; } case "pre-scan": { string folder = args.Length > 2 ? args [2] : null; if (folder.Length == 0) { folder = null; } var recursive = bool.Parse(Console.In.ReadLine()); reg.GenerateScanDataFilesInProcess(monitor, folder, recursive); break; } case "get-desc": var outFile = Console.In.ReadLine(); reg.ParseAddin(monitor, args [2], args [3]); break; } } catch (Exception ex) { monitor.ReportError("Unexpected error in setup process", ex); return(1); } return(0); }
internal static void ExecuteCommand(IProgressStatus monitor, string registryPath, string startupDir, string name, params string[] args) { string asm = new Uri(typeof(SetupProcess).Assembly.CodeBase).LocalPath; string verboseParam = monitor.VerboseLog ? "v " : "nv"; Process process = new Process(); if (Util.IsWindows) { process.StartInfo = new ProcessStartInfo(asm, verboseParam + " " + name + " " + string.Join(" ", args)); } else { process.StartInfo = new ProcessStartInfo("mono", "--debug " + asm + " " + verboseParam + " " + name + " " + string.Join(" ", args)); } process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.EnableRaisingEvents = true; try { process.Start(); } catch (Exception ex) { Console.WriteLine(ex); throw; } process.StandardInput.WriteLine(registryPath); process.StandardInput.WriteLine(startupDir); process.StandardInput.Flush(); // string rr = process.StandardOutput.ReadToEnd (); // Console.WriteLine (rr); ProcessProgressStatus.MonitorProcessStatus(monitor, process.StandardOutput); process.WaitForExit(); if (process.ExitCode != 0) { throw new ProcessFailedException(); } }
public static int Main(string[] args) { ProcessProgressStatus monitor = new ProcessProgressStatus(int.Parse(args[0])); try { string registryPath = Console.In.ReadLine(); string startupDir = Console.In.ReadLine(); string addinsDir = Console.In.ReadLine(); string databaseDir = Console.In.ReadLine(); AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry(registryPath, startupDir, addinsDir, databaseDir); switch (args [1]) { case "scan": string folder = args.Length > 2 ? args [2] : null; if (folder.Length == 0) { folder = null; } StringCollection filesToIgnore = new StringCollection(); for (int n = 3; n < args.Length; n++) { filesToIgnore.Add(args[n]); } reg.ScanFolders(monitor, folder, filesToIgnore); break; case "get-desc": reg.ParseAddin(monitor, args[2], args[3]); break; } } catch (Exception ex) { monitor.ReportError("Unexpected error in setup process", ex); return(1); } return(0); }
public static int Main (string[] args) { ProcessProgressStatus monitor = new ProcessProgressStatus (int.Parse (args[0])); try { string registryPath = Console.In.ReadLine (); string startupDir = Console.In.ReadLine (); string addinsDir = Console.In.ReadLine (); string databaseDir = Console.In.ReadLine (); AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry (registryPath, startupDir, addinsDir, databaseDir); switch (args [1]) { case "scan": string folder = args.Length > 2 ? args [2] : null; if (folder.Length == 0) folder = null; StringCollection filesToIgnore = new StringCollection (); for (int n=3; n<args.Length; n++) filesToIgnore.Add (args[n]); reg.ScanFolders (monitor, folder, filesToIgnore); break; case "get-desc": reg.ParseAddin (monitor, args[2], args[3]); break; } } catch (Exception ex) { monitor.ReportError ("Unexpected error in setup process", ex); return 1; } return 0; }
internal static void ExecuteCommand(IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string name, string arg1, List <string> data) { string verboseParam = monitor.LogLevel.ToString(); // Arguments string StringBuilder sb = new StringBuilder(); sb.Append(verboseParam).Append(' ').Append(name); sb.Append(" \"").Append(arg1).Append("\""); Process process = new Process(); string asm = null; try { asm = CreateHostExe(); if (!Util.IsMono) { process.StartInfo = new ProcessStartInfo(asm, sb.ToString()); } else { asm = asm.Replace(" ", @"\ "); process.StartInfo = new ProcessStartInfo("mono", "--debug " + asm + " " + sb.ToString()); } process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.EnableRaisingEvents = true; process.Start(); process.StandardInput.WriteLine(registryPath); process.StandardInput.WriteLine(startupDir); process.StandardInput.WriteLine(addinsDir); process.StandardInput.WriteLine(databaseDir); if (data != null) { foreach (var d in data) { process.StandardInput.WriteLine(d); } } process.StandardInput.Flush(); StringCollection progessLog = new StringCollection(); ProcessProgressStatus.MonitorProcessStatus(monitor, process.StandardOutput, progessLog); process.WaitForExit(); if (process.ExitCode != 0) { throw new ProcessFailedException(progessLog); } } catch (Exception ex) { Console.WriteLine(ex); throw; } finally { if (asm != null) { try { File.Delete(asm); } catch { } } } }