mirror of
https://github.com/2dust/v2rayN.git
synced 2026-01-18 13:17:05 +00:00
Merge pull request #3 from FlowerRealm/codex/add-codex-integration
Clarify indeterminate flag docs
This commit is contained in:
commit
6951c17486
2 changed files with 35 additions and 2 deletions
|
|
@ -20,20 +20,23 @@ public static class ConfigHandler
|
||||||
public static Config? LoadConfig()
|
public static Config? LoadConfig()
|
||||||
{
|
{
|
||||||
Config? config = null;
|
Config? config = null;
|
||||||
var result = EmbedUtils.LoadResource(Utils.GetConfigPath(_configRes));
|
var configPath = Utils.GetConfigPath(_configRes);
|
||||||
|
var configFileExists = File.Exists(configPath);
|
||||||
|
var result = EmbedUtils.LoadResource(configPath);
|
||||||
if (result.IsNotEmpty())
|
if (result.IsNotEmpty())
|
||||||
{
|
{
|
||||||
config = JsonUtils.Deserialize<Config>(result);
|
config = JsonUtils.Deserialize<Config>(result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (File.Exists(Utils.GetConfigPath(_configRes)))
|
if (configFileExists)
|
||||||
{
|
{
|
||||||
Logging.SaveLog("LoadConfig Exception");
|
Logging.SaveLog("LoadConfig Exception");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isNewConfig = config == null;
|
||||||
config ??= new Config();
|
config ??= new Config();
|
||||||
|
|
||||||
config.CoreBasicItem ??= new()
|
config.CoreBasicItem ??= new()
|
||||||
|
|
@ -171,6 +174,22 @@ public static class ConfigHandler
|
||||||
config.SystemProxyItem.SystemProxyExceptions = Utils.IsWindows() ? Global.SystemProxyExceptionsWindows : Global.SystemProxyExceptionsLinux;
|
config.SystemProxyItem.SystemProxyExceptions = Utils.IsWindows() ? Global.SystemProxyExceptionsWindows : Global.SystemProxyExceptionsLinux;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isNewConfig && !configFileExists)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ret = SaveConfig(config).GetAwaiter().GetResult();
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
Logging.SaveLog($"{_tag}: Failed to create default config file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog($"{_tag}: Failed to create default config file", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,13 @@ public class ProfilesViewModel : MyReactiveObject
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string SubUsageText { get; set; }
|
public string SubUsageText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当订阅用量仍在请求、或远端未提供总流量时保持进度条在“未知/占位”马灯状态,避免显示 0% 等误导性的数值。
|
||||||
|
/// 该值直接绑定到视图层进度条的 <c>IsIndeterminate</c> 属性。
|
||||||
|
/// </summary>
|
||||||
|
[Reactive]
|
||||||
|
public bool SubUsageIndeterminate { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool SubUsageIndeterminate { get; set; }
|
public bool SubUsageIndeterminate { get; set; }
|
||||||
|
|
||||||
|
|
@ -56,6 +63,13 @@ public class ProfilesViewModel : MyReactiveObject
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string SubExpireText { get; set; }
|
public string SubExpireText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在未能计算到期日或仍在加载时,让到期进度条保持“不确定”马灯动画,提示用户等待最新数据。
|
||||||
|
/// 该值直接绑定到视图层进度条的 <c>IsIndeterminate</c> 属性。
|
||||||
|
/// </summary>
|
||||||
|
[Reactive]
|
||||||
|
public bool SubExpireIndeterminate { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool SubExpireIndeterminate { get; set; }
|
public bool SubExpireIndeterminate { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue