mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-14 05:12:09 +08:00
1.1.1 -> 1.1.2 第49次更新
This commit is contained in:
parent
158ee04adc
commit
605c6e61a3
@ -184,6 +184,7 @@ public partial class MainWin : Window
|
|||||||
{
|
{
|
||||||
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!File.Exists(MainConst.NginxConfPath))
|
if (!File.Exists(MainConst.NginxConfPath))
|
||||||
File.Create(MainConst.NginxConfPath).Dispose();
|
File.Create(MainConst.NginxConfPath).Dispose();
|
||||||
if (!Directory.Exists(MainConst.NginxLogsPath))
|
if (!Directory.Exists(MainConst.NginxLogsPath))
|
||||||
@ -300,8 +301,11 @@ public partial class MainWin : Window
|
|||||||
|
|
||||||
if (!MainPres!.IsMihomoRunning)
|
if (!MainPres!.IsMihomoRunning)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(MihomoConfs))
|
||||||
|
throw new Exception(MainConst._ConfErrorMsg);
|
||||||
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!File.Exists(MainConst.MihomoConfPath))
|
if (!File.Exists(MainConst.MihomoConfPath))
|
||||||
File.Create(MainConst.MihomoConfPath).Dispose();
|
File.Create(MainConst.MihomoConfPath).Dispose();
|
||||||
|
|
||||||
@ -576,35 +580,39 @@ public partial class MainWin : Window
|
|||||||
{
|
{
|
||||||
if (MainConst.IsAdmin && MainPres!.IsMihomoExist)
|
if (MainConst.IsAdmin && MainPres!.IsMihomoExist)
|
||||||
{
|
{
|
||||||
if (!File.Exists(MainConst.MihomoConfPath))
|
try
|
||||||
File.Create(MainConst.MihomoConfPath).Dispose();
|
|
||||||
|
|
||||||
ExtraMihomoConfs = File.ReadAllText(MainConst.MihomoConfPath);
|
|
||||||
|
|
||||||
Dictionary<string, object> mihomoConfDict = new DeserializerBuilder()
|
|
||||||
.WithNamingConvention(HyphenatedNamingConvention.Instance)
|
|
||||||
.IgnoreUnmatchedProperties()
|
|
||||||
.Build()
|
|
||||||
.Deserialize<Dictionary<string, object>>(ExtraMihomoConfs) ?? [];
|
|
||||||
|
|
||||||
mihomoConfDict["mixed-port"] = 7880;
|
|
||||||
mihomoConfDict["dns"] = new
|
|
||||||
{
|
{
|
||||||
enable = true,
|
if (!File.Exists(MainConst.MihomoConfPath))
|
||||||
listen = ":53",
|
File.Create(MainConst.MihomoConfPath).Dispose();
|
||||||
enhancedMode = "redir-host",
|
|
||||||
nameserver = new[] { "https://doh.apad.pro/dns-query", "https://ns.net.kg/dns-query" }
|
|
||||||
};
|
|
||||||
mihomoConfDict["tun"] = new
|
|
||||||
{
|
|
||||||
enable = true,
|
|
||||||
stack = "system",
|
|
||||||
autoRoute = true,
|
|
||||||
autoDetectInterface = true,
|
|
||||||
dnsHijack = new[] { "any:53", "tcp://any:53" }
|
|
||||||
};
|
|
||||||
|
|
||||||
MihomoConfs = new SerializerBuilder().WithNamingConvention(HyphenatedNamingConvention.Instance).Build().Serialize(mihomoConfDict);
|
ExtraMihomoConfs = File.ReadAllText(MainConst.MihomoConfPath);
|
||||||
|
|
||||||
|
Dictionary<string, object> mihomoConfDict = new DeserializerBuilder()
|
||||||
|
.WithNamingConvention(HyphenatedNamingConvention.Instance)
|
||||||
|
.IgnoreUnmatchedProperties()
|
||||||
|
.Build()
|
||||||
|
.Deserialize<Dictionary<string, object>>(ExtraMihomoConfs) ?? [];
|
||||||
|
|
||||||
|
mihomoConfDict["mixed-port"] = 7880;
|
||||||
|
mihomoConfDict["dns"] = new
|
||||||
|
{
|
||||||
|
enable = true,
|
||||||
|
listen = ":53",
|
||||||
|
enhancedMode = "redir-host",
|
||||||
|
nameserver = new[] { "https://doh.apad.pro/dns-query", "https://ns.net.kg/dns-query" }
|
||||||
|
};
|
||||||
|
mihomoConfDict["tun"] = new
|
||||||
|
{
|
||||||
|
enable = true,
|
||||||
|
stack = "system",
|
||||||
|
autoRoute = true,
|
||||||
|
autoDetectInterface = true,
|
||||||
|
dnsHijack = new[] { "any:53", "tcp://any:53" }
|
||||||
|
};
|
||||||
|
|
||||||
|
MihomoConfs = new SerializerBuilder().WithNamingConvention(HyphenatedNamingConvention.Instance).Build().Serialize(mihomoConfDict);
|
||||||
|
}
|
||||||
|
catch { MihomoConfs = string.Empty; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void MainWin_KeyDown(object sender, KeyEventArgs e)
|
private void MainWin_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user