public void GacLisat(MyDll mydll) { var args = string.Format(" /l {0}", mydll.Name); var output = _commandExecuter.ExecuteCommand(@"C:\RepomComponentsNET\GACUTIL 4.0\gacutil.exe", args); string[] lines = output.Split( new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None ); foreach (var line in lines) { if (line.IndexOf("Number of items = 1") > -1) { mydll.Installed = true; } if (line.IndexOf("PublicKeyToken=") > -1) { var list = line.Split(','); if (list.Length >= 3) { mydll.PublicKeyToken = list[3].Substring("PublicKeyToken=".Length + 1); } } ; } }
private void btnIIsRestart_Click(object sender, EventArgs e) { btnIIsRestart.Enabled = false; _commandExecuter.ExecuteCommand(@"C:\Windows\System32\iisreset.exe", " /restart", (string output) => { btnIIsRestart.Enabled = true; if (output.IndexOf("erro") > -1) { MessageBox.Show("Error", "IIsRestar error"); } }); }
private void ExecutePostDownloadCommand() { if (_syncItem.PostDownloadCommand != null) { OnStatusUpdate(new StatusUpdateEventArgs(StatusUpdateLevel.Status, string.Format(CultureInfo.InvariantCulture, "Executing: {0} {1}", _syncItem.PostDownloadCommand.Command, _syncItem.PostDownloadCommand.Arguments), false, _syncItem)); try { string output = _commandExecuter.ExecuteCommand(_syncItem.PostDownloadCommand.Command, _syncItem.PostDownloadCommand.Arguments, _syncItem.PostDownloadCommand.WorkingDirectory); OnStatusUpdate(new StatusUpdateEventArgs(StatusUpdateLevel.Status, string.Format(CultureInfo.InvariantCulture, "{0}", output), false, _syncItem)); } catch (Exception ex) { OnStatusUpdate(new StatusUpdateEventArgs(StatusUpdateLevel.Error, string.Format(CultureInfo.InvariantCulture, "{0} {1}", _syncItem.EpisodeTitle, ex.Message), ex, false, _syncItem)); } } }