mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-14 05:12:09 +08:00
1.0.4 -> 1.0.5 第4次更新
This commit is contained in:
parent
93c7bf4cdb
commit
0e5ed26581
@ -7,4 +7,4 @@ using System.Windows;
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
)]
|
@ -8,10 +8,10 @@
|
||||
<PackageReleaseNotes>Just Ceal It</PackageReleaseNotes>
|
||||
<Authors>Space Time</Authors>
|
||||
<Company>Space Time</Company>
|
||||
<AssemblyVersion>1.0.4</AssemblyVersion>
|
||||
<Version>1.0.4</Version>
|
||||
<FileVersion>1.0.4</FileVersion>
|
||||
<InformationalVersion>1.0.4</InformationalVersion>
|
||||
<AssemblyVersion>1.0.5</AssemblyVersion>
|
||||
<Version>1.0.5</Version>
|
||||
<FileVersion>1.0.5</FileVersion>
|
||||
<InformationalVersion>1.0.5</InformationalVersion>
|
||||
<PackageTags>Tool;Sheas;Cealer;Sni</PackageTags>
|
||||
<ApplicationIcon>Sheas-Cealer-Logo.ico</ApplicationIcon>
|
||||
<PackageIcon>Sheas Cealer Logo.png</PackageIcon>
|
||||
@ -30,6 +30,7 @@
|
||||
<IsPublishable>True</IsPublishable>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<ErrorReport>none</ErrorReport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
@ -47,14 +48,14 @@
|
||||
<Page Remove="bin\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Remove="app.manifest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove=".gitattributes" />
|
||||
<None Remove=".gitignore" />
|
||||
<None Remove="Cealing-Clash.exe" />
|
||||
<None Remove="Cealing-Host.json" />
|
||||
<None Remove="Clash.exe" />
|
||||
<None Remove="config.yaml" />
|
||||
<None Remove="Country.mmdb" />
|
||||
<None Remove="app.manifest" />
|
||||
<None Remove="README.md" />
|
||||
<None Remove="Sheas-Cealer-Logo.ico" />
|
||||
</ItemGroup>
|
||||
@ -78,6 +79,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Ona-Core">
|
||||
<HintPath>..\Ona-Core\bin\Release\net5.0-windows10.0.22000.0\Ona-Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sheas-Core">
|
||||
<HintPath>D:\Git-Repository\Sheas-Core\bin\Release\Sheas-Core.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -3,10 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32328.378
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sheas-Cealer", "Sheas-Cealer.csproj", "{662F787A-474F-41FD-B813-645CAA89E531}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sheas-Cealer", "Sheas-Cealer.csproj", "{662F787A-474F-41FD-B813-645CAA89E531}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sheas-Core", "D:\Git-Repository\Sheas-Core\Sheas-Core.csproj", "{42491572-0050-4CDA-9189-DFC98BDBBF73}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ona-Core", "..\Ona-Core\Ona-Core.csproj", "{76263DF7-E4E4-4846-8604-8CFCA7125E2F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{42491572-0050-4CDA-9189-DFC98BDBBF73}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{42491572-0050-4CDA-9189-DFC98BDBBF73}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{42491572-0050-4CDA-9189-DFC98BDBBF73}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{76263DF7-E4E4-4846-8604-8CFCA7125E2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{76263DF7-E4E4-4846-8604-8CFCA7125E2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{76263DF7-E4E4-4846-8604-8CFCA7125E2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{76263DF7-E4E4-4846-8604-8CFCA7125E2F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -37,9 +37,11 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="ConfigButton" Content="代理规则" Grid.Column="0" Margin="5,0,5,0" Click="ConfigButton_Click" />
|
||||
<Button x:Name="HostButton" Content="伪造规则" Grid.Column="1" Margin="5,0,5,0" Click="HostButton_Click" />
|
||||
<Button x:Name="AboutButton" Content="关于项目" Grid.Column="2" Margin="5,0,5,0" Click="AboutButton_Click" />
|
||||
<Button x:Name="ConfigButton" Content="代理规则" Grid.Column="0" Margin="5,0,5,0" Click="ConfigOpenButton_Click" />
|
||||
<Button x:Name="HostMenuButton" Content="伪造规则🔺" Grid.Column="1" Margin="5,0,5,0" Panel.ZIndex="1" MouseEnter="HostMenuButton_MouseEnter" MouseLeave="HostMenuButton_MouseLeave" Click="HostMenuButton_Click" />
|
||||
<Button x:Name="HostOpenButton" Content="打开伪造规则" Grid.Column="1" Margin="5,0,5,0" Background="Orange" MouseEnter="HostMenuButton_MouseEnter" MouseLeave="HostMenuButton_MouseLeave" Click="HostOpenButton_Click" />
|
||||
<Button x:Name="HostUpdateButton" Content="更新伪造规则" Grid.Column="1" Margin="5,0,5,0" Background="Orange" MouseEnter="HostMenuButton_MouseEnter" MouseLeave="HostMenuButton_MouseLeave" Click="HostUpdateButton_Click" />
|
||||
<Button x:Name="AboutButton" Content="关于项目" Grid.Column="2" Margin="5,0,5,0" Click="AboutButton_Click" Cursor="Hand" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
@ -1,14 +1,18 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Threading;
|
||||
using IWshRuntimeLibrary;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OnaCore;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
using File = System.IO.File;
|
||||
|
||||
@ -16,9 +20,11 @@ namespace Sheas_Cealer
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private static string? CEALING_ARGUMENT;
|
||||
private readonly HttpClient MAIN_CLIENT = new(); //当前窗口使用的唯一的 HttpClient
|
||||
private static readonly FileSystemWatcher CEALING_HOST_WATCHER = new(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json") { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite };
|
||||
private static readonly DispatcherTimer MONITOR_TIMER = new() { Interval = new TimeSpan(1000000) }; //0.1s
|
||||
private static string? CEALING_ARGUMENT;
|
||||
private static bool IS_HOST_MENU_OPENED;
|
||||
|
||||
internal MainWindow(string[] args)
|
||||
{
|
||||
@ -131,7 +137,7 @@ namespace Sheas_Cealer
|
||||
YamlMappingNode configMap;
|
||||
try
|
||||
{
|
||||
configStream.Load(File.OpenText(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"config.yaml")));
|
||||
configStream.Load(File.OpenText(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Config.yaml")));
|
||||
configMap = (YamlMappingNode)configStream.Documents[0].RootNode;
|
||||
}
|
||||
catch { throw new Exception("规则无法识别,请检查代理规则是否含有语法错误"); }
|
||||
@ -139,7 +145,7 @@ namespace Sheas_Cealer
|
||||
proxyKey.SetValue("ProxyEnable", 1);
|
||||
proxyKey.SetValue("ProxyServer", "127.0.0.1:" + configMap["mixed-port"]);
|
||||
|
||||
new Clash().ShellRun(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "-d .");
|
||||
new Clash().ShellRun(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"-f .\Cealing-Config.yaml");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -176,16 +182,55 @@ namespace Sheas_Cealer
|
||||
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
|
||||
}
|
||||
|
||||
private void ConfigButton_Click(object sender, RoutedEventArgs e)
|
||||
private void ConfigOpenButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ProcessStartInfo processStartInfo = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"config.yaml")) { UseShellExecute = true };
|
||||
ProcessStartInfo processStartInfo = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Config.yaml")) { UseShellExecute = true };
|
||||
Process.Start(processStartInfo);
|
||||
}
|
||||
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
|
||||
}
|
||||
private void HostButton_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
private void HostMenuButton_MouseEnter(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
IS_HOST_MENU_OPENED = true;
|
||||
|
||||
double hostButtonHeight = HostMenuButton.ActualHeight;
|
||||
AnimateHostButton(new Thickness(0, -hostButtonHeight - 5, 0, hostButtonHeight + 5), new Thickness(0, -hostButtonHeight * 2 - 10, 0, hostButtonHeight * 2 + 10));
|
||||
}
|
||||
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
|
||||
}
|
||||
private void HostMenuButton_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
try { AnimateHostButton(new Thickness(5, 0, 5, 0), new Thickness(5, 0, 5, 0)); }
|
||||
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
|
||||
}
|
||||
private void HostMenuButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
IS_HOST_MENU_OPENED = !IS_HOST_MENU_OPENED;
|
||||
|
||||
if (IS_HOST_MENU_OPENED)
|
||||
{
|
||||
double hostButtonHeight = HostMenuButton.ActualHeight;
|
||||
AnimateHostButton(new Thickness(0, -hostButtonHeight - 5, 0, hostButtonHeight + 5), new Thickness(0, -hostButtonHeight * 2 - 10, 0, hostButtonHeight * 2 + 10));
|
||||
}
|
||||
else
|
||||
AnimateHostButton(new Thickness(5, 0, 5, 0), new Thickness(5, 0, 5, 0));
|
||||
}
|
||||
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
|
||||
}
|
||||
private void AnimateHostButton(Thickness hostOpenButtonThickness, Thickness hostUpdateButtonThickness)
|
||||
{
|
||||
HostOpenButton.BeginAnimation(MarginProperty, new ThicknessAnimation(hostOpenButtonThickness, TimeSpan.FromSeconds(0.25)));
|
||||
HostUpdateButton.BeginAnimation(MarginProperty, new ThicknessAnimation(hostUpdateButtonThickness, TimeSpan.FromSeconds(0.25)));
|
||||
}
|
||||
|
||||
private void HostOpenButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -194,6 +239,26 @@ namespace Sheas_Cealer
|
||||
}
|
||||
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
|
||||
}
|
||||
private async void HostUpdateButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string hostUpdateString = await Http.GetAsync<string>(@"https://gitlab.com/SpaceTimee/Cealing-Host/-/raw/main/Cealing-Host.json", MAIN_CLIENT);
|
||||
StreamReader hostLocalStreamReader = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"));
|
||||
string hostLocalString = hostLocalStreamReader.ReadToEnd();
|
||||
hostLocalStreamReader.Close();
|
||||
|
||||
if (Regex.Replace(hostLocalString, @"\r", string.Empty) == hostUpdateString)
|
||||
MessageBox.Show("太腻害了,你的伪造规则和存储库里的一模一样");
|
||||
else if (MessageBox.Show("你的伪造规则和存储库里的不太一样,需要与存储库同步吗", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"), hostUpdateString);
|
||||
MessageBox.Show("同步已完成");
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
|
||||
}
|
||||
|
||||
private void AboutButton_Click(object sender, RoutedEventArgs e) => new AboutWindow().ShowDialog();
|
||||
|
||||
private void MONITOR_TIMER_Tick(object? sender, EventArgs e)
|
||||
|
76
app.manifest
Normal file
76
app.manifest
Normal file
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC 清单选项
|
||||
如果想要更改 Windows 用户帐户控制级别,请使用
|
||||
以下节点之一替换 requestedExecutionLevel 节点。
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
|
||||
如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此
|
||||
元素。
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
|
||||
Windows 版本的列表。取消评论适当的元素,
|
||||
Windows 将自动选择最兼容的环境。 -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
|
||||
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
|
||||
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
|
||||
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
|
||||
|
||||
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
|
||||
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
</assembly>
|
Loading…
Reference in New Issue
Block a user