public static void Install(string dotNetVersion, string serviceFilePath, string username, string password) { if (String.IsNullOrEmpty(serviceFilePath)) { throw new NullReferenceException("invalid filename"); } if (!File.Exists(serviceFilePath)) { throw new FileNotFoundException(serviceFilePath + " not found"); } string serviceFileName = IO.GetFilename(serviceFilePath); string serviceName = StringHelper.TrimEnd(serviceFileName, IO.GetFileExtension(serviceFilePath).Length + 1); string dotNetFolder = IO.FindDotNetFolder(dotNetVersion); string installUtil = IO.FindFile(dotNetFolder, "Installutil.exe"); ShellResults results; if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password)) { results = Shell.Run(installUtil, "/i /user="******" /password="******" " + IO.GetFilename(serviceFilePath), IO.GetRoot(serviceFilePath)); } else { results = Shell.Run(installUtil, "/i " + IO.GetFilename(serviceFilePath), IO.GetRoot(serviceFilePath)); } if (results.ExitCode != Shell.EXIT_OK) { throw new Exception("Failed to install " + serviceName); } }
public static void Start(string serviceFilePath) { if (String.IsNullOrEmpty(serviceFilePath)) { throw new NullReferenceException("invalid filename"); } if (!File.Exists(serviceFilePath)) { throw new FileNotFoundException(serviceFilePath + " not found"); } string serviceFileName = IO.GetFilename(serviceFilePath); string serviceName = StringHelper.TrimEnd(serviceFileName, IO.GetFileExtension(serviceFilePath).Length + 1); ShellResults results = Shell.Run(IO.System32 + @"net.exe", "START " + serviceName); if (results.ExitCode != Shell.EXIT_OK) { if (!String.IsNullOrEmpty(results.Output)) { ConsoleHelper.DebugWriteLine("output: " + results.Output); } if (!String.IsNullOrEmpty(results.Error)) { ConsoleHelper.DebugWriteLine("output: " + results.Error); } throw new Exception("Failed to start " + serviceName); } }
public static List <SubversionLog> GetLog(svnInfo repo) { List <SubversionLog> list = new List <SubversionLog>(); ShellResults result = Shell.Run(singleton.svnPath, "log " + repo.RepositoryRoot); foreach (string logEntry in Regex.Split(result.Output, new String('-', 72))) { string entry = logEntry.TrimWhiteSpace(); if (!String.IsNullOrEmpty(entry)) { list.Add(new SubversionLog(repo, entry)); } } list.Sort(); return(list); }
public static ShellResults Run(string subCommand, string sandboxPath) { return(Shell.Run(singleton.svnPath, subCommand, sandboxPath)); }