diff --git a/.gitea/workflows/build-trigger.yaml b/.gitea/workflows/build-trigger.yaml
deleted file mode 100644
index 6b66d9f..0000000
--- a/.gitea/workflows/build-trigger.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-name: Trigger Main Build Pipeline
-
-on:
- push:
- tags:
- - '*'
-
-jobs:
- trigger-main-build:
- runs-on: ubuntu-latest
- steps:
- - name: Setup Git Config
- run: |
- git config --global user.email "noreply@sp-tarkov.com"
- git config --global user.name "TriggerBot"
-
- - name: Clone Build Repository
- run: |
- rm -rf ../Build
- git clone https://${{ secrets.BUILD_USERNAME }}:${{ secrets.BUILD_ACCESS_TOKEN }}@dev.sp-tarkov.com/SPT-AKI/Build.git ../Build
-
- - name: Trigger Branch
- working-directory: ../Build
- run: git checkout -b trigger || git checkout trigger
-
- - name: Create Trigger File
- working-directory: ../Build
- run: |
- echo "${GITHUB_REF_NAME}" > .gitea/trigger
- git add .gitea/trigger
- git commit -m "Launcher triggered build with tag '${GITHUB_REF_NAME}'"
-
- - name: Force Push
- working-directory: ../Build
- run: git push --force origin trigger
diff --git a/.github/workflows/build-trigger.yaml b/.github/workflows/build-trigger.yaml
new file mode 100644
index 0000000..a16892c
--- /dev/null
+++ b/.github/workflows/build-trigger.yaml
@@ -0,0 +1,22 @@
+name: Trigger Main Build Pipeline
+
+on:
+ push:
+ tags:
+ - "*"
+
+jobs:
+ trigger-main-build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Trigger Build Workflow
+ uses: peter-evans/repository-dispatch@v3
+ with:
+ token: ${{ secrets.BUILD_REPO_ACCESS_TOKEN }}
+ repository: sp-tarkov/build
+ event-type: build-trigger
+ client-payload: |
+ {
+ "repository": "${{ github.repository }}",
+ "tag": "${{ github.ref_name }}"
+ }
diff --git a/README.md b/README.md
index e440a15..6d13702 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ git config --local user.email "USERNAME@SOMETHING.com"
## Requirements
-- Escape From Tarkov 31124
+- Escape From Tarkov 33420
- .NET 8 SDK
- Visual Studio Code
- [PowerShell v7](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows)
diff --git a/project/SPT.Launcher.Base/Controllers/AccountManager.cs b/project/SPT.Launcher.Base/Controllers/AccountManager.cs
index 4b759fc..3e5a154 100644
--- a/project/SPT.Launcher.Base/Controllers/AccountManager.cs
+++ b/project/SPT.Launcher.Base/Controllers/AccountManager.cs
@@ -289,6 +289,7 @@ namespace SPT.Launcher
}
SelectedAccount.edition = edition;
+ SelectedAccount.wipe = true;
LogManager.Instance.Info($"Account Wiped: {data.username} -> {edition}");
return AccountStatus.OK;
}
diff --git a/project/SPT.Launcher.Base/Controllers/GameStarter.cs b/project/SPT.Launcher.Base/Controllers/GameStarter.cs
index 2dcf1a2..bcd0bcf 100644
--- a/project/SPT.Launcher.Base/Controllers/GameStarter.cs
+++ b/project/SPT.Launcher.Base/Controllers/GameStarter.cs
@@ -21,6 +21,7 @@ using SPT.Launcher.Controllers;
using SPT.Launcher.Interfaces;
using System.Runtime.InteropServices;
using SPT.Launcher.Models.SPT;
+using Newtonsoft.Json.Linq;
namespace SPT.Launcher
{
@@ -90,7 +91,7 @@ namespace SPT.Launcher
if (account.wipe)
{
LogManager.Instance.Info("[LaunchGame] Wipe profile requested");
- RemoveRegistryKeys();
+ RemoveProfileRegistryKeys(account.id);
CleanTempFiles();
}
@@ -288,27 +289,24 @@ namespace SPT.Launcher
}
///
- /// Remove the registry keys
+ /// Remove the SPT JSON-based registry keys associated with the given profile ID
///
- /// returns true if the keys were removed. returns false if an exception occured
- public bool RemoveRegistryKeys()
+ public void RemoveProfileRegistryKeys(string profileId)
{
- try
- {
- var key = Registry.CurrentUser.OpenSubKey(registrySettings, true);
+ var registryFile = new FileInfo(Path.Combine(Environment.CurrentDirectory, "user\\sptRegistry\\registry.json"));
- foreach (var value in key.GetValueNames())
- {
- key.DeleteValue(value);
- }
- }
- catch (Exception ex)
+ if (!registryFile.Exists)
{
- LogManager.Instance.Exception(ex);
- return false;
+ return;
}
- return true;
+ JObject registryData = JObject.Parse(File.ReadAllText(registryFile.FullName));
+
+ // Find any property that has a key containing the profileId, and remove it
+ var propsToRemove = registryData.Properties().Where(prop => prop.Name.Contains(profileId, StringComparison.CurrentCultureIgnoreCase)).ToList();
+ propsToRemove.ForEach(prop => prop.Remove());
+
+ File.WriteAllText(registryFile.FullName, registryData.ToString());
}
///
diff --git a/project/SPT.Launcher.Base/Helpers/FilePatcher.cs b/project/SPT.Launcher.Base/Helpers/FilePatcher.cs
index c175b7a..a019a55 100644
--- a/project/SPT.Launcher.Base/Helpers/FilePatcher.cs
+++ b/project/SPT.Launcher.Base/Helpers/FilePatcher.cs
@@ -33,7 +33,7 @@ namespace SPT.Launcher.Helpers
switch (result.Result)
{
case PatchResultType.Success:
- File.Copy(targetfile, $"{targetfile}.bak");
+ File.Copy(targetfile, $"{targetfile}.spt-bak");
VFS.WriteFile(targetfile, result.PatchedData);
break;
@@ -109,7 +109,7 @@ namespace SPT.Launcher.Helpers
foreach (var file in files)
{
- if (file.Extension == ".bak")
+ if (file.Extension == ".spt-bak")
{
var target = Path.ChangeExtension(file.FullName, null);
diff --git a/project/SPT.Launcher.Base/Helpers/LauncherSettingsProvider.cs b/project/SPT.Launcher.Base/Helpers/LauncherSettingsProvider.cs
index 12e6af2..b94ea70 100644
--- a/project/SPT.Launcher.Base/Helpers/LauncherSettingsProvider.cs
+++ b/project/SPT.Launcher.Base/Helpers/LauncherSettingsProvider.cs
@@ -13,6 +13,7 @@ using Newtonsoft.Json;
using System;
using System.ComponentModel;
using System.IO;
+using SPT.Launcher.Utilities;
using SPT.Launcher.Controllers;
namespace SPT.Launcher.Helpers
@@ -23,7 +24,7 @@ namespace SPT.Launcher.Helpers
public static Settings Instance { get; } = Json.Load(DefaultSettingsFileLocation) ?? new Settings();
}
- public class Settings : INotifyPropertyChanged
+ public class Settings : NotifyPropertyChangedBase
{
public bool FirstRun { get; set; } = true;
@@ -72,121 +73,65 @@ namespace SPT.Launcher.Helpers
public string DefaultLocale { get; set; } = "English";
- private bool _IsAddingServer;
+ private bool _isAddingServer;
[JsonIgnore]
public bool IsAddingServer
{
- get => _IsAddingServer;
- set
- {
- if (_IsAddingServer != value)
- {
- _IsAddingServer = value;
- RaisePropertyChanged(nameof(IsAddingServer));
- }
- }
+ get => _isAddingServer;
+ set => SetProperty(ref _isAddingServer, value);
}
- private bool _AllowSettings;
+ private bool _allowSettings;
[JsonIgnore]
public bool AllowSettings
{
- get => _AllowSettings;
- set
- {
- if (_AllowSettings != value)
- {
- _AllowSettings = value;
- RaisePropertyChanged(nameof(AllowSettings));
- }
- }
+ get => _allowSettings;
+ set => SetProperty(ref _allowSettings, value);
}
- private bool _GameRunning;
+ private bool _gameRunning;
[JsonIgnore]
public bool GameRunning
{
- get => _GameRunning;
- set
- {
- if (_GameRunning != value)
- {
- _GameRunning = value;
- RaisePropertyChanged(nameof(GameRunning));
- }
- }
+ get => _gameRunning;
+ set => SetProperty(ref _gameRunning, value);
}
- private LauncherAction _LauncherStartGameAction;
+ private LauncherAction _launcherStartGameAction;
public LauncherAction LauncherStartGameAction
{
- get => _LauncherStartGameAction;
- set
- {
- if (_LauncherStartGameAction != value)
- {
- _LauncherStartGameAction = value;
- RaisePropertyChanged(nameof(LauncherStartGameAction));
- }
- }
+ get => _launcherStartGameAction;
+ set => SetProperty(ref _launcherStartGameAction, value);
}
- private bool _UseAutoLogin;
+ private bool _useAutoLogin;
public bool UseAutoLogin
{
- get => _UseAutoLogin;
- set
- {
- if (_UseAutoLogin != value)
- {
- _UseAutoLogin = value;
- RaisePropertyChanged(nameof(UseAutoLogin));
- }
- }
+ get => _useAutoLogin;
+ set => SetProperty(ref _useAutoLogin, value);
}
- private bool _IsDevMode;
+ private bool _isDevMode;
public bool IsDevMode
{
- get => _IsDevMode;
- set
- {
- if (_IsDevMode != value)
- {
- _IsDevMode = value;
- RaisePropertyChanged(nameof(IsDevMode));
- }
- }
+ get => _isDevMode;
+ set => SetProperty(ref _isDevMode, value);
}
- private string _GamePath;
+ private string _gamePath;
public string GamePath
{
- get => _GamePath;
- set
- {
- if (_GamePath != value)
- {
- _GamePath = value;
- RaisePropertyChanged(nameof(GamePath));
- }
- }
+ get => _gamePath;
+ set => SetProperty(ref _gamePath, value);
}
- private string[] _ExcludeFromCleanup;
+ private string[] _excludeFromCleanup = [];
public string[] ExcludeFromCleanup
{
- get => _ExcludeFromCleanup ??= Array.Empty();
- set
- {
- if (_ExcludeFromCleanup != value)
- {
- _ExcludeFromCleanup = value;
- RaisePropertyChanged(nameof(ExcludeFromCleanup));
- }
- }
+ get => _excludeFromCleanup;
+ set => SetProperty(ref _excludeFromCleanup, value);
}
public ServerSetting Server { get; set; } = new ServerSetting();
@@ -202,18 +147,15 @@ namespace SPT.Launcher.Helpers
GamePath = Environment.CurrentDirectory;
IsDevMode = false;
- Server = new ServerSetting { Name = "SPT", Url = "http://127.0.0.1:6969" };
+ Server = new ServerSetting
+ {
+ Name = "SPT",
+ Url = "http://127.0.0.1:6969"
+ };
SaveSettings();
}
LogManager.Instance.Info($"Using launcher config at: {LauncherSettingsProvider.DefaultSettingsFileLocation}");
}
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
}
}
diff --git a/project/SPT.Launcher.Base/Helpers/LocalizationProvider.cs b/project/SPT.Launcher.Base/Helpers/LocalizationProvider.cs
index 40c3e3b..45f3e4f 100644
--- a/project/SPT.Launcher.Base/Helpers/LocalizationProvider.cs
+++ b/project/SPT.Launcher.Base/Helpers/LocalizationProvider.cs
@@ -16,6 +16,7 @@ using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
+using SPT.Launcher.Utilities;
using SPT.Launcher.Controllers;
namespace SPT.Launcher.Helpers
@@ -225,7 +226,7 @@ namespace SPT.Launcher.Helpers
public static LocaleData Instance { get; private set; } = Json.LoadClassWithoutSaving(Path.Join(DefaultLocaleFolderPath, $"{LauncherSettingsProvider.Instance.DefaultLocale}.json")) ?? GenerateEnglishLocale();
}
- public class LocaleData : INotifyPropertyChanged
+ public class LocaleData : NotifyPropertyChangedBase
{
//this is going to be some pretty long boiler plate code. So I'm putting everything into regions.
@@ -236,14 +237,7 @@ namespace SPT.Launcher.Helpers
public string copy_logs_to_clipboard
{
get => _copy_logs_to_clipboard;
- set
- {
- if (_copy_logs_to_clipboard != value)
- {
- _copy_logs_to_clipboard = value;
- RaisePropertyChanged(nameof(copy_logs_to_clipboard));
- }
- }
+ set => SetProperty(ref _copy_logs_to_clipboard, value);
}
#endregion
@@ -253,14 +247,7 @@ namespace SPT.Launcher.Helpers
public string copy_failed
{
get => _copy_failed;
- set
- {
- if (_copy_failed != value)
- {
- _copy_failed = value;
- RaisePropertyChanged(nameof(copy_failed));
- }
- }
+ set => SetProperty(ref _copy_failed, value);
}
#endregion
@@ -271,14 +258,7 @@ namespace SPT.Launcher.Helpers
public string register_failed_name_limit
{
get => _register_failed_name_limit;
- set
- {
- if (_register_failed_name_limit != value)
- {
- _register_failed_name_limit = value;
- RaisePropertyChanged(nameof(register_failed_name_limit));
- }
- }
+ set => SetProperty(ref _register_failed_name_limit, value);
}
#endregion
@@ -289,14 +269,7 @@ namespace SPT.Launcher.Helpers
public string failed_to_save_settings
{
get => _failed_to_save_settings;
- set
- {
- if (_failed_to_save_settings != value)
- {
- _failed_to_save_settings = value;
- RaisePropertyChanged(nameof(failed_to_save_settings));
- }
- }
+ set => SetProperty(ref _failed_to_save_settings, value);
}
#endregion
@@ -305,14 +278,7 @@ namespace SPT.Launcher.Helpers
public string dev_mode
{
get => _dev_mode;
- set
- {
- if (_dev_mode != value)
- {
- _dev_mode = value;
- RaisePropertyChanged(nameof(dev_mode));
- }
- }
+ set => SetProperty(ref _dev_mode, value);
}
#endregion
@@ -323,14 +289,7 @@ namespace SPT.Launcher.Helpers
public string ietf_tag
{
get => _ietf_tag;
- set
- {
- if (_ietf_tag != value)
- {
- _ietf_tag = value;
- RaisePropertyChanged(nameof(ietf_tag));
- }
- }
+ set => SetProperty(ref _ietf_tag, value);
}
#endregion
@@ -339,14 +298,7 @@ namespace SPT.Launcher.Helpers
public string native_name
{
get => _native_name;
- set
- {
- if (_native_name != value)
- {
- _native_name = value;
- RaisePropertyChanged(nameof(native_name));
- }
- }
+ set => SetProperty(ref _native_name, value);
}
#endregion
@@ -355,14 +307,7 @@ namespace SPT.Launcher.Helpers
public string retry
{
get => _retry;
- set
- {
- if (_retry != value)
- {
- _retry = value;
- RaisePropertyChanged(nameof(retry));
- }
- }
+ set => SetProperty(ref _retry, value);
}
#endregion
@@ -371,14 +316,7 @@ namespace SPT.Launcher.Helpers
public string server_connecting
{
get => _server_connecting;
- set
- {
- if (_server_connecting != value)
- {
- _server_connecting = value;
- RaisePropertyChanged(nameof(server_connecting));
- }
- }
+ set => SetProperty(ref _server_connecting, value);
}
#endregion
@@ -387,14 +325,7 @@ namespace SPT.Launcher.Helpers
public string server_unavailable_format_1
{
get => _server_unavailable_format_1;
- set
- {
- if (_server_unavailable_format_1 != value)
- {
- _server_unavailable_format_1 = value;
- RaisePropertyChanged(nameof(server_unavailable_format_1));
- }
- }
+ set => SetProperty(ref _server_unavailable_format_1, value);
}
#endregion
@@ -403,14 +334,7 @@ namespace SPT.Launcher.Helpers
public string no_servers_available
{
get => _no_servers_available;
- set
- {
- if (_no_servers_available != value)
- {
- _no_servers_available = value;
- RaisePropertyChanged(nameof(no_servers_available));
- }
- }
+ set => SetProperty(ref _no_servers_available, value);
}
#endregion
@@ -419,14 +343,7 @@ namespace SPT.Launcher.Helpers
public string settings_menu
{
get => _settings_menu;
- set
- {
- if (_settings_menu != value)
- {
- _settings_menu = value;
- RaisePropertyChanged(nameof(settings_menu));
- }
- }
+ set => SetProperty(ref _settings_menu, value);
}
#endregion
@@ -435,14 +352,7 @@ namespace SPT.Launcher.Helpers
public string back
{
get => _back;
- set
- {
- if (_back != value)
- {
- _back = value;
- RaisePropertyChanged(nameof(back));
- }
- }
+ set => SetProperty(ref _back, value);
}
#endregion
@@ -451,14 +361,7 @@ namespace SPT.Launcher.Helpers
public string wipe_profile
{
get => _wipe_profile;
- set
- {
- if (_wipe_profile != value)
- {
- _wipe_profile = value;
- RaisePropertyChanged(nameof(wipe_profile));
- }
- }
+ set => SetProperty(ref _wipe_profile, value);
}
#endregion
@@ -467,14 +370,7 @@ namespace SPT.Launcher.Helpers
public string username
{
get => _username;
- set
- {
- if (_username != value)
- {
- _username = value;
- RaisePropertyChanged(nameof(username));
- }
- }
+ set => SetProperty(ref _username, value);
}
#endregion
@@ -483,14 +379,7 @@ namespace SPT.Launcher.Helpers
public string password
{
get => _password;
- set
- {
- if (_password != value)
- {
- _password = value;
- RaisePropertyChanged(nameof(password));
- }
- }
+ set => SetProperty(ref _password, value);
}
#endregion
@@ -499,14 +388,7 @@ namespace SPT.Launcher.Helpers
public string update
{
get => _update;
- set
- {
- if (_update != value)
- {
- _update = value;
- RaisePropertyChanged(nameof(update));
- }
- }
+ set => SetProperty(ref _update, value);
}
#endregion
@@ -515,14 +397,7 @@ namespace SPT.Launcher.Helpers
public string edit_account_update_error
{
get => _edit_account_update_error;
- set
- {
- if (_edit_account_update_error != value)
- {
- _edit_account_update_error = value;
- RaisePropertyChanged(nameof(edit_account_update_error));
- }
- }
+ set => SetProperty(ref _edit_account_update_error, value);
}
#endregion
@@ -531,14 +406,7 @@ namespace SPT.Launcher.Helpers
public string register
{
get => _register;
- set
- {
- if (_register != value)
- {
- _register = value;
- RaisePropertyChanged(nameof(register));
- }
- }
+ set => SetProperty(ref _register, value);
}
#endregion
@@ -547,14 +415,7 @@ namespace SPT.Launcher.Helpers
public string go_to_register
{
get => _go_to_register;
- set
- {
- if (_go_to_register != value)
- {
- _go_to_register = value;
- RaisePropertyChanged(nameof(_go_to_register));
- }
- }
+ set => SetProperty(ref _go_to_register, value);
}
#endregion
@@ -563,14 +424,7 @@ namespace SPT.Launcher.Helpers
public string login_or_register
{
get => _login_or_register;
- set
- {
- if (_login_or_register != value)
- {
- _login_or_register = value;
- RaisePropertyChanged(nameof(login_or_register));
- }
- }
+ set => SetProperty(ref _login_or_register, value);
}
#endregion
@@ -579,14 +433,7 @@ namespace SPT.Launcher.Helpers
public string go_to_login
{
get => _go_to_login;
- set
- {
- if (_go_to_login != value)
- {
- _go_to_login = value;
- RaisePropertyChanged(nameof(go_to_login));
- }
- }
+ set => SetProperty(ref _go_to_login, value);
}
#endregion
@@ -595,14 +442,7 @@ namespace SPT.Launcher.Helpers
public string login_automatically
{
get => _login_automatically;
- set
- {
- if (_login_automatically != value)
- {
- _login_automatically = value;
- RaisePropertyChanged(nameof(login_automatically));
- }
- }
+ set => SetProperty(ref _login_automatically, value);
}
#endregion
@@ -611,14 +451,7 @@ namespace SPT.Launcher.Helpers
public string incorrect_login
{
get => _incorrect_login;
- set
- {
- if (_incorrect_login != value)
- {
- _incorrect_login = value;
- RaisePropertyChanged(nameof(incorrect_login));
- }
- }
+ set => SetProperty(ref _incorrect_login, value);
}
#endregion
@@ -627,14 +460,7 @@ namespace SPT.Launcher.Helpers
public string login_failed
{
get => _login_failed;
- set
- {
- if (_login_failed != value)
- {
- _login_failed = value;
- RaisePropertyChanged(nameof(login_failed));
- }
- }
+ set => SetProperty(ref _login_failed, value);
}
#endregion
@@ -643,14 +469,7 @@ namespace SPT.Launcher.Helpers
public string edition
{
get => _edition;
- set
- {
- if (_edition != value)
- {
- _edition = value;
- RaisePropertyChanged(nameof(edition));
- }
- }
+ set => SetProperty(ref _edition, value);
}
#endregion
@@ -659,14 +478,7 @@ namespace SPT.Launcher.Helpers
public string id
{
get => _id;
- set
- {
- if (_id != value)
- {
- _id = value;
- RaisePropertyChanged(nameof(id));
- }
- }
+ set => SetProperty(ref _id, value);
}
#endregion
@@ -675,14 +487,7 @@ namespace SPT.Launcher.Helpers
public string logout
{
get => _logout;
- set
- {
- if (_logout != value)
- {
- _logout = value;
- RaisePropertyChanged(nameof(logout));
- }
- }
+ set => SetProperty(ref _logout, value);
}
#endregion
@@ -691,14 +496,7 @@ namespace SPT.Launcher.Helpers
public string account
{
get => _account;
- set
- {
- if (_account != value)
- {
- _account = value;
- RaisePropertyChanged(nameof(account));
- }
- }
+ set => SetProperty(ref _account, value);
}
#endregion
@@ -707,14 +505,7 @@ namespace SPT.Launcher.Helpers
public string edit_account
{
get => _edit_account;
- set
- {
- if (_edit_account != value)
- {
- _edit_account = value;
- RaisePropertyChanged(nameof(edit_account));
- }
- }
+ set => SetProperty(ref _edit_account, value);
}
#endregion
@@ -723,14 +514,7 @@ namespace SPT.Launcher.Helpers
public string start_game
{
get => _start_game;
- set
- {
- if (_start_game != value)
- {
- _start_game = value;
- RaisePropertyChanged(nameof(start_game));
- }
- }
+ set => SetProperty(ref _start_game, value);
}
#endregion
@@ -739,14 +523,7 @@ namespace SPT.Launcher.Helpers
public string installed_in_live_game_warning
{
get => _installed_in_live_game_warning;
- set
- {
- if (_installed_in_live_game_warning != value)
- {
- _installed_in_live_game_warning = value;
- RaisePropertyChanged(nameof(installed_in_live_game_warning));
- }
- }
+ set => SetProperty(ref _installed_in_live_game_warning, value);
}
#endregion
@@ -755,14 +532,7 @@ namespace SPT.Launcher.Helpers
public string no_official_game_warning
{
get => _no_official_game_warning;
- set
- {
- if (_no_official_game_warning != value)
- {
- _no_official_game_warning = value;
- RaisePropertyChanged(nameof(no_official_game_warning));
- }
- }
+ set => SetProperty(ref _no_official_game_warning, value);
}
#endregion
@@ -771,14 +541,7 @@ namespace SPT.Launcher.Helpers
public string eft_exe_not_found_warning
{
get => _eft_exe_not_found_warning;
- set
- {
- if (_eft_exe_not_found_warning != value)
- {
- _eft_exe_not_found_warning = value;
- RaisePropertyChanged(nameof(eft_exe_not_found_warning));
- }
- }
+ set => SetProperty(ref _eft_exe_not_found_warning, value);
}
#endregion
@@ -787,14 +550,7 @@ namespace SPT.Launcher.Helpers
public string account_exist
{
get => _account_exist;
- set
- {
- if (_account_exist != value)
- {
- _account_exist = value;
- RaisePropertyChanged(nameof(account_exist));
- }
- }
+ set => SetProperty(ref _account_exist, value);
}
#endregion
@@ -803,14 +559,7 @@ namespace SPT.Launcher.Helpers
public string url
{
get => _url;
- set
- {
- if (_url != value)
- {
- _url = value;
- RaisePropertyChanged(nameof(url));
- }
- }
+ set => SetProperty(ref _url, value);
}
#endregion
@@ -819,14 +568,7 @@ namespace SPT.Launcher.Helpers
public string default_language
{
get => _default_language;
- set
- {
- if (_default_language != value)
- {
- _default_language = value;
- RaisePropertyChanged(nameof(default_language));
- }
- }
+ set => SetProperty(ref _default_language, value);
}
#endregion
@@ -835,14 +577,7 @@ namespace SPT.Launcher.Helpers
public string game_path
{
get => _game_path;
- set
- {
- if (_game_path != value)
- {
- _game_path = value;
- RaisePropertyChanged(nameof(game_path));
- }
- }
+ set => SetProperty(ref _game_path, value);
}
#endregion
@@ -851,14 +586,7 @@ namespace SPT.Launcher.Helpers
public string clear_game_settings
{
get => _clear_game_settings;
- set
- {
- if (_clear_game_settings != value)
- {
- _clear_game_settings = value;
- RaisePropertyChanged(nameof(clear_game_settings));
- }
- }
+ set => SetProperty(ref _clear_game_settings, value);
}
#endregion
@@ -867,14 +595,7 @@ namespace SPT.Launcher.Helpers
public string clear_game_settings_succeeded
{
get => _clear_game_settings_succeeded;
- set
- {
- if (_clear_game_settings_succeeded != value)
- {
- _clear_game_settings_succeeded = value;
- RaisePropertyChanged(nameof(clear_game_settings_succeeded));
- }
- }
+ set => SetProperty(ref _clear_game_settings_succeeded, value);
}
#endregion
@@ -883,14 +604,7 @@ namespace SPT.Launcher.Helpers
public string clear_game_settings_failed
{
get => _clear_game_settings_failed;
- set
- {
- if (_clear_game_settings_failed != value)
- {
- _clear_game_settings_failed = value;
- RaisePropertyChanged(nameof(clear_game_settings_failed));
- }
- }
+ set => SetProperty(ref _clear_game_settings_failed, value);
}
#endregion
@@ -899,14 +613,7 @@ namespace SPT.Launcher.Helpers
public string load_live_settings
{
get => _load_live_settings;
- set
- {
- if (_load_live_settings != value)
- {
- _load_live_settings = value;
- RaisePropertyChanged(nameof(load_live_settings));
- }
- }
+ set => SetProperty(ref _load_live_settings, value);
}
#endregion
@@ -915,14 +622,7 @@ namespace SPT.Launcher.Helpers
public string load_live_settings_failed
{
get => _load_live_settings_failed;
- set
- {
- if (_load_live_settings_failed != value)
- {
- _load_live_settings_failed = value;
- RaisePropertyChanged(nameof(load_live_settings_failed));
- }
- }
+ set => SetProperty(ref _load_live_settings_failed, value);
}
#endregion
@@ -931,14 +631,7 @@ namespace SPT.Launcher.Helpers
public string load_live_settings_succeeded
{
get => _load_live_settings_succeeded;
- set
- {
- if (_load_live_settings_succeeded != value)
- {
- _load_live_settings_succeeded = value;
- RaisePropertyChanged(nameof(load_live_settings_succeeded));
- }
- }
+ set => SetProperty(ref _load_live_settings_succeeded, value);
}
#endregion
@@ -947,14 +640,7 @@ namespace SPT.Launcher.Helpers
public string remove_registry_keys
{
get => _remove_registry_keys;
- set
- {
- if (_remove_registry_keys != value)
- {
- _remove_registry_keys = value;
- RaisePropertyChanged(nameof(remove_registry_keys));
- }
- }
+ set => SetProperty(ref _remove_registry_keys, value);
}
#endregion
@@ -963,14 +649,7 @@ namespace SPT.Launcher.Helpers
public string remove_registry_keys_succeeded
{
get => _remove_registry_keys_succeeded;
- set
- {
- if (_remove_registry_keys_succeeded != value)
- {
- _remove_registry_keys_succeeded = value;
- RaisePropertyChanged(nameof(remove_registry_keys_succeeded));
- }
- }
+ set => SetProperty(ref _remove_registry_keys_succeeded, value);
}
#endregion
@@ -979,14 +658,7 @@ namespace SPT.Launcher.Helpers
public string remove_registry_keys_failed
{
get => _remove_registry_keys_failed;
- set
- {
- if (_remove_registry_keys_failed != value)
- {
- _remove_registry_keys_failed = value;
- RaisePropertyChanged(nameof(remove_registry_keys_failed));
- }
- }
+ set => SetProperty(ref _remove_registry_keys_failed, value);
}
#endregion
@@ -995,14 +667,7 @@ namespace SPT.Launcher.Helpers
public string clean_temp_files
{
get => _clean_temp_files;
- set
- {
- if (_clean_temp_files != value)
- {
- _clean_temp_files = value;
- RaisePropertyChanged(nameof(clean_temp_files));
- }
- }
+ set => SetProperty(ref _clean_temp_files, value);
}
#endregion
@@ -1011,14 +676,7 @@ namespace SPT.Launcher.Helpers
public string clean_temp_files_succeeded
{
get => _clean_temp_files_succeeded;
- set
- {
- if (_clean_temp_files_succeeded != value)
- {
- _clean_temp_files_succeeded = value;
- RaisePropertyChanged(nameof(clean_temp_files_succeeded));
- }
- }
+ set => SetProperty(ref _clean_temp_files_succeeded, value);
}
#endregion
@@ -1027,14 +685,7 @@ namespace SPT.Launcher.Helpers
public string clean_temp_files_failed
{
get => _clean_temp_files_failed;
- set
- {
- if (_clean_temp_files_failed != value)
- {
- _clean_temp_files_failed = value;
- RaisePropertyChanged(nameof(clean_temp_files_failed));
- }
- }
+ set => SetProperty(ref _clean_temp_files_failed, value);
}
#endregion
@@ -1043,14 +694,7 @@ namespace SPT.Launcher.Helpers
public string select_folder
{
get => _select_folder;
- set
- {
- if (_select_folder != value)
- {
- _select_folder = value;
- RaisePropertyChanged(nameof(select_folder));
- }
- }
+ set => SetProperty(ref _select_folder, value);
}
#endregion
@@ -1059,14 +703,7 @@ namespace SPT.Launcher.Helpers
public string registration_failed
{
get => _registration_failed;
- set
- {
- if (_registration_failed != value)
- {
- _registration_failed = value;
- RaisePropertyChanged(nameof(registration_failed));
- }
- }
+ set => SetProperty(ref _registration_failed, value);
}
#endregion
@@ -1075,14 +712,7 @@ namespace SPT.Launcher.Helpers
public string registration_question_format_1
{
get => _registration_question_format_1;
- set
- {
- if(_registration_question_format_1 != value)
- {
- _registration_question_format_1 = value;
- RaisePropertyChanged(nameof(registration_question_format_1));
- }
- }
+ set => SetProperty(ref _registration_question_format_1, value);
}
#endregion
@@ -1091,14 +721,7 @@ namespace SPT.Launcher.Helpers
public string minimize_action
{
get => _minimize_action;
- set
- {
- if (_minimize_action != value)
- {
- _minimize_action = value;
- RaisePropertyChanged(nameof(minimize_action));
- }
- }
+ set => SetProperty(ref _minimize_action, value);
}
#endregion
@@ -1107,14 +730,7 @@ namespace SPT.Launcher.Helpers
public string do_nothing_action
{
get => _do_nothing_action;
- set
- {
- if (_do_nothing_action != value)
- {
- _do_nothing_action = value;
- RaisePropertyChanged(nameof(do_nothing_action));
- }
- }
+ set => SetProperty(ref _do_nothing_action, value);
}
#endregion
@@ -1123,14 +739,7 @@ namespace SPT.Launcher.Helpers
public string exit_action
{
get => _exit_action;
- set
- {
- if (_exit_action != value)
- {
- _exit_action = value;
- RaisePropertyChanged(nameof(exit_action));
- }
- }
+ set => SetProperty(ref _exit_action, value);
}
#endregion
@@ -1139,14 +748,7 @@ namespace SPT.Launcher.Helpers
public string on_game_start
{
get => _on_game_start;
- set
- {
- if (_on_game_start != value)
- {
- _on_game_start = value;
- RaisePropertyChanged(nameof(on_game_start));
- }
- }
+ set => SetProperty(ref _on_game_start, value);
}
#endregion
@@ -1155,14 +757,7 @@ namespace SPT.Launcher.Helpers
public string game
{
get => _game;
- set
- {
- if (_game != value)
- {
- _game = value;
- RaisePropertyChanged(nameof(game));
- }
- }
+ set => SetProperty(ref _game, value);
}
#endregion
@@ -1171,14 +766,7 @@ namespace SPT.Launcher.Helpers
public string new_password
{
get => _new_password;
- set
- {
- if (_new_password != value)
- {
- _new_password = value;
- RaisePropertyChanged(nameof(new_password));
- }
- }
+ set => SetProperty(ref _new_password, value);
}
#endregion
@@ -1187,14 +775,7 @@ namespace SPT.Launcher.Helpers
public string wipe_warning
{
get => _wipe_warning;
- set
- {
- if (_wipe_warning != value)
- {
- _wipe_warning = value;
- RaisePropertyChanged(nameof(wipe_warning));
- }
- }
+ set => SetProperty(ref _wipe_warning, value);
}
#endregion
@@ -1203,14 +784,7 @@ namespace SPT.Launcher.Helpers
public string cancel
{
get => _cancel;
- set
- {
- if (_cancel != value)
- {
- _cancel = value;
- RaisePropertyChanged(nameof(cancel));
- }
- }
+ set => SetProperty(ref _cancel, value);
}
#endregion
@@ -1219,14 +793,7 @@ namespace SPT.Launcher.Helpers
public string need_an_account
{
get => _need_an_account;
- set
- {
- if (_need_an_account != value)
- {
- _need_an_account = value;
- RaisePropertyChanged(nameof(need_an_account));
- }
- }
+ set => SetProperty(ref _need_an_account, value);
}
#endregion
@@ -1235,14 +802,7 @@ namespace SPT.Launcher.Helpers
public string have_an_account
{
get => _have_an_account;
- set
- {
- if (_have_an_account != value)
- {
- _have_an_account = value;
- RaisePropertyChanged(nameof(have_an_account));
- }
- }
+ set => SetProperty(ref _have_an_account, value);
}
#endregion
@@ -1251,14 +811,7 @@ namespace SPT.Launcher.Helpers
public string reapply_patch
{
get => _reapply_patch;
- set
- {
- if (_reapply_patch != value)
- {
- _reapply_patch = value;
- RaisePropertyChanged(nameof(reapply_patch));
- }
- }
+ set => SetProperty(ref _reapply_patch, value);
}
#endregion
@@ -1267,14 +820,7 @@ namespace SPT.Launcher.Helpers
public string failed_to_receive_patches
{
get => _failed_to_receive_patches;
- set
- {
- if (_failed_to_receive_patches != value)
- {
- _failed_to_receive_patches = value;
- RaisePropertyChanged(nameof(failed_to_receive_patches));
- }
- }
+ set => SetProperty(ref _failed_to_receive_patches, value);
}
#endregion
@@ -1283,14 +829,7 @@ namespace SPT.Launcher.Helpers
public string failed_core_patch
{
get => _failed_core_patch;
- set
- {
- if (_failed_core_patch != value)
- {
- _failed_core_patch = value;
- RaisePropertyChanged(nameof(failed_core_patch));
- }
- }
+ set => SetProperty(ref _failed_core_patch, value);
}
#endregion
@@ -1299,14 +838,7 @@ namespace SPT.Launcher.Helpers
public string failed_mod_patch
{
get => _failed_mod_patch;
- set
- {
- if (_failed_mod_patch != value)
- {
- _failed_mod_patch = value;
- RaisePropertyChanged(nameof(failed_mod_patch));
- }
- }
+ set => SetProperty(ref _failed_mod_patch, value);
}
#endregion
@@ -1315,14 +847,7 @@ namespace SPT.Launcher.Helpers
public string ok
{
get => _ok;
- set
- {
- if (_ok != value)
- {
- _ok = value;
- RaisePropertyChanged(nameof(ok));
- }
- }
+ set => SetProperty(ref _ok, value);
}
#endregion
@@ -1331,14 +856,7 @@ namespace SPT.Launcher.Helpers
public string account_page_denied
{
get => _account_page_denied;
- set
- {
- if (_account_page_denied != value)
- {
- _account_page_denied = value;
- RaisePropertyChanged(nameof(account_page_denied));
- }
- }
+ set => SetProperty(ref _account_page_denied, value);
}
#endregion
@@ -1347,14 +865,7 @@ namespace SPT.Launcher.Helpers
public string account_updated
{
get => _account_updated;
- set
- {
- if (_account_updated != value)
- {
- _account_updated = value;
- RaisePropertyChanged(nameof(_account_updated));
- }
- }
+ set => SetProperty(ref _account_updated, value);
}
#endregion
@@ -1363,14 +874,7 @@ namespace SPT.Launcher.Helpers
public string nickname
{
get => _nickname;
- set
- {
- if (_nickname != value)
- {
- _nickname = value;
- RaisePropertyChanged(nameof(nickname));
- }
- }
+ set => SetProperty(ref _nickname, value);
}
#endregion
@@ -1379,14 +883,7 @@ namespace SPT.Launcher.Helpers
public string side
{
get => _side;
- set
- {
- if (_side != value)
- {
- _side = value;
- RaisePropertyChanged(nameof(side));
- }
- }
+ set => SetProperty(ref _side, value);
}
#endregion
@@ -1395,14 +892,7 @@ namespace SPT.Launcher.Helpers
public string level
{
get => _level;
- set
- {
- if (_level != value)
- {
- _level = value;
- RaisePropertyChanged(nameof(level));
- }
- }
+ set => SetProperty(ref _level, value);
}
#endregion
@@ -1411,14 +901,7 @@ namespace SPT.Launcher.Helpers
public string patching
{
get => _patching;
- set
- {
- if(_patching != value)
- {
- _patching = value;
- RaisePropertyChanged(nameof(patching));
- }
- }
+ set => SetProperty(ref _patching, value);
}
#endregion
@@ -1427,14 +910,7 @@ namespace SPT.Launcher.Helpers
public string file_mismatch_dialog_message
{
get => _file_mismatch_dialog_message;
- set
- {
- if(_file_mismatch_dialog_message != value)
- {
- _file_mismatch_dialog_message = value;
- RaisePropertyChanged(nameof(file_mismatch_dialog_message));
- }
- }
+ set => SetProperty(ref _file_mismatch_dialog_message, value);
}
#endregion
@@ -1443,14 +919,7 @@ namespace SPT.Launcher.Helpers
public string yes
{
get => _yes;
- set
- {
- if(_yes != value)
- {
- _yes = value;
- RaisePropertyChanged(nameof(yes));
- }
- }
+ set => SetProperty(ref _yes, value);
}
#endregion
@@ -1459,14 +928,7 @@ namespace SPT.Launcher.Helpers
public string no
{
get => _no;
- set
- {
- if(_no != value)
- {
- _no = value;
- RaisePropertyChanged(nameof(no));
- }
- }
+ set => SetProperty(ref _no, value);
}
#endregion
@@ -1475,14 +937,7 @@ namespace SPT.Launcher.Helpers
public string profile_created
{
get => _profile_created;
- set
- {
- if(_profile_created != value)
- {
- _profile_created = value;
- RaisePropertyChanged(nameof(profile_created));
- }
- }
+ set => SetProperty(ref _profile_created, value);
}
#endregion
@@ -1491,14 +946,7 @@ namespace SPT.Launcher.Helpers
public string open_folder
{
get => _open_folder;
- set
- {
- if(_open_folder != value)
- {
- _open_folder = value;
- RaisePropertyChanged(nameof(open_folder));
- }
- }
+ set => SetProperty(ref _open_folder, value);
}
#endregion
@@ -1507,14 +955,7 @@ namespace SPT.Launcher.Helpers
public string select_edition
{
get => _select_edition;
- set
- {
- if(_select_edition != value)
- {
- _select_edition = value;
- RaisePropertyChanged(nameof(select_edition));
- }
- }
+ set => SetProperty(ref _select_edition, value);
}
#endregion
@@ -1523,14 +964,7 @@ namespace SPT.Launcher.Helpers
public string copied
{
get => _copied;
- set
- {
- if(_copied != value)
- {
- _copied = value;
- RaisePropertyChanged(nameof(copied));
- }
- }
+ set => SetProperty(ref _copied, value);
}
#endregion
@@ -1539,14 +973,7 @@ namespace SPT.Launcher.Helpers
public string next_level_in
{
get => _next_level_in;
- set
- {
- if(_next_level_in != value)
- {
- _next_level_in = value;
- RaisePropertyChanged(nameof(next_level_in));
- }
- }
+ set => SetProperty(ref _next_level_in, value);
}
#endregion
@@ -1555,14 +982,7 @@ namespace SPT.Launcher.Helpers
public string no_profile_data
{
get => _no_profile_data;
- set
- {
- if (_no_profile_data != value)
- {
- _no_profile_data = value;
- RaisePropertyChanged(nameof(no_profile_data));
- }
- }
+ set => SetProperty(ref _no_profile_data, value);
}
#endregion
@@ -1571,14 +991,7 @@ namespace SPT.Launcher.Helpers
public string profile_version_mismath
{
get => _profile_version_mismath;
- set
- {
- if(_profile_version_mismath != value)
- {
- _profile_version_mismath = value;
- RaisePropertyChanged(nameof(profile_version_mismath));
- }
- }
+ set => SetProperty(ref _profile_version_mismath, value);
}
#endregion
@@ -1587,14 +1000,7 @@ namespace SPT.Launcher.Helpers
public string profile_removed
{
get => _profile_removed;
- set
- {
- if(_profile_removed != value)
- {
- _profile_removed = value;
- RaisePropertyChanged(nameof(profile_removed));
- }
- }
+ set => SetProperty(ref _profile_removed, value);
}
#endregion
@@ -1603,14 +1009,7 @@ namespace SPT.Launcher.Helpers
public string profile_removal_failed
{
get => _profile_removal_failed;
- set
- {
- if(_profile_removal_failed != value)
- {
- _profile_removal_failed = value;
- RaisePropertyChanged(nameof(profile_removal_failed));
- }
- }
+ set => SetProperty(ref _profile_removal_failed, value);
}
#endregion
@@ -1619,14 +1018,7 @@ namespace SPT.Launcher.Helpers
public string profile_remove_question_format_1
{
get => _profile_remove_question_format_1;
- set
- {
- if(_profile_remove_question_format_1 != value)
- {
- _profile_remove_question_format_1 = value;
- RaisePropertyChanged(nameof(profile_remove_question_format_1));
- }
- }
+ set => SetProperty(ref _profile_remove_question_format_1, value);
}
#endregion
@@ -1635,14 +1027,7 @@ namespace SPT.Launcher.Helpers
public string i_understand
{
get => _i_understand;
- set
- {
- if(_i_understand != value)
- {
- _i_understand = value;
- RaisePropertyChanged(nameof(i_understand));
- }
- }
+ set => SetProperty(ref _i_understand, value);
}
#endregion
@@ -1651,14 +1036,7 @@ namespace SPT.Launcher.Helpers
public string game_version_mismatch_format_2
{
get => _game_version_mismatch_format_2;
- set
- {
- if(_game_version_mismatch_format_2 != value)
- {
- _game_version_mismatch_format_2 = value;
- RaisePropertyChanged(nameof(game_version_mismatch_format_2));
- }
- }
+ set => SetProperty(ref _game_version_mismatch_format_2, value);
}
#endregion
@@ -1667,14 +1045,7 @@ namespace SPT.Launcher.Helpers
public string description
{
get => _description;
- set
- {
- if(_description != value)
- {
- _description = value;
- RaisePropertyChanged(nameof(description));
- }
- }
+ set => SetProperty(ref _description, value);
}
#endregion
@@ -1683,14 +1054,7 @@ namespace SPT.Launcher.Helpers
public string author
{
get => _author;
- set
- {
- if (_author != value)
- {
- _author = value;
- RaisePropertyChanged(nameof(author));
- }
- }
+ set => SetProperty(ref _author, value);
}
#endregion
@@ -1700,14 +1064,7 @@ namespace SPT.Launcher.Helpers
public string wipe_on_start
{
get => _wipe_on_start;
- set
- {
- if (_wipe_on_start != value)
- {
- _wipe_on_start = value;
- RaisePropertyChanged(nameof(wipe_on_start));
- }
- }
+ set => SetProperty(ref _wipe_on_start, value);
}
#endregion
@@ -1716,14 +1073,7 @@ namespace SPT.Launcher.Helpers
public string copy_live_settings_question
{
get => _copy_live_settings_question;
- set
- {
- if (_copy_live_settings_question != value)
- {
- _copy_live_settings_question = value;
- RaisePropertyChanged(nameof(copy_live_settings_question));
- }
- }
+ set => SetProperty(ref _copy_live_settings_question, value);
}
#endregion
@@ -1732,14 +1082,7 @@ namespace SPT.Launcher.Helpers
public string mod_not_in_server_warning
{
get => _mod_not_in_server_warning;
- set
- {
- if (_mod_not_in_server_warning != value)
- {
- _mod_not_in_server_warning = value;
- RaisePropertyChanged(nameof(mod_not_in_server_warning));
- }
- }
+ set => SetProperty(ref _mod_not_in_server_warning, value);
}
#endregion
@@ -1748,14 +1091,7 @@ namespace SPT.Launcher.Helpers
public string active_server_mods
{
get => _active_server_mods;
- set
- {
- if (_active_server_mods != value)
- {
- _active_server_mods = value;
- RaisePropertyChanged(nameof(active_server_mods));
- }
- }
+ set => SetProperty(ref _active_server_mods, value);
}
#endregion
@@ -1766,14 +1102,7 @@ namespace SPT.Launcher.Helpers
public string active_server_mods_info_text
{
get => _active_server_mods_info_text;
- set
- {
- if (_active_server_mods_info_text != value)
- {
- _active_server_mods_info_text = value;
- RaisePropertyChanged(nameof(active_server_mods_info_text));
- }
- }
+ set => SetProperty(ref _active_server_mods_info_text, value);
}
#endregion
@@ -1782,14 +1111,7 @@ namespace SPT.Launcher.Helpers
public string inactive_server_mods
{
get => _inactive_server_mods;
- set
- {
- if (_inactive_server_mods != value)
- {
- _inactive_server_mods = value;
- RaisePropertyChanged(nameof(inactive_server_mods));
- }
- }
+ set => SetProperty(ref _inactive_server_mods, value);
}
#endregion
@@ -1800,14 +1122,7 @@ namespace SPT.Launcher.Helpers
public string inactive_server_mods_info_text
{
get => _inactive_server_mods_info_text;
- set
- {
- if (_inactive_server_mods_info_text != value)
- {
- _inactive_server_mods_info_text = value;
- RaisePropertyChanged(nameof(inactive_server_mods_info_text));
- }
- }
+ set => SetProperty(ref _inactive_server_mods_info_text, value);
}
#endregion
@@ -1818,14 +1133,7 @@ namespace SPT.Launcher.Helpers
public string open_link_question_format_1
{
get => _open_link_question_format_1;
- set
- {
- if (_open_link_question_format_1 != value)
- {
- _open_link_question_format_1 = value;
- RaisePropertyChanged(nameof(open_link_question_format_1));
- }
- }
+ set => SetProperty(ref _open_link_question_format_1, value);
}
#endregion
@@ -1836,14 +1144,7 @@ namespace SPT.Launcher.Helpers
public string open_link
{
get => _open_link;
- set
- {
- if (_open_link != value)
- {
- _open_link = value;
- RaisePropertyChanged(nameof(open_link));
- }
- }
+ set => SetProperty(ref _open_link, value);
}
#endregion
@@ -1853,25 +1154,11 @@ namespace SPT.Launcher.Helpers
public string core_dll_file_version_mismatch
{
get => _core_dll_file_version_mismatch;
- set
- {
- if (_core_dll_file_version_mismatch != value)
- {
- _core_dll_file_version_mismatch = value;
- RaisePropertyChanged(nameof(core_dll_file_version_mismatch));
- }
- }
+ set => SetProperty(ref _core_dll_file_version_mismatch, value);
}
#endregion
#endregion
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/ConnectServerModel.cs b/project/SPT.Launcher.Base/Models/Launcher/ConnectServerModel.cs
index f3cb936..3590c1d 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/ConnectServerModel.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/ConnectServerModel.cs
@@ -6,45 +6,24 @@
*/
-using System.ComponentModel;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher
{
- public class ConnectServerModel : INotifyPropertyChanged
+ public class ConnectServerModel : NotifyPropertyChangedBase
{
- private string _InfoText;
+ private string _infoText;
public string InfoText
{
- get => _InfoText;
- set
- {
- if (_InfoText != value)
- {
- _InfoText = value;
- RaisePropertyChanged(nameof(InfoText));
- }
- }
+ get => _infoText;
+ set => SetProperty(ref _infoText, value);
}
- private bool _ConnectionFailed;
+ private bool _connectionFailed;
public bool ConnectionFailed
{
- get => _ConnectionFailed;
- set
- {
- if(_ConnectionFailed != value)
- {
- _ConnectionFailed = value;
- RaisePropertyChanged(nameof(ConnectionFailed));
- }
- }
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
+ get => _connectionFailed;
+ set => SetProperty(ref _connectionFailed, value);
}
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/EditionCollection.cs b/project/SPT.Launcher.Base/Models/Launcher/EditionCollection.cs
index 3bbce27..91d7155 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/EditionCollection.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/EditionCollection.cs
@@ -9,53 +9,32 @@
using SPT.Launcher.Models.SPT;
using System.Collections.ObjectModel;
using System.ComponentModel;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher
{
- public class EditionCollection : INotifyPropertyChanged
+ public class EditionCollection : NotifyPropertyChangedBase
{
- private bool _HasSelection;
+ private bool _hasSelection;
public bool HasSelection
{
- get => _HasSelection;
- set
- {
- if(_HasSelection != value)
- {
- _HasSelection = value;
- RaisePropertyChanged(nameof(HasSelection));
- }
- }
+ get => _hasSelection;
+ set => SetProperty(ref _hasSelection, value);
}
- private int _SelectedEditionIndex;
+ private int _selectedEditionIndex;
public int SelectedEditionIndex
{
- get => _SelectedEditionIndex;
- set
- {
- if (_SelectedEditionIndex != value)
- {
- _SelectedEditionIndex = value;
- RaisePropertyChanged(nameof(SelectedEditionIndex));
- }
- }
+ get => _selectedEditionIndex;
+ set => SetProperty(ref _selectedEditionIndex, value);
}
- private SPTEdition _SelectedEdition;
+ private SPTEdition _selectedEdition;
public SPTEdition SelectedEdition
{
- get => _SelectedEdition;
- set
- {
- if (_SelectedEdition != value)
- {
- _SelectedEdition = value;
- HasSelection = _SelectedEdition != null;
- RaisePropertyChanged(nameof(SelectedEdition));
- }
- }
+ get => _selectedEdition;
+ set => SetProperty(ref _selectedEdition, value, () => HasSelection = _selectedEdition != null);
}
- public ObservableCollection AvailableEditions { get; private set; } = new ObservableCollection();
+ public ObservableCollection AvailableEditions { get; private set; } = [];
public EditionCollection()
{
@@ -66,12 +45,5 @@ namespace SPT.Launcher.Models.Launcher
AvailableEditions.Add(new SPTEdition(edition));
}
}
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/LocaleCollection.cs b/project/SPT.Launcher.Base/Models/Launcher/LocaleCollection.cs
index d8e47b5..402f182 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/LocaleCollection.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/LocaleCollection.cs
@@ -11,38 +11,24 @@ using SPT.Launcher.Helpers;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher
{
- public class LocaleCollection : INotifyPropertyChanged
+ public class LocaleCollection : NotifyPropertyChangedBase
{
- private string _SelectedLocale;
+ private string _selectedLocale;
public string SelectedLocale
{
- get => _SelectedLocale;
- set
- {
- if (_SelectedLocale != value)
- {
- _SelectedLocale = value;
- RaisePropertyChanged(nameof(SelectedLocale));
- LocalizationProvider.LoadLocalByName(value);
- }
- }
+ get => _selectedLocale;
+ set => SetProperty(ref _selectedLocale, value, () => LocalizationProvider.LoadLocalByName(value));
}
public ObservableCollection AvailableLocales { get; set; } = LocalizationProvider.GetAvailableLocales();
- public event PropertyChangedEventHandler PropertyChanged;
-
public LocaleCollection()
{
SelectedLocale = LocalizationProvider.LocaleNameDictionary.GetValueOrDefault(LauncherSettingsProvider.Instance.DefaultLocale, "English");
}
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/LocalizedLauncherAction.cs b/project/SPT.Launcher.Base/Models/Launcher/LocalizedLauncherAction.cs
index d41f025..1f2255c 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/LocalizedLauncherAction.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/LocalizedLauncherAction.cs
@@ -2,25 +2,19 @@
using SPT.Launcher.Models.Launcher;
using System.ComponentModel;
using System.Text.RegularExpressions;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models
{
- public class LocalizedLauncherAction : INotifyPropertyChanged
+ public class LocalizedLauncherAction : NotifyPropertyChangedBase
{
public LauncherAction Action { get; set; }
- private string _Name;
+ private string _name;
public string Name
{
- get => _Name;
- set
- {
- if(_Name != value)
- {
- _Name = value;
- RaisePropertyChanged(nameof(Name));
- }
- }
+ get => _name;
+ set => SetProperty(ref _name, value);
}
public void UpdateLocaleName()
@@ -49,12 +43,5 @@ namespace SPT.Launcher.Models
UpdateLocaleName();
}
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/LoginModel.cs b/project/SPT.Launcher.Base/Models/Launcher/LoginModel.cs
index d623652..1668e5d 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/LoginModel.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/LoginModel.cs
@@ -6,44 +6,24 @@
*/
-using System.ComponentModel;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher
{
- public class LoginModel : INotifyPropertyChanged
+ public class LoginModel : NotifyPropertyChangedBase
{
- private string _Username = "";
+ private string _username = "";
public string Username
{
- get => _Username;
- set
- {
- if (_Username != value)
- {
- _Username = value;
- RaisePropertyChanged(nameof(Username));
- }
- }
+ get => _username;
+ set => SetProperty(ref _username, value);
}
- private string _Password = "";
+ private string _password = "";
public string Password
{
- get => _Password;
- set
- {
- if (_Password != value)
- {
- _Password = value;
- RaisePropertyChanged(nameof(Password));
- }
- }
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
+ get => _password;
+ set => SetProperty(ref _password, value);
}
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/MenuBarItem.cs b/project/SPT.Launcher.Base/Models/Launcher/MenuBarItem.cs
index 911d19a..b0c4b98 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/MenuBarItem.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/MenuBarItem.cs
@@ -9,62 +9,35 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher
{
- public class MenuBarItem : INotifyPropertyChanged
+ public class MenuBarItem : NotifyPropertyChangedBase
{
- private string _Name;
+ private string _name;
public string Name
{
- get => _Name;
- set
- {
- if (_Name != value)
- {
- _Name = value;
- RaisePropertyChanged(nameof(Name));
- }
- }
+ get => _name;
+ set => SetProperty(ref _name, value);
}
- private bool _IsSelected;
+ private bool _isSelected;
public bool IsSelected
{
- get => _IsSelected;
- set
- {
- if (_IsSelected != value)
- {
- _IsSelected = value;
- RaisePropertyChanged(nameof(IsSelected));
- }
- }
+ get => _isSelected;
+ set => SetProperty(ref _isSelected, value);
}
- private Action _ItemAction;
+ private Action _itemAction;
public Action ItemAction
{
- get => _ItemAction;
- set
- {
- if (_ItemAction != value)
- {
- _ItemAction = value;
- RaisePropertyChanged(nameof(ItemAction));
- }
- }
+ get => _itemAction;
+ set => SetProperty(ref _itemAction, value);
}
public Func> CanUseAction = async () => await Task.FromResult(true);
public Action OnFailedToUseAction = null;
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/ModInfoCollection.cs b/project/SPT.Launcher.Base/Models/Launcher/ModInfoCollection.cs
index eaacfb1..eac2fa7 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/ModInfoCollection.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/ModInfoCollection.cs
@@ -2,55 +2,35 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher
{
- public class ModInfoCollection : INotifyPropertyChanged
+ public class ModInfoCollection : NotifyPropertyChangedBase
{
private int _serverModsCount;
public int ServerModsCount
{
get => _serverModsCount;
- set
- {
- if (_serverModsCount != value)
- {
- _serverModsCount = value;
- RaisePropertyChanged(nameof(ServerModsCount));
- }
- }
+ set => SetProperty(ref _serverModsCount, value);
}
private int _profileModsCount;
public int ProfileModsCount
{
get => _profileModsCount;
- set
- {
- if (_profileModsCount != value)
- {
- _profileModsCount = value;
- RaisePropertyChanged(nameof(ProfileModsCount));
- }
- }
+ set => SetProperty(ref _profileModsCount, value);
}
private bool _hasMods;
public bool HasMods
{
get => _hasMods;
- set
- {
- if (_hasMods != value)
- {
- _hasMods = value;
- RaisePropertyChanged(nameof(HasMods));
- }
- }
+ set => SetProperty(ref _hasMods, value);
}
- public ObservableCollection ActiveMods { get; private set; } = new ObservableCollection();
- public ObservableCollection InactiveMods { get; private set; } = new ObservableCollection();
+ public ObservableCollection ActiveMods { get; private set; } = [];
+ public ObservableCollection InactiveMods { get; private set; } = [];
public ModInfoCollection()
{
@@ -68,7 +48,7 @@ namespace SPT.Launcher.Models.Launcher
foreach (var inactiveMod in profileMods)
{
- var existingMod = ActiveMods.Where(x => x.Name == inactiveMod.Name && x.Version == inactiveMod.Version && x.Author == inactiveMod.Author).FirstOrDefault();
+ var existingMod = ActiveMods.FirstOrDefault(x => x.Name == inactiveMod.Name && x.Version == inactiveMod.Version && x.Author == inactiveMod.Author);
if (existingMod != null)
{
@@ -82,11 +62,5 @@ namespace SPT.Launcher.Models.Launcher
HasMods = ActiveMods.Count > 0 || InactiveMods.Count > 0;
}
-
- public event PropertyChangedEventHandler PropertyChanged;
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/Notifications/NotificationItem.cs b/project/SPT.Launcher.Base/Models/Launcher/Notifications/NotificationItem.cs
index f42af1d..7a76a16 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/Notifications/NotificationItem.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/Notifications/NotificationItem.cs
@@ -9,75 +9,48 @@
using System;
using System.ComponentModel;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher.Notifications
{
- public class NotificationItem : INotifyPropertyChanged
+ public class NotificationItem : NotifyPropertyChangedBase
{
- private string _Message;
+ private string _message;
public string Message
{
- get => _Message;
- set
- {
- if (_Message != value)
- {
- _Message = value;
- RaisePropertyChanged(nameof(Message));
- }
- }
+ get => _message;
+ set => SetProperty(ref _message, value);
}
- private string _ButtonText;
+ private string _buttonText;
public string ButtonText
{
- get => _ButtonText;
- set
- {
- if (_ButtonText != value)
- {
- _ButtonText = value;
- RaisePropertyChanged(nameof(ButtonText));
- }
- }
+ get => _buttonText;
+ set => SetProperty(ref _buttonText, value);
}
- private bool _HasButton;
+ private bool _hasButton;
public bool HasButton
{
- get => _HasButton;
- set
- {
- if (_HasButton != value)
- {
- _HasButton = value;
- RaisePropertyChanged(nameof(HasButton));
- }
- }
+ get => _hasButton;
+ set => SetProperty(ref _hasButton, value);
}
public Action ItemAction = null;
- public NotificationItem(string Message)
+ public NotificationItem(string message)
{
- this.Message = Message;
+ Message = message;
ButtonText = string.Empty;
HasButton = false;
}
- public NotificationItem(string Message, string ButtonText, Action ItemAction)
+ public NotificationItem(string message, string buttonText, Action itemAction)
{
- this.Message = Message;
- this.ButtonText = ButtonText;
+ Message = message;
+ ButtonText = buttonText;
HasButton = true;
- this.ItemAction = ItemAction;
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
+ ItemAction = itemAction;
}
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/Notifications/NotificationQueue.cs b/project/SPT.Launcher.Base/Models/Launcher/Notifications/NotificationQueue.cs
index 7be7f79..6cc8496 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/Notifications/NotificationQueue.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/Notifications/NotificationQueue.cs
@@ -13,35 +13,29 @@ using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Timers;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher.Notifications
{
- public class NotificationQueue : INotifyPropertyChanged, IDisposable
+ public class NotificationQueue : NotifyPropertyChangedBase, IDisposable
{
public Timer queueTimer = new Timer();
private Timer animateChangeTimer = new Timer(230);
private Timer animateCloseTimer = new Timer(230);
- public ObservableCollection queue { get; set; } = new ObservableCollection();
+ public ObservableCollection queue { get; set; } = [];
- private bool _ShowBanner;
+ private bool _showBanner;
public bool ShowBanner
{
- get => _ShowBanner;
- set
- {
- if (_ShowBanner != value)
- {
- _ShowBanner = value;
- RaisePropertyChanged(nameof(ShowBanner));
- }
- }
+ get => _showBanner;
+ set => SetProperty(ref _showBanner, value);
}
- public NotificationQueue(int ShowTimeInMiliseconds)
+ public NotificationQueue(int showTimeInMilliseconds)
{
ShowBanner = false;
- queueTimer.Interval = ShowTimeInMiliseconds;
+ queueTimer.Interval = showTimeInMilliseconds;
queueTimer.Elapsed += QueueTimer_Elapsed;
animateChangeTimer.Elapsed += AnimateChange_Elapsed;
@@ -71,43 +65,43 @@ namespace SPT.Launcher.Models.Launcher.Notifications
}
}
- public void Enqueue(string Message, bool AutowNext = false, bool NoDefaultButton = false)
+ public void Enqueue(string message, bool autoNext = false, bool noDefaultButton = false)
{
- if (queue.Where(x => x.Message == Message).Count() == 0)
+ if (queue.All(x => x.Message != message))
{
- if (NoDefaultButton)
+ if (noDefaultButton)
{
- queue.Add(new NotificationItem(Message));
+ queue.Add(new NotificationItem(message));
}
else
{
- queue.Add(new NotificationItem(Message, LocalizationProvider.Instance.ok, () => { }));
+ queue.Add(new NotificationItem(message, LocalizationProvider.Instance.ok, () => { }));
}
CheckAndShowNotifications();
- if (AutowNext && queue.Count == 2)
+ if (autoNext && queue.Count == 2)
{
Next(true);
}
}
}
- public void Enqueue(string Message, string ButtonText, Action ButtonAction, bool AllowNext = false)
+ public void Enqueue(string message, string buttonText, Action buttonAction, bool allowNext = false)
{
- if (queue.Where(x => x.Message == Message && x.ButtonText == ButtonText).Count() == 0)
+ if (queue.All(x=>x.Message != message && x.ButtonText != buttonText))
{
- queue.Add(new NotificationItem(Message, ButtonText, ButtonAction));
+ queue.Add(new NotificationItem(message, buttonText, buttonAction));
CheckAndShowNotifications();
- if (AllowNext && queue.Count == 2)
+ if (allowNext && queue.Count == 2)
{
Next(true);
}
}
}
- public void Next(bool ResetTimer = false)
+ public void Next(bool resetTimer = false)
{
if (queue.Count - 1 <= 0)
{
@@ -115,7 +109,7 @@ namespace SPT.Launcher.Models.Launcher.Notifications
return;
}
- if (ResetTimer)
+ if (resetTimer)
{
queueTimer.Stop();
queueTimer.Start();
@@ -142,13 +136,6 @@ namespace SPT.Launcher.Models.Launcher.Notifications
ShowBanner = true;
}
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
-
public void Dispose()
{
queueTimer.Dispose();
diff --git a/project/SPT.Launcher.Base/Models/Launcher/ProfileInfo.cs b/project/SPT.Launcher.Base/Models/Launcher/ProfileInfo.cs
index bfa36ce..fa5a0af 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/ProfileInfo.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/ProfileInfo.cs
@@ -12,210 +12,127 @@ using SPT.Launcher.Models.SPT;
using System;
using System.ComponentModel;
using System.IO;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher
{
- public class ProfileInfo : INotifyPropertyChanged
+ public class ProfileInfo : NotifyPropertyChangedBase
{
- private string _Username;
+ private string _username;
public string Username
{
- get => _Username;
- set
- {
- if(_Username != value)
- {
- _Username = value;
- RaisePropertyChanged(nameof(Username));
- }
- }
+ get => _username;
+ set => SetProperty(ref _username, value);
}
- private string _Nickname;
+ private string _nickname;
public string Nickname
{
- get => _Nickname;
- set
- {
- if (_Nickname != value)
- {
- _Nickname = value;
- RaisePropertyChanged(nameof(Nickname));
- }
- }
+ get => _nickname;
+ set => SetProperty(ref _nickname, value);
}
- private string _SideImage;
+ private string _sideImage;
public string SideImage
{
- get => _SideImage;
- set
- {
- if (_SideImage != value)
- {
- _SideImage = value;
- RaisePropertyChanged(nameof(SideImage));
- }
- }
+ get => _sideImage;
+ set => SetProperty(ref _sideImage, value);
}
- private string _Side;
+ private string _side;
public string Side
{
- get => _Side;
- set
- {
- if (_Side != value)
- {
- _Side = value;
- RaisePropertyChanged(nameof(Side));
- }
- }
+ get => _side;
+ set => SetProperty(ref _side, value);
}
- private string _Level;
+ private string _level;
public string Level
{
- get => _Level;
- set
- {
- if (_Level != value)
- {
- _Level = value;
- RaisePropertyChanged(nameof(Level));
- }
- }
+ get => _level;
+ set => SetProperty(ref _level, value);
}
private int _XPLevelProgress;
public int XPLevelProgress
{
get => _XPLevelProgress;
- set
- {
- if (_XPLevelProgress != value)
- {
- _XPLevelProgress = value;
- RaisePropertyChanged(nameof(XPLevelProgress));
- }
- }
+ set => SetProperty(ref _XPLevelProgress, value);
}
- private long _CurrentXP;
+ private long _currentXP;
public long CurrentExp
{
- get => _CurrentXP;
- set
- {
- if (_CurrentXP != value)
- {
- _CurrentXP = value;
- RaisePropertyChanged(nameof(CurrentExp));
- }
- }
+ get => _currentXP;
+ set => SetProperty(ref _currentXP, value);
}
- private long _RemainingExp;
+ private long _remainingExp;
public long RemainingExp
{
- get => _RemainingExp;
- set
- {
- if (_RemainingExp != value)
- {
- _RemainingExp = value;
- RaisePropertyChanged(nameof(RemainingExp));
- }
- }
+ get => _remainingExp;
+ set => SetProperty(ref _remainingExp, value);
}
- private long _NextLvlExp;
+ private long _nextLvlExp;
public long NextLvlExp
{
- get => _NextLvlExp;
- set
- {
- if (_NextLvlExp != value)
- {
- _NextLvlExp = value;
- RaisePropertyChanged(nameof(NextLvlExp));
- }
- }
+ get => _nextLvlExp;
+ set => SetProperty(ref _nextLvlExp, value);
}
- private bool _HasData;
+ private bool _hasData;
public bool HasData
{
- get => _HasData;
- set
- {
- if (_HasData != value)
- {
- _HasData = value;
- RaisePropertyChanged(nameof(HasData));
- }
- }
+ get => _hasData;
+ set => SetProperty(ref _hasData, value);
}
public string MismatchMessage => VersionMismatch ? LocalizationProvider.Instance.profile_version_mismath : null;
- private bool _VersionMismatch;
+ private bool _versionMismatch;
public bool VersionMismatch
{
- get => _VersionMismatch;
- set
- {
- if(_VersionMismatch != value)
- {
- _VersionMismatch = value;
- RaisePropertyChanged(nameof(VersionMismatch));
- }
- }
+ get => _versionMismatch;
+ set => SetProperty(ref _versionMismatch, value);
}
- private SPTData _SPT;
+ private SPTData _spt;
public SPTData SPT
{
- get => _SPT;
- set
- {
- if(_SPT != value)
- {
- _SPT = value;
- RaisePropertyChanged(nameof(SPT));
- }
- }
+ get => _spt;
+ set => SetProperty(ref _spt, value);
}
- public void UpdateDisplayedProfile(ProfileInfo PInfo)
+ public void UpdateDisplayedProfile(ProfileInfo pInfo)
{
- if (PInfo.Side == null || string.IsNullOrWhiteSpace(PInfo.Side) || PInfo.Side == "unknown") return;
+ if (pInfo.Side == null || string.IsNullOrWhiteSpace(pInfo.Side) || pInfo.Side == "unknown") return;
HasData = true;
- Nickname = PInfo.Nickname;
- Side = PInfo.Side;
- SideImage = PInfo.SideImage;
- Level = PInfo.Level;
- CurrentExp = PInfo.CurrentExp;
- NextLvlExp = PInfo.NextLvlExp;
- RemainingExp = PInfo.RemainingExp;
- XPLevelProgress = PInfo.XPLevelProgress;
+ Nickname = pInfo.Nickname;
+ Side = pInfo.Side;
+ SideImage = pInfo.SideImage;
+ Level = pInfo.Level;
+ CurrentExp = pInfo.CurrentExp;
+ NextLvlExp = pInfo.NextLvlExp;
+ RemainingExp = pInfo.RemainingExp;
+ XPLevelProgress = pInfo.XPLevelProgress;
- SPT = PInfo.SPT;
+ SPT = pInfo.SPT;
}
///
/// Checks if the SPT versions are compatible (non-major changes)
///
- ///
- ///
+ ///
+ ///
///
- private bool CompareVersions(string CurrentVersion, string ExpectedVersion)
+ private bool CompareVersions(string currentVersion, string expectedVersion)
{
- if (ExpectedVersion == "") return false;
+ if (expectedVersion == "") return false;
- SPTVersion v1 = new SPTVersion(CurrentVersion);
- SPTVersion v2 = new SPTVersion(ExpectedVersion);
+ var v1 = new SPTVersion(currentVersion);
+ var v2 = new SPTVersion(expectedVersion);
// check 'X'.x.x
if (v1.Major != v2.Major) return false;
@@ -242,14 +159,7 @@ namespace SPT.Launcher.Models.Launcher
SideImage = Path.Combine(ImageRequest.ImageCacheFolder, $"side_{Side.ToLower()}.png");
- if (Side != null && !string.IsNullOrWhiteSpace(Side) && Side != "unknown")
- {
- HasData = true;
- }
- else
- {
- HasData = false;
- }
+ HasData = Side != null && !string.IsNullOrWhiteSpace(Side) && Side != "unknown";
Level = serverProfileInfo.currlvl.ToString();
CurrentExp = serverProfileInfo.currexp;
@@ -269,12 +179,5 @@ namespace SPT.Launcher.Models.Launcher
XPLevelProgress = (int)Math.Floor((((double)currentLvlTotal) - RemainingExp) / currentLvlTotal * 100);
}
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/RegisterModel.cs b/project/SPT.Launcher.Base/Models/Launcher/RegisterModel.cs
index 7b07a2d..75056c3 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/RegisterModel.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/RegisterModel.cs
@@ -6,47 +6,27 @@
*/
-using System.ComponentModel;
+using SPT.Launcher.Utilities;
+using SPT.Launcher.Models.Launcher;
-namespace SPT.Launcher.Models.Launcher
+namespace SPT.Launch.Models.Launcher
{
- public class RegisterModel : INotifyPropertyChanged
+ public class RegisterModel : NotifyPropertyChangedBase
{
- private string _Username;
+ private string _username;
public string Username
{
- get => _Username;
- set
- {
- if (_Username != value)
- {
- _Username = value;
- RaisePropertyChanged(nameof(Username));
- }
- }
+ get => _username;
+ set => SetProperty(ref _username, value);
}
- private string _Password;
+ private string _password;
public string Password
{
- get => _Password;
- set
- {
- if (_Password != value)
- {
- _Password = value;
- RaisePropertyChanged(nameof(Password));
- }
- }
+ get => _password;
+ set => SetProperty(ref _password, value);
}
public EditionCollection EditionsCollection { get; set; } = new EditionCollection();
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
}
}
diff --git a/project/SPT.Launcher.Base/Models/Launcher/ServerSetting.cs b/project/SPT.Launcher.Base/Models/Launcher/ServerSetting.cs
index 1db1f61..79e5b02 100644
--- a/project/SPT.Launcher.Base/Models/Launcher/ServerSetting.cs
+++ b/project/SPT.Launcher.Base/Models/Launcher/ServerSetting.cs
@@ -7,47 +7,26 @@
*/
-using System.ComponentModel;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher
{
- public class ServerSetting : INotifyPropertyChanged
+ public class ServerSetting : NotifyPropertyChangedBase
{
public LoginModel AutoLoginCreds { get; set; } = null;
- private string _Name;
+ private string _name;
public string Name
{
- get => _Name;
- set
- {
- if (_Name != value)
- {
- _Name = value;
- RaisePropertyChanged(nameof(Name));
- }
- }
+ get => _name;
+ set => SetProperty(ref _name, value);
}
- private string _Url;
+ private string _url;
public string Url
{
- get => _Url;
- set
- {
- if (_Url != value)
- {
- _Url = value;
- RaisePropertyChanged(nameof(Url));
- }
- }
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
+ get => _url;
+ set => SetProperty(ref _url, value);
}
}
}
diff --git a/project/SPT.Launcher.Base/Models/SPT/SPTVersion.cs b/project/SPT.Launcher.Base/Models/SPT/SPTVersion.cs
index c0e842d..3cdc103 100644
--- a/project/SPT.Launcher.Base/Models/SPT/SPTVersion.cs
+++ b/project/SPT.Launcher.Base/Models/SPT/SPTVersion.cs
@@ -1,42 +1,34 @@
-using System.ComponentModel;
+using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.SPT
{
- public class SPTVersion : INotifyPropertyChanged
+ public class SPTVersion : NotifyPropertyChangedBase
{
public int Major;
public int Minor;
public int Build;
- public bool HasTag => Tag != null;
+ public bool HasTag => Tag != string.Empty;
- private string _Tag = null;
+ private string _tag = string.Empty;
public string Tag
{
- get => _Tag;
- set
- {
- if(_Tag != value)
- {
- _Tag = value;
- RaisePropertyChanged(nameof(Tag));
- RaisePropertyChanged(nameof(HasTag));
- }
- }
+ get => _tag;
+ set => SetProperty(ref _tag, value, () => RaisePropertyChanged(nameof(HasTag)));
}
- public void ParseVersionInfo(string SPTVersion)
+ public void ParseVersionInfo(string sptVersion)
{
- if (SPTVersion.Contains('-'))
+ if (sptVersion.Contains('-'))
{
- string[] versionInfo = SPTVersion.Split('-');
+ string[] versionInfo = sptVersion.Split('-');
- SPTVersion = versionInfo[0];
+ sptVersion = versionInfo[0];
Tag = versionInfo[1];
}
- string[] splitVersion = SPTVersion.Split('.');
+ string[] splitVersion = sptVersion.Split('.');
if (splitVersion.Length >= 3)
{
@@ -48,16 +40,9 @@ namespace SPT.Launcher.Models.SPT
public SPTVersion() { }
- public SPTVersion(string SPTVersion)
+ public SPTVersion(string sptVersion)
{
- ParseVersionInfo(SPTVersion);
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void RaisePropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
+ ParseVersionInfo(sptVersion);
}
public override string ToString()
diff --git a/project/SPT.Launcher.Base/SPT.Launcher.Base.csproj b/project/SPT.Launcher.Base/SPT.Launcher.Base.csproj
index d7cf473..065c761 100644
--- a/project/SPT.Launcher.Base/SPT.Launcher.Base.csproj
+++ b/project/SPT.Launcher.Base/SPT.Launcher.Base.csproj
@@ -2,7 +2,7 @@
net8.0
- SPT.Launch
+ SPT.Launcher
diff --git a/project/SPT.Launcher.Base/Utilities/NotifyPropertyChangedBase.cs b/project/SPT.Launcher.Base/Utilities/NotifyPropertyChangedBase.cs
new file mode 100644
index 0000000..bba74ab
--- /dev/null
+++ b/project/SPT.Launcher.Base/Utilities/NotifyPropertyChangedBase.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace SPT.Launcher.Utilities;
+
+public abstract class NotifyPropertyChangedBase : INotifyPropertyChanged
+{
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected void RaisePropertyChanged(string propertyName)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ protected void SetProperty(ref T field, T value, Action afterSetAction = null, [CallerMemberName] string propertyName = null)
+ {
+ if (!EqualityComparer.Default.Equals(field, value))
+ {
+ field = value;
+ RaisePropertyChanged(propertyName);
+ afterSetAction?.Invoke();
+ }
+ }
+
+ protected void SetNotNullableProperty(ref T field, T value, Action afterSetAction = null, [CallerMemberName] string propertyName = null)
+ {
+ if (value is not null)
+ {
+ SetProperty(ref field, value, afterSetAction, propertyName );
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/SPT.Launcher/App.axaml b/project/SPT.Launcher/App.axaml
index f7def06..9c14bd5 100644
--- a/project/SPT.Launcher/App.axaml
+++ b/project/SPT.Launcher/App.axaml
@@ -79,6 +79,18 @@
+
+
+
+
+
+
diff --git a/project/SPT.Launcher/CustomControls/TitleBar.axaml b/project/SPT.Launcher/CustomControls/TitleBar.axaml
index 2be7281..3c0cc89 100644
--- a/project/SPT.Launcher/CustomControls/TitleBar.axaml
+++ b/project/SPT.Launcher/CustomControls/TitleBar.axaml
@@ -23,8 +23,7 @@
/>
-
-