DiscordWebHook as updateLogDelegate

Add: dwhURL dwhEnabled settings
New: status messages
This commit is contained in:
slothdpal
2024-05-21 21:31:26 +03:00
parent 38ec633efb
commit 54ded84224
12 changed files with 443 additions and 57 deletions

View File

@@ -32,21 +32,13 @@
<setting name="timer" serializeAs="String"> <setting name="timer" serializeAs="String">
<value>30</value> <value>30</value>
</setting> </setting>
<setting name="dwhURL" serializeAs="String">
<value />
</setting>
<setting name="dwhEnabled" serializeAs="String">
<value>False</value>
</setting>
</RelaunchProcess.Properties.Settings> </RelaunchProcess.Properties.Settings>
<Process_Auto_Relaunch.Properties.Settings>
<setting name="startProgramPath" serializeAs="String">
<value/>
</setting>
<setting name="arguments" serializeAs="String">
<value/>
</setting>
<setting name="disableWathing" serializeAs="String">
<value>True</value>
</setting>
<setting name="saveOldState" serializeAs="String">
<value>True</value>
</setting>
</Process_Auto_Relaunch.Properties.Settings>
</userSettings> </userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup>
</configuration> </configuration>

121
DiscordSettings.Designer.cs generated Normal file
View File

@@ -0,0 +1,121 @@
namespace RelaunchProcess
{
partial class DiscordSettings
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.chbxDiscordEnabled = new System.Windows.Forms.CheckBox();
this.textDwhURL = new System.Windows.Forms.TextBox();
this.lblDwhURL = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(193, 89);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0;
this.btnOk.Text = "Сохранить";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(274, 89);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Отменить";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// chbxDiscordEnabled
//
this.chbxDiscordEnabled.AutoSize = true;
this.chbxDiscordEnabled.Checked = true;
this.chbxDiscordEnabled.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbxDiscordEnabled.Location = new System.Drawing.Point(12, 63);
this.chbxDiscordEnabled.Name = "chbxDiscordEnabled";
this.chbxDiscordEnabled.Size = new System.Drawing.Size(232, 17);
this.chbxDiscordEnabled.TabIndex = 2;
this.chbxDiscordEnabled.Text = "Включить отправку сообщений в Discord";
this.chbxDiscordEnabled.UseVisualStyleBackColor = true;
//
// textDwhURL
//
this.textDwhURL.Location = new System.Drawing.Point(12, 37);
this.textDwhURL.Name = "textDwhURL";
this.textDwhURL.Size = new System.Drawing.Size(337, 20);
this.textDwhURL.TabIndex = 3;
//
// lblDwhURL
//
this.lblDwhURL.AutoSize = true;
this.lblDwhURL.Location = new System.Drawing.Point(9, 9);
this.lblDwhURL.Name = "lblDwhURL";
this.lblDwhURL.Size = new System.Drawing.Size(147, 13);
this.lblDwhURL.TabIndex = 4;
this.lblDwhURL.Text = "URL-адрес Discord веб-хука";
//
// DiscordSettings
//
this.AcceptButton = this.btnOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(361, 128);
this.ControlBox = false;
this.Controls.Add(this.lblDwhURL);
this.Controls.Add(this.textDwhURL);
this.Controls.Add(this.chbxDiscordEnabled);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DiscordSettings";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "Настройки Discord webhook";
this.Load += new System.EventHandler(this.DiscordSettings_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.CheckBox chbxDiscordEnabled;
private System.Windows.Forms.TextBox textDwhURL;
private System.Windows.Forms.Label lblDwhURL;
}
}

51
DiscordSettings.cs Normal file
View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using RelaunchProcess.Properties;
namespace RelaunchProcess
{
public partial class DiscordSettings : Form
{
public DiscordSettings()
{
InitializeComponent();
}
private void DiscordSettings_Load(object sender, EventArgs e)
{
chbxDiscordEnabled.Checked=Settings.Default.dwhEnabled;
textDwhURL.Text=Settings.Default.dwhURL;
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void btnOk_Click(object sender, EventArgs e)
{
if (Uri.IsWellFormedUriString(textDwhURL.Text, UriKind.Absolute))
{
Settings.Default.dwhEnabled = chbxDiscordEnabled.Checked;
Settings.Default.dwhURL = textDwhURL.Text;
Settings.Default.Save();
DialogResult = DialogResult.OK;
Close();
}
else
{
//TODO обработать ситуацию с неверным УРЛом
}
}
}
}

120
DiscordSettings.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

16
Form1.Designer.cs generated
View File

@@ -53,6 +53,7 @@ namespace Process_Auto_Relaunch
this.myBackgroundWorker = new System.ComponentModel.BackgroundWorker(); this.myBackgroundWorker = new System.ComponentModel.BackgroundWorker();
this.groupBoxHistory = new System.Windows.Forms.GroupBox(); this.groupBoxHistory = new System.Windows.Forms.GroupBox();
this.richTextBoxHistory = new System.Windows.Forms.RichTextBox(); this.richTextBoxHistory = new System.Windows.Forms.RichTextBox();
this.btnShowDiscordSettings = new System.Windows.Forms.Button();
this.groupBoxActions.SuspendLayout(); this.groupBoxActions.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.groupBoxProgramStart.SuspendLayout(); this.groupBoxProgramStart.SuspendLayout();
@@ -248,6 +249,7 @@ namespace Process_Auto_Relaunch
this.groupBoxEnabled.Controls.Add(this.checkBoxSaveState); this.groupBoxEnabled.Controls.Add(this.checkBoxSaveState);
this.groupBoxEnabled.Controls.Add(this.radioButtonEnableWathing); this.groupBoxEnabled.Controls.Add(this.radioButtonEnableWathing);
this.groupBoxEnabled.Controls.Add(this.radioButtonDisableWathing); this.groupBoxEnabled.Controls.Add(this.radioButtonDisableWathing);
this.groupBoxEnabled.Controls.Add(this.btnShowDiscordSettings);
this.groupBoxEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); 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, 345); this.groupBoxEnabled.Location = new System.Drawing.Point(13, 345);
this.groupBoxEnabled.Margin = new System.Windows.Forms.Padding(4); this.groupBoxEnabled.Margin = new System.Windows.Forms.Padding(4);
@@ -354,6 +356,18 @@ namespace Process_Auto_Relaunch
this.richTextBoxHistory.TabIndex = 0; this.richTextBoxHistory.TabIndex = 0;
this.richTextBoxHistory.Text = ""; this.richTextBoxHistory.Text = "";
// //
// btnShowDiscordSettings
//
this.btnShowDiscordSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnShowDiscordSettings.Location = new System.Drawing.Point(282, 16);
this.btnShowDiscordSettings.Margin = new System.Windows.Forms.Padding(4);
this.btnShowDiscordSettings.Name = "btnShowDiscordSettings";
this.btnShowDiscordSettings.Size = new System.Drawing.Size(89, 34);
this.btnShowDiscordSettings.TabIndex = 1;
this.btnShowDiscordSettings.Text = "Discord";
this.btnShowDiscordSettings.UseVisualStyleBackColor = true;
this.btnShowDiscordSettings.Click += new System.EventHandler(this.btnShowDiscordSettings_Click);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@@ -366,6 +380,7 @@ namespace Process_Auto_Relaunch
this.Controls.Add(this.groupBoxProgramStart); this.Controls.Add(this.groupBoxProgramStart);
this.Controls.Add(this.groupBoxActions); this.Controls.Add(this.groupBoxActions);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4); this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false; this.MaximizeBox = false;
@@ -413,5 +428,6 @@ namespace Process_Auto_Relaunch
private NumericUpDown numericUpDown1; private NumericUpDown numericUpDown1;
private GroupBox groupBoxHistory; private GroupBox groupBoxHistory;
private RichTextBox richTextBoxHistory; private RichTextBox richTextBoxHistory;
private Button btnShowDiscordSettings;
} }
} }

View File

@@ -9,23 +9,38 @@ using RelaunchProcess.Properties;
using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using Discord; using Discord;
using Discord.Webhook; using Discord.Webhook;
using System.Data;
using static System.Net.Mime.MediaTypeNames;
using RelaunchProcess;
namespace Process_Auto_Relaunch namespace Process_Auto_Relaunch
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
private delegate void UpdateLogDelegate(string text, bool add_history = false); private delegate void UpdateLogDelegate(string text, bool add_history = false);
private UpdateLogDelegate updateLogDelegate = null; private UpdateLogDelegate updateLogDelegate;
private DiscordWebhook DWHook; private DiscordWebhook dwhHook;
private DiscordMessage DMessage; private DiscordMessage dwhMessage;
private DiscordSettings discordSettings;
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
this.updateLogDelegate = new UpdateLogDelegate(this.UpdateStatus); this.updateLogDelegate = this.UpdateStatus;
this.updateLogDelegate += this.SendDiscordMessage;
myBackgroundWorker.WorkerSupportsCancellation = true; myBackgroundWorker.WorkerSupportsCancellation = true;
DWHook = new DiscordWebhook(); dwhHook = new DiscordWebhook();
DWHook.Url = "https://discord.com/api/webhooks/1241061556213776405/alNwHEtwe20MvBxFTSDWPKDarPCJpD-0oDUgdcT_5YrLqoybJq7oxNOCOqqmynuVD93p"; if ( Uri.IsWellFormedUriString(Settings.Default.dwhURL,UriKind.Absolute) && Settings.Default.dwhEnabled && Settings.Default.dwhURL!="")
{
dwhHook.Url = Settings.Default.dwhURL;
}
else if (Settings.Default.dwhEnabled) {
Debug.WriteLine($"Îøèáêà â URL âåá-õóêà ({Settings.Default.dwhURL}). Âûâîä â Discord îòêëþ÷åí.");
HistoryLog($"Îøèáêà â URL âåá-õóêà ({Settings.Default.dwhURL}). Âûâîä â Discord îòêëþ÷åí.");
Settings.Default.dwhEnabled = false;
Settings.Default.Save();
}
} }
@@ -125,10 +140,6 @@ namespace Process_Auto_Relaunch
{ {
labelStatus.Text = text; labelStatus.Text = text;
DMessage = new DiscordMessage();
DMessage.Content = text;
DWHook.Send(DMessage);
if (add_history) if (add_history)
{ {
HistoryLog(text); HistoryLog(text);
@@ -153,6 +164,7 @@ namespace Process_Auto_Relaunch
groupBoxProcessName.Enabled = !watching; groupBoxProcessName.Enabled = !watching;
groupBoxProgramStart.Enabled = !watching; groupBoxProgramStart.Enabled = !watching;
groupBoxActions.Enabled = !watching; groupBoxActions.Enabled = !watching;
btnShowDiscordSettings.Enabled = !watching;
Settings.Default.enableWatching = watching; Settings.Default.enableWatching = watching;
@@ -233,12 +245,14 @@ namespace Process_Auto_Relaunch
if (ProcessByNameIsRuning(textBoxProcessName.Text)) if (ProcessByNameIsRuning(textBoxProcessName.Text))
{ {
Status($"Ïðîöåññ {textBoxProcessName.Text} óæå çàïóùåí"); Status($"Ïðîöåññ {textBoxProcessName.Text} óæå çàïóùåí");
if (i < (int)numericUpDown1.Value) SendDiscordMessage($"Ïðîöåññ {textBoxProcessName.Text} çàïóùåí.",true);
i = (int)numericUpDown1.Value; i = (int)numericUpDown1.Value;
} }
else else
{ {
if (radioButtonRestartTimer.Checked) if (radioButtonRestartTimer.Checked)
{ {
if (i==(int)numericUpDown1.Value) SendDiscordMessage($"Ïðîöåññ {textBoxProcessName.Text} íå íàéäåí. Çàïóñê ÷åðåç {i}",true);
i--; i--;
Status($"Ïðîöåññ {textBoxProcessName.Text} íå íàéäåí. Çàïóñê ÷åðåç {i}"); Status($"Ïðîöåññ {textBoxProcessName.Text} íå íàéäåí. Çàïóñê ÷åðåç {i}");
} }
@@ -247,6 +261,7 @@ namespace Process_Auto_Relaunch
{ {
i = (int)numericUpDown1.Value; i = (int)numericUpDown1.Value;
Status("Çàïóñêàåì..."); Status("Çàïóñêàåì...");
SendDiscordMessage($"Çàïóñêàåì {textBoxProcessName.Text}",true);
ProcessStart(Settings.Default.startProgramPath, textBoxArguments.Text); ProcessStart(Settings.Default.startProgramPath, textBoxArguments.Text);
} }
} }
@@ -277,5 +292,38 @@ namespace Process_Auto_Relaunch
Status("Íàáëþäåíèå îñòàíîâëåíî."); Status("Íàáëþäåíèå îñòàíîâëåíî.");
} }
} }
/// <summary>
/// Îòïðàâêà ñîîáùåíèÿ â Äèñêîðä
/// </summary>
/// <param name="text">Òåêñò äëÿ îòïðàâêè</param>
public void SendDiscordMessage(string message, bool addToHistory = false)
{
if (Settings.Default.dwhEnabled && addToHistory)
{
dwhHook.Url = Settings.Default.dwhURL;
dwhMessage.Username = "Relaunch process";
dwhMessage.Content = ":arrows_counterclockwise: " + message;
try
{
dwhHook.Send(dwhMessage);
}
catch (Exception ex)
{
HistoryLog($"Discord messaging error: {ex.Message}");
Debug.WriteLine($"Discord messaging error: {ex.Message}");
Settings.Default.dwhEnabled = false;
Settings.Default.Save();
}
}
}
private void btnShowDiscordSettings_Click(object sender, EventArgs e)
{
discordSettings = new DiscordSettings();
discordSettings.ShowDialog(this);
discordSettings.Dispose();
}
} }
} }

View File

@@ -121,7 +121,7 @@
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>131</value> <value>40</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

View File

@@ -86,7 +86,17 @@
<Compile Include="Form1.Designer.cs"> <Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>Form1.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="DiscordSettings.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DiscordSettings.Designer.cs">
<DependentUpon>DiscordSettings.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Settings.cs" />
<EmbeddedResource Include="DiscordSettings.resx">
<DependentUpon>DiscordSettings.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx"> <EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>Form1.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>

View File

@@ -14,12 +14,6 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
DebugDN|Any CPU = DebugDN|Any CPU
DebugDN|x64 = DebugDN|x64
DebugDNF|Any CPU = DebugDNF|Any CPU
DebugDNF|x64 = DebugDNF|x64
DebugDotNetFramework|Any CPU = DebugDotNetFramework|Any CPU
DebugDotNetFramework|x64 = DebugDotNetFramework|x64
DebugFULL|Any CPU = DebugFULL|Any CPU DebugFULL|Any CPU = DebugFULL|Any CPU
DebugFULL|x64 = DebugFULL|x64 DebugFULL|x64 = DebugFULL|x64
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
@@ -30,18 +24,6 @@ Global
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU {B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.Debug|x64.ActiveCfg = Debug|x64 {B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.Debug|x64.ActiveCfg = Debug|x64
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.Debug|x64.Build.0 = Debug|x64 {B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.Debug|x64.Build.0 = Debug|x64
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDN|Any CPU.ActiveCfg = Debug|Any CPU
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDN|Any CPU.Build.0 = Debug|Any CPU
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDN|x64.ActiveCfg = Debug|x64
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDN|x64.Build.0 = Debug|x64
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDNF|Any CPU.ActiveCfg = Debug|Any CPU
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDNF|Any CPU.Build.0 = Debug|Any CPU
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDNF|x64.ActiveCfg = Debug|x64
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDNF|x64.Build.0 = Debug|x64
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDotNetFramework|Any CPU.ActiveCfg = Debug|Any CPU
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDotNetFramework|Any CPU.Build.0 = Debug|Any CPU
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDotNetFramework|x64.ActiveCfg = Debug|x64
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugDotNetFramework|x64.Build.0 = Debug|x64
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugFULL|Any CPU.ActiveCfg = Debug|Any CPU {B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugFULL|Any CPU.ActiveCfg = Debug|Any CPU
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugFULL|Any CPU.Build.0 = Debug|Any CPU {B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugFULL|Any CPU.Build.0 = Debug|Any CPU
{B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugFULL|x64.ActiveCfg = Debug|x64 {B48F106C-F4E2-4BFB-9BAA-42FC13C03FDD}.DebugFULL|x64.ActiveCfg = Debug|x64
@@ -54,20 +36,8 @@ Global
{11C71B78-004A-471F-B29D-C2CBE4673579}.Debug|Any CPU.Build.0 = Debug|Any CPU {11C71B78-004A-471F-B29D-C2CBE4673579}.Debug|Any CPU.Build.0 = Debug|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.Debug|x64.ActiveCfg = Debug|Any CPU {11C71B78-004A-471F-B29D-C2CBE4673579}.Debug|x64.ActiveCfg = Debug|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.Debug|x64.Build.0 = Debug|Any CPU {11C71B78-004A-471F-B29D-C2CBE4673579}.Debug|x64.Build.0 = Debug|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDN|Any CPU.ActiveCfg = DebugDN|Any CPU {11C71B78-004A-471F-B29D-C2CBE4673579}.DebugFULL|Any CPU.ActiveCfg = Debug|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDN|Any CPU.Build.0 = DebugDN|Any CPU {11C71B78-004A-471F-B29D-C2CBE4673579}.DebugFULL|Any CPU.Build.0 = Debug|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDN|x64.ActiveCfg = DebugDN|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDN|x64.Build.0 = DebugDN|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDNF|Any CPU.ActiveCfg = DebugDNF|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDNF|Any CPU.Build.0 = DebugDNF|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDNF|x64.ActiveCfg = DebugDNF|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDNF|x64.Build.0 = DebugDNF|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDotNetFramework|Any CPU.ActiveCfg = DebugDotNetFramework|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDotNetFramework|Any CPU.Build.0 = DebugDotNetFramework|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDotNetFramework|x64.ActiveCfg = DebugDotNetFramework|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugDotNetFramework|x64.Build.0 = DebugDotNetFramework|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugFULL|Any CPU.ActiveCfg = DebugFULL|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugFULL|Any CPU.Build.0 = DebugFULL|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugFULL|x64.ActiveCfg = DebugFULL|Any CPU {11C71B78-004A-471F-B29D-C2CBE4673579}.DebugFULL|x64.ActiveCfg = DebugFULL|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.DebugFULL|x64.Build.0 = DebugFULL|Any CPU {11C71B78-004A-471F-B29D-C2CBE4673579}.DebugFULL|x64.Build.0 = DebugFULL|Any CPU
{11C71B78-004A-471F-B29D-C2CBE4673579}.Release|Any CPU.ActiveCfg = Release|Any CPU {11C71B78-004A-471F-B29D-C2CBE4673579}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@@ -118,5 +118,29 @@ namespace RelaunchProcess.Properties {
this["timer"] = value; this["timer"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string dwhURL {
get {
return ((string)(this["dwhURL"]));
}
set {
this["dwhURL"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool dwhEnabled {
get {
return ((bool)(this["dwhEnabled"]));
}
set {
this["dwhEnabled"] = value;
}
}
} }
} }

View File

@@ -26,5 +26,11 @@
<Setting Name="timer" Type="System.Decimal" Scope="User"> <Setting Name="timer" Type="System.Decimal" Scope="User">
<Value Profile="(Default)">30</Value> <Value Profile="(Default)">30</Value>
</Setting> </Setting>
<Setting Name="dwhURL" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="dwhEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

28
Settings.cs Normal file
View File

@@ -0,0 +1,28 @@
namespace RelaunchProcess.Properties {
// Этот класс позволяет обрабатывать определенные события в классе параметров:
// Событие SettingChanging возникает перед изменением значения параметра.
// Событие PropertyChanged возникает после изменения значения параметра.
// Событие SettingsLoaded возникает после загрузки значений параметров.
// Событие SettingsSaving возникает перед сохранением значений параметров.
internal sealed partial class Settings {
public Settings() {
// // Для добавления обработчиков событий для сохранения и изменения параметров раскомментируйте приведенные ниже строки:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Добавьте здесь код для обработки события SettingChangingEvent.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Добавьте здесь код для обработки события SettingsSaving.
}
}
}