diff --git a/v2rayN/v2rayN/Common/HttpClientHelper.cs b/v2rayN/v2rayN/Common/HttpClientHelper.cs index 0c6e6ebb..7a635e29 100644 --- a/v2rayN/v2rayN/Common/HttpClientHelper.cs +++ b/v2rayN/v2rayN/Common/HttpClientHelper.cs @@ -35,7 +35,7 @@ namespace v2rayN public async Task PutAsync(string url, Dictionary headers) { - var jsonContent = JsonUtils.ToJson(headers); + var jsonContent = JsonUtils.Serialize(headers); var content = new StringContent(jsonContent, Encoding.UTF8, MediaTypeNames.Application.Json); var result = await httpClient.PutAsync(url, content); diff --git a/v2rayN/v2rayN/Common/JsonUtils.cs b/v2rayN/v2rayN/Common/JsonUtils.cs index 9493411e..b627d426 100644 --- a/v2rayN/v2rayN/Common/JsonUtils.cs +++ b/v2rayN/v2rayN/Common/JsonUtils.cs @@ -14,7 +14,7 @@ namespace v2rayN /// public static T DeepCopy(T obj) { - return FromJson(ToJson(obj, false))!; + return Deserialize(Serialize(obj, false))!; } /// @@ -23,7 +23,7 @@ namespace v2rayN /// /// /// - public static T? FromJson(string? strJson) + public static T? Deserialize(string? strJson) { try { @@ -68,7 +68,7 @@ namespace v2rayN /// /// /// - public static string ToJson(object? obj, bool indented = true) + public static string Serialize(object? obj, bool indented = true) { string result = string.Empty; try @@ -95,7 +95,7 @@ namespace v2rayN /// /// /// - public static int ToJsonFile(object? obj, string filePath, bool nullValue = true) + public static int ToFile(object? obj, string filePath, bool nullValue = true) { int result; try diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index d034f4de..7fa52b9d 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -27,7 +27,7 @@ namespace v2rayN.Handler if (!Utils.IsNullOrEmpty(result)) { //转成Json - config = JsonUtils.FromJson(result); + config = JsonUtils.Deserialize(result); } else { @@ -232,7 +232,7 @@ namespace v2rayN.Handler //save temp file var resPath = Utils.GetConfigPath(configRes); var tempPath = $"{resPath}_temp"; - if (JsonUtils.ToJsonFile(config, tempPath) != 0) + if (JsonUtils.ToFile(config, tempPath) != 0) { return; } @@ -259,13 +259,13 @@ namespace v2rayN.Handler return -1; } - var configOld = JsonUtils.FromJson(result); + var configOld = JsonUtils.Deserialize(result); if (configOld == null) { return -1; } - var subItem = JsonUtils.FromJson>(JsonUtils.ToJson(configOld.subItem)); + var subItem = JsonUtils.Deserialize>(JsonUtils.Serialize(configOld.subItem)); foreach (var it in subItem) { if (Utils.IsNullOrEmpty(it.id)) @@ -275,7 +275,7 @@ namespace v2rayN.Handler SqliteHelper.Instance.Replace(it); } - var profileItems = JsonUtils.FromJson>(JsonUtils.ToJson(configOld.vmess)); + var profileItems = JsonUtils.Deserialize>(JsonUtils.Serialize(configOld.vmess)); foreach (var it in profileItems) { if (Utils.IsNullOrEmpty(it.indexId)) @@ -291,13 +291,13 @@ namespace v2rayN.Handler { continue; } - var routing = JsonUtils.FromJson(JsonUtils.ToJson(it)); + var routing = JsonUtils.Deserialize(JsonUtils.Serialize(it)); foreach (var it2 in it.rules) { it2.id = Utils.GetGUID(false); } routing.ruleNum = it.rules.Count; - routing.ruleSet = JsonUtils.ToJson(it.rules, false); + routing.ruleSet = JsonUtils.Serialize(it.rules, false); if (Utils.IsNullOrEmpty(routing.id)) { @@ -306,7 +306,7 @@ namespace v2rayN.Handler SqliteHelper.Instance.Replace(routing); } - config = JsonUtils.FromJson(JsonUtils.ToJson(configOld)); + config = JsonUtils.Deserialize(JsonUtils.Serialize(configOld)); if (config.coreBasicItem == null) { @@ -1161,7 +1161,7 @@ namespace v2rayN.Handler ProfileItem profileItem = new(); //Is v2ray configuration - V2rayConfig? v2rayConfig = JsonUtils.FromJson(clipboardData); + V2rayConfig? v2rayConfig = JsonUtils.Deserialize(clipboardData); if (v2rayConfig?.inbounds?.Count > 0 && v2rayConfig.outbounds?.Count > 0) { @@ -1252,10 +1252,10 @@ namespace v2rayN.Handler } //SsSIP008 - var lstSsServer = JsonUtils.FromJson>(clipboardData); + var lstSsServer = JsonUtils.Deserialize>(clipboardData); if (lstSsServer?.Count <= 0) { - var ssSIP008 = JsonUtils.FromJson(clipboardData); + var ssSIP008 = JsonUtils.Deserialize(clipboardData); if (ssSIP008?.servers?.Count > 0) { lstSsServer = ssSIP008.servers; @@ -1467,7 +1467,7 @@ namespace v2rayN.Handler return -1; } - var lstRules = JsonUtils.FromJson>(clipboardData); + var lstRules = JsonUtils.Deserialize>(clipboardData); if (lstRules == null) { return -1; @@ -1478,7 +1478,7 @@ namespace v2rayN.Handler item.id = Utils.GetGUID(false); } routingItem.ruleNum = lstRules.Count; - routingItem.ruleSet = JsonUtils.ToJson(lstRules, false); + routingItem.ruleSet = JsonUtils.Serialize(lstRules, false); if (Utils.IsNullOrEmpty(routingItem.id)) { diff --git a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs index 525f1cf5..8c61f69f 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs @@ -35,11 +35,11 @@ namespace v2rayN.Handler } if (Utils.IsNullOrEmpty(fileName)) { - content = JsonUtils.ToJson(singboxConfig); + content = JsonUtils.Serialize(singboxConfig); } else { - JsonUtils.ToJsonFile(singboxConfig, fileName, false); + JsonUtils.ToFile(singboxConfig, fileName, false); } } else @@ -51,11 +51,11 @@ namespace v2rayN.Handler } if (Utils.IsNullOrEmpty(fileName)) { - content = JsonUtils.ToJson(v2rayConfig); + content = JsonUtils.Serialize(v2rayConfig); } else { - JsonUtils.ToJsonFile(v2rayConfig, fileName, false); + JsonUtils.ToFile(v2rayConfig, fileName, false); } } } @@ -158,7 +158,7 @@ namespace v2rayN.Handler { return -1; } - JsonUtils.ToJsonFile(singboxConfig, fileName, false); + JsonUtils.ToFile(singboxConfig, fileName, false); } else { @@ -166,7 +166,7 @@ namespace v2rayN.Handler { return -1; } - JsonUtils.ToJsonFile(v2rayConfig, fileName, false); + JsonUtils.ToFile(v2rayConfig, fileName, false); } return 0; } diff --git a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs index 629f84bd..7b8c4438 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs @@ -35,7 +35,7 @@ namespace v2rayN.Handler return -1; } - singboxConfig = JsonUtils.FromJson(result); + singboxConfig = JsonUtils.Deserialize(result); if (singboxConfig == null) { msg = ResUI.FailedGenDefaultConfiguration; @@ -177,7 +177,7 @@ namespace v2rayN.Handler _config.tunModeItem.stack = Global.TunStacks[0]; } - var tunInbound = JsonUtils.FromJson(Utils.GetEmbedText(Global.TunSingboxInboundFileName)) ?? new Inbound4Sbox { }; + var tunInbound = JsonUtils.Deserialize(Utils.GetEmbedText(Global.TunSingboxInboundFileName)) ?? new Inbound4Sbox { }; tunInbound.mtu = _config.tunModeItem.mtu; tunInbound.strict_route = _config.tunModeItem.strictRoute; tunInbound.stack = _config.tunModeItem.stack; @@ -458,7 +458,7 @@ namespace v2rayN.Handler if (prevNode is not null && prevNode.configType != EConfigType.Custom) { - var prevOutbound = JsonUtils.FromJson(txtOutbound); + var prevOutbound = JsonUtils.Deserialize(txtOutbound); GenOutbound(prevNode, prevOutbound); prevOutbound.tag = $"{Global.ProxyTag}2"; singboxConfig.outbounds.Add(prevOutbound); @@ -471,7 +471,7 @@ namespace v2rayN.Handler if (nextNode is not null && nextNode.configType != EConfigType.Custom) { - var nextOutbound = JsonUtils.FromJson(txtOutbound); + var nextOutbound = JsonUtils.Deserialize(txtOutbound); GenOutbound(nextNode, nextOutbound); nextOutbound.tag = Global.ProxyTag; singboxConfig.outbounds.Insert(0, nextOutbound); @@ -496,7 +496,7 @@ namespace v2rayN.Handler { singboxConfig.route.auto_detect_interface = true; - var tunRules = JsonUtils.FromJson>(Utils.GetEmbedText(Global.TunSingboxRulesFileName)); + var tunRules = JsonUtils.Deserialize>(Utils.GetEmbedText(Global.TunSingboxRulesFileName)); singboxConfig.route.rules.AddRange(tunRules); GenRoutingDirectExe(out List lstDnsExe, out List lstDirectExe); @@ -519,7 +519,7 @@ namespace v2rayN.Handler var routing = ConfigHandler.GetDefaultRouting(_config); if (routing != null) { - var rules = JsonUtils.FromJson>(routing.ruleSet); + var rules = JsonUtils.Deserialize>(routing.ruleSet); foreach (var item in rules!) { if (item.enabled) @@ -534,7 +534,7 @@ namespace v2rayN.Handler var lockedItem = ConfigHandler.GetLockedRoutingItem(_config); if (lockedItem != null) { - var rules = JsonUtils.FromJson>(lockedItem.ruleSet); + var rules = JsonUtils.Deserialize>(lockedItem.ruleSet); foreach (var item in rules!) { GenRoutingUserRule(item, singboxConfig.route.rules); @@ -726,7 +726,7 @@ namespace v2rayN.Handler { tunDNS = Utils.GetEmbedText(Global.TunSingboxDNSFileName); } - dns4Sbox = JsonUtils.FromJson(tunDNS); + dns4Sbox = JsonUtils.Deserialize(tunDNS); } else { @@ -737,7 +737,7 @@ namespace v2rayN.Handler normalDNS = "{\"servers\":[{\"address\":\"tcp://8.8.8.8\"}]}"; } - dns4Sbox = JsonUtils.FromJson(normalDNS); + dns4Sbox = JsonUtils.Deserialize(normalDNS); } if (dns4Sbox is null) { @@ -821,7 +821,7 @@ namespace v2rayN.Handler return -1; } - singboxConfig = JsonUtils.FromJson(result); + singboxConfig = JsonUtils.Deserialize(result); if (singboxConfig == null) { msg = ResUI.FailedGenDefaultConfiguration; @@ -919,7 +919,7 @@ namespace v2rayN.Handler continue; } - var outbound = JsonUtils.FromJson(txtOutbound); + var outbound = JsonUtils.Deserialize(txtOutbound); GenOutbound(item, outbound); outbound.tag = Global.ProxyTag + inbound.listen_port.ToString(); singboxConfig.outbounds.Add(outbound); diff --git a/v2rayN/v2rayN/Handler/CoreConfigV2ray.cs b/v2rayN/v2rayN/Handler/CoreConfigV2ray.cs index c2bb713b..a77e94bc 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigV2ray.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigV2ray.cs @@ -37,7 +37,7 @@ namespace v2rayN.Handler return -1; } - v2rayConfig = JsonUtils.FromJson(result); + v2rayConfig = JsonUtils.Deserialize(result); if (v2rayConfig == null) { msg = ResUI.FailedGenDefaultConfiguration; @@ -153,7 +153,7 @@ namespace v2rayN.Handler return null; } - var inbound = JsonUtils.FromJson(result); + var inbound = JsonUtils.Deserialize(result); if (inbound == null) { return null; @@ -186,12 +186,12 @@ namespace v2rayN.Handler { v2rayConfig.routing.domainStrategy = routing.domainStrategy; } - var rules = JsonUtils.FromJson>(routing.ruleSet); + var rules = JsonUtils.Deserialize>(routing.ruleSet); foreach (var item in rules) { if (item.enabled) { - var item2 = JsonUtils.FromJson(JsonUtils.ToJson(item)); + var item2 = JsonUtils.Deserialize(JsonUtils.Serialize(item)); GenRoutingUserRule(item2, v2rayConfig); } } @@ -202,10 +202,10 @@ namespace v2rayN.Handler var lockedItem = ConfigHandler.GetLockedRoutingItem(_config); if (lockedItem != null) { - var rules = JsonUtils.FromJson>(lockedItem.ruleSet); + var rules = JsonUtils.Deserialize>(lockedItem.ruleSet); foreach (var item in rules) { - var item2 = JsonUtils.FromJson(JsonUtils.ToJson(item)); + var item2 = JsonUtils.Deserialize(JsonUtils.Serialize(item)); GenRoutingUserRule(item2, v2rayConfig); } } @@ -687,7 +687,7 @@ namespace v2rayN.Handler pathHttp = string.Join("\",\"", arrPath); } request = request.Replace("$requestPath$", $"\"{pathHttp}\""); - tcpSettings.header.request = JsonUtils.FromJson(request); + tcpSettings.header.request = JsonUtils.Deserialize(request); streamSettings.tcpSettings = tcpSettings; } @@ -848,7 +848,7 @@ namespace v2rayN.Handler && prevNode.configType != EConfigType.Hysteria2 && prevNode.configType != EConfigType.Tuic) { - var prevOutbound = JsonUtils.FromJson(txtOutbound); + var prevOutbound = JsonUtils.Deserialize(txtOutbound); GenOutbound(prevNode, prevOutbound); prevOutbound.tag = $"{Global.ProxyTag}2"; v2rayConfig.outbounds.Add(prevOutbound); @@ -866,7 +866,7 @@ namespace v2rayN.Handler && nextNode.configType != EConfigType.Hysteria2 && nextNode.configType != EConfigType.Tuic) { - var nextOutbound = JsonUtils.FromJson(txtOutbound); + var nextOutbound = JsonUtils.Deserialize(txtOutbound); GenOutbound(nextNode, nextOutbound); nextOutbound.tag = Global.ProxyTag; v2rayConfig.outbounds.Insert(0, nextOutbound); @@ -911,7 +911,7 @@ namespace v2rayN.Handler return -1; } - v2rayConfig = JsonUtils.FromJson(result); + v2rayConfig = JsonUtils.Deserialize(result); if (v2rayConfig == null) { msg = ResUI.FailedGenDefaultConfiguration; @@ -1008,7 +1008,7 @@ namespace v2rayN.Handler continue; } - var outbound = JsonUtils.FromJson(txtOutbound); + var outbound = JsonUtils.Deserialize(txtOutbound); GenOutbound(item, outbound); outbound.tag = Global.ProxyTag + inbound.port.ToString(); v2rayConfig.outbounds.Add(outbound); diff --git a/v2rayN/v2rayN/Handler/ProxySetting.cs b/v2rayN/v2rayN/Handler/ProxySetting.cs index e728f3f4..1e7c17c9 100644 --- a/v2rayN/v2rayN/Handler/ProxySetting.cs +++ b/v2rayN/v2rayN/Handler/ProxySetting.cs @@ -320,27 +320,5 @@ namespace v2rayN.Handler ref int lpcEntries // Number of entries written to the buffer ); } - - //判断是否使用代理 - public static bool UsedProxy() - { - using RegistryKey? rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true); - if (rk?.GetValue("ProxyEnable")?.ToString() == "1") - { - return true; - } - else - { - return false; - } - } - - //获得代理的IP和端口 - public static string? GetProxyProxyServer() - { - using RegistryKey? rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true); - string ProxyServer = rk.GetValue("ProxyServer").ToString(); - return ProxyServer; - } } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Handler/ShareHandler.cs b/v2rayN/v2rayN/Handler/ShareHandler.cs index dec56779..6ad7f506 100644 --- a/v2rayN/v2rayN/Handler/ShareHandler.cs +++ b/v2rayN/v2rayN/Handler/ShareHandler.cs @@ -65,7 +65,7 @@ namespace v2rayN.Handler fp = item.fingerprint }; - url = JsonUtils.ToJson(vmessQRCode); + url = JsonUtils.Serialize(vmessQRCode); url = Utils.Base64Encode(url); url = $"{Global.ProtocolShares[EConfigType.VMess]}{url}"; @@ -450,7 +450,7 @@ namespace v2rayN.Handler result = Utils.Base64Decode(result); //转成Json - VmessQRCode? vmessQRCode = JsonUtils.FromJson(result); + VmessQRCode? vmessQRCode = JsonUtils.Deserialize(result); if (vmessQRCode == null) { msg = ResUI.FailedConversionConfiguration; diff --git a/v2rayN/v2rayN/Handler/StatisticsSingbox.cs b/v2rayN/v2rayN/Handler/StatisticsSingbox.cs index 60519d1d..7db85996 100644 --- a/v2rayN/v2rayN/Handler/StatisticsSingbox.cs +++ b/v2rayN/v2rayN/Handler/StatisticsSingbox.cs @@ -113,7 +113,7 @@ namespace v2rayN.Handler up = 0; down = 0; try { - var trafficItem = JsonUtils.FromJson(source); + var trafficItem = JsonUtils.Deserialize(source); if (trafficItem != null) { up = trafficItem.up; diff --git a/v2rayN/v2rayN/Handler/UpdateHandle.cs b/v2rayN/v2rayN/Handler/UpdateHandle.cs index 365eb039..6236c58f 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandle.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandle.cs @@ -407,7 +407,7 @@ namespace v2rayN.Handler { try { - var gitHubReleases = JsonUtils.FromJson>(gitHubReleaseApi); + var gitHubReleases = JsonUtils.Deserialize>(gitHubReleaseApi); var gitHubRelease = preRelease ? gitHubReleases!.First() : gitHubReleases!.First(r => r.Prerelease == false); var version = new SemanticVersion(gitHubRelease!.TagName); var body = gitHubRelease!.Body; diff --git a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs index 0192e8fa..a5cb132e 100644 --- a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs @@ -78,7 +78,7 @@ namespace v2rayN.ViewModels } if (!Utils.IsNullOrEmpty(normalDNS2)) { - var obj2 = JsonUtils.FromJson(normalDNS2); + var obj2 = JsonUtils.Deserialize(normalDNS2); if (obj2 == null) { UI.Show(ResUI.FillCorrectDNSText); @@ -87,7 +87,7 @@ namespace v2rayN.ViewModels } if (!Utils.IsNullOrEmpty(tunDNS2)) { - var obj2 = JsonUtils.FromJson(tunDNS2); + var obj2 = JsonUtils.Deserialize(tunDNS2); if (obj2 == null) { UI.Show(ResUI.FillCorrectDNSText); @@ -102,8 +102,8 @@ namespace v2rayN.ViewModels ConfigHandler.SaveDNSItems(_config, item); var item2 = LazyConfig.Instance.GetDNSItem(ECoreType.sing_box); - item2.normalDNS = JsonUtils.ToJson(JsonUtils.ParseJson(normalDNS2)); - item2.tunDNS = JsonUtils.ToJson(JsonUtils.ParseJson(tunDNS2)); + item2.normalDNS = JsonUtils.Serialize(JsonUtils.ParseJson(normalDNS2)); + item2.tunDNS = JsonUtils.Serialize(JsonUtils.ParseJson(tunDNS2)); ConfigHandler.SaveDNSItems(_config, item2); _noticeHandler?.Enqueue(ResUI.OperationSuccess); diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index 52f581bc..eb622188 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -832,7 +832,7 @@ namespace v2rayN.ViewModels totalDown = t22 == null ? "" : Utils.HumanFy(t22.totalDown), totalUp = t22 == null ? "" : Utils.HumanFy(t22.totalUp) }).OrderBy(t => t.sort).ToList(); - _lstProfile = JsonUtils.FromJson>(JsonUtils.ToJson(lstModel)); + _lstProfile = JsonUtils.Deserialize>(JsonUtils.Serialize(lstModel)); Application.Current.Dispatcher.Invoke((Action)(() => { @@ -938,7 +938,7 @@ namespace v2rayN.ViewModels } else { - lstSelecteds = JsonUtils.FromJson>(JsonUtils.ToJson(orderProfiles)); + lstSelecteds = JsonUtils.Deserialize>(JsonUtils.Serialize(orderProfiles)); } return 0; diff --git a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs index 52f08ba4..23dcc2e4 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs @@ -58,7 +58,7 @@ namespace v2rayN.ViewModels else { SelectedRouting = routingItem; - _rules = JsonUtils.FromJson>(SelectedRouting.ruleSet); + _rules = JsonUtils.Deserialize>(SelectedRouting.ruleSet); } RefreshRulesItems(); @@ -207,7 +207,7 @@ namespace v2rayN.ViewModels } if (lst.Count > 0) { - Utils.SetClipboardData(JsonUtils.ToJson(lst)); + Utils.SetClipboardData(JsonUtils.Serialize(lst)); //UI.Show(ResUI.OperationSuccess")); } } @@ -246,7 +246,7 @@ namespace v2rayN.ViewModels it.id = Utils.GetGUID(false); } item.ruleNum = _rules.Count; - item.ruleSet = JsonUtils.ToJson(_rules, false); + item.ruleSet = JsonUtils.Serialize(_rules, false); if (ConfigHandler.SaveRoutingItem(_config, item) == 0) { @@ -328,7 +328,7 @@ namespace v2rayN.ViewModels { return -1; } - var lstRules = JsonUtils.FromJson>(clipboardData); + var lstRules = JsonUtils.Deserialize>(clipboardData); if (lstRules == null) { return -1; diff --git a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs index 0a19f4c4..dfcfddc4 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs @@ -136,7 +136,7 @@ namespace v2rayN.ViewModels _lockedItem = ConfigHandler.GetLockedRoutingItem(_config); if (_lockedItem != null) { - _lockedRules = JsonUtils.FromJson>(_lockedItem.ruleSet); + _lockedRules = JsonUtils.Deserialize>(_lockedItem.ruleSet); ProxyDomain = Utils.List2String(_lockedRules[0].domain, true); ProxyIP = Utils.List2String(_lockedRules[0].ip, true); @@ -161,7 +161,7 @@ namespace v2rayN.ViewModels _lockedRules[2].domain = Utils.String2List(Utils.Convert2Comma(BlockDomain.TrimEx())); _lockedRules[2].ip = Utils.String2List(Utils.Convert2Comma(BlockIP.TrimEx())); - _lockedItem.ruleSet = JsonUtils.ToJson(_lockedRules, false); + _lockedItem.ruleSet = JsonUtils.Serialize(_lockedRules, false); ConfigHandler.SaveRoutingItem(_config, _lockedItem); }