简化代码

This commit is contained in:
小仙女
2023-02-19 13:34:22 +08:00
parent b84bad4e1a
commit 6a89be2e89
24 changed files with 244 additions and 265 deletions
@@ -106,7 +106,7 @@ namespace v2rayN.ViewModels
{
UI.Show(ResUI.CustomServerTips);
OpenFileDialog fileDialog = new OpenFileDialog
OpenFileDialog fileDialog = new()
{
Multiselect = false,
Filter = "Config|*.json|YAML|*.yaml;*.yml|All|*.*"
@@ -121,10 +121,7 @@ namespace v2rayN.ViewModels
return;
}
var item = LazyConfig.Instance.GetProfileItem(SelectedSource.indexId);
if (item is null)
{
item = SelectedSource;
}
item ??= SelectedSource;
item.address = fileName;
if (ConfigHandler.AddCustomServer(ref _config, item, false) == 0)
{