mirror of
https://github.com/SlothDpal/Relaunch-Process.git
synced 2026-02-22 17:27:38 +03:00
Added checkbox killed freezed process
This commit is contained in:
@@ -44,6 +44,9 @@
|
||||
<setting name="dwhAvatarURL" serializeAs="String">
|
||||
<value>https://distribution.faceit-cdn.net/images/7240adfa-6bda-43a0-abd0-8c599f176686.jpeg</value>
|
||||
</setting>
|
||||
<setting name="closeFreezeProcess" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</RelaunchProcess.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup>
|
||||
|
||||
26
Form1.Designer.cs
generated
26
Form1.Designer.cs
generated
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
20
Form1.cs
20
Form1.cs
@@ -306,11 +306,27 @@ namespace Process_Auto_Relaunch
|
||||
waitResponceTimer = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод события для таймера если процесс не отвечает
|
||||
/// </summary>
|
||||
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)
|
||||
|
||||
14
Properties/Settings.Designer.cs
generated
14
Properties/Settings.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия: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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,5 +38,8 @@
|
||||
<Setting Name="dwhAvatarURL" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">https://distribution.faceit-cdn.net/images/7240adfa-6bda-43a0-abd0-8c599f176686.jpeg</Value>
|
||||
</Setting>
|
||||
<Setting Name="closeFreezeProcess" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
Reference in New Issue
Block a user