mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-14 16:35:00 +03:00
Centralize shared configuration state
Introduce a synchronized ConfigState and make ConfigTextManager static. Update configuration access across desktop and WebAPI, and add an AddServer overload using the current configuration.
This commit is contained in:
@@ -79,7 +79,7 @@ public static class ConnectionHandler
|
|||||||
|
|
||||||
public static async Task<int> GetRealPingTime(HttpClient client, CancellationToken cancellationToken = default)
|
public static async Task<int> GetRealPingTime(HttpClient client, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var url = ConfigTextManager.Instance.Config.SpeedTestItem.SpeedPingTestUrl;
|
var url = ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl;
|
||||||
var responseTime = -1;
|
var responseTime = -1;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -114,7 +114,7 @@ public static class ConnectionHandler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var url = ConfigTextManager.Instance.Config.SpeedTestItem.IPAPIUrl;
|
var url = ConfigTextManager.Config.SpeedTestItem.IPAPIUrl;
|
||||||
if (url.IsNullOrEmpty())
|
if (url.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public static class CoreConfigHandler
|
|||||||
|
|
||||||
public static async Task<RetResult> GenerateClientConfig(CoreConfigContext context, string? fileName)
|
public static async Task<RetResult> GenerateClientConfig(CoreConfigContext context, string? fileName)
|
||||||
{
|
{
|
||||||
var config = ConfigTextManager.Instance.Config;
|
var config = ConfigTextManager.Config;
|
||||||
var result = new RetResult();
|
var result = new RetResult();
|
||||||
var node = context.Node;
|
var node = context.Node;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public static class ProxySettingLinux
|
|||||||
|
|
||||||
private static async Task ExecCmd(List<string> args)
|
private static async Task ExecCmd(List<string> args)
|
||||||
{
|
{
|
||||||
var customSystemProxyScriptPath = ConfigTextManager.Instance.Config.SystemProxyItem?.CustomSystemProxyScriptPath;
|
var customSystemProxyScriptPath = ConfigTextManager.Config.SystemProxyItem?.CustomSystemProxyScriptPath;
|
||||||
var fileName = (customSystemProxyScriptPath.IsNotEmpty() && File.Exists(customSystemProxyScriptPath))
|
var fileName = (customSystemProxyScriptPath.IsNotEmpty() && File.Exists(customSystemProxyScriptPath))
|
||||||
? customSystemProxyScriptPath
|
? customSystemProxyScriptPath
|
||||||
: await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetLinuxShellFileName), false);
|
: await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetLinuxShellFileName), false);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public static class ProxySettingOSX
|
|||||||
|
|
||||||
private static async Task ExecCmd(List<string> args)
|
private static async Task ExecCmd(List<string> args)
|
||||||
{
|
{
|
||||||
var customSystemProxyScriptPath = ConfigTextManager.Instance.Config.SystemProxyItem?.CustomSystemProxyScriptPath;
|
var customSystemProxyScriptPath = ConfigTextManager.Config.SystemProxyItem?.CustomSystemProxyScriptPath;
|
||||||
var fileName = (customSystemProxyScriptPath.IsNotEmpty() && File.Exists(customSystemProxyScriptPath))
|
var fileName = (customSystemProxyScriptPath.IsNotEmpty() && File.Exists(customSystemProxyScriptPath))
|
||||||
? customSystemProxyScriptPath
|
? customSystemProxyScriptPath
|
||||||
: await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetOSXShellFileName), false);
|
: await FileUtils.CreateLinuxShellFile(_proxySetFileName, EmbedUtils.GetEmbedText(Global.ProxySetOSXShellFileName), false);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public sealed class AppManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
Logging.Setup();
|
Logging.Setup();
|
||||||
_config = ConfigTextManager.Instance.Init();
|
_config = ConfigTextManager.Init();
|
||||||
if (_config == null)
|
if (_config == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -127,7 +127,7 @@ public sealed class AppManager
|
|||||||
AppEvents.AppExitRequested.Publish();
|
AppEvents.AppExitRequested.Publish();
|
||||||
await Task.Delay(50); //Wait for AppExitRequested to be processed
|
await Task.Delay(50); //Wait for AppExitRequested to be processed
|
||||||
|
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
await ProfileExManager.Instance.SaveTo();
|
await ProfileExManager.Instance.SaveTo();
|
||||||
await StatisticsManager.Instance.SaveTo();
|
await StatisticsManager.Instance.SaveTo();
|
||||||
await CoreManager.Instance.CoreStop();
|
await CoreManager.Instance.CoreStop();
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public sealed class ClashApiManager
|
|||||||
private async Task<int> TestProxyDelay(string name)
|
private async Task<int> TestProxyDelay(string name)
|
||||||
{
|
{
|
||||||
var url = $"{ApiUrl}/proxies/{Utils.UrlEncode(name)}/delay?timeout=10000&url=" +
|
var url = $"{ApiUrl}/proxies/{Utils.UrlEncode(name)}/delay?timeout=10000&url=" +
|
||||||
Utils.UrlEncode(ConfigTextManager.Instance.Config.SpeedTestItem.SpeedPingTestUrl);
|
Utils.UrlEncode(ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl);
|
||||||
return await SendTestRequest(url);
|
return await SendTestRequest(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ public sealed class ClashApiManager
|
|||||||
{
|
{
|
||||||
var url =
|
var url =
|
||||||
$"{ApiUrl}/providers/proxies/{Utils.UrlEncode(providerName)}/{Utils.UrlEncode(name)}/healthcheck?timeout=10000&url=" +
|
$"{ApiUrl}/providers/proxies/{Utils.UrlEncode(providerName)}/{Utils.UrlEncode(name)}/healthcheck?timeout=10000&url=" +
|
||||||
Utils.UrlEncode(ConfigTextManager.Instance.Config.SpeedTestItem.SpeedPingTestUrl);
|
Utils.UrlEncode(ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl);
|
||||||
return await SendTestRequest(url);
|
return await SendTestRequest(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,25 @@ public static class ConfigDbManager
|
|||||||
{
|
{
|
||||||
private static readonly string _tag = "ConfigDbManager";
|
private static readonly string _tag = "ConfigDbManager";
|
||||||
|
|
||||||
|
private static Config CurrentConfig => ConfigState.Instance.Current;
|
||||||
|
|
||||||
private static async Task<int> SaveConfig()
|
private static async Task<int> SaveConfig()
|
||||||
{
|
{
|
||||||
return await ConfigTextManager.Instance.SaveConfig();
|
return await ConfigTextManager.SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Server
|
#region Server
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a server profile to the current configuration from ConfigState.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="profileItem">Server profile to add</param>
|
||||||
|
/// <returns>Result of the operation (0 if successful, -1 if failed)</returns>
|
||||||
|
public static Task<int> AddServer(ProfileItem profileItem)
|
||||||
|
{
|
||||||
|
return AddServer(CurrentConfig, profileItem);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a server profile to the configuration
|
/// Add a server profile to the configuration
|
||||||
/// Dispatches the request to the appropriate method based on the config type
|
/// Dispatches the request to the appropriate method based on the config type
|
||||||
@@ -2997,7 +3009,7 @@ public static class ConfigDbManager
|
|||||||
private static async Task<int> MigrateProfileExtraV2ToV3Sub(List<ProfileItem> batch)
|
private static async Task<int> MigrateProfileExtraV2ToV3Sub(List<ProfileItem> batch)
|
||||||
{
|
{
|
||||||
var updateProfileItems = new List<ProfileItem>();
|
var updateProfileItems = new List<ProfileItem>();
|
||||||
var config = ConfigTextManager.Instance.Config;
|
var config = ConfigTextManager.Config;
|
||||||
|
|
||||||
foreach (var item in batch)
|
foreach (var item in batch)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
namespace ServiceLib.Manager.Data;
|
||||||
|
|
||||||
|
public sealed class ConfigState
|
||||||
|
{
|
||||||
|
private static readonly Lazy<ConfigState> _instance = new(() => new());
|
||||||
|
private readonly Lock _lock = new();
|
||||||
|
private Config? _current;
|
||||||
|
|
||||||
|
public static ConfigState Instance => _instance.Value;
|
||||||
|
|
||||||
|
public Config Current
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
return _current ??= new Config();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInitialized
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
return _current is not null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetCurrent(Config config)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(config);
|
||||||
|
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
_current = config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,27 @@
|
|||||||
namespace ServiceLib.Manager.Data;
|
namespace ServiceLib.Manager.Data;
|
||||||
|
|
||||||
public class ConfigTextManager
|
public static class ConfigTextManager
|
||||||
{
|
{
|
||||||
private static readonly Lazy<ConfigTextManager> _instance = new(() => new());
|
|
||||||
public static ConfigTextManager Instance => _instance.Value;
|
|
||||||
|
|
||||||
private static readonly string _configRes = Global.ConfigFileName;
|
private static readonly string _configRes = Global.ConfigFileName;
|
||||||
private static readonly string _tag = "ConfigTextManager";
|
private static readonly string _tag = "ConfigTextManager";
|
||||||
|
|
||||||
public Config Config { get; private set; }
|
public static Config Config
|
||||||
|
{
|
||||||
|
get => ConfigState.Instance.Current;
|
||||||
|
private set => ConfigState.Instance.SetCurrent(value);
|
||||||
|
}
|
||||||
|
|
||||||
#region Init
|
#region Init
|
||||||
|
|
||||||
public Config? Init()
|
public static Config? Init()
|
||||||
{
|
{
|
||||||
Config = LoadConfig();
|
var config = LoadConfig();
|
||||||
|
if (config == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Config = config;
|
||||||
return Config;
|
return Config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +32,7 @@ public class ConfigTextManager
|
|||||||
/// Initialize default values for missing configuration sections
|
/// Initialize default values for missing configuration sections
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Config object containing application settings or null if there's an error</returns>
|
/// <returns>Config object containing application settings or null if there's an error</returns>
|
||||||
private Config? LoadConfig()
|
private static Config? LoadConfig()
|
||||||
{
|
{
|
||||||
Config? config = null;
|
Config? config = null;
|
||||||
var result = EmbedUtils.LoadResource(Utils.GetConfigPath(_configRes));
|
var result = EmbedUtils.LoadResource(Utils.GetConfigPath(_configRes));
|
||||||
@@ -228,7 +235,7 @@ public class ConfigTextManager
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="_config">Configuration object to be saved</param>
|
/// <param name="_config">Configuration object to be saved</param>
|
||||||
/// <returns>0 if successful, -1 if failed</returns>
|
/// <returns>0 if successful, -1 if failed</returns>
|
||||||
public async Task<int> SaveConfig()
|
public static async Task<int> SaveConfig()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -259,7 +266,7 @@ public class ConfigTextManager
|
|||||||
|
|
||||||
#region UIItem
|
#region UIItem
|
||||||
|
|
||||||
public WindowSizeItem? GetWindowSizeItem(string typeName)
|
public static WindowSizeItem? GetWindowSizeItem(string typeName)
|
||||||
{
|
{
|
||||||
var sizeItem = Config?.UiItem?.WindowSizeItem?.FirstOrDefault(t => t.TypeName == typeName);
|
var sizeItem = Config?.UiItem?.WindowSizeItem?.FirstOrDefault(t => t.TypeName == typeName);
|
||||||
if (sizeItem == null || sizeItem.Width <= 0 || sizeItem.Height <= 0)
|
if (sizeItem == null || sizeItem.Width <= 0 || sizeItem.Height <= 0)
|
||||||
@@ -270,7 +277,7 @@ public class ConfigTextManager
|
|||||||
return sizeItem;
|
return sizeItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int SaveWindowSizeItem(string typeName, double width, double height)
|
public static int SaveWindowSizeItem(string typeName, double width, double height)
|
||||||
{
|
{
|
||||||
var sizeItem = Config?.UiItem?.WindowSizeItem?.FirstOrDefault(t => t.TypeName == typeName);
|
var sizeItem = Config?.UiItem?.WindowSizeItem?.FirstOrDefault(t => t.TypeName == typeName);
|
||||||
if (sizeItem == null)
|
if (sizeItem == null)
|
||||||
@@ -285,7 +292,7 @@ public class ConfigTextManager
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int SaveMainGirdHeight(double height1, double height2)
|
public static int SaveMainGirdHeight(double height1, double height2)
|
||||||
{
|
{
|
||||||
var uiItem = Config.UiItem ?? new();
|
var uiItem = Config.UiItem ?? new();
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class PacManager
|
|||||||
|
|
||||||
private async Task<byte[]> InitText(int httpPort)
|
private async Task<byte[]> InitText(int httpPort)
|
||||||
{
|
{
|
||||||
var customSystemProxyPacPath = ConfigTextManager.Instance.Config.SystemProxyItem.CustomSystemProxyPacPath;
|
var customSystemProxyPacPath = ConfigTextManager.Config.SystemProxyItem.CustomSystemProxyPacPath;
|
||||||
var fileName = customSystemProxyPacPath.IsNotEmpty() && File.Exists(customSystemProxyPacPath)
|
var fileName = customSystemProxyPacPath.IsNotEmpty() && File.Exists(customSystemProxyPacPath)
|
||||||
? customSystemProxyPacPath
|
? customSystemProxyPacPath
|
||||||
: Path.Combine(Utils.GetConfigPath(), "pac.txt");
|
: Path.Combine(Utils.GetConfigPath(), "pac.txt");
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class TaskManager
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
await ProfileExManager.Instance.SaveTo();
|
await ProfileExManager.Instance.SaveTo();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public sealed class WebDavManager
|
|||||||
|
|
||||||
public WebDavManager()
|
public WebDavManager()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> GetClient()
|
private async Task<bool> GetClient()
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public partial class CoreConfigV2rayService
|
|||||||
subjectSelector = [baseTagName],
|
subjectSelector = [baseTagName],
|
||||||
pingConfig = new()
|
pingConfig = new()
|
||||||
{
|
{
|
||||||
destination = ConfigTextManager.Instance.Config.SpeedTestItem.SpeedPingTestUrl,
|
destination = ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl,
|
||||||
interval = "5m",
|
interval = "5m",
|
||||||
timeout = "30s",
|
timeout = "30s",
|
||||||
sampling = 2,
|
sampling = 2,
|
||||||
@@ -68,7 +68,7 @@ public partial class CoreConfigV2rayService
|
|||||||
_coreConfig.observatory = new Observatory4Ray
|
_coreConfig.observatory = new Observatory4Ray
|
||||||
{
|
{
|
||||||
subjectSelector = [baseTagName],
|
subjectSelector = [baseTagName],
|
||||||
probeUrl = ConfigTextManager.Instance.Config.SpeedTestItem.SpeedPingTestUrl,
|
probeUrl = ConfigTextManager.Config.SpeedTestItem.SpeedPingTestUrl,
|
||||||
probeInterval = "3m",
|
probeInterval = "3m",
|
||||||
enableConcurrency = true,
|
enableConcurrency = true,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public partial class AddGroupServerViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public AddGroupServerViewModel(ProfileItem profileItem)
|
public AddGroupServerViewModel(ProfileItem profileItem)
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
var canEditRemove = this.WhenAnyValue(
|
var canEditRemove = this.WhenAnyValue(
|
||||||
x => x.SelectedChild,
|
x => x.SelectedChild,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public partial class AddServer2ViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public AddServer2ViewModel(ProfileItem profileItem)
|
public AddServer2ViewModel(ProfileItem profileItem)
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
BrowseServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
BrowseServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ public partial class AddServerViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public AddServerViewModel(ProfileItem profileItem)
|
public AddServerViewModel(ProfileItem profileItem)
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
FetchCertCmd = ReactiveCommand.CreateFromTask(async () =>
|
FetchCertCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public partial class BackupAndRestoreViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public BackupAndRestoreViewModel()
|
public BackupAndRestoreViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
WebDavCheckCmd = ReactiveCommand.CreateFromTask(async () =>
|
WebDavCheckCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
@@ -46,7 +46,7 @@ public partial class BackupAndRestoreViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
DisplayOperationMsg();
|
DisplayOperationMsg();
|
||||||
_config.WebDavItem = SelectedSource;
|
_config.WebDavItem = SelectedSource;
|
||||||
_ = await ConfigTextManager.Instance.SaveConfig();
|
_ = await ConfigTextManager.SaveConfig();
|
||||||
|
|
||||||
var result = await WebDavManager.Instance.CheckConnection();
|
var result = await WebDavManager.Instance.CheckConnection();
|
||||||
if (result)
|
if (result)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public CheckUpdateViewModel()
|
public CheckUpdateViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
CheckUpdateCmd = ReactiveCommand.CreateFromTask(CheckUpdate);
|
CheckUpdateCmd = ReactiveCommand.CreateFromTask(CheckUpdate);
|
||||||
CheckUpdateCmd.ThrownExceptions.Subscribe(ex =>
|
CheckUpdateCmd.ThrownExceptions.Subscribe(ex =>
|
||||||
@@ -126,7 +126,7 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
|||||||
.Select(t => t.CoreTypeForStorage)
|
.Select(t => t.CoreTypeForStorage)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CheckOnly()
|
private async Task CheckOnly()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ public partial class ClashConnectionsViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
public ClashConnectionsViewModel()
|
public ClashConnectionsViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
AutoRefresh = _config.ClashUIItem.ConnectionsAutoRefresh;
|
AutoRefresh = _config.ClashUIItem.ConnectionsAutoRefresh;
|
||||||
|
|
||||||
var canEditRemove = this.WhenAnyValue(
|
var canEditRemove = this.WhenAnyValue(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public partial class ClashProxiesViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public ClashProxiesViewModel()
|
public ClashProxiesViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
ProxiesReloadCmd = ReactiveCommand.CreateFromTask(async () =>
|
ProxiesReloadCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public partial class DNSSettingViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public DNSSettingViewModel()
|
public DNSSettingViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
SaveCmd = ReactiveCommand.CreateFromTask(SaveSettingAsync);
|
SaveCmd = ReactiveCommand.CreateFromTask(SaveSettingAsync);
|
||||||
|
|
||||||
ImportDefConfig4V2rayCompatibleCmd = ReactiveCommand.CreateFromTask(async () =>
|
ImportDefConfig4V2rayCompatibleCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
@@ -82,7 +82,7 @@ public partial class DNSSettingViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
private async Task Init()
|
private async Task Init()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
var item = _config.SimpleDNSItem;
|
var item = _config.SimpleDNSItem;
|
||||||
UseSystemHosts = item.UseSystemHosts ?? false;
|
UseSystemHosts = item.UseSystemHosts ?? false;
|
||||||
AddCommonHosts = item.AddCommonHosts ?? false;
|
AddCommonHosts = item.AddCommonHosts ?? false;
|
||||||
@@ -217,7 +217,7 @@ public partial class DNSSettingViewModel : MyReactiveObject, ICloseable
|
|||||||
item2.TunDNS = JsonUtils.Serialize(JsonUtils.Deserialize<Dns4Sbox>(TunDNS2Compatible));
|
item2.TunDNS = JsonUtils.Serialize(JsonUtils.Deserialize<Dns4Sbox>(TunDNS2Compatible));
|
||||||
await ConfigDbManager.SaveDNSItems(_config, item2);
|
await ConfigDbManager.SaveDNSItems(_config, item2);
|
||||||
|
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
RequestClose?.Invoke(this, EventArgs.Empty);
|
RequestClose?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public partial class FullConfigTemplateViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public FullConfigTemplateViewModel()
|
public FullConfigTemplateViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
await SaveSettingAsync();
|
await SaveSettingAsync();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class GlobalHotkeySettingViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public GlobalHotkeySettingViewModel()
|
public GlobalHotkeySettingViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
_globalHotkeys = JsonUtils.DeepCopy(_config.GlobalHotkeys);
|
_globalHotkeys = JsonUtils.DeepCopy(_config.GlobalHotkeys);
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ public class GlobalHotkeySettingViewModel : MyReactiveObject, ICloseable
|
|||||||
{
|
{
|
||||||
_config.GlobalHotkeys = _globalHotkeys;
|
_config.GlobalHotkeys = _globalHotkeys;
|
||||||
|
|
||||||
if (await ConfigTextManager.Instance.SaveConfig() == 0)
|
if (await ConfigTextManager.SaveConfig() == 0)
|
||||||
{
|
{
|
||||||
RequestClose?.Invoke(this, EventArgs.Empty);
|
RequestClose?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public partial class MainWindowViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
BlIsWindows = Utils.IsWindows();
|
BlIsWindows = Utils.IsWindows();
|
||||||
MainGirdOrientation = _config.UiItem.MainGirdOrientation;
|
MainGirdOrientation = _config.UiItem.MainGirdOrientation;
|
||||||
|
|
||||||
@@ -795,7 +795,7 @@ public partial class MainWindowViewModel : MyReactiveObject
|
|||||||
await StatusBarViewModel.RefreshRoutingsMenu();
|
await StatusBarViewModel.RefreshRoutingsMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
using var downloadService = await DownloadService.CreateDownloadServiceWithCheck();
|
using var downloadService = await DownloadService.CreateDownloadServiceWithCheck();
|
||||||
await new UpdateService(downloadService, _config, UpdateTaskHandler).UpdateGeoFileAll();
|
await new UpdateService(downloadService, _config, UpdateTaskHandler).UpdateGeoFileAll();
|
||||||
await Reload();
|
await Reload();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public partial class MsgViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public MsgViewModel()
|
public MsgViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
MsgFilter = _config.MsgUIItem.MainMsgFilter ?? string.Empty;
|
MsgFilter = _config.MsgUIItem.MainMsgFilter ?? string.Empty;
|
||||||
AutoRefresh = _config.MsgUIItem.AutoRefresh ?? true;
|
AutoRefresh = _config.MsgUIItem.AutoRefresh ?? true;
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public partial class OptionSettingViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public OptionSettingViewModel()
|
public OptionSettingViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
BlIsWindows = Utils.IsWindows();
|
BlIsWindows = Utils.IsWindows();
|
||||||
BlIsLinux = Utils.IsLinux();
|
BlIsLinux = Utils.IsLinux();
|
||||||
BlIsIsMacOS = Utils.IsMacOS();
|
BlIsIsMacOS = Utils.IsMacOS();
|
||||||
@@ -407,7 +407,7 @@ public partial class OptionSettingViewModel : MyReactiveObject, ICloseable
|
|||||||
//coreType
|
//coreType
|
||||||
await SaveCoreType();
|
await SaveCoreType();
|
||||||
|
|
||||||
if (await ConfigTextManager.Instance.SaveConfig() == 0)
|
if (await ConfigTextManager.SaveConfig() == 0)
|
||||||
{
|
{
|
||||||
await AutoStartupHandler.UpdateTask(_config);
|
await AutoStartupHandler.UpdateTask(_config);
|
||||||
AppManager.Instance.Reset();
|
AppManager.Instance.Reset();
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public partial class ProfilesSelectViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public ProfilesSelectViewModel()
|
public ProfilesSelectViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
_subIndexId = _config.SubIndexId ?? string.Empty;
|
_subIndexId = _config.SubIndexId ?? string.Empty;
|
||||||
|
|
||||||
#region WhenAnyValue && ReactiveCommand
|
#region WhenAnyValue && ReactiveCommand
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public partial class ProfilesViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public ProfilesViewModel()
|
public ProfilesViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
#region WhenAnyValue && ReactiveCommand
|
#region WhenAnyValue && ReactiveCommand
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public partial class RoutingRuleDetailsViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public RoutingRuleDetailsViewModel(RulesItem rulesItem)
|
public RoutingRuleDetailsViewModel(RulesItem rulesItem)
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
SelectProfileCmd = ReactiveCommand.CreateFromTask(async () =>
|
SelectProfileCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public partial class RoutingRuleSettingViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public RoutingRuleSettingViewModel(RoutingItem routingItem)
|
public RoutingRuleSettingViewModel(RoutingItem routingItem)
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
var canEditRemove = this.WhenAnyValue(
|
var canEditRemove = this.WhenAnyValue(
|
||||||
x => x.SelectedSource,
|
x => x.SelectedSource,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public partial class RoutingSettingViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public RoutingSettingViewModel()
|
public RoutingSettingViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
var canEditRemove = this.WhenAnyValue(
|
var canEditRemove = this.WhenAnyValue(
|
||||||
x => x.SelectedSource,
|
x => x.SelectedSource,
|
||||||
@@ -113,7 +113,7 @@ public partial class RoutingSettingViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
_config.RoutingBasicItem.DomainStrategy = DomainStrategy;
|
_config.RoutingBasicItem.DomainStrategy = DomainStrategy;
|
||||||
_config.RoutingBasicItem.DomainStrategy4Singbox = DomainStrategy4Singbox;
|
_config.RoutingBasicItem.DomainStrategy4Singbox = DomainStrategy4Singbox;
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Refresh Save
|
#endregion Refresh Save
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public partial class StatusBarViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public StatusBarViewModel()
|
public StatusBarViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
SelectedRouting = new();
|
SelectedRouting = new();
|
||||||
SelectedServer = new();
|
SelectedServer = new();
|
||||||
RunningServerToolTipText = GetRunningServerToolTipText("-");
|
RunningServerToolTipText = GetRunningServerToolTipText("-");
|
||||||
@@ -373,7 +373,7 @@ public partial class StatusBarViewModel : MyReactiveObject
|
|||||||
NoticeManager.Instance.SendMessageEx($"{ResUI.TipChangeSystemProxy} - {_config.SystemProxyItem.SysProxyType}");
|
NoticeManager.Instance.SendMessageEx($"{ResUI.TipChangeSystemProxy} - {_config.SystemProxyItem.SysProxyType}");
|
||||||
|
|
||||||
SystemProxySelected = (int)_config.SystemProxyItem.SysProxyType;
|
SystemProxySelected = (int)_config.SystemProxyItem.SysProxyType;
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ChangeSystemProxyAsync(ESysProxyType type, bool blChange)
|
public async Task ChangeSystemProxyAsync(ESysProxyType type, bool blChange)
|
||||||
@@ -459,7 +459,7 @@ public partial class StatusBarViewModel : MyReactiveObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
ReloadRequested.Publish();
|
ReloadRequested.Publish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
|
|||||||
|
|
||||||
public SubEditViewModel(SubItem subItem)
|
public SubEditViewModel(SubItem subItem)
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
SelectPrevProfileCmd = ReactiveCommand.CreateFromTask(async () =>
|
SelectPrevProfileCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public partial class SubSettingViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public SubSettingViewModel()
|
public SubSettingViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
var canEditRemove = this.WhenAnyValue(
|
var canEditRemove = this.WhenAnyValue(
|
||||||
x => x.SelectedSource,
|
x => x.SelectedSource,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public partial class App : Application
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ConfigTextManager.Instance.Config.UiItem.MacOSShowInDock)
|
if (!ConfigTextManager.Config.UiItem.MacOSShowInDock)
|
||||||
{
|
{
|
||||||
MacAppUtils.SetActivationPolicyAccessory();
|
MacAppUtils.SetActivationPolicyAccessory();
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ public partial class App : Application
|
|||||||
|
|
||||||
private static void RestoreMacOSAccessoryPolicyAfterMiniaturize(MainWindow mainWindow)
|
private static void RestoreMacOSAccessoryPolicyAfterMiniaturize(MainWindow mainWindow)
|
||||||
{
|
{
|
||||||
if (ConfigTextManager.Instance.Config.UiItem.MacOSShowInDock)
|
if (ConfigTextManager.Config.UiItem.MacOSShowInDock)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ public partial class App : Application
|
|||||||
|
|
||||||
private static void RestoreMacOSAccessoryPolicy(MainWindow mainWindow)
|
private static void RestoreMacOSAccessoryPolicy(MainWindow mainWindow)
|
||||||
{
|
{
|
||||||
if (ConfigTextManager.Instance.Config.UiItem.MacOSShowInDock || MacAppUtils.IsWindowMiniaturized(mainWindow))
|
if (ConfigTextManager.Config.UiItem.MacOSShowInDock || MacAppUtils.IsWindowMiniaturized(mainWindow))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sizeItem = ConfigTextManager.Instance.GetWindowSizeItem(GetType().Name);
|
var sizeItem = ConfigTextManager.GetWindowSizeItem(GetType().Name);
|
||||||
if (sizeItem is null)
|
if (sizeItem is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -55,7 +55,7 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
|
|||||||
base.OnClosed(e);
|
base.OnClosed(e);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ConfigTextManager.Instance.SaveWindowSizeItem(GetType().Name, Width, Height);
|
ConfigTextManager.SaveWindowSizeItem(GetType().Name, Width, Height);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ internal class Program
|
|||||||
|
|
||||||
if (OperatingSystem.IsMacOS())
|
if (OperatingSystem.IsMacOS())
|
||||||
{
|
{
|
||||||
var showInDock = Design.IsDesignMode || ConfigTextManager.Instance.Config.UiItem.MacOSShowInDock;
|
var showInDock = Design.IsDesignMode || ConfigTextManager.Config.UiItem.MacOSShowInDock;
|
||||||
builder = builder.With(new MacOSPlatformOptions { ShowInDock = showInDock });
|
builder = builder.With(new MacOSPlatformOptions { ShowInDock = showInDock });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public ThemeSettingViewModel()
|
public ThemeSettingViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
BindingUI();
|
BindingUI();
|
||||||
RestoreUI();
|
RestoreUI();
|
||||||
@@ -43,7 +43,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
_config.UiItem.CurrentTheme = CurrentTheme;
|
_config.UiItem.CurrentTheme = CurrentTheme;
|
||||||
ModifyTheme();
|
ModifyTheme();
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
_config.UiItem.CurrentFontSize = CurrentFontSize;
|
_config.UiItem.CurrentFontSize = CurrentFontSize;
|
||||||
ModifyFontSize();
|
ModifyFontSize();
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
_config.UiItem.CurrentLanguage = CurrentLanguage;
|
_config.UiItem.CurrentLanguage = CurrentLanguage;
|
||||||
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
NoticeManager.Instance.Enqueue(ResUI.NeedRebootTips);
|
NoticeManager.Instance.Enqueue(ResUI.NeedRebootTips);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public partial class ClashConnectionsView : ReactiveUserControl<ClashConnections
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public partial class DNSSettingWindow : WindowBase<DNSSettingViewModel>
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
Loaded += Window_Loaded;
|
Loaded += Window_Loaded;
|
||||||
btnCancel.Click += (s, e) => Close();
|
btnCancel.Click += (s, e) => Close();
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public partial class FullConfigTemplateWindow : WindowBase<FullConfigTemplateVie
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
Loaded += Window_Loaded;
|
Loaded += Window_Loaded;
|
||||||
btnCancel.Click += (_, _) => Close();
|
btnCancel.Click += (_, _) => Close();
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.TopRight };
|
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.TopRight };
|
||||||
|
|
||||||
KeyDown += MainWindow_KeyDown;
|
KeyDown += MainWindow_KeyDown;
|
||||||
@@ -396,15 +396,15 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
|||||||
|
|
||||||
private void StorageUI()
|
private void StorageUI()
|
||||||
{
|
{
|
||||||
ConfigTextManager.Instance.SaveWindowSizeItem(GetType().Name, Width, Height);
|
ConfigTextManager.SaveWindowSizeItem(GetType().Name, Width, Height);
|
||||||
|
|
||||||
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
|
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
|
||||||
{
|
{
|
||||||
ConfigTextManager.Instance.SaveMainGirdHeight(gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth);
|
ConfigTextManager.SaveMainGirdHeight(gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth);
|
||||||
}
|
}
|
||||||
else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical)
|
else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical)
|
||||||
{
|
{
|
||||||
ConfigTextManager.Instance.SaveMainGirdHeight(gridMain.RowDefinitions[0].ActualHeight, gridMain.RowDefinitions[2].ActualHeight);
|
ConfigTextManager.SaveMainGirdHeight(gridMain.RowDefinitions[0].ActualHeight, gridMain.RowDefinitions[2].ActualHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
|||||||
|
|
||||||
Loaded += Window_Loaded;
|
Loaded += Window_Loaded;
|
||||||
btnCancel.Click += (s, e) => Close();
|
btnCancel.Click += (s, e) => Close();
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
||||||
btnBrowseCustomSystemProxyPacPath.Click += BtnBrowseCustomSystemProxyPacPath_Click;
|
btnBrowseCustomSystemProxyPacPath.Click += BtnBrowseCustomSystemProxyPacPath_Click;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
menuSelectAll.Click += menuSelectAll_Click;
|
menuSelectAll.Click += menuSelectAll_Click;
|
||||||
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public partial class StatusBarView : ReactiveUserControl<StatusBarViewModel>
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
txtRunningServerDisplay.Tapped += TxtRunningServerDisplay_Tapped;
|
txtRunningServerDisplay.Tapped += TxtRunningServerDisplay_Tapped;
|
||||||
txtRunningInfoDisplay.Tapped += TxtRunningServerDisplay_Tapped;
|
txtRunningInfoDisplay.Tapped += TxtRunningServerDisplay_Tapped;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public sealed partial class V2rayRuntime
|
|||||||
Config.WebDavItem.Password = input.Password;
|
Config.WebDavItem.Password = input.Password;
|
||||||
}
|
}
|
||||||
Config.WebDavItem.DirName = input.DirName?.Trim();
|
Config.WebDavItem.DirName = input.DirName?.Trim();
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
return OperationView.Ok(ApiMessageKeys.WebDavSettingsSaved);
|
return OperationView.Ok(ApiMessageKeys.WebDavSettingsSaved);
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ public sealed partial class V2rayRuntime
|
|||||||
{
|
{
|
||||||
await _mutations.RunAsync(async () =>
|
await _mutations.RunAsync(async () =>
|
||||||
{
|
{
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
await ProfileExManager.Instance.SaveTo();
|
await ProfileExManager.Instance.SaveTo();
|
||||||
await StatisticsManager.Instance.SaveTo();
|
await StatisticsManager.Instance.SaveTo();
|
||||||
});
|
});
|
||||||
@@ -211,7 +211,7 @@ public sealed partial class V2rayRuntime
|
|||||||
await ProfileExManager.Instance.SaveTo();
|
await ProfileExManager.Instance.SaveTo();
|
||||||
await StatisticsManager.Instance.SaveTo();
|
await StatisticsManager.Instance.SaveTo();
|
||||||
StatisticsManager.Instance.Close();
|
StatisticsManager.Instance.Close();
|
||||||
await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig()), cancellationToken);
|
await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()), cancellationToken);
|
||||||
await SQLiteHelper.Instance.DisposeDbConnectionAsync();
|
await SQLiteHelper.Instance.DisposeDbConnectionAsync();
|
||||||
databaseClosed = true;
|
databaseClosed = true;
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public sealed partial class V2rayRuntime
|
|||||||
.Distinct(StringComparer.Ordinal)
|
.Distinct(StringComparer.Ordinal)
|
||||||
.ToList();
|
.ToList();
|
||||||
Config.CheckUpdateItem.UpdateViaProxy = input.UseProxy;
|
Config.CheckUpdateItem.UpdateViaProxy = input.UseProxy;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
|
|
||||||
return OperationView.Ok(ApiMessageKeys.CoreUpdateSettingsSaved);
|
return OperationView.Ok(ApiMessageKeys.CoreUpdateSettingsSaved);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public sealed partial class V2rayRuntime
|
|||||||
await _mutations.RunAsync(async () =>
|
await _mutations.RunAsync(async () =>
|
||||||
{
|
{
|
||||||
Config.SubIndexId = subscriptionId ?? string.Empty;
|
Config.SubIndexId = subscriptionId ?? string.Empty;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
_events.Publish("profiles-changed", new { subscriptionId = Config.SubIndexId });
|
_events.Publish("profiles-changed", new { subscriptionId = Config.SubIndexId });
|
||||||
return OperationView.Ok(ApiMessageKeys.CommonCompleted, new { subscriptionId = Config.SubIndexId });
|
return OperationView.Ok(ApiMessageKeys.CommonCompleted, new { subscriptionId = Config.SubIndexId });
|
||||||
@@ -63,7 +63,7 @@ public sealed partial class V2rayRuntime
|
|||||||
var imported = await ConfigDbManager.AddBatchServers(Config, request.Content, groupId, request.IsSubscription);
|
var imported = await ConfigDbManager.AddBatchServers(Config, request.Content, groupId, request.IsSubscription);
|
||||||
if (imported > 0)
|
if (imported > 0)
|
||||||
{
|
{
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
}
|
}
|
||||||
return imported;
|
return imported;
|
||||||
});
|
});
|
||||||
@@ -270,7 +270,7 @@ public sealed partial class V2rayRuntime
|
|||||||
if (removesCurrent)
|
if (removesCurrent)
|
||||||
{
|
{
|
||||||
_ = await ConfigDbManager.GetDefaultServer(Config);
|
_ = await ConfigDbManager.GetDefaultServer(Config);
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public sealed partial class V2rayRuntime
|
|||||||
await using var operation = await _operations.EnterOperationAsync(token);
|
await using var operation = await _operations.EnterOperationAsync(token);
|
||||||
await _mutations.RunAsync(async () =>
|
await _mutations.RunAsync(async () =>
|
||||||
{
|
{
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
await ProfileExManager.Instance.SaveTo();
|
await ProfileExManager.Instance.SaveTo();
|
||||||
}, operation.Token);
|
}, operation.Token);
|
||||||
}, cancellationToken);
|
}, cancellationToken);
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ public sealed partial class V2rayRuntime
|
|||||||
}
|
}
|
||||||
Config.RoutingBasicItem.DomainStrategy = input.DomainStrategy!;
|
Config.RoutingBasicItem.DomainStrategy = input.DomainStrategy!;
|
||||||
Config.RoutingBasicItem.DomainStrategy4Singbox = input.DomainStrategy4Singbox!;
|
Config.RoutingBasicItem.DomainStrategy4Singbox = input.DomainStrategy4Singbox!;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
@@ -260,7 +260,7 @@ public sealed partial class V2rayRuntime
|
|||||||
RestoreConfigValues(Config, oldConfig);
|
RestoreConfigValues(Config, oldConfig);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig()));
|
await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()));
|
||||||
}
|
}
|
||||||
catch (Exception rollbackException)
|
catch (Exception rollbackException)
|
||||||
{
|
{
|
||||||
@@ -314,7 +314,7 @@ public sealed partial class V2rayRuntime
|
|||||||
await _mutations.RunAsync(async () =>
|
await _mutations.RunAsync(async () =>
|
||||||
{
|
{
|
||||||
ApplyInboundSettings(Config.Inbound[0], input);
|
ApplyInboundSettings(Config.Inbound[0], input);
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
|
|
||||||
return await CompleteCoreAffectingChangeAsync("inbound", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
return await CompleteCoreAffectingChangeAsync("inbound", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
||||||
@@ -375,7 +375,7 @@ public sealed partial class V2rayRuntime
|
|||||||
Config.Fragment4RayItem.Lengths = fragmentLengths.ToList();
|
Config.Fragment4RayItem.Lengths = fragmentLengths.ToList();
|
||||||
Config.Fragment4RayItem.Delays = fragmentDelays.ToList();
|
Config.Fragment4RayItem.Delays = fragmentDelays.ToList();
|
||||||
Config.Fragment4RayItem.MaxSplit = input.FragmentMaxSplit;
|
Config.Fragment4RayItem.MaxSplit = input.FragmentMaxSplit;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
|
|
||||||
return await CompleteCoreAffectingChangeAsync("core", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
return await CompleteCoreAffectingChangeAsync("core", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
||||||
@@ -402,7 +402,7 @@ public sealed partial class V2rayRuntime
|
|||||||
Config.ConstItem.SrsSourceUrl = input.SrsSourceUrl;
|
Config.ConstItem.SrsSourceUrl = input.SrsSourceUrl;
|
||||||
Config.ConstItem.RouteRulesTemplateSourceUrl = input.RouteRulesTemplateSourceUrl;
|
Config.ConstItem.RouteRulesTemplateSourceUrl = input.RouteRulesTemplateSourceUrl;
|
||||||
Config.ConstItem.SubConvertUrl = input.SubConvertUrl;
|
Config.ConstItem.SubConvertUrl = input.SubConvertUrl;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
|
|
||||||
if (statisticsChanged)
|
if (statisticsChanged)
|
||||||
@@ -435,7 +435,7 @@ public sealed partial class V2rayRuntime
|
|||||||
Config.SpeedTestItem.MixedConcurrencyCount = Math.Max(input.MixedConcurrencyCount, Global.SpeedTestConcurrencyCountMin);
|
Config.SpeedTestItem.MixedConcurrencyCount = Math.Max(input.MixedConcurrencyCount, Global.SpeedTestConcurrencyCountMin);
|
||||||
Config.SpeedTestItem.IPAPIUrl = input.IPAPIUrl;
|
Config.SpeedTestItem.IPAPIUrl = input.IPAPIUrl;
|
||||||
Config.SpeedTestItem.UdpTestTarget = input.UdpTestTarget;
|
Config.SpeedTestItem.UdpTestTarget = input.UdpTestTarget;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
_events.Publish("settings-changed", new { section = "speedtest", restartRequired = false });
|
_events.Publish("settings-changed", new { section = "speedtest", restartRequired = false });
|
||||||
return OperationView.Ok(ApiMessageKeys.SpeedTestSettingsSaved);
|
return OperationView.Ok(ApiMessageKeys.SpeedTestSettingsSaved);
|
||||||
@@ -467,7 +467,7 @@ public sealed partial class V2rayRuntime
|
|||||||
item.CoreType = mapping.CoreType;
|
item.CoreType = mapping.CoreType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
return await CompleteCoreAffectingChangeAsync("core-types", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
return await CompleteCoreAffectingChangeAsync("core-types", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
||||||
}
|
}
|
||||||
@@ -503,7 +503,7 @@ public sealed partial class V2rayRuntime
|
|||||||
{
|
{
|
||||||
Config.RoutingBasicItem.DomainStrategy = input.DomainStrategy!;
|
Config.RoutingBasicItem.DomainStrategy = input.DomainStrategy!;
|
||||||
Config.RoutingBasicItem.DomainStrategy4Singbox = input.DomainStrategy4Singbox!;
|
Config.RoutingBasicItem.DomainStrategy4Singbox = input.DomainStrategy4Singbox!;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
return await CompleteCoreAffectingChangeAsync("routing", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
return await CompleteCoreAffectingChangeAsync("routing", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
||||||
}
|
}
|
||||||
@@ -522,7 +522,7 @@ public sealed partial class V2rayRuntime
|
|||||||
await _mutations.RunAsync(async () =>
|
await _mutations.RunAsync(async () =>
|
||||||
{
|
{
|
||||||
Config.SimpleDNSItem = input;
|
Config.SimpleDNSItem = input;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
return await CompleteCoreAffectingChangeAsync("dns", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
return await CompleteCoreAffectingChangeAsync("dns", fingerprint != GetCoreConfigurationFingerprint(), applyContext);
|
||||||
}
|
}
|
||||||
@@ -743,7 +743,7 @@ public sealed partial class V2rayRuntime
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Config.RoutingBasicItem.RoutingIndexId = string.Empty;
|
Config.RoutingBasicItem.RoutingIndexId = string.Empty;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (Removed: true, AffectsCore: item.IsActive);
|
return (Removed: true, AffectsCore: item.IsActive);
|
||||||
@@ -1234,7 +1234,7 @@ public sealed partial class V2rayRuntime
|
|||||||
}
|
}
|
||||||
|
|
||||||
token.ThrowIfCancellationRequested();
|
token.ThrowIfCancellationRequested();
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
token.ThrowIfCancellationRequested();
|
token.ThrowIfCancellationRequested();
|
||||||
}, token),
|
}, token),
|
||||||
() => RestoreRegionalPresetSnapshotAsync(applyContext));
|
() => RestoreRegionalPresetSnapshotAsync(applyContext));
|
||||||
@@ -1349,7 +1349,7 @@ public sealed partial class V2rayRuntime
|
|||||||
await _mutations.RunAsync(async () =>
|
await _mutations.RunAsync(async () =>
|
||||||
{
|
{
|
||||||
RestoreConfigValues(Config, context.OldConfig);
|
RestoreConfigValues(Config, context.OldConfig);
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
|
|
||||||
await SQLiteHelper.Instance.DeleteAllAsync<RoutingItem>();
|
await SQLiteHelper.Instance.DeleteAllAsync<RoutingItem>();
|
||||||
if (context.OldRoutingItems.Length > 0
|
if (context.OldRoutingItems.Length > 0
|
||||||
@@ -1625,7 +1625,7 @@ public sealed partial class V2rayRuntime
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
RestoreConfigValues(Config, context.OldConfig);
|
RestoreConfigValues(Config, context.OldConfig);
|
||||||
await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig()));
|
await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()));
|
||||||
configRestored = true;
|
configRestored = true;
|
||||||
await _mutations.RunAsync(async () =>
|
await _mutations.RunAsync(async () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public sealed partial class V2rayRuntime(
|
|||||||
private bool _restoring;
|
private bool _restoring;
|
||||||
private int _restoreAndRestartRequested;
|
private int _restoreAndRestartRequested;
|
||||||
|
|
||||||
private Config Config => ConfigTextManager.Instance.Config;
|
private Config Config => ConfigTextManager.Config;
|
||||||
private CoreRuntimeSnapshot CurrentCoreRuntime => Volatile.Read(ref _coreRuntime);
|
private CoreRuntimeSnapshot CurrentCoreRuntime => Volatile.Read(ref _coreRuntime);
|
||||||
public bool RestoreAndRestartRequested => Volatile.Read(ref _restoreAndRestartRequested) != 0;
|
public bool RestoreAndRestartRequested => Volatile.Read(ref _restoreAndRestartRequested) != 0;
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ public sealed partial class V2rayRuntime(
|
|||||||
{
|
{
|
||||||
Config.Inbound[0].AllowLANConn = allowProxyFromLan;
|
Config.Inbound[0].AllowLANConn = allowProxyFromLan;
|
||||||
}
|
}
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
await ConfigDbManager.InitBuiltinDNS(Config);
|
await ConfigDbManager.InitBuiltinDNS(Config);
|
||||||
await BuiltinDnsProfileBootstrap.EnsureAsync(
|
await BuiltinDnsProfileBootstrap.EnsureAsync(
|
||||||
@@ -269,7 +269,7 @@ public sealed partial class V2rayRuntime(
|
|||||||
}
|
}
|
||||||
var selectedProfileId = Config.IndexId;
|
var selectedProfileId = Config.IndexId;
|
||||||
var defaultProfile = await ConfigDbManager.GetDefaultServer(Config);
|
var defaultProfile = await ConfigDbManager.GetDefaultServer(Config);
|
||||||
await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig()));
|
await _mutations.RunAsync(() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()));
|
||||||
await ProfileExManager.Instance.Init();
|
await ProfileExManager.Instance.Init();
|
||||||
await CertPemManager.Instance.Init(Config);
|
await CertPemManager.Instance.Init(Config);
|
||||||
// The Web frontend owns its runtime and rejects generated launch contexts that enable TUN.
|
// The Web frontend owns its runtime and rejects generated launch contexts that enable TUN.
|
||||||
@@ -392,7 +392,7 @@ public sealed partial class V2rayRuntime(
|
|||||||
steps.Add(new("configuration save", async deadline =>
|
steps.Add(new("configuration save", async deadline =>
|
||||||
{
|
{
|
||||||
await _mutations.RunAsync(
|
await _mutations.RunAsync(
|
||||||
() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig()),
|
() => EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig()),
|
||||||
deadline.Token);
|
deadline.Token);
|
||||||
return true;
|
return true;
|
||||||
}));
|
}));
|
||||||
@@ -503,7 +503,7 @@ public sealed partial class V2rayRuntime(
|
|||||||
if (removesCurrentProfile)
|
if (removesCurrentProfile)
|
||||||
{
|
{
|
||||||
_ = await ConfigDbManager.GetDefaultServer(Config);
|
_ = await ConfigDbManager.GetDefaultServer(Config);
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -552,7 +552,7 @@ public sealed partial class V2rayRuntime(
|
|||||||
await handler.UpdateProcess(id);
|
await handler.UpdateProcess(id);
|
||||||
|
|
||||||
operation.Token.ThrowIfCancellationRequested();
|
operation.Token.ThrowIfCancellationRequested();
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
await UpdateSubscriptionTimestampLockedAsync(id);
|
await UpdateSubscriptionTimestampLockedAsync(id);
|
||||||
}, operation.Token);
|
}, operation.Token);
|
||||||
_events.Publish("profiles-changed", new { subscriptionId = id });
|
_events.Publish("profiles-changed", new { subscriptionId = id });
|
||||||
@@ -780,7 +780,7 @@ public sealed partial class V2rayRuntime(
|
|||||||
await _mutations.RunAsync(async () =>
|
await _mutations.RunAsync(async () =>
|
||||||
{
|
{
|
||||||
Config.IndexId = profile.IndexId;
|
Config.IndexId = profile.IndexId;
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -792,7 +792,7 @@ public sealed partial class V2rayRuntime(
|
|||||||
var selected = await ConfigDbManager.GetDefaultServer(Config);
|
var selected = await ConfigDbManager.GetDefaultServer(Config);
|
||||||
if (selected is not null)
|
if (selected is not null)
|
||||||
{
|
{
|
||||||
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.Instance.SaveConfig());
|
await EnsureConfigSaveSucceededAsync(() => ConfigTextManager.SaveConfig());
|
||||||
}
|
}
|
||||||
return selected;
|
return selected;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sizeItem = ConfigTextManager.Instance.GetWindowSizeItem(GetType().Name);
|
var sizeItem = ConfigTextManager.GetWindowSizeItem(GetType().Name);
|
||||||
if (sizeItem == null)
|
if (sizeItem == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -32,7 +32,7 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ConfigTextManager.Instance.SaveWindowSizeItem(GetType().Name, Width, Height);
|
ConfigTextManager.SaveWindowSizeItem(GetType().Name, Width, Height);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class MaterialDesignFonts
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var fontFamily = ConfigTextManager.Instance.Config.UiItem.CurrentFontFamily;
|
var fontFamily = ConfigTextManager.Config.UiItem.CurrentFontFamily;
|
||||||
if (fontFamily.IsNotEmpty())
|
if (fontFamily.IsNotEmpty())
|
||||||
{
|
{
|
||||||
var fontPath = Utils.GetFontsPath();
|
var fontPath = Utils.GetFontsPath();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public sealed partial class HotkeyManager
|
|||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
_hotkeyTriggerDic.Clear();
|
_hotkeyTriggerDic.Clear();
|
||||||
foreach (var item in ConfigTextManager.Instance.Config.GlobalHotkeys)
|
foreach (var item in ConfigTextManager.Config.GlobalHotkeys)
|
||||||
{
|
{
|
||||||
if (item.KeyCode != null && (Key)item.KeyCode != Key.None)
|
if (item.KeyCode != null && (Key)item.KeyCode != Key.None)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject
|
|||||||
|
|
||||||
public ThemeSettingViewModel()
|
public ThemeSettingViewModel()
|
||||||
{
|
{
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
RegisterSystemColorSet(_config, ModifyTheme);
|
RegisterSystemColorSet(_config, ModifyTheme);
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
_config.UiItem.CurrentTheme = CurrentTheme;
|
_config.UiItem.CurrentTheme = CurrentTheme;
|
||||||
ModifyTheme();
|
ModifyTheme();
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
_config.UiItem.ColorPrimaryName = SelectedSwatch?.Name;
|
_config.UiItem.ColorPrimaryName = SelectedSwatch?.Name;
|
||||||
ChangePrimaryColor(SelectedSwatch.ExemplarHue.Color);
|
ChangePrimaryColor(SelectedSwatch.ExemplarHue.Color);
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
_config.UiItem.CurrentFontSize = CurrentFontSize;
|
_config.UiItem.CurrentFontSize = CurrentFontSize;
|
||||||
ModifyFontSize();
|
ModifyFontSize();
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public partial class ThemeSettingViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
_config.UiItem.CurrentLanguage = CurrentLanguage;
|
_config.UiItem.CurrentLanguage = CurrentLanguage;
|
||||||
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
||||||
await ConfigTextManager.Instance.SaveConfig();
|
await ConfigTextManager.SaveConfig();
|
||||||
NoticeManager.Instance.Enqueue(ResUI.NeedRebootTips);
|
NoticeManager.Instance.Enqueue(ResUI.NeedRebootTips);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public partial class AddGroupServerWindow
|
|||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeData(ProfileItem profileItem)
|
private void InitializeData(ProfileItem profileItem)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public partial class AddServer2Window
|
|||||||
interaction.SetOutput(fileName);
|
interaction.SetOutput(fileName);
|
||||||
}).DisposeWith(disposables);
|
}).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeData(ProfileItem profileItem)
|
private void InitializeData(ProfileItem profileItem)
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ public partial class AddServerWindow
|
|||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
|
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeData(ProfileItem profileItem)
|
private void InitializeData(ProfileItem profileItem)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public partial class ClashConnectionsView
|
|||||||
public ClashConnectionsView()
|
public ClashConnectionsView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public partial class DNSSettingWindow
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
cmbDirectDNSStrategy.ItemsSource = Global.DomainStrategy;
|
cmbDirectDNSStrategy.ItemsSource = Global.DomainStrategy;
|
||||||
cmbRemoteDNSStrategy.ItemsSource = Global.DomainStrategy;
|
cmbRemoteDNSStrategy.ItemsSource = Global.DomainStrategy;
|
||||||
@@ -72,7 +72,7 @@ public partial class DNSSettingWindow
|
|||||||
this.OneWayBind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridBasicDNSSettings.IsEnabled).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridBasicDNSSettings.IsEnabled).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridAdvancedDNSSettings.IsEnabled).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridAdvancedDNSSettings.IsEnabled).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void linkDnsObjectDoc_Click(object sender, RoutedEventArgs e)
|
private void linkDnsObjectDoc_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public partial class FullConfigTemplateWindow
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@ public partial class FullConfigTemplateWindow
|
|||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void linkFullConfigTemplateDoc_Click(object sender, RoutedEventArgs e)
|
private void linkFullConfigTemplateDoc_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public partial class GlobalHotkeySettingWindow
|
|||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
BindingData();
|
BindingData();
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public partial class MainWindow
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false);
|
ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false);
|
||||||
|
|
||||||
App.Current.SessionEnding += Current_SessionEnding;
|
App.Current.SessionEnding += Current_SessionEnding;
|
||||||
@@ -345,15 +345,15 @@ public partial class MainWindow
|
|||||||
|
|
||||||
private void StorageUI()
|
private void StorageUI()
|
||||||
{
|
{
|
||||||
ConfigTextManager.Instance.SaveWindowSizeItem(GetType().Name, Width, Height);
|
ConfigTextManager.SaveWindowSizeItem(GetType().Name, Width, Height);
|
||||||
|
|
||||||
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
|
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
|
||||||
{
|
{
|
||||||
ConfigTextManager.Instance.SaveMainGirdHeight(gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth);
|
ConfigTextManager.SaveMainGirdHeight(gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth);
|
||||||
}
|
}
|
||||||
else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical)
|
else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical)
|
||||||
{
|
{
|
||||||
ConfigTextManager.Instance.SaveMainGirdHeight(gridMain1.RowDefinitions[0].ActualHeight, gridMain1.RowDefinitions[2].ActualHeight);
|
ConfigTextManager.SaveMainGirdHeight(gridMain1.RowDefinitions[0].ActualHeight, gridMain1.RowDefinitions[2].ActualHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public partial class OptionSettingWindow
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
||||||
btnBrowseCustomSystemProxyPacPath.Click += BtnBrowseCustomSystemProxyPacPath_Click;
|
btnBrowseCustomSystemProxyPacPath.Click += BtnBrowseCustomSystemProxyPacPath_Click;
|
||||||
@@ -149,7 +149,7 @@ public partial class OptionSettingWindow
|
|||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task InitSettingFont()
|
private async Task InitSettingFont()
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public partial class ProfilesSelectWindow
|
|||||||
}).DisposeWith(disposables);
|
}).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
|
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AllowMultiSelect(bool allow)
|
private void AllowMultiSelect(bool allow)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public partial class ProfilesView
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
lstGroup.MaxHeight = Math.Floor(SystemParameters.WorkArea.Height * 0.20 / 40) * 40;
|
lstGroup.MaxHeight = Math.Floor(SystemParameters.WorkArea.Height * 0.20 / 40) * 40;
|
||||||
|
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||||
txtServerFilter.PreviewKeyDown += TxtServerFilter_PreviewKeyDown;
|
txtServerFilter.PreviewKeyDown += TxtServerFilter_PreviewKeyDown;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public partial class RoutingRuleDetailsWindow
|
|||||||
this.BindCommand(ViewModel, vm => vm.SelectProfileCmd, v => v.btnSelectProfile).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SelectProfileCmd, v => v.btnSelectProfile).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeData(RulesItem rulesItem)
|
private void InitializeData(RulesItem rulesItem)
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public partial class RoutingRuleSettingWindow
|
|||||||
interaction.SetOutput(fileName);
|
interaction.SetOutput(fileName);
|
||||||
}).DisposeWith(disposables);
|
}).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public partial class RoutingSettingWindow
|
|||||||
interaction.SetOutput(result);
|
interaction.SetOutput(result);
|
||||||
}).DisposeWith(disposables);
|
}).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RoutingSettingWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
|
private void RoutingSettingWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public partial class StatusBarView
|
|||||||
public StatusBarView()
|
public StatusBarView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_config = ConfigTextManager.Instance.Config;
|
_config = ConfigTextManager.Config;
|
||||||
|
|
||||||
menuExit.Click += menuExit_Click;
|
menuExit.Click += menuExit_Click;
|
||||||
txtRunningServerDisplay.PreviewMouseDown += txtRunningInfoDisplay_MouseDoubleClick;
|
txtRunningServerDisplay.PreviewMouseDown += txtRunningInfoDisplay_MouseDoubleClick;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public partial class SubEditWindow
|
|||||||
this.BindCommand(ViewModel, vm => vm.SelectNextProfileCmd, v => v.btnSelectNextProfile).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SelectNextProfileCmd, v => v.btnSelectNextProfile).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public partial class SubSettingWindow
|
|||||||
interaction.SetOutput(RxVoid.Default);
|
interaction.SetOutput(RxVoid.Default);
|
||||||
}).DisposeWith(disposables);
|
}).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Instance.Config.UiItem.CurrentTheme);
|
WindowsUtils.SetDarkBorder(this, ConfigTextManager.Config.UiItem.CurrentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ShareSub(string url)
|
private async Task ShareSub(string url)
|
||||||
|
|||||||
Reference in New Issue
Block a user