mirror of
https://github.com/SlothDpal/Relaunch-Process.git
synced 2026-02-22 17:27:38 +03:00
перенос настроек из старо сборки в новую через settings.upgrade
This commit is contained in:
@@ -47,6 +47,9 @@
|
|||||||
<setting name="closeFreezeProcess" serializeAs="String">
|
<setting name="closeFreezeProcess" serializeAs="String">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="upgradeSettings" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
</RelaunchProcess.Properties.Settings>
|
</RelaunchProcess.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>
|
||||||
|
|||||||
20
Form1.cs
20
Form1.cs
@@ -15,7 +15,7 @@ using RelaunchProcess;
|
|||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Configuration;
|
||||||
|
|
||||||
namespace Process_Auto_Relaunch
|
namespace Process_Auto_Relaunch
|
||||||
{
|
{
|
||||||
@@ -47,6 +47,24 @@ namespace Process_Auto_Relaunch
|
|||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
if (Settings.Default.upgradeSettings)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Обновление настроек.");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Settings.Default.Upgrade();
|
||||||
|
}
|
||||||
|
catch (ConfigurationErrorsException ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"Ошибка обновления настроек: {ex.Message}");
|
||||||
|
Settings.Default.Reset();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Settings.Default.upgradeSettings = false;
|
||||||
|
Settings.Default.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
this.updateLogDelegate = this.UpdateStatus;
|
this.updateLogDelegate = this.UpdateStatus;
|
||||||
this.updateLogDelegate += this.SendDiscordMessage;
|
this.updateLogDelegate += this.SendDiscordMessage;
|
||||||
this.updateLogDelegate += this.HistoryLog;
|
this.updateLogDelegate += this.HistoryLog;
|
||||||
|
|||||||
@@ -82,14 +82,11 @@
|
|||||||
<Prefer32Bit>true</Prefer32Bit>
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="CSharpDiscordWebhook, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>.\CSharpDiscordWebhook.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ using System.Runtime.InteropServices;
|
|||||||
// Номер сборки
|
// Номер сборки
|
||||||
// Редакция
|
// Редакция
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("1.6.0.0")]
|
[assembly: AssemblyVersion("1.6.0.21")]
|
||||||
[assembly: AssemblyFileVersion("1.6.0.0")]
|
[assembly: AssemblyFileVersion("1.6.0.21")]
|
||||||
|
|
||||||
[assembly: AssemblyInformationalVersion("1.6.0.0")]
|
[assembly: AssemblyInformationalVersion("1.6.0.21")]
|
||||||
16
Properties/Settings.Designer.cs
generated
16
Properties/Settings.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Этот код создан программой.
|
// Этот код создан программой.
|
||||||
// Исполняемая версия:4.0.30319.42000
|
// Исполняемая версия:4.0.30319.42000
|
||||||
@@ -12,7 +12,7 @@ namespace RelaunchProcess.Properties {
|
|||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
@@ -179,5 +179,17 @@ namespace RelaunchProcess.Properties {
|
|||||||
this["closeFreezeProcess"] = value;
|
this["closeFreezeProcess"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool upgradeSettings {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["upgradeSettings"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["upgradeSettings"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,5 +41,8 @@
|
|||||||
<Setting Name="closeFreezeProcess" Type="System.Boolean" Scope="User">
|
<Setting Name="closeFreezeProcess" Type="System.Boolean" Scope="User">
|
||||||
<Value Profile="(Default)">True</Value>
|
<Value Profile="(Default)">True</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="upgradeSettings" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
Reference in New Issue
Block a user