diff --git a/App.config b/App.config
index ac315de..379efdc 100644
--- a/App.config
+++ b/App.config
@@ -44,6 +44,9 @@
https://distribution.faceit-cdn.net/images/7240adfa-6bda-43a0-abd0-8c599f176686.jpeg
+
+ True
+
diff --git a/Form1.Designer.cs b/Form1.Designer.cs
index d023abd..e87e385 100644
--- a/Form1.Designer.cs
+++ b/Form1.Designer.cs
@@ -45,6 +45,7 @@ namespace Process_Auto_Relaunch
this.groupBoxProcessName = new System.Windows.Forms.GroupBox();
this.textBoxProcessName = new System.Windows.Forms.TextBox();
this.groupBoxEnabled = new System.Windows.Forms.GroupBox();
+ this.checkBoxCloseFreezeProcess = new System.Windows.Forms.CheckBox();
this.checkBoxSaveState = new System.Windows.Forms.CheckBox();
this.radioButtonEnableWathing = new System.Windows.Forms.RadioButton();
this.radioButtonDisableWathing = new System.Windows.Forms.RadioButton();
@@ -83,7 +84,7 @@ namespace Process_Auto_Relaunch
this.groupBoxActions.Margin = new System.Windows.Forms.Padding(4);
this.groupBoxActions.Name = "groupBoxActions";
this.groupBoxActions.Padding = new System.Windows.Forms.Padding(4);
- this.groupBoxActions.Size = new System.Drawing.Size(382, 111);
+ this.groupBoxActions.Size = new System.Drawing.Size(382, 84);
this.groupBoxActions.TabIndex = 0;
this.groupBoxActions.TabStop = false;
this.groupBoxActions.Text = "Действие после отсутствия процесса";
@@ -169,7 +170,7 @@ namespace Process_Auto_Relaunch
this.groupBoxProgramStart.Controls.Add(this.labelArguments);
this.groupBoxProgramStart.Controls.Add(this.labelProgramStartPath);
this.groupBoxProgramStart.Controls.Add(this.buttonSetProgramStart);
- this.groupBoxProgramStart.Location = new System.Drawing.Point(13, 228);
+ this.groupBoxProgramStart.Location = new System.Drawing.Point(13, 201);
this.groupBoxProgramStart.Margin = new System.Windows.Forms.Padding(4);
this.groupBoxProgramStart.Name = "groupBoxProgramStart";
this.groupBoxProgramStart.Padding = new System.Windows.Forms.Padding(4);
@@ -239,19 +240,35 @@ namespace Process_Auto_Relaunch
//
this.groupBoxEnabled.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
+ this.groupBoxEnabled.Controls.Add(this.checkBoxCloseFreezeProcess);
this.groupBoxEnabled.Controls.Add(this.checkBoxSaveState);
this.groupBoxEnabled.Controls.Add(this.radioButtonEnableWathing);
this.groupBoxEnabled.Controls.Add(this.radioButtonDisableWathing);
this.groupBoxEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
- this.groupBoxEnabled.Location = new System.Drawing.Point(13, 348);
+ this.groupBoxEnabled.Location = new System.Drawing.Point(13, 321);
this.groupBoxEnabled.Margin = new System.Windows.Forms.Padding(4);
this.groupBoxEnabled.Name = "groupBoxEnabled";
this.groupBoxEnabled.Padding = new System.Windows.Forms.Padding(4);
- this.groupBoxEnabled.Size = new System.Drawing.Size(382, 76);
+ this.groupBoxEnabled.Size = new System.Drawing.Size(382, 103);
this.groupBoxEnabled.TabIndex = 9;
this.groupBoxEnabled.TabStop = false;
this.groupBoxEnabled.Text = "Состояние";
//
+ // checkBoxCloseFreezeProcess
+ //
+ this.checkBoxCloseFreezeProcess.AutoSize = true;
+ this.checkBoxCloseFreezeProcess.Checked = global::RelaunchProcess.Properties.Settings.Default.closeFreezeProcess;
+ this.checkBoxCloseFreezeProcess.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.checkBoxCloseFreezeProcess.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::RelaunchProcess.Properties.Settings.Default, "closeFreezeProcess", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
+ this.checkBoxCloseFreezeProcess.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
+ this.checkBoxCloseFreezeProcess.Location = new System.Drawing.Point(20, 75);
+ this.checkBoxCloseFreezeProcess.Margin = new System.Windows.Forms.Padding(4);
+ this.checkBoxCloseFreezeProcess.Name = "checkBoxCloseFreezeProcess";
+ this.checkBoxCloseFreezeProcess.Size = new System.Drawing.Size(221, 20);
+ this.checkBoxCloseFreezeProcess.TabIndex = 3;
+ this.checkBoxCloseFreezeProcess.Text = "Закрывать зависший процесс";
+ this.checkBoxCloseFreezeProcess.UseVisualStyleBackColor = true;
+ //
// checkBoxSaveState
//
this.checkBoxSaveState.AutoSize = true;
@@ -476,5 +493,6 @@ namespace Process_Auto_Relaunch
private ToolStripMenuItem webhookSettingsMenuItem;
private ToolStripMenuItem AboutProgram;
private ToolTip tipProgramStartPath;
+ private CheckBox checkBoxCloseFreezeProcess;
}
}
diff --git a/Form1.cs b/Form1.cs
index 7f3b659..7fd10ce 100644
--- a/Form1.cs
+++ b/Form1.cs
@@ -306,11 +306,27 @@ namespace Process_Auto_Relaunch
waitResponceTimer = null;
}
+ ///
+ /// Метод события для таймера если процесс не отвечает
+ ///
private void ProcessNotResponding(Object source, ElapsedEventArgs e)
{
Debug.WriteLine("Таймер ожидания ответа процесса вышел.");
- Status($"Процесс {ProcessName} не отвечает. @everyone сделайте что-нибудь!", NotifyLevel.logDiscord);
- Status($"Процесс {ProcessName} не отвечает.", NotifyLevel.logHistory);
+ Status($"Процесс {ProcessName} не отвечает уже какое-то время, возможно завис!", NotifyLevel.logHistory | NotifyLevel.logDiscord);
+
+ // Если процесс не завершаем, тогда только информируем
+ if (!checkBoxCloseFreezeProcess.Checked)
+ {
+ Status("@everyone Завершение процесса отключено. Сделайте что-нибудь!", NotifyLevel.logHistory | NotifyLevel.logDiscord);
+ return;
+ }
+
+ // Пытаемся самостоятельно завершить процесс
+ // ! Обнаружение зависшего процесса может быть некорректным !
+ if (ProcessByNameIsRuning(textBoxProcessName.Text))
+ {
+ ProcessKill(WatchedProcess);
+ }
}
private void ProcessStart(string path, string args)
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
index a6205d2..7be96f2 100644
--- a/Properties/Settings.Designer.cs
+++ b/Properties/Settings.Designer.cs
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
@@ -167,5 +167,17 @@ namespace RelaunchProcess.Properties {
this["dwhAvatarURL"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool closeFreezeProcess {
+ get {
+ return ((bool)(this["closeFreezeProcess"]));
+ }
+ set {
+ this["closeFreezeProcess"] = value;
+ }
+ }
}
}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
index 1f40892..aa69502 100644
--- a/Properties/Settings.settings
+++ b/Properties/Settings.settings
@@ -38,5 +38,8 @@
https://distribution.faceit-cdn.net/images/7240adfa-6bda-43a0-abd0-8c599f176686.jpeg
+
+ True
+
\ No newline at end of file