mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-14 05:12:09 +08:00
1.1.1 -> 1.1.2 第4次更新
This commit is contained in:
parent
84947471df
commit
ec8c86897f
@ -74,8 +74,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||||
<PackageReference Include="MaterialDesignThemes" Version="5.0.0" />
|
<PackageReference Include="MaterialDesignThemes" Version="5.1.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -3,13 +3,13 @@ using System.ComponentModel;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Text.Json;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using IWshRuntimeLibrary;
|
using IWshRuntimeLibrary;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using OnaCore;
|
using OnaCore;
|
||||||
using Sheas_Cealer.Consts;
|
using Sheas_Cealer.Consts;
|
||||||
using Sheas_Cealer.Preses;
|
using Sheas_Cealer.Preses;
|
||||||
@ -176,18 +176,17 @@ public partial class MainWin : Window
|
|||||||
string hostResolverRules = string.Empty;
|
string hostResolverRules = string.Empty;
|
||||||
int ruleIndex = 0;
|
int ruleIndex = 0;
|
||||||
|
|
||||||
using FileStream hostStream = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json"), FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
|
JsonElement hostArray = JsonDocument.Parse(new FileStream(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json"), FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete)).RootElement;
|
||||||
using StreamReader hostReader = new(hostStream);
|
|
||||||
|
|
||||||
foreach (JToken hostJToken in JArray.Parse(hostReader.ReadToEnd()))
|
foreach (JsonElement hostItem in hostArray.EnumerateArray())
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(hostJToken[1]!.ToString()))
|
string hostSni = string.IsNullOrWhiteSpace(hostItem[1].ToString()) ? $"c{ruleIndex}" : hostItem[1].ToString();
|
||||||
hostJToken[1] = $"c{ruleIndex}";
|
string hostIp = string.IsNullOrWhiteSpace(hostItem[2].ToString()) ? "127.0.0.1" : hostItem[2].ToString();
|
||||||
|
|
||||||
foreach (JToken hostName in hostJToken[0]!)
|
foreach (JsonElement hostName in hostItem[0].EnumerateArray())
|
||||||
hostRules += $"MAP {hostName} {hostJToken[1]},";
|
hostRules += $"MAP {hostName} {hostSni},";
|
||||||
|
|
||||||
hostResolverRules += $"MAP {hostJToken[1]} {hostJToken[2]},";
|
hostResolverRules += $"MAP {hostSni} {hostIp},";
|
||||||
|
|
||||||
++ruleIndex;
|
++ruleIndex;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user