mirror of
https://github.com/sp-tarkov/launcher.git
synced 2025-02-12 22:30:43 -05:00
Merge pull request 'fix/setting-backdrop' (!54) from waffle.lord/Launcher:fix/setting-backdrop into master
Reviewed-on: SPT/Launcher#54
This commit is contained in:
commit
1e30609baf
@ -27,10 +27,10 @@ namespace SPT.Launcher.Helpers
|
|||||||
{
|
{
|
||||||
public bool FirstRun { get; set; } = true;
|
public bool FirstRun { get; set; } = true;
|
||||||
|
|
||||||
public void SaveSettings()
|
public bool SaveSettings()
|
||||||
{
|
{
|
||||||
Server.Url = Path.TrimEndingDirectorySeparator(Server.Url);
|
Server.Url = Path.TrimEndingDirectorySeparator(Server.Url);
|
||||||
Json.SaveWithFormatting(LauncherSettingsProvider.DefaultSettingsFileLocation, this, Formatting.Indented);
|
return Json.SaveWithFormatting(LauncherSettingsProvider.DefaultSettingsFileLocation, this, Formatting.Indented);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetDefaults()
|
public void ResetDefaults()
|
||||||
|
@ -191,6 +191,7 @@ namespace SPT.Launcher.Helpers
|
|||||||
englishLocale.open_link_question_format_1 = "Are you sure you want to open the following link: \n{0}";
|
englishLocale.open_link_question_format_1 = "Are you sure you want to open the following link: \n{0}";
|
||||||
englishLocale.open_link = "Open Link";
|
englishLocale.open_link = "Open Link";
|
||||||
englishLocale.dev_mode = "Developer Mode";
|
englishLocale.dev_mode = "Developer Mode";
|
||||||
|
englishLocale.failed_to_save_settings = "Failed to save settings";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
Directory.CreateDirectory(LocalizationProvider.DefaultLocaleFolderPath);
|
Directory.CreateDirectory(LocalizationProvider.DefaultLocaleFolderPath);
|
||||||
@ -227,6 +228,24 @@ namespace SPT.Launcher.Helpers
|
|||||||
|
|
||||||
#region All Properties
|
#region All Properties
|
||||||
|
|
||||||
|
#region failed_to_save_settings
|
||||||
|
|
||||||
|
private string _failed_to_save_settings;
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region dev_mode
|
#region dev_mode
|
||||||
private string _dev_mode;
|
private string _dev_mode;
|
||||||
public string dev_mode
|
public string dev_mode
|
||||||
|
@ -7,10 +7,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using SPT.Launcher.Controllers;
|
||||||
|
|
||||||
namespace SPT.Launcher.MiniCommon
|
namespace SPT.Launcher.MiniCommon
|
||||||
{
|
{
|
||||||
@ -39,14 +41,26 @@ namespace SPT.Launcher.MiniCommon
|
|||||||
/// <param name="filepath">Full path to file</param>
|
/// <param name="filepath">Full path to file</param>
|
||||||
/// <param name="data">Object to save to json file</param>
|
/// <param name="data">Object to save to json file</param>
|
||||||
/// <param name="format">NewtonSoft.Json Formatting</param>
|
/// <param name="format">NewtonSoft.Json Formatting</param>
|
||||||
public static void SaveWithFormatting<T>(string filepath, T data, Formatting format)
|
public static bool SaveWithFormatting<T>(string filepath, T data, Formatting format)
|
||||||
{
|
{
|
||||||
if (!File.Exists(filepath))
|
try
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(filepath));
|
|
||||||
}
|
|
||||||
|
|
||||||
File.WriteAllText(filepath, JsonConvert.SerializeObject(data, format));
|
if (!File.Exists(filepath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(filepath));
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllText(filepath, JsonConvert.SerializeObject(data, format));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogManager.Instance.Exception(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
||||||
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Tryb Dewelopera"
|
"dev_mode": "Tryb Dewelopera",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "Эти моды не были загружены сервером, но ваш профиль использовал их раньше",
|
"inactive_server_mods_info_text": "Эти моды не были загружены сервером, но ваш профиль использовал их раньше",
|
||||||
"open_link_question_format_1": "Вы уверены, что хотите открыть следующую ссылку? \n{0}",
|
"open_link_question_format_1": "Вы уверены, что хотите открыть следующую ссылку? \n{0}",
|
||||||
"open_link": "Открыть ссылку",
|
"open_link": "Открыть ссылку",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
"inactive_server_mods_info_text": "These mods have not been loaded by the server, but your profile has used them in the past",
|
||||||
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
"open_link_question_format_1": "Are you sure you want to open the following link: \n{0}",
|
||||||
"open_link": "Open Link",
|
"open_link": "Open Link",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -94,5 +94,6 @@
|
|||||||
"inactive_server_mods_info_text": "Bu modlar sunucu tarafından yüklenmedi, ancak profiliniz geçmişte bunları kullandı",
|
"inactive_server_mods_info_text": "Bu modlar sunucu tarafından yüklenmedi, ancak profiliniz geçmişte bunları kullandı",
|
||||||
"open_link_question_format_1": "Aşağıdaki bağlantıyı açmak istediğinizden emin misiniz? \n{0}",
|
"open_link_question_format_1": "Aşağıdaki bağlantıyı açmak istediğinizden emin misiniz? \n{0}",
|
||||||
"open_link": "Bağlantıyı Aç",
|
"open_link": "Bağlantıyı Aç",
|
||||||
"dev_mode": "Developer Mode"
|
"dev_mode": "Developer Mode",
|
||||||
|
"failed_to_save_settings": "Failed to save settings"
|
||||||
}
|
}
|
@ -11,6 +11,7 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Avalonia.Controls.Notifications;
|
||||||
|
|
||||||
namespace SPT.Launcher.ViewModels
|
namespace SPT.Launcher.ViewModels
|
||||||
{
|
{
|
||||||
@ -41,7 +42,11 @@ namespace SPT.Launcher.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
LauncherSettingsProvider.Instance.AllowSettings = true;
|
LauncherSettingsProvider.Instance.AllowSettings = true;
|
||||||
LauncherSettingsProvider.Instance.SaveSettings();
|
|
||||||
|
if (!LauncherSettingsProvider.Instance.SaveSettings())
|
||||||
|
{
|
||||||
|
SendNotification("", LocalizationProvider.Instance.failed_to_save_settings, NotificationType.Error);
|
||||||
|
}
|
||||||
|
|
||||||
NavigateBack();
|
NavigateBack();
|
||||||
}
|
}
|
||||||
@ -52,11 +57,11 @@ namespace SPT.Launcher.ViewModels
|
|||||||
|
|
||||||
if (filesCleared)
|
if (filesCleared)
|
||||||
{
|
{
|
||||||
SendNotification("", LocalizationProvider.Instance.clean_temp_files_succeeded, Avalonia.Controls.Notifications.NotificationType.Success);
|
SendNotification("", LocalizationProvider.Instance.clean_temp_files_succeeded, NotificationType.Success);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendNotification("", LocalizationProvider.Instance.clean_temp_files_failed, Avalonia.Controls.Notifications.NotificationType.Error);
|
SendNotification("", LocalizationProvider.Instance.clean_temp_files_failed, NotificationType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<!-- Backdrop -->
|
<!-- Backdrop -->
|
||||||
<Rectangle Fill="{StaticResource SPT_Background_Dark}"
|
<Rectangle Fill="{StaticResource SPT_Background_Dark}"
|
||||||
Grid.RowSpan="6" Grid.ColumnSpan="5"
|
Grid.RowSpan="7" Grid.ColumnSpan="5"
|
||||||
Opacity=".7"
|
Opacity=".7"
|
||||||
/>
|
/>
|
||||||
<WrapPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
|
<WrapPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user