using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace subs_check.win.gui
{
    public partial class CheckUpdates : Form
    {
        // 添加一个属性用于存储和传递文本内容
        public string UrlContent { get; set; }
        public System.Windows.Forms.ComboBox.ObjectCollection githubProxys { get; set; }
        public string githubProxy { get; set; }
        string githubProxyURL;
        public string 当前subsCheck版本号 { get; set; }
        public string 当前GUI版本号 { get; set; }
        public string 最新GUI版本号 { get; set; }

        public CheckUpdates()
        {
            InitializeComponent();
        }

        private async void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            label3.Text = 最新GUI版本号;
            label4.Text = 当前GUI版本号;

            label5.Text = 当前subsCheck版本号;

            if (comboBox1.Text == "自动选择")
            {
                // 创建不包含"自动选择"的代理列表
                List<string> proxyItems = new List<string>();
                for (int j = 0; j < comboBox1.Items.Count; j++)
                {
                    string proxyItem = comboBox1.Items[j].ToString();
                    if (proxyItem != "自动选择")
                        proxyItems.Add(proxyItem);
                }

                // 随机打乱列表顺序
                Random random = new Random();
                proxyItems = proxyItems.OrderBy(x => random.Next()).ToList();

                // 异步检测可用代理
                githubProxyURL = await DetectGitHubProxyAsync(proxyItems);
            }
            else
            {
                githubProxyURL = $"https://{comboBox1.Text}/";
            }

            if (最新GUI版本号 != 当前GUI版本号)
            {
                // 检查当前目录下是否存在 Upgrade.exe
                string upgradeExePath = System.IO.Path.Combine(Application.StartupPath, "Upgrade.exe");
                if (System.IO.File.Exists(upgradeExePath))
                {
                    button1.Text = "立即更新";
                    button1.Enabled = true;
                }
                else
                {
                    button1.Text = "缺少更新程序";
                    button1.Enabled = false;
                }
            }
            else
            {
                button1.Text = "已是最新版本";
                button1.Enabled = false;
            }

            using (HttpClient client = new HttpClient())
            {
                try
                {
                    client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win32; x86) AppleWebKit/537.36 (KHTML, like Gecko) cmliu/SubsCheck-Win-GUI");
                    client.Timeout = TimeSpan.FromSeconds(30); // 增加超时时间以适应下载需求

                    string url = "https://api.github.com/repos/beck-8/subs-check/releases/latest";
                    string 备用url = "https://api.github.cmliussss.net/repos/beck-8/subs-check/releases/latest";

                    HttpResponseMessage response = null;
                    string responseBody = null;
                    JObject json = null;

                    // 先尝试主URL
                    try
                    {
                        response = await client.GetAsync(url);

                        // 如果主URL请求成功返回有效数据
                        if (response.IsSuccessStatusCode)
                        {
                            responseBody = await response.Content.ReadAsStringAsync();
                            json = JObject.Parse(responseBody);
                            Console.WriteLine("成功从主API获取版本信息");
                        }
                        // 如果主URL请求不成功但没有抛出异常
                        else
                        {
                            Console.WriteLine($"主API请求失败 HTTP {(int)response.StatusCode}，尝试备用API...");
                            response = await client.GetAsync(备用url);

                            if (response.IsSuccessStatusCode)
                            {
                                responseBody = await response.Content.ReadAsStringAsync();
                                json = JObject.Parse(responseBody);
                                Console.WriteLine("成功从备用API获取版本信息");
                            }
                            else
                            {
                                Console.WriteLine($"备用API也请求失败: HTTP {(int)response.StatusCode}", true);
                                return; // 两个URL都失败，提前退出
                            }
                        }
                    }
                    // 捕获网络请求异常（如连接超时、无法解析域名等）
                    catch (HttpRequestException ex)
                    {
                        Console.WriteLine($"主API请求出错: {ex.Message}，尝试备用API...");
                        try
                        {
                            response = await client.GetAsync(备用url);
                            if (response.IsSuccessStatusCode)
                            {
                                responseBody = await response.Content.ReadAsStringAsync();
                                json = JObject.Parse(responseBody);
                                Console.WriteLine("成功从备用API获取版本信息");
                            }
                            else
                            {
                                Console.WriteLine($"备用API也请求失败: HTTP {(int)response.StatusCode}", true);
                                return; // 备用URL也失败，提前退出
                            }
                        }
                        catch (Exception backupEx)
                        {
                            Console.WriteLine($"备用API请求也出错: {backupEx.Message}", true);
                            return; // 连备用URL也异常，提前退出
                        }
                    }
                    // 捕获JSON解析异常
                    catch (Newtonsoft.Json.JsonException ex)
                    {
                        Console.WriteLine($"解析JSON数据出错: {ex.Message}", true);
                        try
                        {
                            response = await client.GetAsync(备用url);
                            if (response.IsSuccessStatusCode)
                            {
                                responseBody = await response.Content.ReadAsStringAsync();
                                json = JObject.Parse(responseBody);
                                Console.WriteLine("成功从备用API获取版本信息");
                            }
                        }
                        catch (Exception backupEx)
                        {
                            Console.WriteLine($"备用API请求也出错: {backupEx.Message}", true);
                            return; // 连备用URL也有问题，提前退出
                        }
                    }
                    // 捕获其他所有异常
                    catch (Exception ex)
                    {
                        Console.WriteLine($"获取版本信息时出现未预期的错误: {ex.Message}", true);
                        try
                        {
                            response = await client.GetAsync(备用url);
                            if (response.IsSuccessStatusCode)
                            {
                                responseBody = await response.Content.ReadAsStringAsync();
                                json = JObject.Parse(responseBody);
                                Console.WriteLine("成功从备用URL获取版本信息");
                            }
                        }
                        catch (Exception backupEx)
                        {
                            //控制台打印错误
                            Console.WriteLine($"备用API请求也出错: {backupEx.Message}", true);
                            return; // 连备用URL也有问题，提前退出
                        }
                    }

                    // 如果成功获取了JSON数据，继续处理
                    if (json != null)
                    {
                        string latestVersion = json["tag_name"].ToString();
                        label6.Text = latestVersion;
                        if (当前subsCheck版本号 != latestVersion)
                        {
                            button2.Text = "立即更新";
                            button2.Enabled = true;
                        }
                        else
                        {
                            button2.Text = "已是最新版本";
                            button2.Enabled = false;
                        }
                    }

                }
                catch (Exception ex)
                {
                    MessageBox.Show($"下载 subs-check.exe 时出错: {ex.Message}\n\n请前往 https://github.com/beck-8/subs-check/releases 自行下载！",
                        "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }

        // 创建专用方法用于异步检测GitHub代理
        private async Task<string> DetectGitHubProxyAsync(List<string> proxyItems)
        {
            string detectedProxyURL = "";

            // 遍历随机排序后的代理列表
            foreach (string proxyItem in proxyItems)
            {
                string checkUrl = $"https://{proxyItem}/https://raw.githubusercontent.com/cmliu/SubsCheck-Win-GUI/master/packages.config";

                try
                {
                    using (HttpClient client = new HttpClient())
                    {
                        client.Timeout = TimeSpan.FromSeconds(5); // 设置5秒超时
                                                                  // 添加User-Agent头，避免被拒绝访问
                        client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win32; x86) AppleWebKit/537.36 (KHTML, like Gecko) cmliu/SubsCheck-Win-GUI");

                        // 使用异步方式
                        HttpResponseMessage response = await client.GetAsync(checkUrl);
                        if (response.IsSuccessStatusCode)
                        {
                            // 找到可用代理
                            detectedProxyURL = $"https://{proxyItem}/";
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    // 记录错误但继续尝试下一个
                    Console.WriteLine($"Error: {ex.Message}");
                }
            }
            return detectedProxyURL;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            // 设置对话框结果为OK，表示用户点击了"立即更新"按钮
            this.DialogResult = DialogResult.OK;

            // 关闭窗口
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //下载链接
            string downloadURL = $"{githubProxyURL}https://github.com/cmliu/SubsCheck-Win-GUI/releases/download/{最新GUI版本号}/SubsCheck_Win_GUI.zip";
            //目标文件
            string downloadEXE = "subs-check.win.gui.exe";

            try
            {
                // 获取应用程序目录
                string executablePath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
                // 创建 Upgrade.ini 文件路径
                string iniFilePath = System.IO.Path.Combine(executablePath, "Upgrade.ini");

                // 准备 INI 文件内容
                string iniContent =
                    "[Upgrade]\r\n" +
                    $"DownloadURL={downloadURL}\r\n" +
                    $"TargetFile={downloadEXE}\r\n";

                // 写入文件（如果文件已存在会被覆盖）
                System.IO.File.WriteAllText(iniFilePath, iniContent);

                DialogResult result = MessageBox.Show(
                    $"发现新版本: {最新GUI版本号}\n\n" +
                    "· 点击【确定】将下载并安装更新\n" +
                    "· 更新过程中程序会自动关闭并重启\n" +
                    "· 更新完成后所有设置将保持不变\n\n" +
                    "是否立即更新到最新版本？",
                    "发现新版本",
                    MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Information);

                if (result == DialogResult.OK)
                {
                    // 检查目标文件是否存在
                    string targetFilePath = System.IO.Path.Combine(Application.StartupPath, "Upgrade.exe");
                    if (System.IO.File.Exists(targetFilePath))
                    {
                        // 使用Process.Start异步启动应用程序
                        System.Diagnostics.Process.Start(targetFilePath);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("更新程序 Upgrade.exe 不存在！",
                            "错误",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"写入更新信息时出错: {ex.Message}",
                    "错误",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }
    }
}

protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            timer1.Enabled = true;
            if (githubProxys != null)
            {
                comboBox1.Items.Clear();
                foreach (var item in githubProxys)
                {
                    comboBox1.Items.Add(item);
                }
            }
            if (!string.IsNullOrEmpty(githubProxy)) comboBox1.Text = githubProxy;
        }

using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace subs_check.win.gui
{
    public partial class Form1: Form
    {
        //string 版本号;
        string 标题;
        private Process subsCheckProcess = null;
        string nodeInfo;//进度
        private Icon originalNotifyIcon; // 保存原始图标
        private ToolStripMenuItem startMenuItem;
        private ToolStripMenuItem stopMenuItem;
        string githubProxyURL = "";
        int run = 0;
        string 当前subsCheck版本号 = "未知版本";
        string 当前GUI版本号 = "未知版本";
        string 最新GUI版本号 = "未知版本";
        private string nextCheckTime = null;// 用于存储下次检查时间
        string WebUIapiKey = "CMLiussss";
        int downloading = 0;
        public Form1()
        {
            InitializeComponent();
            originalNotifyIcon = notifyIcon1.Icon;

            toolTip1.SetToolTip(numericUpDown1, "并发线程数：推荐 宽带峰值/50M。");
            toolTip1.SetToolTip(numericUpDown2, "检查间隔时间(分钟)：放置后台的时候，下次自动测速的间隔时间。\n\n 双击切换 使用「cron表达式」");
            toolTip1.SetToolTip(label2, "检查间隔时间(分钟)：放置后台的时候，下次自动测速的间隔时间。\n\n 双击切换 使用「cron表达式」");

            toolTip1.SetToolTip(numericUpDown3, "超时时间(毫秒)：节点的最大延迟。");
            toolTip1.SetToolTip(numericUpDown4, "最低测速结果舍弃(KB/s)。");
            toolTip1.SetToolTip(numericUpDown5, "下载测试时间(s)：与下载链接大小相关，默认最大测试10s。");
            toolTip1.SetToolTip(numericUpDown6, "本地监听端口：用于直接返回测速结果的节点信息，方便 Sub-Store 实现订阅转换。");
            toolTip1.SetToolTip(numericUpDown7, "Sub-Store监听端口：用于订阅订阅转换。\n注意：除非你知道你在干什么，否则不要将你的 Sub-Store 暴露到公网，否则可能会被滥用");
            toolTip1.SetToolTip(textBox1, "节点池订阅地址：支持 Link、Base64、Clash 格式的订阅链接。");
            toolTip1.SetToolTip(checkBox1, "以节点IP查询位置重命名节点。\n质量差的节点可能造成IP查询失败，造成整体检查速度稍微变慢。");
            toolTip1.SetToolTip(checkBox2, "是否开启流媒体检测，其中IP欺诈依赖'节点地址查询'，内核版本需要 v2.0.8 以上\n\n示例：美国1 | ⬇ 5.6MB/s |0%|Netflix|Disney|Openai\n风控值：0% (使用ping0.cc标准)\n流媒体解锁：Netflix、Disney、Openai");
            toolTip1.SetToolTip(comboBox3, "GitHub 代理：代理订阅 GitHub raw 节点池。");
            toolTip1.SetToolTip(comboBox2, "测速地址：注意 并发数*节点速度<最大网速 否则测速结果不准确\n尽量不要使用Speedtest，Cloudflare提供的下载链接，因为很多节点屏蔽测速网站。");
            toolTip1.SetToolTip(textBox7, "将测速结果推送到Worker的地址。");
            toolTip1.SetToolTip(textBox6, "Worker令牌。");
            toolTip1.SetToolTip(comboBox1, "测速结果的保存方法。");
            toolTip1.SetToolTip(textBox2, "Gist ID：注意！非Github用户名！");
            toolTip1.SetToolTip(textBox3, "Github TOKEN");

            toolTip1.SetToolTip(comboBox4, "通用订阅：内置了Sub-Store程序，自适应订阅格式。\nClash订阅：带规则的 Mihomo、Clash 订阅格式。");
            toolTip1.SetToolTip(comboBox5, "生成带规则的 Clash 订阅所需的覆写规则文件");

            toolTip1.SetToolTip(checkBox3, "保存几个成功的节点，不选代表不限制，内核版本需要 v2.1.0 以上\n如果你的并发数量超过这个参数，那么成功的结果可能会大于这个数值");
            toolTip1.SetToolTip(numericUpDown8, "保存几个成功的节点，不选代表不限制，内核版本需要 v2.1.0 以上\n如果你的并发数量超过这个参数，那么成功的结果可能会大于这个数值");

            toolTip1.SetToolTip(textBox11, "支持标准cron表达式，如：\n 0 */2 * * * 表示每2小时的整点执行\n 0 0 */2 * * 表示每2天的0点执行\n 0 0 1 * * 表示每月1日0点执行\n */30 * * * * 表示每30分钟执行一次\n\n 双击切换 使用「分钟倒计时」");

            toolTip1.SetToolTip(checkBox5, "开机启动：勾选后，程序将在Windows启动时自动运行");
            // 设置通知图标的上下文菜单
            SetupNotifyIconContextMenu();
        }

        private void SetupNotifyIconContextMenu()
        {
            // 创建上下文菜单
            ContextMenuStrip contextMenu = new ContextMenuStrip();

            // 创建"▶ 启动"菜单项
            startMenuItem = new ToolStripMenuItem("启动");
            startMenuItem.Click += (sender, e) =>
            {
                if (button1.Text == "▶ 启动")
                {
                    button1_Click(sender, e);
                }
            };

            // 创建"⏹ 停止"菜单项
            stopMenuItem = new ToolStripMenuItem("停止");
            stopMenuItem.Click += (sender, e) =>
            {
                if (button1.Text == "⏹ 停止")
                {
                    button1_Click(sender, e);
                }
            };
            stopMenuItem.Enabled = false; // 初始状态下禁用

            // 创建"退出"菜单项
            ToolStripMenuItem exitMenuItem = new ToolStripMenuItem("退出");
            exitMenuItem.Click += async (sender, e) =>
            {
                try
                {
                    // 如果程序正在运行，先停止它
                    if (subsCheckProcess != null && !subsCheckProcess.HasExited)
                    {
                        await KillNodeProcessAsync();
                        StopSubsCheckProcess();
                    }

                    // 确保通知图标被移除
                    notifyIcon1.Visible = false;

                    // 使用更直接的退出方式
                    Environment.Exit(0);
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"退出程序时发生错误: {ex.Message}", "错误",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);

                    // 如果仍然失败，尝试强制退出
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                }
            };

            // 将菜单项添加到上下文菜单
            contextMenu.Items.Add(startMenuItem);
            contextMenu.Items.Add(stopMenuItem);
            contextMenu.Items.Add(new ToolStripSeparator()); // 分隔线
            contextMenu.Items.Add(exitMenuItem);

            // 将上下文菜单分配给通知图标
            notifyIcon1.ContextMenuStrip = contextMenu;

            // 确保通知图标可见
            notifyIcon1.Visible = true;
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                // 取消关闭操作
                e.Cancel = true;
                // 调用隐藏窗口方法
                隐藏窗口();
            }
        }

        private async void timer1_Tick(object sender, EventArgs e)//初始化
        {
            timer1.Enabled = false;
            if (button2.Text == "高级设置∧") button2_Click(sender, e);
            // 检查并创建config文件夹
            string executablePath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
            string configFolderPath = System.IO.Path.Combine(executablePath, "config");
            if (!System.IO.Directory.Exists(configFolderPath))
            {
                // 文件不存在，可以给用户反馈
                string 免责声明 = "SubsCheck-Win-GUI 项目仅供教育、研究和安全测试目的而设计和开发。本项目旨在为安全研究人员、学术界人士及技术爱好者提供一个探索和实践网络通信技术的工具。\r\n在下载和使用本项目代码时，使用者必须严格遵守其所适用的法律和规定。使用者有责任确保其行为符合所在地区的法律框架、规章制度及其他相关规定。\r\n\r\n使用条款\r\n\r\n教育与研究用途：本软件仅可用于网络技术和编程领域的学习、研究和安全测试。\r\n禁止非法使用：严禁将 SubsCheck-Win-GUI 用于任何非法活动或违反使用者所在地区法律法规的行为。\r\n使用时限：基于学习和研究目的，建议用户在完成研究或学习后，或在安装后的24小时内，删除本软件及所有相关文件。\r\n免责声明：SubsCheck-Win-GUI 的创建者和贡献者不对因使用或滥用本软件而导致的任何损害或法律问题负责。\r\n用户责任：用户对使用本软件的方式以及由此产生的任何后果完全负责。\r\n无技术支持：本软件的创建者不提供任何技术支持或使用协助。\r\n知情同意：使用 SubsCheck-Win-GUI 即表示您已阅读并理解本免责声明，并同意受其条款的约束。\r\n\r\n请记住：本软件的主要目的是促进学习、研究和安全测试。创作者不支持或认可任何其他用途。使用者应当在合法和负责任的前提下使用本工具。\r\n\r\n同意以上条款请点击\"是 / Yes\"，否则程序将退出。";

                // 显示带有 "同意" 和 "拒绝" 选项的对话框
                DialogResult result = MessageBox.Show(免责声明, "SubsCheck-Win-GUI 免责声明", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                // 如果用户点击 "拒绝" (对应于 No 按钮)
                if (result == DialogResult.No)
                {
                    // 退出程序
                    Environment.Exit(0); // 立即退出程序
                }
                System.IO.Directory.CreateDirectory(configFolderPath);
            }

            FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
            当前GUI版本号 = "v" + myFileVersionInfo.FileVersion;
            最新GUI版本号 = 当前GUI版本号;
            标题 = "SubsCheck Win GUI " + 当前GUI版本号;
            this.Text = 标题;// + " TG:CMLiussss BY:CM喂饭 干货满满";
            comboBox1.Text = "本地";
            comboBox4.Text = "通用订阅";
            ReadConfig();

            if (CheckCommandLineParameter("-auto"))
            {
                Log("检测到开机启动，准备执行任务...");
                button1_Click(this, EventArgs.Empty);
                this.Hide();
                notifyIcon1.Visible = true;
            } else await CheckGitHubVersionAsync();
        }

        private async Task CheckGitHubVersionAsync()
        {
            try
            {
                // 首先检查是否有网络连接
                if (!IsNetworkAvailable())
                {
                    return; // 静默返回，不显示错误
                }

                var result = await 获取版本号("https://api.github.com/repos/cmliu/SubsCheck-Win-GUI/releases/latest");
                if (result.Item1 != "未知版本")
                {
                    string latestVersion = result.Item1;
                    if (latestVersion != 当前GUI版本号)
                    {
                        最新GUI版本号 = latestVersion;
                        标题 = "SubsCheck Win GUI " + 当前GUI版本号 + $"  发现新版本: {最新GUI版本号} 请及时更新！";
                        this.Text = 标题;
                    }
                }
            }
            catch
            {
                // 静默处理任何其他异常
                return;
            }
        }

        // 添加检查网络连接的辅助方法
        private bool IsNetworkAvailable()
        {
            try
            {
                return NetworkInterface.GetIsNetworkAvailable();
            }
            catch
            {
                return false; // 如果无法检查网络状态，假设网络不可用
            }
        }

        private async void ReadConfig()//读取配置文件
        {
            checkBox5.CheckedChanged -= checkBox5_CheckedChanged;// 临时移除事件处理器，防止触发事件
            try
            {
                string executablePath = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
                string configFilePath = Path.Combine(executablePath, "config", "config.yaml");

                if (File.Exists(configFilePath))
                {
                    // 读取YAML文件内容
                    string yamlContent = File.ReadAllText(configFilePath);

                    // 使用YamlDotNet解析YAML
                    var deserializer = new YamlDotNet.Serialization.Deserializer();
                    var config = deserializer.Deserialize<Dictionary<string, object>>(yamlContent);

                    // 使用新函数获取整数值并设置UI控件
                    int? concurrentValue = 读取config整数(config, "concurrent");
                    if (concurrentValue.HasValue) numericUpDown1.Value = concurrentValue.Value;

                    int? checkIntervalValue = 读取config整数(config, "check-interval");
                    if (checkIntervalValue.HasValue) numericUpDown2.Value = checkIntervalValue.Value;

                    int? timeoutValue = 读取config整数(config, "timeout");
                    if (timeoutValue.HasValue) numericUpDown3.Value = timeoutValue.Value;

                    int? minspeedValue = 读取config整数(config, "min-speed");
                    if (minspeedValue.HasValue) numericUpDown4.Value = minspeedValue.Value;

                    int? downloadtimeoutValue = 读取config整数(config, "download-timeout");
                    if (downloadtimeoutValue.HasValue) numericUpDown5.Value = downloadtimeoutValue.Value;

                    string speedTestUrl = 读取config字符串(config, "speed-test-url");
                    if (speedTestUrl != null) comboBox2.Text = speedTestUrl;

                    string savemethod = 读取config字符串(config, "save-method");
                    if (savemethod != null)
                    {
                        if (savemethod == "local") comboBox1.Text = "本地";
                        else comboBox1.Text = savemethod;
                    }

                    string listenport = 读取config字符串(config, "listen-port");
                    if (listenport != null)
                    {
                        // 查找最后一个冒号的位置
                        int colonIndex = listenport.LastIndexOf(':');
                        if (colonIndex >= 0 && colonIndex < listenport.Length - 1)
                        {
                            // 提取冒号后面的部分作为端口号
                            string portStr = listenport.Substring(colonIndex + 1);
                            if (decimal.TryParse(portStr, out decimal port))
                            {
                                numericUpDown6.Value = port;
                            }
                        }
                    }

                    /*
                    int? substoreport = 读取config整数(config, "sub-store-port");
                    if (substoreport.HasValue) numericUpDown7.Value = substoreport.Value;
                    */

                    string substoreport = 读取config字符串(config, "sub-store-port");
                    if (substoreport != null)
                    {
                        // 查找最后一个冒号的位置
                        int colonIndex = substoreport.LastIndexOf(':');
                        if (colonIndex >= 0 && colonIndex < substoreport.Length - 1)
                        {
                            // 提取冒号后面的部分作为端口号
                            string portStr = substoreport.Substring(colonIndex + 1);
                            if (decimal.TryParse(portStr, out decimal port))
                            {
                                numericUpDown7.Value = port;
                            }
                        }
                    }

                    string githubproxy = 读取config字符串(config, "githubproxy");
                    if (githubproxy != null) comboBox3.Text = githubproxy;

                    const string githubRawPrefix = "https://raw.githubusercontent.com/";

                    string mihomoOverwriteUrl = 读取config字符串(config, "mihomo-overwrite-url");
                    int mihomoOverwriteUrlIndex = mihomoOverwriteUrl.IndexOf(githubRawPrefix);
                    if (mihomoOverwriteUrl != null)
                    {
                        if (mihomoOverwriteUrl.Contains("http://127.0.0"))
                        {
                            if (mihomoOverwriteUrl.EndsWith("bdg.yaml", StringComparison.OrdinalIgnoreCase))
                            {
                                comboBox5.Text = "[内置]布丁狗的订阅转换";
                                await ProcessComboBox5Selection();
                            }
                            else if (mihomoOverwriteUrl.EndsWith("ACL4SSR_Online_Full.yaml", StringComparison.OrdinalIgnoreCase))
                            {
                                comboBox5.Text = "[内置]ACL4SSR_Online_Full";
                                await ProcessComboBox5Selection();
                            }
                        }
                        else if (mihomoOverwriteUrlIndex > 0) comboBox5.Text = mihomoOverwriteUrl.Substring(mihomoOverwriteUrlIndex);
                        else comboBox5.Text = mihomoOverwriteUrl;
                    }

                    // 处理URLs，检查是否包含GitHub raw链接
                    List<string> subUrls = 读取config列表(config, "sub-urls");
                    if (subUrls != null && subUrls.Count > 0)
                    {
                        // 创建一个新的过滤后的列表
                        var filteredUrls = new List<string>();

                        for (int i = 0; i < subUrls.Count; i++)
                        {
                            // 排除本地URL
                            string localUrlPattern = $"http://127.0.0.1:{numericUpDown6.Value}/all.yaml";
                            if (!subUrls[i].Equals(localUrlPattern, StringComparison.OrdinalIgnoreCase))
                            {
                                // 处理GitHub raw链接
                                int index = subUrls[i].IndexOf(githubRawPrefix);
                                if (index > 0) // 如果找到且不在字符串开头
                                {
                                    // 只保留从githubRawPrefix开始的部分
                                    filteredUrls.Add(subUrls[i].Substring(index));
                                }
                                else
                                {
                                    // 如果不是GitHub链接，直接添加
                                    filteredUrls.Add(subUrls[i]);
                                }
                            }
                        }

                        // 将过滤后的列表中的每个URL放在单独的行上
                        textBox1.Text = string.Join(Environment.NewLine, filteredUrls);
                    }

                    string renamenode = 读取config字符串(config, "rename-node");
                    if (renamenode != null && renamenode == "true") checkBox1.Checked = true;
                    else checkBox1.Checked = false;

                    string mediacheck = 读取config字符串(config, "media-check");
                    if (mediacheck != null && mediacheck == "true") checkBox2.Checked = true;
                    else checkBox2.Checked = false;

                    string githubgistid = 读取config字符串(config, "github-gist-id");
                    if (githubgistid != null) textBox2.Text = githubgistid;
                    string githubtoken = 读取config字符串(config, "github-token");
                    if (githubtoken != null) textBox3.Text = githubtoken;

                    string githubapimirror = 读取config字符串(config, "github-api-mirror");
                    if (githubapimirror != null) textBox4.Text = githubapimirror;

                    string workerurl = 读取config字符串(config, "worker-url");
                    if (workerurl != null) textBox7.Text = workerurl;
                    string workertoken = 读取config字符串(config, "worker-token");
                    if (workertoken != null) textBox6.Text = workertoken;

                    string webdavusername = 读取config字符串(config, "webdav-username");
                    if (webdavusername != null) textBox9.Text = webdavusername;
                    string webdavpassword = 读取config字符串(config, "webdav-password");
                    if (webdavpassword != null) textBox8.Text = webdavpassword;
                    string webdavurl = 读取config字符串(config, "webdav-url");
                    if (webdavurl != null) textBox5.Text = webdavurl;

                    string subscheckversion = 读取config字符串(config, "subscheck-version");
                    if (subscheckversion != null) 当前subsCheck版本号 = subscheckversion;

                    int? successlimit = 读取config整数(config, "success-limit");
                    if (successlimit.HasValue)
                    {
                        if (successlimit.Value == 0)
                        {
                            checkBox3.Checked = false;
                            numericUpDown8.Enabled = false;
                        }
                        else
                        {
                            checkBox3.Checked = true;
                            numericUpDown8.Enabled = true;
                            numericUpDown8.Value = successlimit.Value;
                        }
                    }

                    string enablewebui = 读取config字符串(config, "enable-web-ui");
                    if (enablewebui != null && enablewebui == "true") checkBox4.Checked = true;
                    else checkBox4.Checked = false;

                    string apikey = 读取config字符串(config, "api-key");
                    if (apikey != null)
                    {
                        if (apikey == GetComputerNameMD5())
                        {
                            checkBox4.Checked = false;
                            string oldapikey = 读取config字符串(config, "old-api-key");
                            if (oldapikey != null)
                            {
                                textBox10.Text = oldapikey;
                            }
                            else
                            {
                                textBox10.PasswordChar = '\0';
                                textBox10.Text = "请输入密钥";
                                textBox10.ForeColor = Color.Gray;
                            }
                        }
                        else
                        {
                            textBox10.Text = apikey;
                        }
                    }

                    string cronexpression = 读取config字符串(config, "cron-expression");
                    if (cronexpression != null)
                    {
                        textBox11.Text = cronexpression;
                        string cronDescription = GetCronExpressionDescription(textBox11.Text);
                        textBox11.Location = new Point(9, 48);
                        textBox11.Visible = true;
                        label2.Visible = false;
                        numericUpDown2.Visible = false;
                    }

                    string guiauto = 读取config字符串(config, "gui-auto");
                    if (guiauto != null && guiauto == "true") checkBox5.Checked = true;
                    else checkBox5.Checked = false;
                }
                else
                {
                    comboBox3.Text = "自动选择";
                    comboBox5.Text = "[内置]布丁狗的订阅转换";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"读取配置文件时发生错误: {ex.Message}", "错误",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            checkBox5.CheckedChanged += checkBox5_CheckedChanged;// 重新绑定事件处理器
        }

        private int? 读取config整数(Dictionary<string, object> config, string fieldName)
        {
            // 检查是否存在指定字段且不为null
            if (config.ContainsKey(fieldName) && config[fieldName] != null)
            {
                int value;
                if (int.TryParse(config[fieldName].ToString(), out value))
                    return value;
            }
            return null;
        }

        private string 读取config字符串(Dictionary<string, object> config, string fieldName)
        {
            // 检查是否存在指定字段且不为null
            if (config.ContainsKey(fieldName) && config[fieldName] != null)
            {
                return config[fieldName].ToString();
            }
            return null;
        }

        private List<string> 读取config列表(Dictionary<string, object> config, string fieldName)
        {
            // 检查是否存在指定字段且不为null
            if (config.ContainsKey(fieldName) && config[fieldName] != null)
            {
                // 尝试将对象转换为列表
                if (config[fieldName] is List<object> listItems)
                {
                    return listItems.Select(item => item?.ToString()).Where(s => !string.IsNullOrEmpty(s)).ToList();
                }
            }
            return null;
        }

        private async Task SaveConfig(bool githubProxyCheck = true)//保存配置文件
        {
            try
            {
                string executablePath = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
                string configFilePath = Path.Combine(executablePath, "config", "config.yaml");

                // 创建配置字典
                var config = new Dictionary<string, object>();

                // 从UI控件获取值并添加到字典中
                config["concurrent"] = (int)numericUpDown1.Value;
                config["check-interval"] = (int)numericUpDown2.Value;
                if (textBox11.Visible) config["cron-expression"] = textBox11.Text;
                config["timeout"] = (int)numericUpDown3.Value;
                config["min-speed"] = (int)numericUpDown4.Value;
                config["download-timeout"] = (int)numericUpDown5.Value;

                if (!string.IsNullOrEmpty(comboBox2.Text)) config["speed-test-url"] = comboBox2.Text;

                // 保存save-method，将"本地"转换为"local"
                config["save-method"] = comboBox1.Text == "本地" ? "local" : comboBox1.Text;

                // 保存gist参数
                config["github-gist-id"] = textBox2.Text;
                config["github-token"] = textBox3.Text;

                config["github-api-mirror"] = textBox4.Text;

                // 保存r2参数
                config["worker-url"] = textBox7.Text;
                config["worker-token"] = textBox6.Text;

                // 保存webdav参数
                config["webdav-username"] = textBox9.Text;
                config["webdav-password"] = textBox8.Text;
                config["webdav-url"] = textBox5.Text;

                // 保存enable-web-ui
                config["enable-web-ui"] = true;

                // 保存listen-port
                if (checkBox4.Checked)
                {
                    WebUIapiKey = textBox10.Text;
                    config["listen-port"] = $@":{numericUpDown6.Value}";
                }
                else
                {
                    WebUIapiKey = GetComputerNameMD5();
                    config["listen-port"] = $@"127.0.0.1:{numericUpDown6.Value}";
                    if (textBox10.Text != "请输入密钥") config["old-api-key"] = textBox10.Text;
                }
                config["api-key"] = WebUIapiKey;

                // 保存sub-store-port
                config["sub-store-port"] = $@":{numericUpDown7.Value}";

                string githubRawPrefix = "https://raw.githubusercontent.com/";
                if (githubProxyCheck)
                {
                    // 检查并处理 GitHub Raw URLs
                    if (comboBox3.Text == "自动选择")
                    {
                        // 创建不包含"自动选择"的代理列表
                        List<string> proxyItems = new List<string>();
                        for (int j = 0; j < comboBox3.Items.Count; j++)
                        {
                            string proxyItem = comboBox3.Items[j].ToString();
                            if (proxyItem != "自动选择")
                                proxyItems.Add(proxyItem);
                        }

                        // 随机打乱列表顺序
                        Random random = new Random();
                        proxyItems = proxyItems.OrderBy(x => random.Next()).ToList();

                        // 异步检测可用代理
                        githubProxyURL = await DetectGitHubProxyAsync(proxyItems);
                    }
                }

                if (comboBox3.Text != "自动选择") githubProxyURL = $"https://{comboBox3.Text}/";
                config["githubproxy"] = comboBox3.Text;
                config["github-proxy"] = githubProxyURL;

                // 保存sub-urls列表
                List<string> subUrls = new List<string>();
                string allyamlFilePath = System.IO.Path.Combine(executablePath, "output", "all.yaml");
                if (System.IO.File.Exists(allyamlFilePath))
                {
                    subUrls.Add($"http://127.0.0.1:{numericUpDown6.Value}/all.yaml");
                    Log("已加载上次测试结果。");
                }

                if (!string.IsNullOrEmpty(textBox1.Text))
                {
                    subUrls.AddRange(textBox1.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList());
                    // 处理URLs
                    for (int i = 0; i < subUrls.Count; i++)
                    {
                        if (subUrls[i].StartsWith(githubRawPrefix) && !string.IsNullOrEmpty(githubProxyURL))
                        {
                            // 替换为代理 URL 格式
                            //subUrls[i] = githubProxyURL + githubRawPrefix + subUrls[i].Substring(githubRawPrefix.Length);
                            // 使用subs-check内置github-proxy参数
                            subUrls[i] = githubRawPrefix + subUrls[i].Substring(githubRawPrefix.Length);
                        }
                    }
                }

                config["sub-urls"] = subUrls;

                // 处理配置文件下载与配置
                if (comboBox5.Text.Contains("[内置]"))
                {
                    // 确定文件名和下载URL
                    string fileName;
                    string downloadFilePath;
                    string downloadUrl;
                    string displayName;

                    if (comboBox5.Text.Contains("[内置]布丁狗"))
                    {
                        fileName = "bdg.yaml";
                        displayName = "[内置]布丁狗的订阅转换";
                        downloadUrl = "https://raw.githubusercontent.com/cmliu/ACL4SSR/main/yaml/bdg.yaml";
                    }
                    else // [内置]ACL4SSR
                    {
                        fileName = "ACL4SSR_Online_Full.yaml";
                        displayName = "[内置]ACL4SSR_Online_Full";
                        downloadUrl = "https://raw.githubusercontent.com/beck-8/override-hub/main/yaml/ACL4SSR_Online_Full.yaml";
                    }

                    // 确保output文件夹存在
                    string outputFolderPath = Path.Combine(executablePath, "output");
                    if (!Directory.Exists(outputFolderPath))
                    {
                        Directory.CreateDirectory(outputFolderPath);
                    }

                    // 确定文件完整路径
                    downloadFilePath = Path.Combine(outputFolderPath, fileName);
                    if (!File.Exists(downloadFilePath)) await ProcessComboBox5Selection();

                    // 检查文件是否存在
                    if (!File.Exists(downloadFilePath))
                    {
                        Log($"{displayName} 覆写配置文件 未找到，将使用在线版本。");
                        config["mihomo-overwrite-url"] = githubProxyURL + downloadUrl;
                    }
                    else
                    {
                        Log($"{displayName} 覆写配置文件 加载成功。");
                        config["mihomo-overwrite-url"] = $"http://127.0.0.1:{numericUpDown6.Value}/{fileName}";
                    }
                }
                else if (comboBox5.Text.StartsWith(githubRawPrefix)) config["mihomo-overwrite-url"] = githubProxyURL + comboBox5.Text;
                else config["mihomo-overwrite-url"] = comboBox5.Text != "" ? comboBox5.Text : $"http://127.0.0.1:{numericUpDown6.Value}/ACL4SSR_Online_Full.yaml";

                config["rename-node"] = checkBox1.Checked;//以节点IP查询位置重命名节点
                config["media-check"] = checkBox2.Checked;//是否开启流媒体检测
                config["keep-success-proxies"] = false;
                config["print-progress"] = false;//是否显示进度
                config["sub-urls-retry"] = 3;//重试次数(获取订阅失败后重试次数)
                config["subscheck-version"] = 当前subsCheck版本号;//当前subsCheck版本号

                config["gui-auto"] = checkBox5.Checked;//是否开机自启

                //保存几个成功的节点，为0代表不限制
                if (checkBox3.Checked) config["success-limit"] = (int)numericUpDown8.Value;
                else config["success-limit"] = 0;

                // 使用YamlDotNet序列化配置
                var serializer = new YamlDotNet.Serialization.SerializerBuilder()
                    .WithIndentedSequences()  // 使序列化结果更易读
                    .Build();

                string yamlContent = serializer.Serialize(config);

                // 确保配置目录存在
                string configDirPath = Path.GetDirectoryName(configFilePath);
                if (!Directory.Exists(configDirPath))
                    Directory.CreateDirectory(configDirPath);

                string moreYamlPath = Path.Combine(configDirPath, "more.yaml");
                if (File.Exists(moreYamlPath))
                {
                    // 读取more.yaml的内容
                    string moreYamlContent = File.ReadAllText(moreYamlPath);

                    // 确保more.yaml内容以换行开始
                    if (!moreYamlContent.StartsWith("\n") && !moreYamlContent.StartsWith("\r\n"))
                    {
                        yamlContent += "\n"; // 添加换行符作为分隔
                    }

                    // 将more.yaml的内容追加到要写入的config.yaml内容后
                    yamlContent += moreYamlContent;

                    Log($"已将补充参数配置 more.yaml 内容追加到配置文件");
                }
                // 写入YAML文件
                File.WriteAllText(configFilePath, yamlContent);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"保存配置文件时发生错误: {ex.Message}", "错误",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (button2.Text == "高级设置∧")
            {
                button2.Text = "高级设置∨";
                groupBox3.Visible = false;
            }
            else
            {
                button2.Text = "高级设置∧";
                groupBox3.Visible = true;
            }
            判断保存类型();
        }

        private async void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
            if (button1.Text == "▶ 启动")
            {
                if (checkBox4.Checked && textBox10.Text == "请输入密钥")
                {
                    MessageBox.Show("您已启用WebUI，请设置WebUI API密钥！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                run = 1;
                if (button3.Enabled==false)
                {
                    string executablePath = Path.GetDirectoryName(Application.ExecutablePath);
                    string allyamlFilePath = Path.Combine(executablePath, "output", "all.yaml");
                    button3.Enabled = File.Exists(allyamlFilePath);
                }

                numericUpDown1.Enabled = false;
                numericUpDown2.Enabled = false;
                textBox11.Enabled = false;
                numericUpDown3.Enabled = false;
                numericUpDown4.Enabled = false;
                numericUpDown5.Enabled = false;
                numericUpDown6.Enabled = false;
                numericUpDown7.Enabled = false;
                comboBox1.Enabled = false;
                textBox1.Enabled = false;
                groupBox3.Enabled = false;
                groupBox4.Enabled = false;
                groupBox5.Enabled = false;
                groupBox6.Enabled = false;
                if (checkBox4.Checked) button6.Enabled = true;
                button1.Text = "⏹ 停止";
                //timer3.Enabled = true;
                // 清空 richTextBox1
                richTextBox1.Clear();
                await KillNodeProcessAsync();
                await SaveConfig();

                if (run == 1)
                {
                    // 更新菜单项的启用状态
                    startMenuItem.Enabled = false;
                    stopMenuItem.Enabled = true;

                    // 清空 richTextBox1
                    //richTextBox1.Clear();

                    notifyIcon1.Text = "SubsCheck: 已就绪";

                    // 启动 subs-check.exe 程序
                    StartSubsCheckProcess();
                }
            }
            else
            {
                run = 0;
                Log("任务停止");
                progressBar1.Value = 0;
                groupBox2.Text = "实时日志";
                notifyIcon1.Text = "SubsCheck: 未运行";
                // 停止 subs-check.exe 程序
                StopSubsCheckProcess();
                // 结束 Sub-Store
                await KillNodeProcessAsync();
                if (checkBox4.Checked) ReadConfig();
                button3.Enabled = false;
                numericUpDown1.Enabled = true;
                numericUpDown2.Enabled = true;
                textBox11.Enabled = true;
                numericUpDown3.Enabled = true;
                numericUpDown4.Enabled = true;
                numericUpDown5.Enabled = true;
                numericUpDown6.Enabled = true;
                numericUpDown7.Enabled = true;
                comboBox1.Enabled = true;
                textBox1.Enabled = true;
                groupBox3.Enabled = true;
                groupBox4.Enabled = true;
                groupBox5.Enabled = true;
                groupBox6.Enabled = true;
                button6.Enabled = false;
                button1.Text = "▶ 启动";
                //timer3.Enabled = false;
                // 更新菜单项的启用状态
                startMenuItem.Enabled = true;
                stopMenuItem.Enabled = false;
            }
            if (downloading == 0) button1.Enabled = true;
        }

        private async Task DownloadSubsCheckEXE()
        {
            button1.Enabled = false;
            downloading = 1;
            try
            {
                Log("正在检查网络连接...");

                // 首先检查是否有网络连接
                if (!IsNetworkAvailable())
                {
                    Log("网络连接不可用，无法下载核心文件。", true);
                    MessageBox.Show("缺少 subs-check.exe 核心文件。\n\n您可以前往 https://github.com/beck-8/subs-check/releases 自行下载！",
                        "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                var result = await 获取版本号("https://api.github.com/repos/beck-8/subs-check/releases/latest", true);
                if (result.Item1 != "未知版本")
                {
                    // 创建不使用系统代理的 HttpClientHandler
                    HttpClientHandler handler = new HttpClientHandler
                    {
                        UseProxy = false,
                        Proxy = null
                    };

                    // 使用自定义 handler 创建 HttpClient
                    using (HttpClient client = new HttpClient(handler))
                    {
                        try
                        {
                            string latestVersion = result.Item1;
                            JArray assets = result.Item2;
                            Log($"subs-check.exe 最新版本为: {latestVersion} ");
                            // 查找Windows i386版本的资源
                            string downloadUrl = null;

                            foreach (var asset in assets)
                            {
                                if (asset["name"].ToString() == "subs-check_Windows_i386.zip")
                                {
                                    downloadUrl = asset["browser_download_url"].ToString();
                                    break;
                                }
                            }

                            if (downloadUrl != null)
                            {
                                string 代理下载链接 = githubProxyURL + downloadUrl;
                                string 原生下载链接 = 代理下载链接;
                                // 计算"https://"在下载链接中出现的次数
                                int httpsCount = 0;
                                int lastIndex = -1;
                                int currentIndex = 0;

                                // 查找所有"https://"出现的位置
                                while ((currentIndex = 代理下载链接.IndexOf("https://", currentIndex)) != -1)
                                {
                                    httpsCount++;
                                    lastIndex = currentIndex;
                                    currentIndex += 8; // "https://".Length = 8
                                }

                                // 如果"https://"出现2次或以上，提取最后一个"https://"之后的内容
                                if (httpsCount >= 2 && lastIndex != -1)
                                {
                                    原生下载链接 = 代理下载链接.Substring(lastIndex);
                                }

                                string executablePath = Path.GetDirectoryName(Application.ExecutablePath);

                                // 创建下载请求 - 优化的多级尝试下载逻辑
                                Log("开始下载文件...");
                                bool downloadSuccess = false;
                                string zipFilePath = Path.Combine(executablePath, "subs-check_Windows_i386.zip");
                                string failureReason = "";

                                // 如果文件已存在，先删除
                                if (File.Exists(zipFilePath)) File.Delete(zipFilePath);

                                // 第一次尝试：使用代理下载链接 + 当前HttpClient(不使用系统代理)
                                try
                                {
                                    Log($"[尝试1/4] 使用代理下载链接：{代理下载链接}");
                                    downloadSuccess = await DownloadFileAsync(client, 代理下载链接, zipFilePath);
                                }
                                catch (Exception ex)
                                {
                                    Log($"[尝试1/4] 失败: {ex.Message}", true);
                                    failureReason = ex.Message;
                                }

                                // 如果第一次尝试失败，且代理链接与原生链接不同，使用原生下载链接尝试
                                if (!downloadSuccess && 代理下载链接 != 原生下载链接)
                                {
                                    try
                                    {
                                        Log($"[尝试2/4] 使用原生下载链接：{原生下载链接}");
                                        downloadSuccess = await DownloadFileAsync(client, 原生下载链接, zipFilePath);
                                    }
                                    catch (Exception ex)
                                    {
                                        Log($"[尝试2/4] 失败: {ex.Message}", true);
                                        failureReason = ex.Message;
                                    }
                                }

                                // 如果前面的尝试都失败，创建使用系统代理的HttpClient再次尝试
                                if (!downloadSuccess)
                                {
                                    try
                                    {
                                        Log("[尝试3/4] 使用系统代理 + 代理下载链接");
                                        using (HttpClient proxyClient = new HttpClient())
                                        {
                                            proxyClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win32; x86) AppleWebKit/537.36 (KHTML, like Gecko) cmliu/SubsCheck-Win-GUI");
                                            proxyClient.Timeout = TimeSpan.FromSeconds(30);

                                            downloadSuccess = await DownloadFileAsync(proxyClient, 代理下载链接, zipFilePath);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Log($"[尝试3/4] 失败: {ex.Message}", true);
                                        failureReason = ex.Message;
                                    }

                                    // 最后一次尝试：使用系统代理 + 原生链接（如果不同）
                                    if (!downloadSuccess && 代理下载链接 != 原生下载链接)
                                    {
                                        try
                                        {
                                            Log("[尝试4/4] 使用系统代理 + 原生下载链接");
                                            using (HttpClient proxyClient = new HttpClient())
                                            {
                                                proxyClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win32; x86) AppleWebKit/537.36 (KHTML, like Gecko) cmliu/SubsCheck-Win-GUI");
                                                proxyClient.Timeout = TimeSpan.FromSeconds(30);

                                                downloadSuccess = await DownloadFileAsync(proxyClient, 原生下载链接, zipFilePath);
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            Log($"[尝试4/4] 失败: {ex.Message}", true);
                                            failureReason = ex.Message;
                                        }
                                    }
                                }

                                if (downloadSuccess)
                                {
                                    Log("下载完成，正在解压文件...");

                                    // 解压文件的代码保持不变
                                    using (System.IO.Compression.ZipArchive archive = System.IO.Compression.ZipFile.OpenRead(zipFilePath))
                                    {
                                        // 查找subs-check.exe
                                        System.IO.Compression.ZipArchiveEntry exeEntry = archive.Entries.FirstOrDefault(
                                            entry => entry.Name.Equals("subs-check.exe", StringComparison.OrdinalIgnoreCase));

                                        if (exeEntry != null)
                                        {
                                            string exeFilePath = Path.Combine(executablePath, "subs-check.exe");

                                            // 如果文件已存在，先删除
                                            if (File.Exists(exeFilePath))
                                            {
                                                File.Delete(exeFilePath);
                                            }

                                            // 解压文件
                                            exeEntry.ExtractToFile(exeFilePath);
                                            当前subsCheck版本号 = latestVersion;
                                            Log($"subs-check.exe {当前subsCheck版本号} 已就绪！");

                                            await SaveConfig(false);

                                            // 删除下载的zip文件
                                            //File.Delete(zipFilePath);
                                        }
                                        else
                                        {
                                            Log("无法在压缩包中找到 subs-check.exe 文件。", true);
                                        }
                                    }
                                }
                                else
                                {
                                    // 所有尝试都失败
                                    Log($"所有下载尝试均失败，最后错误: {failureReason}", true);
                                    MessageBox.Show($"下载 subs-check.exe 失败，请检查网络连接后重试。\n\n可尝试更换 Github Proxy 后，点击「检查更新」>「更新内核」。\n或前往 https://github.com/beck-8/subs-check/releases 自行下载！",
                                        "下载失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    progressBar1.Value = 0;
                                }

                                // 解压文件
                                using (System.IO.Compression.ZipArchive archive = System.IO.Compression.ZipFile.OpenRead(zipFilePath))
                                {
                                    // 查找subs-check.exe
                                    System.IO.Compression.ZipArchiveEntry exeEntry = archive.Entries.FirstOrDefault(
                                        entry => entry.Name.Equals("subs-check.exe", StringComparison.OrdinalIgnoreCase));

                                    if (exeEntry != null)
                                    {
                                        string exeFilePath = Path.Combine(executablePath, "subs-check.exe");

                                        // 如果文件已存在，先删除
                                        if (File.Exists(exeFilePath))
                                        {
                                            File.Delete(exeFilePath);
                                        }

                                        // 解压文件
                                        exeEntry.ExtractToFile(exeFilePath);
                                        当前subsCheck版本号 = latestVersion;
                                        Log($"subs-check.exe {当前subsCheck版本号} 已就绪！");

                                        await SaveConfig(false);
                                        // 这里保留原有行为，不修改button1.Enabled

                                        // 删除下载的zip文件
                                        //File.Delete(zipFilePath);
                                    }
                                    else
                                    {
                                        Log("无法在压缩包中找到 subs-check.exe 文件。", true);
                                    }
                                }
                            }
                            else
                            {
                                Log("无法找到适用于 Windows i386 的下载链接。", true);
                                MessageBox.Show("未能找到适用的 subs-check.exe 下载链接。\n\n可尝试更换 Github Proxy 后，点击「检查更新」>「更新内核」。\n或前往 https://github.com/beck-8/subs-check/releases 自行下载！",
                                    "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        catch (Exception ex)
                        {
                            Log($"下载过程中出错: {ex.Message}", true);
                            MessageBox.Show($"下载 subs-check.exe 时出错: {ex.Message}\n\n可尝试更换 Github Proxy 后，点击「检查更新」>「更新内核」。\n或前往 https://github.com/beck-8/subs-check/releases 自行下载！",
                                "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log($"初始化下载过程出错: {ex.Message}", true);
                MessageBox.Show($"下载准备过程出错: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            button1.Enabled = true;
            downloading = 0;
        }

        /// <summary>
        /// 获取最新版本号和对应的下载链接
        /// </summary>
        /// <param name="版本号URL">API请求URL</param>
        /// <param name="是否输出log">是否在日志中输出信息</param>
        /// <returns>包含最新版本号和下载链接的元组</returns>
        private async Task<(string LatestVersion, JArray assets)> 获取版本号(string 版本号URL, bool 是否输出log = false)
        {
            string latestVersion = "未知版本";
            JArray assets = null;

            // 创建不使用系统代理的 HttpClientHandler
            HttpClientHandler handler = new HttpClientHandler
            {
                UseProxy = false,
                Proxy = null
            };

            // 使用自定义 handler 创建 HttpClient
            using (HttpClient client = new HttpClient(handler))
            {
                client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win32; x86) AppleWebKit/537.36 (KHTML, like Gecko) cmliu/SubsCheck-Win-GUI");
                client.Timeout = TimeSpan.FromSeconds(30); // 增加超时时间以适应下载需求

                if (是否输出log) Log("正在获取最新版本 subs-check.exe 内核下载地址...");
                string url = 版本号URL;
                string 备用url = 版本号URL.Replace("api.github.com", "api.github.cmliussss.net");

                HttpResponseMessage response = null;
                string responseBody = null;
                JObject json = null;

                // 先尝试主URL
                try
                {
                    response = await client.GetAsync(url);

                    // 如果主URL请求成功返回有效数据
                    if (response.IsSuccessStatusCode)
                    {
                        responseBody = await response.Content.ReadAsStringAsync();
                        json = JObject.Parse(responseBody);
                        if (是否输出log) Log("成功从主API获取版本信息");
                    }
                    // 如果主URL请求不成功但没有抛出异常
                    else
                    {
                        if (是否输出log) Log($"主API请求失败 HTTP {(int)response.StatusCode}，尝试备用API...");
                        response = await client.GetAsync(备用url);

                        if (response.IsSuccessStatusCode)
                        {
                            responseBody = await response.Content.ReadAsStringAsync();
                            json = JObject.Parse(responseBody);
                            if (是否输出log) Log("成功从备用API获取版本信息");
                        }
                        else
                        {
                            if (是否输出log) Log($"备用API也请求失败: HTTP {(int)response.StatusCode}", true);
                            return (latestVersion, assets); // 两个URL都失败，提前退出
                        }
                    }
                }
                // 捕获网络请求异常（如连接超时、无法解析域名等）
                catch (HttpRequestException ex)
                {
                    if (是否输出log) Log($"主API请求出错: {ex.Message}，尝试备用API...");
                    try
                    {
                        response = await client.GetAsync(备用url);
                        if (response.IsSuccessStatusCode)
                        {
                            responseBody = await response.Content.ReadAsStringAsync();
                            json = JObject.Parse(responseBody);
                            if (是否输出log) Log("成功从备用API获取版本信息");
                        }
                        else
                        {
                            if (是否输出log) Log($"备用API也请求失败: HTTP {(int)response.StatusCode}", true);
                            return (latestVersion, assets); // 备用URL也失败，提前退出
                        }
                    }
                    catch (Exception backupEx)
                    {
                        if (是否输出log) Log($"备用API请求也出错: {backupEx.Message}", true);
                        return (latestVersion, assets); // 连备用URL也异常，提前退出
                    }
                }
                // 捕获JSON解析异常
                catch (Newtonsoft.Json.JsonException ex)
                {
                    if (是否输出log) Log($"解析JSON数据出错: {ex.Message}", true);
                    try
                    {
                        response = await client.GetAsync(备用url);
                        if (response.IsSuccessStatusCode)
                        {
                            responseBody = await response.Content.ReadAsStringAsync();
                            json = JObject.Parse(responseBody);
                            if (是否输出log) Log("成功从备用API获取版本信息");
                        }
                    }
                    catch (Exception backupEx)
                    {
                        if (是否输出log) Log($"备用API请求也出错: {backupEx.Message}", true);
                        return (latestVersion, assets); // 连备用URL也有问题，提前退出
                    }
                }
                // 捕获其他所有异常
                catch (Exception ex)
                {
                    if (是否输出log) Log($"获取版本信息时出现未预期的错误: {ex.Message}", true);
                    try
                    {
                        response = await client.GetAsync(备用url);
                        if (response.IsSuccessStatusCode)
                        {
                            responseBody = await response.Content.ReadAsStringAsync();
                            json = JObject.Parse(responseBody);
                            if (是否输出log) Log("成功从备用URL获取版本信息");
                        }
                    }
                    catch (Exception backupEx)
                    {
                        if (是否输出log) Log($"备用API请求也出错: {backupEx.Message}", true);
                        return (latestVersion, assets); // 连备用URL也有问题，提前退出
                    }
                }

                // 如果成功获取了JSON数据，继续处理
                if (json != null)
                {
                    latestVersion = json["tag_name"].ToString();
                    assets = (JArray)json["assets"];
                }
            }

            return (latestVersion, assets);
        }

        private async void StartSubsCheckProcess()
        {
            try
            {
                // 重置进度条
                progressBar1.Value = 0;
                groupBox2.Text = "实时日志";
                using (MemoryStream ms = new MemoryStream(Properties.Resources.going))
                {
                    notifyIcon1.Icon = new Icon(ms);
                }

                // 获取当前应用程序目录
                string executablePath = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
                string subsCheckPath = Path.Combine(executablePath, "subs-check.exe");

                // 检查是否有其他subs-check.exe进程正在运行，并强制结束它们
                try
                {
                    Process[] processes = Process.GetProcessesByName("subs-check");
                    if (processes.Length > 0)
                    {
                        Log("发现正在运行的subs-check.exe进程，正在强制结束...");
                        foreach (Process process in processes)
                        {
                            // 确保不是当前应用程序的进程
                            if (process != subsCheckProcess)
                            {
                                try
                                {
                                    process.Kill();
                                    process.WaitForExit();
                                    Log($"成功结束subs-check.exe进程(ID: {process.Id})");
                                }
                                catch (Exception ex)
                                {
                                    Log($"结束subs-check.exe进程时出错(ID: {process.Id}): {ex.Message}", true);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log($"检查运行中的subs-check.exe进程时出错: {ex.Message}", true);
                }

                // 检查文件是否存在
                if (!File.Exists(subsCheckPath))
                {
                    Log("没有找到 subs-check.exe 文件。", true);
                    await DownloadSubsCheckEXE(); // 使用异步等待
                }

                // 创建进程启动信息
                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    FileName = subsCheckPath,
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    RedirectStandardError = true,
                    CreateNoWindow = true,
                    WorkingDirectory = executablePath,
                    StandardOutputEncoding = Encoding.UTF8,
                    StandardErrorEncoding = Encoding.UTF8
                };

                // 创建进程
                subsCheckProcess = new Process { StartInfo = startInfo };

                // 设置输出和错误数据接收事件处理
                subsCheckProcess.OutputDataReceived += SubsCheckProcess_OutputDataReceived;
                subsCheckProcess.ErrorDataReceived += SubsCheckProcess_OutputDataReceived;

                // 启动进程
                subsCheckProcess.Start();

                // 开始异步读取输出
                subsCheckProcess.BeginOutputReadLine();
                subsCheckProcess.BeginErrorReadLine();

                // 设置进程退出事件处理
                subsCheckProcess.EnableRaisingEvents = true;
                subsCheckProcess.Exited += SubsCheckProcess_Exited;

                Log($"subs-check.exe {当前subsCheck版本号} 已启动...");
                timer4.Enabled = true;
            }
            catch (Exception ex)
            {
                Log($"启动 subs-check.exe 时出错: {ex.Message}", true);
                button1.Text = "▶ 启动";
            }
        }

        private void StopSubsCheckProcess()
        {
            timer4.Enabled = false;
            if (subsCheckProcess != null && !subsCheckProcess.HasExited)
            {
                try
                {
                    // 尝试正常关闭进程
                    subsCheckProcess.Kill();
                    subsCheckProcess.WaitForExit();
                    Log("subs-check.exe 已停止");
                    notifyIcon1.Icon = originalNotifyIcon;
                    button7.Enabled = false;
                    button7.Text = "🔀未启动";
                }
                catch (Exception ex)
                {
                    Log($"停止 subs-check.exe 时出错: {ex.Message}", true);
                }
                finally
                {
                    subsCheckProcess.Dispose();
                    subsCheckProcess = null;
                }
            }
        }

        private void SubsCheckProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.Data))
            {
                // 由于此事件在另一个线程中触发，需要使用 Invoke 在 UI 线程上更新控件
                BeginInvoke(new Action(() =>
                {
                    // 过滤ANSI转义序列
                    string cleanText = RemoveAnsiEscapeCodes(e.Data);

                    // 检查是否包含"下次检查时间"信息
                    if (cleanText.Contains("下次检查时间:"))
                    {
                        if (button3.Enabled == false)
                        {
                            string executablePath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
                            string outputFolderPath = System.IO.Path.Combine(executablePath, "output");
                            if (System.IO.Directory.Exists(outputFolderPath))
                            {
                                string allyamlFilePath = System.IO.Path.Combine(outputFolderPath, "all.yaml");
                                if (System.IO.File.Exists(allyamlFilePath)) button3.Enabled = true;
                            }
                        }
                        // 提取完整的下次检查时间信息
                        int startIndex = cleanText.IndexOf("下次检查时间:");
                        nextCheckTime = cleanText.Substring(startIndex);
                    }

                    if (!cleanText.StartsWith("[GIN]"))
                    {
                        // 如果不是进度行，则添加到日志中
                        richTextBox1.AppendText(cleanText + "\r\n");
                        // 滚动到最底部
                        richTextBox1.SelectionStart = richTextBox1.Text.Length;
                        richTextBox1.ScrollToCaret();
                    }

                    /*
                    // 检查是否是进度信息行
                    if (cleanText.StartsWith("进度: ["))
                    {
                        // 解析百分比
                        int percentIndex = cleanText.IndexOf('%');
                        if (percentIndex > 0)
                        {
                            // 查找百分比前面的数字部分
                            int startIndex = cleanText.LastIndexOfAny(new char[] { ' ', '>' }, percentIndex) + 1;
                            string percentText = cleanText.Substring(startIndex, percentIndex - startIndex);

                            if (double.TryParse(percentText, out double percentValue))
                            {
                                // 更新进度条，将百分比值（0-100）设置给进度条
                                progressBar1.Value = (int)Math.Round(percentValue);
                            }
                        }

                        // 解析节点信息部分（例如：(12/6167) 可用: 0）
                        int infoStartIndex = cleanText.IndexOf('(');
                        if (infoStartIndex > 0)
                        {
                            string fullNodeInfo = cleanText.Substring(infoStartIndex);

                            // 提取最重要的信息：节点数量和可用数量
                            int endIndex = fullNodeInfo.IndexOf("2025-"); // 查找日期部分开始位置
                            if (endIndex > 0)
                            {
                                nodeInfo = fullNodeInfo.Substring(0, endIndex).Trim();
                            }
                            else
                            {
                                // 如果找不到日期部分，则取前30个字符
                                nodeInfo = fullNodeInfo.Length > 30 ? fullNodeInfo.Substring(0, 30) + "..." : fullNodeInfo;
                            }

                            groupBox2.Text = "实时日志 " + nodeInfo;

                            // 确保通知图标文本不超过63个字符
                            string notifyText = "SubsCheck: " + nodeInfo;
                            if (notifyText.Length > 63)
                            {
                                notifyText = notifyText.Substring(0, 60) + "...";
                            }
                            notifyIcon1.Text = notifyText;
                        }

                        // 更新lastProgressLine，但不向richTextBox添加文本
                        lastProgressLine = cleanText;
                    }
                    else
                    {
                        // 如果不是进度行，则添加到日志中
                        richTextBox1.AppendText(cleanText + "\r\n");
                        // 滚动到最底部
                        richTextBox1.SelectionStart = richTextBox1.Text.Length;
                        richTextBox1.ScrollToCaret();
                    }
                    */
                }));
            }
        }

        // 添加一个方法来过滤ANSI转义序列
        private string RemoveAnsiEscapeCodes(string input)
        {
            // 匹配ANSI转义序列的正则表达式
            // 这将匹配类似 "[2m"、"[0m"、"[92m" 等格式的ANSI颜色代码
            return System.Text.RegularExpressions.Regex.Replace(input, @"\x1B\[[0-9;]*[mGK]", string.Empty);
        }

        private void SubsCheckProcess_Exited(object sender, EventArgs e)
        {
            // 进程退出时，在 UI 线程上更新控件
            BeginInvoke(new Action(() =>
            {
                Log("subs-check.exe 已退出");
                button1.Text = "▶ 启动";

                // 更新菜单项的启用状态
                startMenuItem.Enabled = true;
                stopMenuItem.Enabled = false;

                // 重新启用控件
                numericUpDown1.Enabled = true;
                numericUpDown2.Enabled = true;
                numericUpDown3.Enabled = true;
                numericUpDown4.Enabled = true;
                numericUpDown5.Enabled = true;
                numericUpDown6.Enabled = true;
                textBox1.Enabled = true;
                groupBox3.Enabled = true;
            }));
        }

        /// <summary>
        /// 获取本地局域网IP地址，如果有多个则让用户选择
        /// </summary>
        /// <returns>用户选择的IP地址，如果未选择则返回127.0.0.1</returns>
        private string GetLocalLANIP()
        {
            try
            {
                // 获取所有网卡的IP地址
                List<string> lanIPs = new List<string>();

                // 获取所有网络接口
                foreach (System.Net.NetworkInformation.NetworkInterface ni in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
                {
                    // 排除loopback、虚拟网卡和非活动网卡
                    if (ni.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Loopback &&
                        ni.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
                    {
                        // 获取该网卡的所有IP地址
                        foreach (System.Net.NetworkInformation.UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses)
                        {
                            // 只添加IPv4地址且不是回环地址
                            if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork &&
                                !System.Net.IPAddress.IsLoopback(ip.Address))
                            {
                                lanIPs.Add(ip.Address.ToString());
                            }
                        }
                    }
                }

                // 如果没有找到任何IP地址，返回本地回环地址
                if (lanIPs.Count == 0)
                {
                    return "127.0.0.1";
                }
                // 如果只找到一个IP地址，直接返回
                else if (lanIPs.Count == 1)
                {
                    return lanIPs[0];
                }
                // 如果有多个IP地址，让用户选择
                else
                {
                    // 创建选择窗口
                    Form selectForm = new Form();
                    selectForm.Text = "选择局域网IP地址";
                    selectForm.StartPosition = FormStartPosition.CenterParent;
                    /*
                    selectForm.Width = 520;  // 保持宽度
                    selectForm.Height = 320; // 增加高度以容纳额外的警告标签
                    selectForm.FormBorderStyle = FormBorderStyle.FixedDialog;
                    */
                    selectForm.AutoSize = true;  // 启用自动大小调整
                    selectForm.AutoSizeMode = AutoSizeMode.GrowAndShrink;  // 根据内容调整大小
                    selectForm.FormBorderStyle = FormBorderStyle.FixedSingle;  // 使用固定但可调整的边框
                    selectForm.ShowIcon = false;
                    selectForm.MaximizeBox = false;
                    selectForm.MinimizeBox = false;

                    // 添加说明标签
                    Label label = new Label();
                    label.Text = "发现多个局域网IP地址：\n\n" +
                                 "· 仅在本机访问：直接点击【取消】，将使用127.0.0.1\n\n" +
                                 "· 局域网内其他设备访问：请在下面列表中选择一个正确的局域网IP";
                    label.Location = new Point(15, 10);
                    label.AutoSize = true;
                    label.MaximumSize = new Size(380, 0); // 设置最大宽度，允许自动换行
                    selectForm.Controls.Add(label);

                    // 计算标签高度以正确放置列表框
                    int labelHeight = label.Height + 20;

                    // 添加IP地址列表框
                    ListBox listBox = new ListBox();
                    listBox.Location = new Point(15, labelHeight);
                    listBox.Width = 380;
                    listBox.Height = 130; // 保持列表框高度
                    foreach (string ip in lanIPs)
                    {
                        listBox.Items.Add(ip);
                    }
                    // 查找非".1"结尾的IP地址，如果所有IP都以".1"结尾，则使用第一个IP
                    int selectedIndex = 0;
                    for (int i = 0; i < lanIPs.Count; i++)
                    {
                        if (!lanIPs[i].EndsWith(".1"))
                        {
                            selectedIndex = i;
                            break;
                        }
                    }

                    // 设置选中的索引
                    listBox.SelectedIndex = selectedIndex;
                    selectForm.Controls.Add(listBox);

                    // 添加警告标签（放在列表框下方）
                    Label warningLabel = new Label();
                    warningLabel.Text = "注意：选择错误的IP会导致局域网内其他设备无法访问。\n\n　　　推荐您可以先尝试使用非“.1”结尾的IP！";
                    warningLabel.Location = new Point(15, labelHeight + listBox.Height + 10);
                    warningLabel.AutoSize = true;
                    warningLabel.ForeColor = Color.Red; // 警告文本使用红色
                    selectForm.Controls.Add(warningLabel);

                    // 计算按钮位置（居中排布）
                    int buttonY = labelHeight + listBox.Height + warningLabel.Height + 20;
                    int buttonTotalWidth = 75 * 2 + 15; // 两个按钮的宽度加间距
                    int buttonStartX = (selectForm.ClientSize.Width - buttonTotalWidth) / 2;

                    // 添加确定按钮
                    Button okButton = new Button();
                    okButton.Text = "确定";
                    okButton.DialogResult = DialogResult.OK;
                    okButton.Location = new Point(buttonStartX, buttonY);
                    okButton.Width = 75;
                    selectForm.Controls.Add(okButton);
                    selectForm.AcceptButton = okButton;

                    // 添加取消按钮
                    Button cancelButton = new Button();
                    cancelButton.Text = "取消";
                    cancelButton.DialogResult = DialogResult.Cancel;
                    cancelButton.Location = new Point(buttonStartX + 90, buttonY);
                    cancelButton.Width = 75;
                    selectForm.Controls.Add(cancelButton);
                    selectForm.CancelButton = cancelButton;

                    // 显示选择窗口
                    if (selectForm.ShowDialog() == DialogResult.OK)
                    {
                        return listBox.SelectedItem.ToString();
                    }
                    else
                    {
                        return "127.0.0.1"; // 如果用户取消，返回本地回环地址
                    }
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show($"获取局域网IP地址时出错: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return "127.0.0.1";
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            string 本地IP = GetLocalLANIP();
            try
            {
                // 构造URL
                string url = comboBox4.Text == "Clash" ? $"http://{本地IP}:{numericUpDown7.Value}/api/file/mihomo" : $"http://{本地IP}:{numericUpDown7.Value}/download/sub";

                // 将URL复制到剪贴板
                Clipboard.SetText(url);
                button3.Text = "复制成功";
                timer2.Enabled = true;
                // 可选：显示提示消息
                //MessageBox.Show($"URL已复制到剪贴板：\n{url}", "复制成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"复制到剪贴板时出错：{ex.Message}", "错误",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            button3.Text = "复制订阅";
        }

        private void comboBox3_Leave(object sender, EventArgs e)
        {
            // 检查是否有内容
            if (string.IsNullOrWhiteSpace(comboBox3.Text))
            {
                comboBox3.Text = "自动选择";
                return;
            }

            string input = comboBox3.Text.Trim();

            // 检查是否存在 "://" 协议部分
            int protocolIndex = input.IndexOf("://");
            if (protocolIndex >= 0)
            {
                // 保留 "://" 之后的内容
                input = input.Substring(protocolIndex + 3);
            }

            // 检查是否存在 "/" 路径部分
            int pathIndex = input.IndexOf('/');
            if (pathIndex >= 0)
            {
                // 只保留 "/" 之前的域名部分
                input = input.Substring(0, pathIndex);
            }

            // 更新 comboBox3 的文本
            comboBox3.Text = input;
        }

        private void 判断保存类型()
        {
            if (comboBox1.Text == "本地" || button2.Text == "高级设置∨")
            {
                groupBox4.Visible = false;
                groupBox5.Visible = false;
                groupBox6.Visible = false;
            }
            else if (comboBox1.Text == "gist" && button2.Text == "高级设置∧")
            {
                groupBox4.Visible = true;

                groupBox5.Visible = false;
                groupBox6.Visible = false;
            }
            else if (comboBox1.Text == "r2" && button2.Text == "高级设置∧")
            {
                groupBox5.Location = groupBox4.Location;
                groupBox5.Visible = true;

                groupBox4.Visible = false;
                groupBox6.Visible = false;
            }
            else if (comboBox1.Text == "webdav" && button2.Text == "高级设置∧")
            {
                groupBox6.Location = groupBox4.Location;
                groupBox6.Visible = true;

                groupBox4.Visible = false;
                groupBox5.Visible = false;
            }
        }

        private void comboBox1_TextChanged(object sender, EventArgs e)
        {
            判断保存类型();
            if(!(comboBox1.Text == "本地" || comboBox1.Text == "") && button2.Text == "高级设置∨") button2_Click(sender, e);
        }

        private void textBox3_Enter(object sender, EventArgs e)
        {
            textBox3.PasswordChar = '\0';
            textBox6.PasswordChar = '\0';
            textBox8.PasswordChar = '\0';
        }

        private void textBox3_Leave(object sender, EventArgs e)
        {
            textBox3.PasswordChar = '*';
            textBox6.PasswordChar = '*';
            textBox8.PasswordChar = '*';
        }

        private void textBox10_Enter(object sender, EventArgs e)
        {
            textBox10.PasswordChar = '\0';
            if (textBox10.Text == "请输入密钥")
            {
                textBox10.Text = "";
                textBox10.ForeColor = Color.Black;
            }
        }

        private void textBox10_Leave(object sender, EventArgs e)
        {

            if (textBox10.Text == "")
            {
                textBox10.PasswordChar = '\0';
                textBox10.Text = "请输入密钥";
                textBox10.ForeColor = Color.Gray;
            }
            else
            {
                textBox10.ForeColor = Color.Black;
                textBox10.PasswordChar = '*';
            }
        }

        private void textBox7_Leave(object sender, EventArgs e)
        {
            // 检查是否有内容
            if (string.IsNullOrWhiteSpace(textBox7.Text))
                return;

            string input = textBox7.Text.Trim();

            try
            {
                // 尝试解析为 URI
                Uri uri = new Uri(input);

                // 构建基础 URL (scheme + authority)
                string baseUrl = $"{uri.Scheme}://{uri.Authority}";

                // 更新 textBox7 的文本为基础 URL
                textBox7.Text = baseUrl;
            }
            catch (UriFormatException)
            {
                // 如果输入的不是有效 URI，尝试使用简单的字符串处理
                // 查找双斜杠后的第一个斜杠
                int schemeIndex = input.IndexOf("://");
                if (schemeIndex >= 0)
                {
                    int pathStartIndex = input.IndexOf('/', schemeIndex + 3);
                    if (pathStartIndex >= 0)
                    {
                        // 截取到路径开始之前
                        textBox7.Text = input.Substring(0, pathStartIndex);
                    }
                }
            }
        }

        private void Log(string message, bool isError = false)
        {
            string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string logType = isError ? "ERR" : "INF";
            richTextBox1.AppendText($"{timestamp} {logType} {message}\r\n");

            if (richTextBox1.IsHandleCreated)
            {
                richTextBox1.BeginInvoke((MethodInvoker)(() =>
                {
                    // 滚动到最底部
                    richTextBox1.SelectionStart = richTextBox1.Text.Length;
                    richTextBox1.ScrollToCaret();
                }));
            }
        }

        private void 恢复窗口()
        {
            // 首先显示窗体
            this.Show();

            // 强制停止当前布局逻辑
            this.SuspendLayout();

            // 恢复窗口状态
            this.WindowState = FormWindowState.Normal;

            // 强制重新布局
            this.ResumeLayout(true); // 参数true表示立即执行布局

            // 调用刷新布局的方法
            this.PerformLayout();

            // 处理WindowsForms消息队列中的所有挂起消息
            Application.DoEvents();

            // 激活窗口（使其获得焦点）
            this.Activate();
        }

        private void 隐藏窗口()
        {
            // 隐藏窗体（从任务栏消失）
            this.Hide();

            // 确保通知图标可见
            notifyIcon1.Visible = true;

            // 可选：显示气泡提示
            notifyIcon1.ShowBalloonTip(1000, "SubsCheck", "程序已最小化到系统托盘", ToolTipIcon.Info);
        }

        private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                // 检查窗口是否可见
                if (this.Visible)
                {
                    // 如果窗口当前可见，则隐藏窗口
                    隐藏窗口();
                }
                else
                {
                    // 如果窗口当前不可见，则恢复窗口
                    恢复窗口();
                }
            }
        }

        // 创建专用方法用于异步检测GitHub代理
        private async Task<string> DetectGitHubProxyAsync(List<string> proxyItems)
        {
            bool proxyFound = false;
            string detectedProxyURL = "";

            Log("检测可用 GitHub 代理...");

            // 遍历随机排序后的代理列表
            foreach (string proxyItem in proxyItems)
            {
                string checkUrl = $"https://{proxyItem}/https://raw.githubusercontent.com/cmliu/SubsCheck-Win-GUI/master/packages.config";
                Log($"正在测试 GitHub 代理: {proxyItem}");
                richTextBox1.Refresh();

                try
                {
                    using (HttpClient client = new HttpClient())
                    {
                        client.Timeout = TimeSpan.FromSeconds(5); // 设置5秒超时
                                                                  // 添加User-Agent头，避免被拒绝访问
                        client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win32; x86) AppleWebKit/537.36 (KHTML, like Gecko) cmliu/SubsCheck-Win-GUI");

                        // 使用异步方式
                        HttpResponseMessage response = await client.GetAsync(checkUrl);
                        if (response.IsSuccessStatusCode)
                        {
                            // 找到可用代理
                            detectedProxyURL = $"https://{proxyItem}/";
                            Log($"找到可用 GitHub 代理: {proxyItem}");
                            proxyFound = true;
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    // 记录错误但继续尝试下一个
                    Log($"代理 {proxyItem} 测试失败: {ex.Message}", true);
                    richTextBox1.Refresh();
                }
            }

            // 如果没有找到可用的代理
            if (!proxyFound)
            {
                Log("未找到可用的 GitHub 代理，请在高级设置中手动设置。", true);
                MessageBox.Show("未找到可用的 GitHub 代理。\n\n请打开高级设置手动填入一个可用的Github Proxy，或检查您的网络连接。",
                    "代理检测失败",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }

            return detectedProxyURL;
        }

        private async void button5_Click(object sender, EventArgs e)
        {
            try
            {
                button5.Enabled = false;
                button1.Enabled = false;
                // 清空日志
                richTextBox1.Clear();
                Log("开始检查和下载最新版本的 subs-check.exe...");

                // 获取当前应用程序目录
                string executablePath = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
                string subsCheckPath = Path.Combine(executablePath, "subs-check.exe");

                // 检查文件是否存在
                if (File.Exists(subsCheckPath))
                {
                    Log($"发现 subs-check.exe，正在删除...");

                    try
                    {
                        // 首先检查是否有进程正在运行
                        Process[] processes = Process.GetProcessesByName("subs-check");
                        if (processes.Length > 0)
                        {
                            Log("发现正在运行的 subs-check.exe 进程，正在强制结束...");
                            foreach (Process process in processes)
                            {
                                try
                                {
                                    process.Kill();
                                    process.WaitForExit();
                                    Log($"成功结束 subs-check.exe 进程(ID: {process.Id})");
                                }
                                catch (Exception ex)
                                {
                                    Log($"结束进程时出错(ID: {process.Id}): {ex.Message}", true);
                                }
                            }
                        }

                        // 删除文件
                        File.Delete(subsCheckPath);
                        Log("成功删除旧版本 subs-check.exe");
                    }
                    catch (Exception ex)
                    {
                        Log($"删除 subs-check.exe 时出错: {ex.Message}", true);
                        MessageBox.Show($"无法删除现有的 subs-check.exe 文件: {ex.Message}\n\n请手动删除后重试，或者检查文件是否被其他程序占用。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        button5.Enabled = true;
                        return;
                    }
                }
                else
                {
                    Log("未找到现有的 subs-check.exe 文件，将直接下载最新版本");
                }

                // 检测可用的 GitHub 代理
                if (!string.IsNullOrEmpty(comboBox3.Text) && comboBox3.Text == "自动选择")
                {
                    // 创建不包含"自动选择"的代理列表
                    List<string> proxyItems = new List<string>();
                    for (int j = 0; j < comboBox3.Items.Count; j++)
                    {
                        string proxyItem = comboBox3.Items[j].ToString();
                        if (proxyItem != "自动选择")
                            proxyItems.Add(proxyItem);
                    }

                    // 随机打乱列表顺序
                    Random random = new Random();
                    proxyItems = proxyItems.OrderBy(x => random.Next()).ToList();

                    // 异步检测可用代理
                    githubProxyURL = await DetectGitHubProxyAsync(proxyItems);

                    // 如果未能找到可用代理，提示用户
                    if (string.IsNullOrEmpty(githubProxyURL))
                    {
                        Log("未能找到可用的 GitHub 代理，下载可能会失败", true);
                    }
                }
                else if (!string.IsNullOrEmpty(comboBox3.Text))
                {
                    githubProxyURL = $"https://{comboBox3.Text}/";
                    Log($"使用指定的 GitHub 代理: {comboBox3.Text}");
                }
                else
                {
                    Log("未设置 GitHub 代理，将尝试直接下载", true);
                }

                // 下载最新版本的 subs-check.exe
                await DownloadSubsCheckEXE();

                // 完成
                Log("内核更新完成！");
            }
            catch (Exception ex)
            {
                Log($"操作过程中出错: {ex.Message}", true);
                MessageBox.Show($"处理过程中出现错误: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                button5.Enabled = true;
                button1.Enabled = true;
            }
        }

        private decimal 订阅端口;
        private decimal SubStore端口;
        private void numericUpDown6_ValueChanged(object sender, EventArgs e)
        {
            // 检查numericUpDown7是否存在并且与numericUpDown6的值相等
            if (numericUpDown6.Value == numericUpDown7.Value)
            {
                // 显示警告消息
                MessageBox.Show("订阅端口 和 Sub-Store端口 不能相同！",
                               "端口冲突",
                               MessageBoxButtons.OK,
                               MessageBoxIcon.Warning);

                // 将numericUpDown6的值恢复为更改前的值
                numericUpDown6.Value = 订阅端口;
                numericUpDown7.Value = SubStore端口;
            }
            else
            {
                // 保存当前值作为下次比较的基准
                订阅端口 = numericUpDown6.Value;
                SubStore端口 = numericUpDown7.Value;
            }
        }

        /// <summary>
        /// 异步检测并强制终止所有程序目录下的output\node.exe进程
        /// </summary>
        private async Task KillNodeProcessAsync()
        {
            try
            {
                Log("检查 node.exe 进程状态...");

                // 获取当前应用程序的执行目录
                string executablePath = Path.GetDirectoryName(Application.ExecutablePath);
                string nodeExePath = Path.Combine(executablePath, "output", "node.exe");

                // 获取所有node.exe进程
                Process[] nodeProcesses = Process.GetProcessesByName("node");

                if (nodeProcesses.Length == 0)
                {
                    Log("未发现运行中的 node.exe 进程");
                    return;
                }

                Log($"发现 {nodeProcesses.Length} 个 node.exe 进程，开始检查并终止匹配路径的进程...");

                int terminatedCount = 0;

                foreach (Process process in nodeProcesses)
                {
                    try
                    {
                        // 使用Task.Run将可能耗时的操作放在后台线程执行
                        string processPath = await Task.Run(() => {
                            try
                            {
                                return process.MainModule?.FileName;
                            }
                            catch (Exception)
                            {
                                return null;
                            }
                        });

                        // 检查是否匹配我们要查找的node.exe路径
                        if (!string.IsNullOrEmpty(processPath) &&
                            processPath.Equals(nodeExePath, StringComparison.OrdinalIgnoreCase))
                        {
                            // 找到匹配的进程，终止它
                            Log($"发现匹配路径的 node.exe 进程(ID: {process.Id})，正在强制结束...");

                            await Task.Run(() => {
                                process.Kill();
                                process.WaitForExit();
                            });

                            Log($"成功结束 node.exe 进程(ID: {process.Id})");
                            terminatedCount++;
                        }
                    }
                    catch (Exception ex)
                    {
                        // 访问进程信息时可能会因为权限问题抛出异常
                        Log($"访问或终止进程(ID: {process.Id})时出错: {ex.Message}", true);
                    }
                }

                if (terminatedCount > 0)
                {
                    Log($"总共终止了 {terminatedCount} 个匹配路径的 node.exe 进程");
                }
                else
                {
                    Log("未发现需要终止的 node.exe 进程");
                }
            }
            catch (Exception ex)
            {
                Log($"检查或终止 node.exe 进程时出错: {ex.Message}", true);
            }
        }

        private async void textBox1_DoubleClick(object sender, EventArgs e)
        {
            if (textBox1.Enabled)
            {
                // 创建EditURLs窗口的实例
                EditURLs editURLsForm = new EditURLs();

                // 传递当前textBox1的内容到EditURLs窗口
                editURLsForm.UrlContent = textBox1.Text + "\n";
                editURLsForm.githubProxys = comboBox3.Items;
                editURLsForm.githubProxy = comboBox3.Text;
                // 显示对话框并等待结果
                DialogResult result = editURLsForm.ShowDialog();

                // 如果用户点击了"保存并关闭"按钮（返回DialogResult.OK）
                if (result == DialogResult.OK)
                {
                    // 获取编辑后的内容，按行拆分，过滤空行
                    string[] lines = editURLsForm.UrlContent.Split(
                        new[] { "\r\n", "\r", "\n" },
                        StringSplitOptions.RemoveEmptyEntries);

                    // 去除每行首尾的空白字符
                    for (int i = 0; i < lines.Length; i++)
                    {
                        lines[i] = lines[i].Trim();
                    }

                    // 再次过滤掉空行
                    lines = lines.Where(line => !string.IsNullOrWhiteSpace(line)).ToArray();

                    // 将处理后的内容更新到Form1的textBox1
                    textBox1.Text = string.Join(Environment.NewLine, lines);
                    await SaveConfig(false);
                    Log("已保存订阅地址列表。");
                }
            }

        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked == false) checkBox2.Checked = false;
        }

        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox2.Checked == true) checkBox1.Checked = true;
        }

        private async void timer3_Tick(object sender, EventArgs e)
        {
            if (button1.Text == "⏹ 停止")
            {
                Log("subs-check.exe 运行时满24小时，自动重启清理内存占用。");
                // 停止 subs-check.exe 程序
                StopSubsCheckProcess();
                // 结束 Sub-Store
                await KillNodeProcessAsync();
                // 重新启动 subs-check.exe 程序
                StartSubsCheckProcess();
                numericUpDown1.Enabled = false;
                numericUpDown2.Enabled = false;
                numericUpDown3.Enabled = false;
                numericUpDown4.Enabled = false;
                numericUpDown5.Enabled = false;
                numericUpDown6.Enabled = false;
                numericUpDown7.Enabled = false;
                comboBox1.Enabled = false;
                textBox1.Enabled = false;
                groupBox3.Enabled = false;
                groupBox4.Enabled = false;
                groupBox5.Enabled = false;
                groupBox6.Enabled = false;
                button1.Text = "⏹ 停止";
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            // 创建 CheckUpdates 窗口实例
            CheckUpdates checkUpdatesForm = new CheckUpdates();

            // 传递必要的数据和状态
            checkUpdatesForm.githubProxys = comboBox3.Items;
            checkUpdatesForm.githubProxy = comboBox3.Text;

            checkUpdatesForm.当前subsCheck版本号 = 当前subsCheck版本号;
            checkUpdatesForm.当前GUI版本号 = 当前GUI版本号;
            checkUpdatesForm.最新GUI版本号 = 最新GUI版本号;

            // 为 CheckUpdates 的 button2 添加点击事件处理程序
            checkUpdatesForm.FormClosed += (s, args) => {
                // 移除事件处理，避免内存泄漏
                if (checkUpdatesForm.DialogResult == DialogResult.OK)
                {
                    // 如果返回OK结果，表示按钮被点击并需要更新内核
                    button5_Click(this, EventArgs.Empty);
                }
            };

            // 设置 button2 点击后关闭窗口并返回 DialogResult.OK
            // 这需要在 CheckUpdates.cs 中修改 button2_Click 方法

            // 显示 CheckUpdates 窗口
            checkUpdatesForm.ShowDialog();
        }

        private void checkBox3_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox3.Checked) numericUpDown8.Enabled = true;
            else numericUpDown8.Enabled = false;
        }

        private async void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox5.Text.Contains("[内置]")) await ProcessComboBox5Selection(true);
        }

        private async Task ProcessComboBox5Selection(bool 汇报Log = false)
        {
            // 确定文件名和下载URL
            string fileName;
            string downloadFilePath;
            string downloadUrl;
            string displayName;
            string executablePath = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
            if (comboBox5.Text.Contains("[内置]布丁狗"))
            {
                fileName = "bdg.yaml";
                displayName = "[内置]布丁狗的订阅转换";
                downloadUrl = "https://raw.githubusercontent.com/cmliu/ACL4SSR/main/yaml/bdg.yaml";
            }
            else // [内置]ACL4SSR
            {
                fileName = "ACL4SSR_Online_Full.yaml";
                displayName = "[内置]ACL4SSR_Online_Full";
                downloadUrl = "https://raw.githubusercontent.com/beck-8/override-hub/main/yaml/ACL4SSR_Online_Full.yaml";
            }

            // 确保output文件夹存在
            string outputFolderPath = Path.Combine(executablePath, "output");
            if (!Directory.Exists(outputFolderPath))
            {
                Directory.CreateDirectory(outputFolderPath);
            }

            // 确定文件完整路径
            downloadFilePath = Path.Combine(outputFolderPath, fileName);

            // 检查文件是否存在
            if (!File.Exists(downloadFilePath))
            {
                Log($"{displayName} 覆写配置文件 未找到，正在下载...");

                // 重置进度条
                progressBar1.Value = 0;

                // 添加GitHub代理前缀如果有
                string fullDownloadUrl = githubProxyURL + downloadUrl;

                try
                {
                    // 创建不使用系统代理的HttpClientHandler
                    using (HttpClientHandler handler = new HttpClientHandler { UseProxy = false, Proxy = null })
                    using (HttpClient client = new HttpClient(handler))
                    {
                        client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win32; x86) AppleWebKit/537.36 (KHTML, like Gecko) cmliu/SubsCheck-Win-GUI");
                        client.Timeout = TimeSpan.FromSeconds(15); // 设置15秒超时

                        // 先获取文件大小
                        HttpResponseMessage headResponse = await client.SendAsync(new HttpRequestMessage(HttpMethod.Head, fullDownloadUrl));
                        long totalBytes = headResponse.Content.Headers.ContentLength ?? 0;

                        // 如果无法获取文件大小，显示不确定进度
                        if (totalBytes == 0)
                        {
                            Console.WriteLine($"无法获取 {displayName} 文件大小，将显示不确定进度");
                        }

                        // 创建下载请求并获取响应流
                        using (var response = await client.GetAsync(fullDownloadUrl, HttpCompletionOption.ResponseHeadersRead))
                        {
                            if (response.IsSuccessStatusCode)
                            {
                                using (var contentStream = await response.Content.ReadAsStreamAsync())
                                using (var fileStream = new FileStream(downloadFilePath, FileMode.Create, FileAccess.Write, FileShare.None, 8192, true))
                                {
                                    byte[] buffer = new byte[8192];
                                    long totalBytesRead = 0;
                                    int bytesRead;

                                    while ((bytesRead = await contentStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
                                    {
                                        await fileStream.WriteAsync(buffer, 0, bytesRead);
                                        totalBytesRead += bytesRead;

                                        // 更新进度条
                                        if (totalBytes > 0)
                                        {
                                            int progressPercentage = (int)((totalBytesRead * 100) / totalBytes);
                                            // 确保进度值在有效范围内 (0-100)
                                            progressPercentage = Math.Min(100, Math.Max(0, progressPercentage));
                                            progressBar1.Value = progressPercentage;
                                        }
                                    }

                                    // 确保进度条显示100%
                                    progressBar1.Value = 100;
                                }

                                Log($"{displayName} 覆写配置文件 下载成功");
                            }
                            else
                            {
                                Log($"{displayName} 覆写配置文件 下载失败: HTTP {(int)response.StatusCode} {response.ReasonPhrase}", true);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log($"{displayName} 覆写配置文件 下载失败: {ex.Message}", true);
                    // 出错时重置进度条
                    progressBar1.Value = 0;
                }
            }
            else
            {
                if (汇报Log) Log($"{displayName} 覆写配置文件 已就绪。");
            }
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            if (numericUpDown1.Value > 128)
            {
                string warningMessage =
                    "⚠ 高并发风险提醒 ⚠\n\n" +
                    "您设置的并发数值过高，可能导致：\n\n" +
                    "• 运营商判定为异常流量并限制网络\n" +
                    "• 路由器性能压力过大\n" +
                    "• 测速结果不准确\n\n" +
                    "并发数设置建议：\n" +
                    "• 宽带峰值/50Mbps：一般对网络无影响\n" +
                    "• 宽带峰值/25Mbps：可能会影响同网络下载任务\n" +
                    "• 宽带峰值/10Mbps：可能会影响同网络下其他设备的上网体验\n";

                Log(warningMessage);
            }
        }

        private void checkBox4_CheckedChanged(object sender, EventArgs e)
        {
            if(checkBox4.Checked) textBox10.Enabled = true;
            else textBox10.Enabled = false;
        }

        private void button6_Click(object sender, EventArgs e)
        {
            string 本地IP = GetLocalLANIP();
            try
            {
                // 构造URL
                string url = $"http://{本地IP}:{numericUpDown6.Value}/admin";

                // 使用系统默认浏览器打开URL
                System.Diagnostics.Process.Start(url);

                Log($"正在浏览器中打开 Subs-Check 配置管理: {url}");
            }
            catch (Exception ex)
            {
                Log($"打开浏览器失败: {ex.Message}", true);
                MessageBox.Show($"打开浏览器时出错: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        /// <summary>
        /// 获取API状态信息并返回包含6个元素的字符串数组
        /// </summary>
        /// <returns>
        /// 包含6个元素的字符串数组：
        /// [0] - 状态类型 ("checking"/"idle"/"error")
        /// [1] - 状态图标类别 ("primary"/"success"/"danger")
        /// [2] - 状态文本 ("正在检测中..."/"空闲"/"获取状态失败")
        /// [3] - 节点总数 (proxyCount或"N/A")
        /// [4] - 进度百分比 (progress或"N/A")
        /// [5] - 可用节点数量 (available或"N/A")
        /// </returns>
        private async Task<string[]> GetApiStatusAsync()
        {
            string[] resultArray = new string[6];
            string baseUrl = $"http://127.0.0.1:{numericUpDown6.Value}";

            try
            {
                using (HttpClient client = new HttpClient())
                {
                    // 设置基础URL
                    client.BaseAddress = new Uri(baseUrl);

                    // 添加API密钥请求头
                    client.DefaultRequestHeaders.Add("X-API-Key", WebUIapiKey);

                    // 设置超时时间
                    client.Timeout = TimeSpan.FromSeconds(5);

                    // 发送请求
                    HttpResponseMessage response = await client.GetAsync("/api/status");

                    // 检查响应状态
                    if (response.IsSuccessStatusCode)
                    {
                        // 读取响应内容
                        string content = await response.Content.ReadAsStringAsync();

                        // 解析JSON
                        JObject data = JObject.Parse(content);

                        if (data["checking"] != null && data["checking"].Value<bool>())
                        {
                            // 正在检测状态
                            resultArray[0] = "checking";
                            resultArray[1] = "primary";
                            resultArray[2] = "正在检测中...";

                            // 提取节点数据
                            resultArray[3] = data["proxyCount"]?.ToString() ?? "0";
                            resultArray[4] = data["progress"]?.ToString() ?? "0";
                            resultArray[5] = data["available"]?.ToString() ?? "0";
                        }
                        else
                        {
                            // 空闲状态
                            resultArray[0] = "idle";
                            resultArray[1] = "success";
                            resultArray[2] = "空闲";

                            // 空闲时相关数据设为N/A
                            resultArray[3] = "N/A";
                            resultArray[4] = "N/A";
                            resultArray[5] = "N/A";
                        }
                    }
                    else
                    {
                        // 请求失败，例如未授权
                        resultArray[0] = "error";
                        resultArray[1] = "danger";
                        resultArray[2] = $"API请求失败: {(int)response.StatusCode}";
                        resultArray[3] = "N/A";
                        resultArray[4] = "N/A";
                        resultArray[5] = "N/A";
                    }
                }
            }
            catch (Exception ex)
            {
                // 发生异常
                resultArray[0] = "error";
                resultArray[1] = "danger";
                resultArray[2] = $"获取状态失败: {ex.Message}";
                resultArray[3] = "N/A";
                resultArray[4] = "N/A";
                resultArray[5] = "N/A";

                // 可选：记录错误到日志
                Log($"获取API状态失败: {ex.Message}", true);
            }

            return resultArray;
        }

        private async void timer4_Tick(object sender, EventArgs e)
        {
            //if (!button7.Enabled) button7.Enabled = true;
            string[] subscheck状态 = await GetApiStatusAsync();
            string 状态类型 = subscheck状态[0];
            string 状态图标类别 = subscheck状态[1];
            string 状态文本 = subscheck状态[2];
            string 节点总数 = subscheck状态[3];
            string 进度百分比 = subscheck状态[4];
            string 可用节点数量 = subscheck状态[5];
            // 更新状态文本

            if (状态类型 == "checking")
            {
                button7.Text = "⏸ 暂停";
                nodeInfo = $"({进度百分比}/{节点总数}) 可用: {可用节点数量}";
                int nodeTotal = int.Parse(节点总数);
                if (nodeTotal > 0) {
                    int 进度条百分比 = int.Parse(进度百分比) * 100 / nodeTotal;
                    progressBar1.Value = 进度条百分比;
                    if (!button7.Enabled) button7.Enabled = true;
                }

                // 确保通知图标文本不超过63个字符
                string notifyText = "SubsCheck: " + nodeInfo;
                if (notifyText.Length > 63)
                {
                    notifyText = notifyText.Substring(0, 60) + "...";
                }
                notifyIcon1.Text = notifyText;
                textBox1.Enabled = false;
            }
            else if (状态类型 == "idle")
            {
                button7.Text = "⏯ 开始";
                progressBar1.Value = 100;
                nodeInfo = $"等待{nextCheckTime}";
                notifyIcon1.Text = "SubsCheck: 已就绪\n" + nextCheckTime; ;
                textBox1.Enabled = true;
            }
            else if (状态类型 == "error")
            {
                button7.Text = "🔀 未知";
                nodeInfo = 状态文本;
            }
            groupBox2.Text = $"实时日志 {nodeInfo}";
        }

        private async void button7_Click(object sender, EventArgs e)
        {
            button7.Enabled = false;
            timer4.Enabled = false;

            try
            {
                bool isSuccess;

                if (button7.Text == "⏯ 开始")
                {
                    isSuccess = await SendApiRequestAsync("/api/trigger-check", "节点检查");
                    if (isSuccess)
                    {
                        button7.Text = "⏸ 暂停";
                        textBox1.Enabled = false; // 检查开始后禁用订阅编辑
                    }
                }
                else // "⏸ 暂停"
                {
                    isSuccess = await SendApiRequestAsync("/api/force-close", "强制关闭");
                }

                // 如果请求失败，更新按钮状态为未知
                if (!isSuccess) button7.Text = "🔀 未知";
            }
            finally
            {
                // 无论成功失败都重新启用定时器和按钮
                timer4.Enabled = true;
                timer4.Start();
                //button7.Enabled = true;
            }
        }

        /// <summary>
        /// 发送API请求到SubsCheck服务
        /// </summary>
        /// <param name="endpoint">API端点路径</param>
        /// <param name="operationName">操作名称(用于日志)</param>
        /// <returns>操作是否成功</returns>
        private async Task<bool> SendApiRequestAsync(string endpoint, string operationName)
        {
            try
            {
                // 获取API基础地址和API密钥
                string baseUrl = $"http://127.0.0.1:{numericUpDown6.Value}";

                using (HttpClient client = new HttpClient())
                {
                    client.BaseAddress = new Uri(baseUrl);
                    client.DefaultRequestHeaders.Add("X-API-Key", WebUIapiKey);
                    client.Timeout = TimeSpan.FromSeconds(10);

                    // 发送POST请求
                    HttpResponseMessage response = await client.PostAsync(endpoint, new StringContent(""));

                    // 检查响应状态
                    if (response.IsSuccessStatusCode)
                    {
                        Log($"成功{operationName}");
                        return true;
                    }
                    else
                    {
                        string errorContent = await response.Content.ReadAsStringAsync();
                        Log($"{operationName}失败: HTTP {(int)response.StatusCode} {response.ReasonPhrase}\n{errorContent}", true);
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                Log($"{operationName}时发生错误: {ex.Message}", true);
                return false;
            }
        }

        private void textBox11_Leave(object sender, EventArgs e)
        {
            if (IsValidCronExpression(textBox11.Text))
            {
                // 计算并显示cron表达式的说明
                string cronDescription = GetCronExpressionDescription(textBox11.Text);
                // 可以用工具提示或者消息框显示，这里使用消息框
                //MessageBox.Show(cronDescription, "Cron表达式说明", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Log($"Cron表达式说明 {cronDescription}");
            }
            else
            {
                MessageBox.Show("请输入有效的cron表达式，例如：*/30 * * * *", "无效的cron表达式",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox11.Focus();
                textBox11.Text = "0 */2 * * *"; // 恢复默认值
            }
        }

        /// <summary>
        /// 验证输入文本是否是合法的cron表达式
        /// </summary>
        /// <returns>如果是合法的cron表达式，则返回true；否则返回false</returns>
        private bool IsValidCronExpression(string cron表达式)
        {
            string cronExpression = cron表达式.Trim();

            // 如果是空字符串，则不是有效表达式
            if (string.IsNullOrWhiteSpace(cronExpression))
                return false;

            // 分割cron表达式为5个部分：分钟 小时 日期 月份 星期
            string[] parts = cronExpression.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            // cron表达式必须有5个部分
            if (parts.Length != 5)
                return false;

            try
            {
                // 验证每个部分
                // 分钟 (0-59)
                if (!IsValidCronField(parts[0], 0, 59))
                    return false;

                // 小时 (0-23)
                if (!IsValidCronField(parts[1], 0, 23))
                    return false;

                // 日期 (1-31)
                if (!IsValidCronField(parts[2], 1, 31))
                    return false;

                // 月份 (1-12)
                if (!IsValidCronField(parts[3], 1, 12))
                    return false;

                // 星期 (0-7，0和7都表示星期日)
                if (!IsValidCronField(parts[4], 0, 7))
                    return false;

                return true;
            }
            catch
            {
                return false;
            }
        }

        /// <summary>
        /// 验证cron表达式中的单个字段是否合法
        /// </summary>
        /// <param name="field">字段值</param>
        /// <param name="min">最小允许值</param>
        /// <param name="max">最大允许值</param>
        /// <returns>如果字段合法，则返回true；否则返回false</returns>
        private bool IsValidCronField(string field, int min, int max)
        {
            // 处理通配符 "*"
            if (field == "*")
                return true;

            // 处理步长 "*/n"
            if (field.StartsWith("*/"))
            {
                string stepStr = field.Substring(2);
                if (int.TryParse(stepStr, out int step))
                    return step > 0 && step <= max;
                return false;
            }

            // 处理范围 "n-m"
            if (field.Contains("-"))
            {
                string[] range = field.Split('-');
                if (range.Length != 2)
                    return false;

                if (int.TryParse(range[0], out int start) && int.TryParse(range[1], out int end))
                    return start >= min && end <= max && start <= end;
                return false;
            }

            // 处理列表 "n,m,k"
            if (field.Contains(","))
            {
                string[] values = field.Split(',');
                foreach (string item in values)
                {
                    if (!int.TryParse(item, out int itemValue) || itemValue < min || itemValue > max)
                        return false;
                }
                return true;
            }

            // 处理单个数字
            if (int.TryParse(field, out int fieldValue))
                return fieldValue >= min && fieldValue <= max;

            return false;
        }

        /// <summary>
        /// 获取cron表达式的友好文本说明
        /// </summary>
        /// <param name="cron表达式">要解析的cron表达式</param>
        /// <returns>返回cron表达式的执行时间说明</returns>
        private string GetCronExpressionDescription(string cron表达式)
        {
            try
            {
                string cronExpression = cron表达式.Trim();
                string[] parts = cronExpression.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                if (parts.Length != 5)
                    return "无效的cron表达式";

                // 分别解析每个部分
                string minuteDesc = ParseCronPart(parts[0], "分钟", 0, 59);
                string hourDesc = ParseCronPart(parts[1], "小时", 0, 23);
                string dayDesc = ParseCronPart(parts[2], "日", 1, 31);
                string monthDesc = ParseCronPart(parts[3], "月", 1, 12);
                string weekDesc = ParseCronPart(parts[4], "星期", 0, 7, true);

                // 组合最终说明
                string description = "执行时间: ";

                // 月份
                if (monthDesc != "每月")
                    description += monthDesc + "的";

                // 星期与日期的关系
                if (parts[2] == "*" && parts[4] != "*")
                    description += weekDesc + "的";
                else if (parts[2] != "*" && parts[4] == "*")
                    description += dayDesc;
                else if (parts[2] != "*" && parts[4] != "*")
                    description += $"{dayDesc}或{weekDesc}";
                else
                    description += "每天";

                // 时间（小时:分钟）
                description += $"{hourDesc}{minuteDesc}";

                return description;
            }
            catch
            {
                return "无法解析cron表达式";
            }
        }

        /// <summary>
        /// 解析cron表达式的单个部分
        /// </summary>
        private string ParseCronPart(string part, string unit, int min, int max, bool isWeekday = false)
        {
            // 处理星号，表示每个时间单位
            if (part == "*")
            {
                return $"每{unit}";
            }

            // 处理步长 */n
            if (part.StartsWith("*/"))
            {
                int step = int.Parse(part.Substring(2));
                return $"每{step}{unit}";
            }

            // 处理范围 n-m
            if (part.Contains("-"))
            {
                string[] range = part.Split('-');
                int start = int.Parse(range[0]);
                int end = int.Parse(range[1]);

                if (isWeekday)
                {
                    string[] weekdays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
                    return $"从{weekdays[start]}到{weekdays[end]}";
                }

                return $"从{start}{unit}到{end}{unit}";
            }

            // 处理列表 n,m,k
            if (part.Contains(","))
            {
                string[] values = part.Split(',');
                if (isWeekday)
                {
                    string[] weekdays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
                    return string.Join("、", values.Select(v => weekdays[int.Parse(v)]));
                }
                return $"{string.Join("、", values)}{unit}";
            }

            // 处理单个数字
            int value = int.Parse(part);
            if (isWeekday)
            {
                string[] weekdays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
                return weekdays[value];
            }
            return $"{value}{unit}";
        }

        private void 切换cron表达式(object sender, EventArgs e)
        {
            if (textBox11.Visible)
            {
                textBox11.Visible = false;
                label2.Visible = true;
                numericUpDown2.Visible = true;
                Log("下次检查时间间隔 使用分钟倒计时");
            }
            else
            {
                textBox11.Location = new Point(9, 48);
                textBox11.Visible = true;
                label2.Visible = false;
                numericUpDown2.Visible = false;
                Log("下次检查时间间隔 使用cron表达式");
            }
        }

        /// <summary>
        /// 获取计算机名的MD5哈希值
        /// </summary>
        /// <returns>返回计算机名的MD5哈希字符串(32位小写)</returns>
        private string GetComputerNameMD5()
        {
            try
            {
                // 获取计算机名
                string computerName = System.Environment.MachineName;

                // 引入必要的命名空间
                using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
                {
                    // 将计算机名转换为字节数组
                    byte[] inputBytes = System.Text.Encoding.UTF8.GetBytes(computerName);

                    // 计算MD5哈希值
                    byte[] hashBytes = md5.ComputeHash(inputBytes);

                    // 将字节数组转换为十六进制字符串
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < hashBytes.Length; i++)
                    {
                        sb.Append(hashBytes[i].ToString("x2"));
                    }

                    return sb.ToString();
                }
            }
            catch (Exception ex)
            {
                Log($"计算计算机名MD5时出错: {ex.Message}", true);
                return "CMLiussss";
            }
        }

        // 添加辅助下载方法
        async Task<bool> DownloadFileAsync(HttpClient httpClient, string url, string filePath)
        {
            try
            {
                // 获取文件大小
                HttpResponseMessage headResponse = await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, url));
                headResponse.EnsureSuccessStatusCode(); // 确保请求成功
                long totalBytes = headResponse.Content.Headers.ContentLength ?? 0;

                // 下载文件
                using (var response = await httpClient.GetAsync(url, HttpCompletionOption.ResponseHeadersRead))
                {
                    response.EnsureSuccessStatusCode(); // 确保请求成功

                    using (var contentStream = await response.Content.ReadAsStreamAsync())
                    using (var fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None, 8192, true))
                    {
                        byte[] buffer = new byte[8192];
                        long totalBytesRead = 0;
                        int bytesRead;

                        while ((bytesRead = await contentStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
                        {
                            await fileStream.WriteAsync(buffer, 0, bytesRead);
                            totalBytesRead += bytesRead;

                            // 更新进度条
                            if (totalBytes > 0)
                            {
                                int progressPercentage = (int)((totalBytesRead * 100) / totalBytes);
                                progressPercentage = Math.Min(100, Math.Max(0, progressPercentage));
                                progressBar1.Value = progressPercentage;
                            }
                        }
                    }
                }

                return true; // 下载成功
            }
            catch
            {
                throw; // 重新抛出异常，让调用者处理
            }
        }

        private static about aboutWindow = null;
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // 检查窗口是否已经打开
            if (aboutWindow != null && !aboutWindow.IsDisposed)
            {
                // 窗口已经存在，激活它
                aboutWindow.Activate();
                return;
            }

            // 需要创建新窗口
            this.BeginInvoke(new Action(() =>
            {
                // 创建about窗口实例
                aboutWindow = new about();

                // 传递版本号信息
                aboutWindow.GuiVersion = 当前GUI版本号;
                aboutWindow.CoreVersion = 当前subsCheck版本号;

                // 添加窗口关闭时的处理，清除静态引用
                aboutWindow.FormClosed += (s, args) => aboutWindow = null;

                // 非模态显示窗口
                aboutWindow.Show(this);

                // 设置TopMost确保窗口显示在最前面
                aboutWindow.TopMost = true;
            }));
        }

        private void button8_Click(object sender, EventArgs e)
        {
            try
            {
                // 创建MoreYAML窗口实例
                MoreYAML moreYamlWindow = new MoreYAML();

                // 显示为模态对话框，这会阻塞主线程直到窗口关闭
                DialogResult result = moreYamlWindow.ShowDialog(this);

                // 如果需要，可以处理对话框的返回结果
                if (result == DialogResult.OK)
                {
                    // 用户点击了"确定"或某种完成操作的按钮
                    Log("补充参数配置已成功保存到 more.yaml 文件！设置已应用");
                }
            }
            catch (Exception ex)
            {
                Log($"打开MoreYAML窗口时出错: {ex.Message}", true);
                MessageBox.Show($"打开MoreYAML窗口时出错: {ex.Message}", "错误",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private async void checkBox5_CheckedChanged(object sender, EventArgs e)
        {
            checkBox5.Enabled = false;
            try
            {
                // 获取当前应用程序的可执行文件路径
                string appPath = Application.ExecutablePath;
                // 获取应用程序名称（不包含扩展名）
                string appName = Path.GetFileNameWithoutExtension(appPath);
                // 获取启动文件夹的路径
                string startupFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
                // 快捷方式文件的完整路径
                string shortcutPath = Path.Combine(startupFolderPath, $"{appName}.lnk");

                if (checkBox5.Checked)
                {
                    // 检查启动文件夹中是否已存在该快捷方式
                    if (File.Exists(shortcutPath))
                    {
                        Log("开机启动项已存在，无需重复创建");
                    }
                    else
                    {
                        // 创建快捷方式
                        CreateShortcut(appPath, shortcutPath, "-auto");
                        Log("已成功创建开机启动项，下次电脑启动时将自动运行程序");
                    }
                }
                else
                {
                    // 删除启动项
                    if (File.Exists(shortcutPath))
                    {
                        File.Delete(shortcutPath);
                        Log("已移除开机启动项，下次开机将不会自动启动");
                    }
                }
            }
            catch (Exception ex)
            {
                Log($"设置开机启动项时出错: {ex.Message}", true);
                MessageBox.Show($"设置开机启动项失败: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

                // 恢复CheckBox状态，避免UI状态与实际状态不一致
                checkBox5.CheckedChanged -= checkBox5_CheckedChanged;
                checkBox5.Checked = !checkBox5.Checked;
                checkBox5.CheckedChanged += checkBox5_CheckedChanged;
            }
            checkBox5.Enabled = true;
            await SaveConfig(false);
        }

        /// <summary>
        /// 创建指向指定路径应用程序的快捷方式
        /// </summary>
        /// <param name="targetPath">目标应用程序的完整路径</param>
        /// <param name="shortcutPath">要创建的快捷方式的完整路径</param>
        /// <param name="arguments">可选的启动参数</param>
        private void CreateShortcut(string targetPath, string shortcutPath, string arguments = "")
        {
            // 使用COM接口创建快捷方式
            Type t = Type.GetTypeFromProgID("WScript.Shell");
            dynamic shell = Activator.CreateInstance(t);
            var shortcut = shell.CreateShortcut(shortcutPath);

            shortcut.TargetPath = targetPath;
            if (!string.IsNullOrEmpty(arguments))
                shortcut.Arguments = arguments; // 设置启动参数

            shortcut.WorkingDirectory = Path.GetDirectoryName(targetPath);
            shortcut.WindowStyle = 7; // 最小化启动: 7, 正常启动: 1, 最大化启动: 3
            shortcut.Description = "SubsCheck Win GUI自启动快捷方式";
            shortcut.IconLocation = targetPath + ",0"; // 使用应用程序自身的图标

            // 保存快捷方式
            shortcut.Save();

            // 释放COM对象
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(shortcut);
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(shell);
        }

        /// <summary>
        /// 检查启动参数中是否包含指定的参数
        /// </summary>
        /// <param name="parameterName">要检查的参数名称，例如"-autoup"</param>
        /// <returns>如果存在指定参数，则返回true；否则返回false</returns>
        private bool CheckCommandLineParameter(string parameterName)
        {
            // 获取命令行参数数组
            string[] args = Environment.GetCommandLineArgs();

            // 遍历所有参数，检查是否有匹配的参数
            foreach (string arg in args)
            {
                // 不区分大小写比较
                if (string.Equals(arg, parameterName, StringComparison.OrdinalIgnoreCase))
                {
                    return true;
                }
            }

            return false;
        }

        private void richTextBox1_DoubleClick(object sender, EventArgs e)
        {
            // 检查是否有日志内容
            if (richTextBox1.TextLength > 0)
            {
                // 显示确认对话框，询问用户是否要清空日志
                DialogResult result = MessageBox.Show(
                    "是否要清空当前日志？",
                    "清空日志确认",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button2); // 默认选择"否"按钮

                if (result == DialogResult.Yes)
                {
                    // 清空richTextBox1内容
                    richTextBox1.Clear();
                    // 记录一条清空日志的操作信息
                    Log("日志已清空");
                }
            }
        }

        private void numericUpDown4_ValueChanged(object sender, EventArgs e)
        {
            if (numericUpDown4.Value > 4096)
            {
                string warningMessage =
                    "⚠ 测速下限设置提醒 ⚠\n\n" +
                    "您设置的测速下限值过高，可能导致：\n\n" +
                    "• 可用节点数量显著减少\n" +
                    "• 部分低速但稳定的节点被过滤\n" +
                    "测速下限设置建议：\n" +
                    "• 日常浏览：512-1024 KB/s\n" +
                    "• 视频观看：1024-2048 KB/s\n" +
                    "• 大文件下载：根据实际需求设置\n";

                Log(warningMessage);
            }
        }

        private void numericUpDown3_ValueChanged(object sender, EventArgs e)
        {
            if (numericUpDown3.Value < 5000)
            {
                string warningMessage =
                    "⚠ 超时时间设置提醒 ⚠\n\n" +
                    "该超时时间并非延迟时间，除非您的网络极其优秀，否则超时时间过低会导致无可用节点。\n\n" +
                    "• 超时时间是真连接测试的最大等待时间\n" +
                    "• 设置过低会导致大部分节点连接失败\n" +
                    "• 推荐设置不低于5000ms\n\n" +
                    "建议超时时间设置：\n" +
                    "• 普通网络环境：5000± ms\n" +
                    "• 极好网络环境：3000± ms\n";

                Log(warningMessage);
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace subs_check.win.gui
{
    public partial class EditURLs: Form
    {
        // 添加一个属性用于存储和传递文本内容
        public string UrlContent { get; set; }
        public System.Windows.Forms.ComboBox.ObjectCollection githubProxys { get; set; }
        public string githubProxy { get; set; }
        string githubProxyURL;
        string SubsCheckURLs;
        public EditURLs()
        {
            InitializeComponent();

            // 设置textBox1的锚点为上、左、右
            textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;

            // 设置button1、button2、button3的锚点为左、下
            button1.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            button2.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            button3.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;

            // 设置button4的锚点为右、下
            button4.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
        }

        // 加载窗体时处理传入的内容
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // 将传入的内容显示在textBox1中
            if (!string.IsNullOrEmpty(UrlContent)) textBox1.Text = UrlContent;

            timer1.Enabled = true;

            if (githubProxys != null)
            {
                comboBox1.Items.Clear();
                foreach (var item in githubProxys)
                {
                    comboBox1.Items.Add(item);
                }
            }
            if (!string.IsNullOrEmpty(githubProxy)) comboBox1.Text = githubProxy;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // 将textBox1的内容保存到UrlContent属性
            UrlContent = textBox1.Text;

            // 设置对话框结果为OK并关闭窗口
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            // 确保有内容需要处理
            if (string.IsNullOrWhiteSpace(textBox1.Text))
                return;

            // 按行分割文本
            string[] lines = textBox1.Text.Split(
                new[] { "\r\n", "\r", "\n" },
                StringSplitOptions.RemoveEmptyEntries);

            // 去除每行首尾的空白字符
            for (int i = 0; i < lines.Length; i++)
            {
                lines[i] = lines[i].Trim();
            }

            // 使用LINQ的Distinct()方法去重，并过滤掉空行
            string[] uniqueLines = lines
                .Where(line => !string.IsNullOrWhiteSpace(line))
                .Distinct(StringComparer.OrdinalIgnoreCase) // 忽略大小写进行去重
                .ToArray();

            // 将去重后的内容设回textBox1
            textBox1.Text = string.Join(Environment.NewLine, uniqueLines) + "\n";

            // 可选：显示去重结果
            int removed = lines.Length - uniqueLines.Length;
            if (removed > 0)
            {
                MessageBox.Show($"已移除 {removed} 个重复行。", "去重完成",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("没有发现重复行。", "去重完成",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

        private async void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;

            if (comboBox1.Text == "自动选择")
            {
                // 创建不包含"自动选择"的代理列表
                List<string> proxyItems = new List<string>();
                for (int j = 0; j < comboBox1.Items.Count; j++)
                {
                    string proxyItem = comboBox1.Items[j].ToString();
                    if (proxyItem != "自动选择")
                        proxyItems.Add(proxyItem);
                }

                // 随机打乱列表顺序
                Random random = new Random();
                proxyItems = proxyItems.OrderBy(x => random.Next()).ToList();

                // 异步检测可用代理
                githubProxyURL = await DetectGitHubProxyAsync(proxyItems);
            }
            else
            {
                githubProxyURL = $"https://{comboBox1.Text}/";
            }

            string SubsCheckURLsURL = $"{githubProxyURL}https://raw.githubusercontent.com/cmliu/cmliu/main/SubsCheck-URLs";
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.Timeout = TimeSpan.FromSeconds(5); // 设置5秒超时
                    client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win32; x86) AppleWebKit/537.36 (KHTML, like Gecko) cmliu/SubsCheck-Win-GUI");

                    // 使用异步方式检查URL可访问性
                    HttpResponseMessage response = await client.GetAsync(SubsCheckURLsURL);
                    if (response.IsSuccessStatusCode)
                    {
                        button2.Text = "在线获取";
                        button2.Enabled = true;
                        SubsCheckURLs = await response.Content.ReadAsStringAsync();
                        //MessageBox.Show(SubsCheckURLs);
                    }
                    else
                    {
                        button2.Text = "获取失败";
                        button2.Enabled = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                // 网络错误或其他异常情况
                button2.Text = "获取失败";
                button2.Enabled = false;
            }
        }

        // 创建专用方法用于异步检测GitHub代理
        private async Task<string> DetectGitHubProxyAsync(List<string> proxyItems)
        {
            string detectedProxyURL = "";

            // 遍历随机排序后的代理列表
            foreach (string proxyItem in proxyItems)
            {
                string checkUrl = $"https://{proxyItem}/https://raw.githubusercontent.com/cmliu/SubsCheck-Win-GUI/master/packages.config";

                try
                {
                    using (HttpClient client = new HttpClient())
                    {
                        client.Timeout = TimeSpan.FromSeconds(5); // 设置5秒超时
                                                                  // 添加User-Agent头，避免被拒绝访问
                        client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win32; x86) AppleWebKit/537.36 (KHTML, like Gecko) cmliu/SubsCheck-Win-GUI");

                        // 使用异步方式
                        HttpResponseMessage response = await client.GetAsync(checkUrl);
                        if (response.IsSuccessStatusCode)
                        {
                            // 找到可用代理
                            detectedProxyURL = $"https://{proxyItem}/";
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    // 记录错误但继续尝试下一个
                    Console.WriteLine($"Error: {ex.Message}");
                }
            }
            return detectedProxyURL;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            // 检查是否已成功获取在线内容
            if (string.IsNullOrEmpty(SubsCheckURLs))
            {
                MessageBox.Show("未能获取在线内容，请重试。", "获取失败",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // 显示带有"覆盖"和"追加"选项的对话框
            DialogResult result = MessageBox.Show(
                "请选择如何处理获取到的内容：\n\n" +
                "- 点击【是】将覆盖当前内容\n" +
                "- 点击【否】将追加到当前内容后面\n" +
                "- 点击【取消】不做任何操作",
                "操作选择",
                MessageBoxButtons.YesNoCancel,
                MessageBoxIcon.Question);

            // 根据用户选择执行对应操作
            if (result == DialogResult.Yes)
            {
                // 覆盖操作
                // 确保所有换行符格式一致 (将单独的\n或\r替换为Windows风格的\r\n)
                string normalizedText = NormalizeLineEndings(SubsCheckURLs);
                textBox1.Text = normalizedText;
                MessageBox.Show("已用在线内容覆盖原有内容。", "感谢大自然的馈赠",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (result == DialogResult.No)
            {
                // 追加操作
                // 确保原有内容末尾有换行符
                if (!textBox1.Text.EndsWith("\r\n") && !textBox1.Text.EndsWith("\n"))
                {
                    textBox1.Text += Environment.NewLine;
                }

                // 追加新内容，确保换行符格式一致
                textBox1.Text += NormalizeLineEndings(SubsCheckURLs);
                MessageBox.Show("已将在线内容追加到原有内容后。", "感谢大自然的馈赠",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            // 如果用户选择"取消"，不执行任何操作
        }

        // 标准化文本中的换行符为Windows风格 (\r\n)
        private string NormalizeLineEndings(string text)
        {
            if (string.IsNullOrEmpty(text))
                return string.Empty;

            // 先将所有类型的换行符替换为\n
            text = text.Replace("\r\n", "\n").Replace("\r", "\n");
            // 然后将\n替换为\r\n
            text = text.Replace("\n", Environment.NewLine);

            return text;
        }

    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace subs_check.win.gui
{
    public partial class MoreYAML : Form
    {
        string 初始化;
        public MoreYAML()
        {
            InitializeComponent();

            // 移除文本框的等待光标
            textBox1.UseWaitCursor = false;
            初始化 = textBox1.Text;

            // 设置 groupBox1 的 Anchor 属性，使其跟随窗体四边缩放
            groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;

            // 设置文本框跟随 groupBox1 缩放
            textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;

            // 设置 linkLabel1 固定在右上角
            linkLabel1.Anchor = AnchorStyles.Top | AnchorStyles.Right;

            // 设置按钮固定在底部
            button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
            button3.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
            button2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            // 检查并加载配置文件
            LoadMoreYamlConfig();
        }

        /// <summary>
        /// 检查并加载 more.yaml 配置文件
        /// </summary>
        private void LoadMoreYamlConfig()
        {
            try
            {
                // 获取当前程序的执行路径
                string executablePath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
                // 指定config目录路径
                string configFolderPath = System.IO.Path.Combine(executablePath, "config");
                // 指定more.yaml文件的完整路径
                string moreYamlFilePath = System.IO.Path.Combine(configFolderPath, "more.yaml");

                // 检查文件是否存在
                if (System.IO.File.Exists(moreYamlFilePath))
                {
                    // 读取文件内容并赋值给textBox1
                    string yamlContent = System.IO.File.ReadAllText(moreYamlFilePath, Encoding.UTF8);
                    textBox1.Text = yamlContent;
                }
            }
            catch (Exception ex)
            {
                // 读取文件时出错，可以选择是否显示错误信息
                MessageBox.Show($"读取配置文件时发生错误：{ex.Message}", "提示",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://github.com/beck-8/subs-check/blob/master/config/config.example.yaml");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                // 验证textbox1的内容是否符合YAML格式
                if (!IsValidYaml(textBox1.Text))
                {
                    MessageBox.Show("输入的内容不符合YAML格式，请检查后重试！", "格式错误",
                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                // 获取当前程序的执行路径
                string executablePath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
                // 指定config目录路径
                string configFolderPath = System.IO.Path.Combine(executablePath, "config");
                // 指定more.yaml文件的完整路径
                string moreYamlFilePath = System.IO.Path.Combine(configFolderPath, "more.yaml");

                // 确保config目录存在
                if (!System.IO.Directory.Exists(configFolderPath))
                {
                    System.IO.Directory.CreateDirectory(configFolderPath);
                }

                // 将textBox1的内容写入more.yaml文件
                System.IO.File.WriteAllText(moreYamlFilePath, textBox1.Text, Encoding.UTF8);

                // 设置对话框结果为OK并关闭窗口
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"保存配置文件时发生错误：{ex.Message}", "错误",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        /// <summary>
        /// 验证字符串是否为有效的YAML格式
        /// </summary>
        /// <param name="yamlContent">要验证的YAML字符串</param>
        /// <returns>如果是有效的YAML格式，返回true；否则返回false</returns>
        private bool IsValidYaml(string yamlContent)
        {
            if (string.IsNullOrWhiteSpace(yamlContent))
                return true; // 空内容被视为有效（可以根据需要更改）

            try
            {
                // 使用YamlDotNet尝试解析YAML内容
                var deserializer = new YamlDotNet.Serialization.Deserializer();
                deserializer.Deserialize<object>(yamlContent);
                return true;
            }
            catch (YamlDotNet.Core.YamlException)
            {
                // 捕获YAML解析异常，表示格式无效
                return false;
            }
            catch (Exception)
            {
                // 其他异常也视为格式无效
                return false;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.Text = 初始化;
        }
    }
}

using System;
using System.Windows.Forms;
using System.Diagnostics;

namespace subs_check.win.gui
{
    public partial class about : Form
    {
        // 添加两个公共属性来接收版本号
        public string GuiVersion { set { label2.Text = value; } }
        public string CoreVersion { set { label3.Text = value; } }

        public about()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://github.com/beck-8/subs-check");
        }

        private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://t.me/CMLiussss");
        }

        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://url.cmliussss.com/SCWinGUI");
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://github.com/cmliu/SubsCheck-Win-GUI");
        }

        private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://github.com/beck-8/subs-check");
        }

        private void linkLabel6_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://github.com/bestruirui/BestSub");
        }

        private void linkLabel8_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://github.com/sub-store-org/Sub-Store");
        }
    }
}

namespace subs_check.win.gui
{
    partial class Form1
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源，为 true；否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要修改
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.checkBox5 = new System.Windows.Forms.CheckBox();
            this.textBox11 = new System.Windows.Forms.TextBox();
            this.button7 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.comboBox4 = new System.Windows.Forms.ComboBox();
            this.button3 = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
            this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
            this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
            this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
            this.label7 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.button2 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.label8 = new System.Windows.Forms.Label();
            this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
            this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.numericUpDown7 = new System.Windows.Forms.NumericUpDown();
            this.label20 = new System.Windows.Forms.Label();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.linkLabel1 = new System.Windows.Forms.LinkLabel();
            this.button5 = new System.Windows.Forms.Button();
            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.button8 = new System.Windows.Forms.Button();
            this.textBox10 = new System.Windows.Forms.TextBox();
            this.checkBox4 = new System.Windows.Forms.CheckBox();
            this.numericUpDown8 = new System.Windows.Forms.NumericUpDown();
            this.checkBox3 = new System.Windows.Forms.CheckBox();
            this.button4 = new System.Windows.Forms.Button();
            this.checkBox1 = new System.Windows.Forms.CheckBox();
            this.checkBox2 = new System.Windows.Forms.CheckBox();
            this.comboBox5 = new System.Windows.Forms.ComboBox();
            this.label19 = new System.Windows.Forms.Label();
            this.comboBox3 = new System.Windows.Forms.ComboBox();
            this.label10 = new System.Windows.Forms.Label();
            this.comboBox2 = new System.Windows.Forms.ComboBox();
            this.label9 = new System.Windows.Forms.Label();
            this.progressBar1 = new System.Windows.Forms.ProgressBar();
            this.timer2 = new System.Windows.Forms.Timer(this.components);
            this.groupBox4 = new System.Windows.Forms.GroupBox();
            this.textBox4 = new System.Windows.Forms.TextBox();
            this.label13 = new System.Windows.Forms.Label();
            this.textBox3 = new System.Windows.Forms.TextBox();
            this.label12 = new System.Windows.Forms.Label();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.label11 = new System.Windows.Forms.Label();
            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
            this.groupBox5 = new System.Windows.Forms.GroupBox();
            this.textBox6 = new System.Windows.Forms.TextBox();
            this.label15 = new System.Windows.Forms.Label();
            this.textBox7 = new System.Windows.Forms.TextBox();
            this.label16 = new System.Windows.Forms.Label();
            this.groupBox6 = new System.Windows.Forms.GroupBox();
            this.textBox5 = new System.Windows.Forms.TextBox();
            this.label14 = new System.Windows.Forms.Label();
            this.textBox8 = new System.Windows.Forms.TextBox();
            this.label17 = new System.Windows.Forms.Label();
            this.textBox9 = new System.Windows.Forms.TextBox();
            this.label18 = new System.Windows.Forms.Label();
            this.timer3 = new System.Windows.Forms.Timer(this.components);
            this.timer4 = new System.Windows.Forms.Timer(this.components);
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).BeginInit();
            this.groupBox2.SuspendLayout();
            this.groupBox3.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).BeginInit();
            this.groupBox4.SuspendLayout();
            this.groupBox5.SuspendLayout();
            this.groupBox6.SuspendLayout();
            this.SuspendLayout();
            //
            // notifyIcon1
            //
            this.notifyIcon1.BalloonTipTitle = "Subs-Check";
            this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
            this.notifyIcon1.Text = "Subs-Check：未运行";
            this.notifyIcon1.Visible = true;
            this.notifyIcon1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseClick);
            //
            // timer1
            //
            this.timer1.Enabled = true;
            this.timer1.Interval = 1;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.checkBox5);
            this.groupBox1.Controls.Add(this.textBox11);
            this.groupBox1.Controls.Add(this.button7);
            this.groupBox1.Controls.Add(this.button6);
            this.groupBox1.Controls.Add(this.comboBox4);
            this.groupBox1.Controls.Add(this.button3);
            this.groupBox1.Controls.Add(this.textBox1);
            this.groupBox1.Controls.Add(this.comboBox1);
            this.groupBox1.Controls.Add(this.numericUpDown4);
            this.groupBox1.Controls.Add(this.numericUpDown3);
            this.groupBox1.Controls.Add(this.numericUpDown2);
            this.groupBox1.Controls.Add(this.numericUpDown1);
            this.groupBox1.Controls.Add(this.label7);
            this.groupBox1.Controls.Add(this.label6);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.button2);
            this.groupBox1.Controls.Add(this.button1);
            this.groupBox1.Controls.Add(this.label8);
            this.groupBox1.Location = new System.Drawing.Point(13, 13);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(174, 484);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "参数设置";
            //
            // checkBox5
            //
            this.checkBox5.AutoSize = true;
            this.checkBox5.Location = new System.Drawing.Point(91, 428);
            this.checkBox5.Name = "checkBox5";
            this.checkBox5.Size = new System.Drawing.Size(72, 16);
            this.checkBox5.TabIndex = 30;
            this.checkBox5.Text = "开机自启";
            this.checkBox5.UseVisualStyleBackColor = true;
            this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
            //
            // textBox11
            //
            this.textBox11.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBox11.Location = new System.Drawing.Point(9, 343);
            this.textBox11.Name = "textBox11";
            this.textBox11.Size = new System.Drawing.Size(154, 21);
            this.textBox11.TabIndex = 21;
            this.textBox11.Text = "0 */2 * * *";
            this.textBox11.Visible = false;
            this.textBox11.DoubleClick += new System.EventHandler(this.切换cron表达式);
            this.textBox11.Leave += new System.EventHandler(this.textBox11_Leave);
            //
            // button7
            //
            this.button7.Enabled = false;
            this.button7.Location = new System.Drawing.Point(7, 399);
            this.button7.Name = "button7";
            this.button7.Size = new System.Drawing.Size(75, 23);
            this.button7.TabIndex = 30;
            this.button7.Text = "🔀未启动";
            this.button7.UseVisualStyleBackColor = true;
            this.button7.Click += new System.EventHandler(this.button7_Click);
            //
            // button6
            //
            this.button6.Enabled = false;
            this.button6.Location = new System.Drawing.Point(88, 399);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(75, 23);
            this.button6.TabIndex = 29;
            this.button6.Text = "访问WebUI";
            this.button6.UseVisualStyleBackColor = true;
            this.button6.Click += new System.EventHandler(this.button6_Click);
            //
            // comboBox4
            //
            this.comboBox4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBox4.FormattingEnabled = true;
            this.comboBox4.Items.AddRange(new object[] {
            "通用订阅",
            "Clash"});
            this.comboBox4.Location = new System.Drawing.Point(8, 372);
            this.comboBox4.Name = "comboBox4";
            this.comboBox4.Size = new System.Drawing.Size(74, 20);
            this.comboBox4.TabIndex = 19;
            //
            // button3
            //
            this.button3.Enabled = false;
            this.button3.Location = new System.Drawing.Point(88, 370);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(75, 23);
            this.button3.TabIndex = 18;
            this.button3.Text = "复制订阅";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            //
            // textBox1
            //
            this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBox1.Location = new System.Drawing.Point(9, 179);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.ReadOnly = true;
            this.textBox1.Size = new System.Drawing.Size(154, 185);
            this.textBox1.TabIndex = 17;
            this.textBox1.Text = resources.GetString("textBox1.Text");
            this.textBox1.WordWrap = false;
            this.textBox1.Click += new System.EventHandler(this.textBox1_DoubleClick);
            this.textBox1.DoubleClick += new System.EventHandler(this.textBox1_DoubleClick);
            //
            // comboBox1
            //
            this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Items.AddRange(new object[] {
            "本地",
            "gist",
            "r2",
            "webdav"});
            this.comboBox1.Location = new System.Drawing.Point(105, 135);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new System.Drawing.Size(58, 20);
            this.comboBox1.TabIndex = 16;
            this.comboBox1.TextChanged += new System.EventHandler(this.comboBox1_TextChanged);
            //
            // numericUpDown4
            //
            this.numericUpDown4.Location = new System.Drawing.Point(105, 106);
            this.numericUpDown4.Maximum = new decimal(new int[] {
            20480,
            0,
            0,
            0});
            this.numericUpDown4.Minimum = new decimal(new int[] {
            128,
            0,
            0,
            0});
            this.numericUpDown4.Name = "numericUpDown4";
            this.numericUpDown4.Size = new System.Drawing.Size(58, 21);
            this.numericUpDown4.TabIndex = 13;
            this.numericUpDown4.Value = new decimal(new int[] {
            1024,
            0,
            0,
            0});
            this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged);
            //
            // numericUpDown3
            //
            this.numericUpDown3.Location = new System.Drawing.Point(105, 77);
            this.numericUpDown3.Maximum = new decimal(new int[] {
            10000,
            0,
            0,
            0});
            this.numericUpDown3.Minimum = new decimal(new int[] {
            1000,
            0,
            0,
            0});
            this.numericUpDown3.Name = "numericUpDown3";
            this.numericUpDown3.Size = new System.Drawing.Size(58, 21);
            this.numericUpDown3.TabIndex = 12;
            this.numericUpDown3.Value = new decimal(new int[] {
            5000,
            0,
            0,
            0});
            this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged);
            //
            // numericUpDown2
            //
            this.numericUpDown2.Location = new System.Drawing.Point(105, 48);
            this.numericUpDown2.Maximum = new decimal(new int[] {
            1440,
            0,
            0,
            0});
            this.numericUpDown2.Minimum = new decimal(new int[] {
            30,
            0,
            0,
            0});
            this.numericUpDown2.Name = "numericUpDown2";
            this.numericUpDown2.Size = new System.Drawing.Size(58, 21);
            this.numericUpDown2.TabIndex = 11;
            this.numericUpDown2.Value = new decimal(new int[] {
            120,
            0,
            0,
            0});
            this.numericUpDown2.DoubleClick += new System.EventHandler(this.切换cron表达式);
            //
            // numericUpDown1
            //
            this.numericUpDown1.Location = new System.Drawing.Point(105, 19);
            this.numericUpDown1.Maximum = new decimal(new int[] {
            1024,
            0,
            0,
            0});
            this.numericUpDown1.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.numericUpDown1.Name = "numericUpDown1";
            this.numericUpDown1.Size = new System.Drawing.Size(58, 21);
            this.numericUpDown1.TabIndex = 10;
            this.numericUpDown1.Value = new decimal(new int[] {
            32,
            0,
            0,
            0});
            this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
            //
            // label7
            //
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(7, 137);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(65, 12);
            this.label7.TabIndex = 8;
            this.label7.Text = "保存方法：";
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(7, 108);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(101, 12);
            this.label6.TabIndex = 5;
            this.label6.Text = "测速下限(KB/s)：";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(7, 79);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(101, 12);
            this.label3.TabIndex = 4;
            this.label3.Text = "超时时间(毫秒)：";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(7, 50);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(101, 12);
            this.label2.TabIndex = 3;
            this.label2.Text = "检查间隔(分钟)：";
            this.label2.DoubleClick += new System.EventHandler(this.切换cron表达式);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(7, 21);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(77, 12);
            this.label1.TabIndex = 2;
            this.label1.Text = "并发线程数：";
            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(88, 450);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(75, 23);
            this.button2.TabIndex = 1;
            this.button2.Text = "高级设置∧";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // button1
            //
            this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button1.Location = new System.Drawing.Point(7, 428);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 45);
            this.button1.TabIndex = 0;
            this.button1.Text = "▶ 启动";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // label8
            //
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(7, 164);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(161, 12);
            this.label8.TabIndex = 9;
            this.label8.Text = "节点池订阅链接(点击编辑)：";
            this.label8.Click += new System.EventHandler(this.textBox1_DoubleClick);
            //
            // numericUpDown6
            //
            this.numericUpDown6.Location = new System.Drawing.Point(281, 19);
            this.numericUpDown6.Maximum = new decimal(new int[] {
            65535,
            0,
            0,
            0});
            this.numericUpDown6.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.numericUpDown6.Name = "numericUpDown6";
            this.numericUpDown6.Size = new System.Drawing.Size(58, 21);
            this.numericUpDown6.TabIndex = 15;
            this.numericUpDown6.Value = new decimal(new int[] {
            8199,
            0,
            0,
            0});
            this.numericUpDown6.ValueChanged += new System.EventHandler(this.numericUpDown6_ValueChanged);
            //
            // numericUpDown5
            //
            this.numericUpDown5.Location = new System.Drawing.Point(281, 45);
            this.numericUpDown5.Maximum = new decimal(new int[] {
            10,
            0,
            0,
            0});
            this.numericUpDown5.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.numericUpDown5.Name = "numericUpDown5";
            this.numericUpDown5.Size = new System.Drawing.Size(58, 21);
            this.numericUpDown5.TabIndex = 14;
            this.numericUpDown5.Value = new decimal(new int[] {
            10,
            0,
            0,
            0});
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(191, 21);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(89, 12);
            this.label4.TabIndex = 7;
            this.label4.Text = "HTTP服务端口：";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(191, 48);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(89, 12);
            this.label5.TabIndex = 6;
            this.label5.Text = "测速时间(秒)：";
            //
            // numericUpDown7
            //
            this.numericUpDown7.Location = new System.Drawing.Point(441, 19);
            this.numericUpDown7.Maximum = new decimal(new int[] {
            65535,
            0,
            0,
            0});
            this.numericUpDown7.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.numericUpDown7.Name = "numericUpDown7";
            this.numericUpDown7.Size = new System.Drawing.Size(58, 21);
            this.numericUpDown7.TabIndex = 21;
            this.numericUpDown7.Value = new decimal(new int[] {
            8299,
            0,
            0,
            0});
            this.numericUpDown7.ValueChanged += new System.EventHandler(this.numericUpDown6_ValueChanged);
            //
            // label20
            //
            this.label20.AutoSize = true;
            this.label20.Location = new System.Drawing.Point(345, 21);
            this.label20.Name = "label20";
            this.label20.Size = new System.Drawing.Size(95, 12);
            this.label20.TabIndex = 20;
            this.label20.Text = "Sub-Store端口：";
            //
            // groupBox2
            //
            this.groupBox2.Controls.Add(this.linkLabel1);
            this.groupBox2.Controls.Add(this.button5);
            this.groupBox2.Controls.Add(this.richTextBox1);
            this.groupBox2.Location = new System.Drawing.Point(193, 13);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(600, 484);
            this.groupBox2.TabIndex = 1;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "实时日志";
            //
            // linkLabel1
            //
            this.linkLabel1.AutoSize = true;
            this.linkLabel1.Location = new System.Drawing.Point(460, 2);
            this.linkLabel1.Name = "linkLabel1";
            this.linkLabel1.Size = new System.Drawing.Size(137, 12);
            this.linkLabel1.TabIndex = 21;
            this.linkLabel1.TabStop = true;
            this.linkLabel1.Text = "关于 SubsCheck Win GUI";
            this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
            //
            // button5
            //
            this.button5.Location = new System.Drawing.Point(515, 450);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(75, 23);
            this.button5.TabIndex = 20;
            this.button5.Text = "更新内核";
            this.button5.UseVisualStyleBackColor = true;
            this.button5.Visible = false;
            this.button5.Click += new System.EventHandler(this.button5_Click);
            //
            // richTextBox1
            //
            this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.richTextBox1.Location = new System.Drawing.Point(3, 17);
            this.richTextBox1.Name = "richTextBox1";
            this.richTextBox1.ReadOnly = true;
            this.richTextBox1.Size = new System.Drawing.Size(594, 464);
            this.richTextBox1.TabIndex = 0;
            this.richTextBox1.Text = "";
            this.richTextBox1.DoubleClick += new System.EventHandler(this.richTextBox1_DoubleClick);
            //
            // groupBox3
            //
            this.groupBox3.Controls.Add(this.button8);
            this.groupBox3.Controls.Add(this.textBox10);
            this.groupBox3.Controls.Add(this.checkBox4);
            this.groupBox3.Controls.Add(this.numericUpDown8);
            this.groupBox3.Controls.Add(this.checkBox3);
            this.groupBox3.Controls.Add(this.button4);
            this.groupBox3.Controls.Add(this.checkBox1);
            this.groupBox3.Controls.Add(this.numericUpDown6);
            this.groupBox3.Controls.Add(this.checkBox2);
            this.groupBox3.Controls.Add(this.numericUpDown5);
            this.groupBox3.Controls.Add(this.comboBox5);
            this.groupBox3.Controls.Add(this.label19);
            this.groupBox3.Controls.Add(this.comboBox3);
            this.groupBox3.Controls.Add(this.label10);
            this.groupBox3.Controls.Add(this.label4);
            this.groupBox3.Controls.Add(this.comboBox2);
            this.groupBox3.Controls.Add(this.label9);
            this.groupBox3.Controls.Add(this.label5);
            this.groupBox3.Controls.Add(this.numericUpDown7);
            this.groupBox3.Controls.Add(this.label20);
            this.groupBox3.Location = new System.Drawing.Point(13, 503);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(780, 103);
            this.groupBox3.TabIndex = 2;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "高级设置";
            this.groupBox3.Visible = false;
            //
            // button8
            //
            this.button8.Location = new System.Drawing.Point(695, 43);
            this.button8.Name = "button8";
            this.button8.Size = new System.Drawing.Size(75, 23);
            this.button8.TabIndex = 29;
            this.button8.Text = "补充参数";
            this.button8.UseVisualStyleBackColor = true;
            this.button8.Click += new System.EventHandler(this.button8_Click);
            //
            // textBox10
            //
            this.textBox10.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBox10.Enabled = false;
            this.textBox10.Location = new System.Drawing.Point(141, 73);
            this.textBox10.Name = "textBox10";
            this.textBox10.PasswordChar = '*';
            this.textBox10.Size = new System.Drawing.Size(110, 21);
            this.textBox10.TabIndex = 6;
            this.textBox10.Text = "admin";
            this.textBox10.Enter += new System.EventHandler(this.textBox10_Enter);
            this.textBox10.Leave += new System.EventHandler(this.textBox10_Leave);
            //
            // checkBox4
            //
            this.checkBox4.AutoSize = true;
            this.checkBox4.Location = new System.Drawing.Point(9, 75);
            this.checkBox4.Name = "checkBox4";
            this.checkBox4.Size = new System.Drawing.Size(138, 16);
            this.checkBox4.TabIndex = 28;
            this.checkBox4.Text = "启用WebUI API密钥：";
            this.checkBox4.UseVisualStyleBackColor = true;
            this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
            //
            // numericUpDown8
            //
            this.numericUpDown8.Enabled = false;
            this.numericUpDown8.Location = new System.Drawing.Point(122, 45);
            this.numericUpDown8.Maximum = new decimal(new int[] {
            65535,
            0,
            0,
            0});
            this.numericUpDown8.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.numericUpDown8.Name = "numericUpDown8";
            this.numericUpDown8.Size = new System.Drawing.Size(58, 21);
            this.numericUpDown8.TabIndex = 22;
            this.numericUpDown8.Value = new decimal(new int[] {
            100,
            0,
            0,
            0});
            //
            // checkBox3
            //
            this.checkBox3.AutoSize = true;
            this.checkBox3.Location = new System.Drawing.Point(9, 48);
            this.checkBox3.Name = "checkBox3";
            this.checkBox3.Size = new System.Drawing.Size(108, 16);
            this.checkBox3.TabIndex = 27;
            this.checkBox3.Text = "节点保存数目：";
            this.checkBox3.UseVisualStyleBackColor = true;
            this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
            //
            // button4
            //
            this.button4.Location = new System.Drawing.Point(695, 71);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(75, 23);
            this.button4.TabIndex = 26;
            this.button4.Text = "检查更新";
            this.button4.UseVisualStyleBackColor = true;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            //
            // checkBox1
            //
            this.checkBox1.AutoSize = true;
            this.checkBox1.Checked = true;
            this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox1.Location = new System.Drawing.Point(9, 20);
            this.checkBox1.Name = "checkBox1";
            this.checkBox1.Size = new System.Drawing.Size(96, 16);
            this.checkBox1.TabIndex = 22;
            this.checkBox1.Text = "节点地址查询";
            this.checkBox1.UseVisualStyleBackColor = true;
            this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
            //
            // checkBox2
            //
            this.checkBox2.AutoSize = true;
            this.checkBox2.Location = new System.Drawing.Point(106, 20);
            this.checkBox2.Name = "checkBox2";
            this.checkBox2.Size = new System.Drawing.Size(84, 16);
            this.checkBox2.TabIndex = 25;
            this.checkBox2.Text = "流媒体检测";
            this.checkBox2.UseVisualStyleBackColor = true;
            this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
            //
            // comboBox5
            //
            this.comboBox5.FormattingEnabled = true;
            this.comboBox5.Items.AddRange(new object[] {
            "[内置]布丁狗的订阅转换",
            "[内置]ACL4SSR_Online_Full",
            "https://raw.githubusercontent.com/mihomo-party-org/override-hub/main/yaml/布丁狗的订阅转" +
                "换.yaml",
            "https://raw.githubusercontent.com/mihomo-party-org/override-hub/main/yaml/ACL4SSR" +
                "_Online_Full.yaml",
            "https://raw.githubusercontent.com/mihomo-party-org/override-hub/main/yaml/ACL4SSR" +
                "_Online_Full_WithIcon.yaml",
            "https://raw.githubusercontent.com/mihomo-party-org/override-hub/main/yaml/添加直连规则." +
                "yaml",
            "https://fastly.jsdelivr.net/gh/mihomo-party-org/override-hub@main/yaml/布丁狗的订阅转换.y" +
                "aml",
            "https://fastly.jsdelivr.net/gh/mihomo-party-org/override-hub@main/yaml/ACL4SSR_On" +
                "line_Full.yaml",
            "https://fastly.jsdelivr.net/gh/mihomo-party-org/override-hub@main/yaml/ACL4SSR_On" +
                "line_Full_WithIcon.yaml",
            "https://fastly.jsdelivr.net/gh/mihomo-party-org/override-hub@main/yaml/添加直连规则.yam" +
                "l"});
            this.comboBox5.Location = new System.Drawing.Point(414, 73);
            this.comboBox5.Name = "comboBox5";
            this.comboBox5.Size = new System.Drawing.Size(275, 20);
            this.comboBox5.TabIndex = 24;
            this.comboBox5.SelectedIndexChanged += new System.EventHandler(this.comboBox5_SelectedIndexChanged);
            //
            // label19
            //
            this.label19.AutoSize = true;
            this.label19.Location = new System.Drawing.Point(260, 76);
            this.label19.Name = "label19";
            this.label19.Size = new System.Drawing.Size(149, 12);
            this.label19.TabIndex = 23;
            this.label19.Text = "Clash订阅 覆写配置文件：";
            //
            // comboBox3
            //
            this.comboBox3.FormattingEnabled = true;
            this.comboBox3.Items.AddRange(new object[] {
            "自动选择",
            "1.github.010716.xyz",
            "113355.kabaka.xyz",
            "80888888.xyz",
            "aa.w0x7ce.eu",
            "acc.meiqer.com",
            "api-ghp.fjy.zone",
            "armg1.jyhk.tk",
            "armg2.jyhk.tk",
            "b.yesican.top",
            "bakht1.jsdelivr.fyi",
            "bakht2.jsdelivr.fyi",
            "bakht3.jsdelivr.fyi",
            "booster.ookkk.ggff.net",
            "c.gatepro.cn",
            "cc.ikakatoo.us",
            "ccgit1.5gyh.cf",
            "ccgit2.5gyh.cf",
            "cdn-gh.141888.xyz",
            "cfghproxy.165683.xyz",
            "chirophy.online",
            "choner.eu.org",
            "d.scyun.top",
            "daili.6dot.cn",
            "dh.guluy.top",
            "dh.jeblove.com",
            "dl.github.mirror.shalo.link",
            "dnsvip.uk",
            "docker.bkxhkoo.com",
            "docker.ppp.ac.cn",
            "down.avi.gs",
            "download.ojbk.one",
            "download.serein.cc",
            "f.shenbing.nyc.mn",
            "fastgithub.starryfun.icu",
            "file.justgame.top",
            "ft.v1k1.xin",
            "fuck-flow.nobige.cn",
            "g.108964.xyz",
            "g.blfrp.cn",
            "g.bravexist.cn",
            "g.down.0ms.net",
            "g.jscdn.cn",
            "g.yeyuqiufeng.cn",
            "gh.136361.xyz",
            "gh.13x.plus",
            "gh.19121912.xyz",
            "gh.193.gs",
            "gh.220106.xyz",
            "gh.222322.xyz",
            "gh.244224659.xyz",
            "gh.2i.gs",
            "gh.316688.xyz",
            "gh.321122.xyz",
            "gh.334433.xyz",
            "gh.39.al",
            "gh.518298.xyz",
            "gh.52099520.xyz",
            "gh.654535.xyz",
            "gh.777000.best",
            "gh.799154.xyz",
            "gh.860686.xyz",
            "gh.8p.gs",
            "gh.960980.xyz",
            "gh.accn.eu.org",
            "gh.amirrors.com",
            "gh.andiest.com",
            "gh.aurzex.top",
            "gh.avmine.com",
            "gh.b52m.cn",
            "gh.bhexo.cn",
            "gh.cdn.fullcone.cn",
            "gh.chewable.eu.org",
            "gh.chillwaytech.com",
            "gh.cnbattle.com",
            "gh.crond.dev",
            "gh.dev.438250.xyz",
            "gh.duang.io",
            "gh.duckcc.com",
            "gh.dwsy.link",
            "gh.ecdn.ip-ddns.com",
            "gh.flewsea.news",
            "gh.flewsea.pw",
            "gh.flyrr.cc",
            "gh.gongyi.tk",
            "gh.gorun.eu.org",
            "gh.gxb.pub",
            "gh.haloless.com",
            "gh.heshiheng.top",
            "gh.hitcs.cc",
            "gh.i3.pw",
            "gh.ibridge.eu.org",
            "gh.iinx.top",
            "gh.j8.work",
            "gh.jadelive.top",
            "gh.jscdn.cn",
            "gh.jxq.io",
            "gh.kejilion.pro",
            "gh.kemon.ai",
            "gh.kmxm.online",
            "gh.lib.cx",
            "gh.lkwplus.com",
            "gh.lux1983.com",
            "gh.luzy.top",
            "gh.lyh.moe",
            "gh.miaomiao.video",
            "gh.micedns.cloudns.org",
            "gh.mirror.190211.xyz",
            "gh.mirror.coolfeature.top",
            "gh.moetools.net",
            "gh.momonomi.xyz",
            "gh.mrskye.cn",
            "gh.mtx72.cc",
            "gh.nekhill.top",
            "gh.nekorect.eu.org",
            "gh.nextfuture.top",
            "gh.oevery.me",
            "gh.oneproxy.top",
            "gh.opsproxy.com",
            "gh.osspub.cn",
            "gh.padao.fun",
            "gh.prlrr.com",
            "gh.pylas.xyz",
            "gh.qptf.eu.org",
            "gh.qsd.onl",
            "gh.qsq.one",
            "gh.rem.asia",
            "gh.riye.de",
            "gh.scy.ink",
            "gh.someo.top",
            "gh.stanl.ee",
            "gh.stewitch.com",
            "gh.suite.eu.org",
            "gh.tbw.wiki",
            "gh.tou.lu",
            "gh.tryxd.cn",
            "gh.uclort.com",
            "gh.wglee.org",
            "gh.wowforever.xyz",
            "gh.wuuu.cc",
            "gh.wwang.de",
            "gh.wygg.us.kg",
            "gh.xbzza.cn",
            "gh.xda.plus",
            "gh.yahool.com.cn",
            "gh.yushum.com",
            "ghac.760710.xyz",
            "ghacc.cpuhk.eu.org",
            "ghb.wglee.org",
            "gh-boost.oneboy.app",
            "gh-deno.mocn.top",
            "ghfast.top",
            "ghjs.131412.eu.org",
            "ghp.618032.xyz",
            "ghp.9e6.site",
            "ghp.dnsplus.uk",
            "ghp.fit2.fun",
            "ghp.imc.re",
            "ghp.jokeme.top",
            "ghp.lanchonghai.com",
            "ghp.miaostay.com",
            "ghp.opendatahub.xyz",
            "ghp.pbren.com",
            "ghp.src.moe",
            "ghp.tryanks.com",
            "ghp.vatery.com",
            "ghp.xiaopan.ai",
            "ghp.ybot.xin",
            "ghp.yeye.f5.si",
            "ghproxy.0081024.xyz",
            "ghproxy.053000.xyz",
            "ghproxy.200502.xyz",
            "ghproxy.943689.xyz",
            "ghproxy.alltobid.cc",
            "ghproxy.amayakite.xyz",
            "ghproxy.bugungu.top",
            "gh-proxy.dorz.tech",
            "ghproxy.dsdog.tk",
            "ghproxy.ducknet.work",
            "ghproxy.gopher.ink",
            "ghproxy.gpnu.org",
            "ghproxy.hoshizukimio.top",
            "gh-proxy.iflyelf.com",
            "ghproxy.imoyuapp.win",
            "gh-proxy.jacksixth.top",
            "gh-proxy.jmper.me",
            "ghproxy.joylian.com",
            "gh-proxy.just520.top",
            "ghproxy.licardo.vip",
            "gh-proxy.mereith.com",
            "ghproxy.minge.dev",
            "ghproxy.missfuture.eu.org",
            "ghproxy.moweilong.com",
            "ghproxy.nanakorobi.com",
            "ghproxy.net",
            "gh-proxy.not.icu",
            "ghproxy.ownyuan.top",
            "gh-proxy.rxliuli.com",
            "ghproxy.sakuramoe.dev",
            "ghproxy.smallfawn.work",
            "ghproxy.sveir.xyz",
            "ghproxy.temoa.fun",
            "ghproxy.thefoxnet.com",
            "ghproxy.tracemouse.top",
            "ghproxy.txq.life",
            "ghproxy.viper.pub",
            "ghproxy.vyronlee-lab.com",
            "ghproxy.weizhiwen.net",
            "ghproxy.wjsphy.top",
            "ghproxy.workers.haoutil.com",
            "ghproxy.xiaohei-studio-chatgpt-proxy.com.cn",
            "gh-proxy.yuntao.me",
            "git.1999111.xyz",
            "git.22345678.xyz",
            "git.40609891.xyz",
            "git.5gyh.cf",
            "git.988896.xyz",
            "git.aaltozz.info",
            "git.acap.cc",
            "git.amoluo.win",
            "git.anye.in",
            "git.binbow.link",
            "git.blaow.cloudns.org",
            "git.closersyu.top",
            "git.ifso.site",
            "git.imvery.moe",
            "git.ixdd.de",
            "git.ldvx.de",
            "git.lincloud.pro",
            "git.liunasc.xyz",
            "git.llvho.com",
            "git.loushi.site",
            "git.lzzz.ink",
            "git.maomao.ovh",
            "git.mokoc.live",
            "git.niege.app",
            "git.nyar.work",
            "git.o8.cx",
            "git.outtw.com",
            "git.ppp.ac.cn",
            "git.repcz.link",
            "git.txaff.com",
            "git.verynb.org",
            "git.wsl.icu",
            "git.wyy.sh",
            "git.xiny.eu.org",
            "git.xuantan.icu",
            "git.zlong.eu.org",
            "git3.openapi.site",
            "git-clone.ccrui.dev",
            "github.08050611.xyz",
            "github.143760.xyz",
            "github.170011.xyz",
            "github.17263241.xyz",
            "github.180280.xyz",
            "github.197909.xyz",
            "github.19890821.xyz",
            "github.201068.xyz",
            "github.333033.xyz",
            "github.4240333.xyz",
            "github.564456.xyz",
            "github.732086.xyz",
            "github.776884.xyz",
            "github.789056.xyz",
            "github.818668.xyz",
            "github.8void.sbs",
            "github.9394961.xyz",
            "github.960118.xyz",
            "github.abyss.moe",
            "github.atzzz.com",
            "github.axcio.dns-dynamic.net",
            "github.boki.moe",
            "github.boringhex.top",
            "github.bullb.net",
            "github.c1g.top",
            "github.cf.xihale.top",
            "github.chasun.top",
            "github.chuancey.eu.org",
            "github.cnxiaobai.com",
            "github.computerqwq.top",
            "github.cswklt.top",
            "github.ctios.cn",
            "github.ddlink.asia",
            "github.dockerspeed.site",
            "github.eejsq.net",
            "github.ffffffff0x.com",
            "github.gdzja.site",
            "github.haodiy.xyz",
            "github.hhh.sd",
            "github.hi.edu.rs",
            "github.hostscc.top",
            "github.hx208.top",
            "github.ilxyz.xyz",
            "github.intellisensing.tech",
            "github.jerryliang.win",
            "github.jimmyshjj.top",
            "github.jinenyy.vip",
            "github.jscdn.cn",
            "github.kidos.top",
            "github.kuugo.top",
            "github.lao.plus",
            "github.mayx.eu.org",
            "github.mirror.qlnu-sec.cn",
            "github.mirror.vurl.eu.org",
            "github.mirrors.hikafeng.com",
            "github.mistudio.top",
            "github.orangbus.cn",
            "github.pipers.cn",
            "github.proxy.zerozone.tech",
            "github.pxy.lnsee.com",
            "github.quickso.net",
            "github.ruxi.org",
            "github.sagolu.top",
            "github.serein.cc",
            "github.snakexgc.com",
            "github.space520.eu.org",
            "github.sssss.work",
            "github.static.cv",
            "github.suyijun.top",
            "github.try255.com",
            "github.unipus.site",
            "github.verynb.org",
            "github.vipchanel.com",
            "github.widiazine.top",
            "github.workers.lv10.ren",
            "github.workersnail.com",
            "github.xin-yu.cloud",
            "github.xiongmx.com",
            "github.xwb009.xyz",
            "github.xxlab.tech",
            "github.xxqq.de",
            "github.xykcloud.com",
            "github.yeep6.eu.org",
            "github.ylyhtools.top",
            "github.yoloarea.com",
            "github.yunfile.fun",
            "github.zhaolele.top",
            "github.zhou2008.cn",
            "github.zhulin240520.buzz",
            "github.zyhmifan.top",
            "githubacc.caiaiwan.com",
            "githubapi.jjchizha.com",
            "githubgo.856798.xyz",
            "github-proxy.ai-lulu.top",
            "github-proxy.caoayu.top",
            "github-proxy.explorexd.uk",
            "github-proxy.fjiabinc.cn",
            "github-proxy.sharefree.site",
            "githubproxy.unix.do",
            "github-quick.1ms.dev",
            "github-raw-download.nekhill.top",
            "githubsg.lilyya.top",
            "gitproxy.mrhjx.cn",
            "gitproxy.ozoo.top",
            "godlike.ezpull.top",
            "gp.19841106.xyz",
            "gp.dahe.now.cc",
            "gp.daxei.now.cc",
            "g-p.loli.us",
            "gp.ownorigin.top",
            "gt.changqqq.xyz",
            "gxb.pub",
            "hay.uxio.cn",
            "hg.19840228.top",
            "hh.newhappy.cf",
            "hk.114914.xyz",
            "hub.12138.3653655.xyz",
            "hub.326998.xyz",
            "hub.885666.xyz",
            "hub.fnas64.xin",
            "hub.jeblove.com",
            "hub.naloong.de",
            "hub.vps.861020.xyz",
            "hub.vvn.me",
            "hub.why-ing.top",
            "hub.xjl.ch",
            "jh.ussh.net",
            "jias.ayanjiu.top",
            "jiasu.iwtriptqt1016.eu.org",
            "jiasughapi.lingjun.cc",
            "jiasuqi.167889.xyz",
            "jisuan.xyz",
            "js.wd666.cloudns.biz",
            "l0l0l.cc",
            "m.seafood.loan",
            "mc.cn.eu.org",
            "mdv.162899.xyz",
            "micromatrix.gq",
            "mip.cnzzla.com",
            "my.iiso.site",
            "my.losesw.live",
            "mygh.api.xiaomao.eu.org",
            "nav.253874.net",
            "nav.cxycsx.vip",
            "nav.gjcloak.xyz",
            "nav.hgd1999.com",
            "nav.hoiho.cn",
            "nav.syss.fun",
            "nav.tossp.com",
            "nav.wxapp.xyz",
            "nav.yyxw.tk",
            "navs.itmax.cn",
            "neoz.chat",
            "noad.keliyan.top",
            "node2.txq.life",
            "or.tianba.eu.org",
            "p.jackyu.cn",
            "privateghproxy.iil.im",
            "proxy.191027.xyz",
            "proxy.atoposs.com",
            "proxy.ccc8.vip",
            "proxy.dragontea.cc",
            "proxy.fakups.cn",
            "proxydl.lcayun.cn",
            "proxy-gh.1l1.icu",
            "q-github.cnxiaobai.com",
            "ql.l50.top",
            "raw.nmd.im",
            "rst.567812.xyz",
            "static.kaixinwu.vip",
            "static.yiwangmeng.com",
            "t.992699.xyz",
            "tpe.corpa.me",
            "tube.20140301.xyz",
            "vps.pansen626.com",
            "wfgithub.xiaonuomi.ie.eu.org"});
            this.comboBox3.Location = new System.Drawing.Point(600, 19);
            this.comboBox3.Name = "comboBox3";
            this.comboBox3.Size = new System.Drawing.Size(170, 20);
            this.comboBox3.TabIndex = 21;
            this.comboBox3.Leave += new System.EventHandler(this.comboBox3_Leave);
            //
            // label10
            //
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(505, 21);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(89, 12);
            this.label10.TabIndex = 20;
            this.label10.Text = "Github Proxy：";
            //
            // comboBox2
            //
            this.comboBox2.FormattingEnabled = true;
            this.comboBox2.Items.AddRange(new object[] {
            "https://github.com/AaronFeng753/Waifu2x-Extension-GUI/releases/download/v2.21.12/" +
                "Waifu2x-Extension-GUI-v2.21.12-Portable.7z",
            "https://github.com/2dust/v2rayN/releases/download/7.10.4/v2rayN-windows-64-deskto" +
                "p.zip",
            "https://github.com/VSCodium/vscodium/releases/download/1.98.0.25067/codium-1.98.0" +
                ".25067-el9.aarch64.rpm"});
            this.comboBox2.Location = new System.Drawing.Point(414, 45);
            this.comboBox2.Name = "comboBox2";
            this.comboBox2.Size = new System.Drawing.Size(275, 20);
            this.comboBox2.TabIndex = 19;
            this.comboBox2.Text = "https://github.com/AaronFeng753/Waifu2x-Extension-GUI/releases/download/v2.21.12/" +
    "Waifu2x-Extension-GUI-v2.21.12-Portable.7z";
            //
            // label9
            //
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(344, 48);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(65, 12);
            this.label9.TabIndex = 18;
            this.label9.Text = "测速地址：";
            //
            // progressBar1
            //
            this.progressBar1.Location = new System.Drawing.Point(13, 3);
            this.progressBar1.Name = "progressBar1";
            this.progressBar1.Size = new System.Drawing.Size(780, 3);
            this.progressBar1.TabIndex = 3;
            //
            // timer2
            //
            this.timer2.Interval = 2000;
            this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
            //
            // groupBox4
            //
            this.groupBox4.Controls.Add(this.textBox4);
            this.groupBox4.Controls.Add(this.label13);
            this.groupBox4.Controls.Add(this.textBox3);
            this.groupBox4.Controls.Add(this.label12);
            this.groupBox4.Controls.Add(this.textBox2);
            this.groupBox4.Controls.Add(this.label11);
            this.groupBox4.Location = new System.Drawing.Point(13, 612);
            this.groupBox4.Name = "groupBox4";
            this.groupBox4.Size = new System.Drawing.Size(780, 51);
            this.groupBox4.TabIndex = 4;
            this.groupBox4.TabStop = false;
            this.groupBox4.Text = "Gist 上传参数";
            this.groupBox4.Visible = false;
            //
            // textBox4
            //
            this.textBox4.Location = new System.Drawing.Point(467, 18);
            this.textBox4.Name = "textBox4";
            this.textBox4.Size = new System.Drawing.Size(306, 21);
            this.textBox4.TabIndex = 5;
            //
            // label13
            //
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(359, 21);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(113, 12);
            this.label13.TabIndex = 4;
            this.label13.Text = "API Mirror(可选)：";
            //
            // textBox3
            //
            this.textBox3.Location = new System.Drawing.Point(253, 18);
            this.textBox3.Name = "textBox3";
            this.textBox3.PasswordChar = '*';
            this.textBox3.Size = new System.Drawing.Size(100, 21);
            this.textBox3.TabIndex = 3;
            this.textBox3.Enter += new System.EventHandler(this.textBox3_Enter);
            this.textBox3.Leave += new System.EventHandler(this.textBox3_Leave);
            //
            // label12
            //
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(168, 21);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(89, 12);
            this.label12.TabIndex = 2;
            this.label12.Text = "Github Token：";
            //
            // textBox2
            //
            this.textBox2.Location = new System.Drawing.Point(62, 18);
            this.textBox2.Name = "textBox2";
            this.textBox2.Size = new System.Drawing.Size(100, 21);
            this.textBox2.TabIndex = 1;
            //
            // label11
            //
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(7, 21);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(59, 12);
            this.label11.TabIndex = 0;
            this.label11.Text = "Gist ID：";
            //
            // toolTip1
            //
            this.toolTip1.AutoPopDelay = 5000;
            this.toolTip1.InitialDelay = 500;
            this.toolTip1.ReshowDelay = 500;
            this.toolTip1.ShowAlways = true;
            //
            // groupBox5
            //
            this.groupBox5.Controls.Add(this.textBox6);
            this.groupBox5.Controls.Add(this.label15);
            this.groupBox5.Controls.Add(this.textBox7);
            this.groupBox5.Controls.Add(this.label16);
            this.groupBox5.Location = new System.Drawing.Point(13, 669);
            this.groupBox5.Name = "groupBox5";
            this.groupBox5.Size = new System.Drawing.Size(780, 51);
            this.groupBox5.TabIndex = 6;
            this.groupBox5.TabStop = false;
            this.groupBox5.Text = "R2 上传参数";
            this.groupBox5.Visible = false;
            //
            // textBox6
            //
            this.textBox6.Location = new System.Drawing.Point(467, 18);
            this.textBox6.Name = "textBox6";
            this.textBox6.PasswordChar = '*';
            this.textBox6.Size = new System.Drawing.Size(306, 21);
            this.textBox6.TabIndex = 3;
            this.textBox6.Text = "1234567890";
            this.textBox6.Enter += new System.EventHandler(this.textBox3_Enter);
            this.textBox6.Leave += new System.EventHandler(this.textBox3_Leave);
            //
            // label15
            //
            this.label15.AutoSize = true;
            this.label15.Location = new System.Drawing.Point(382, 21);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(89, 12);
            this.label15.TabIndex = 2;
            this.label15.Text = "Worker Token：";
            //
            // textBox7
            //
            this.textBox7.Location = new System.Drawing.Point(88, 18);
            this.textBox7.Name = "textBox7";
            this.textBox7.Size = new System.Drawing.Size(285, 21);
            this.textBox7.TabIndex = 1;
            this.textBox7.Text = "https://example.worker.dev";
            this.textBox7.Leave += new System.EventHandler(this.textBox7_Leave);
            //
            // label16
            //
            this.label16.AutoSize = true;
            this.label16.Location = new System.Drawing.Point(7, 21);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(77, 12);
            this.label16.TabIndex = 0;
            this.label16.Text = "Worker URL：";
            //
            // groupBox6
            //
            this.groupBox6.Controls.Add(this.textBox5);
            this.groupBox6.Controls.Add(this.label14);
            this.groupBox6.Controls.Add(this.textBox8);
            this.groupBox6.Controls.Add(this.label17);
            this.groupBox6.Controls.Add(this.textBox9);
            this.groupBox6.Controls.Add(this.label18);
            this.groupBox6.Location = new System.Drawing.Point(13, 726);
            this.groupBox6.Name = "groupBox6";
            this.groupBox6.Size = new System.Drawing.Size(780, 51);
            this.groupBox6.TabIndex = 6;
            this.groupBox6.TabStop = false;
            this.groupBox6.Text = "Webdav 上传参数";
            this.groupBox6.Visible = false;
            //
            // textBox5
            //
            this.textBox5.Location = new System.Drawing.Point(467, 18);
            this.textBox5.Name = "textBox5";
            this.textBox5.Size = new System.Drawing.Size(306, 21);
            this.textBox5.TabIndex = 5;
            this.textBox5.Text = "https://example.com/dav/";
            //
            // label14
            //
            this.label14.AutoSize = true;
            this.label14.Location = new System.Drawing.Point(382, 21);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(77, 12);
            this.label14.TabIndex = 4;
            this.label14.Text = "Webdav URL：";
            //
            // textBox8
            //
            this.textBox8.Location = new System.Drawing.Point(257, 18);
            this.textBox8.Name = "textBox8";
            this.textBox8.PasswordChar = '*';
            this.textBox8.Size = new System.Drawing.Size(110, 21);
            this.textBox8.TabIndex = 3;
            this.textBox8.Text = "admin";
            this.textBox8.Enter += new System.EventHandler(this.textBox3_Enter);
            this.textBox8.Leave += new System.EventHandler(this.textBox3_Leave);
            //
            // label17
            //
            this.label17.AutoSize = true;
            this.label17.Location = new System.Drawing.Point(186, 21);
            this.label17.Name = "label17";
            this.label17.Size = new System.Drawing.Size(65, 12);
            this.label17.TabIndex = 2;
            this.label17.Text = "Password：";
            //
            // textBox9
            //
            this.textBox9.Location = new System.Drawing.Point(70, 18);
            this.textBox9.Name = "textBox9";
            this.textBox9.Size = new System.Drawing.Size(110, 21);
            this.textBox9.TabIndex = 1;
            this.textBox9.Text = "admin";
            //
            // label18
            //
            this.label18.AutoSize = true;
            this.label18.Location = new System.Drawing.Point(7, 21);
            this.label18.Name = "label18";
            this.label18.Size = new System.Drawing.Size(65, 12);
            this.label18.TabIndex = 0;
            this.label18.Text = "Username：";
            //
            // timer3
            //
            this.timer3.Interval = 86400000;
            this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
            //
            // timer4
            //
            this.timer4.Interval = 1000;
            this.timer4.Tick += new System.EventHandler(this.timer4_Tick);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.AutoSize = true;
            this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.ClientSize = new System.Drawing.Size(800, 784);
            this.Controls.Add(this.groupBox6);
            this.Controls.Add(this.groupBox5);
            this.Controls.Add(this.groupBox4);
            this.Controls.Add(this.groupBox3);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.progressBar1);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.Name = "Form1";
            this.Text = "SubsCheck Win GUI";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).EndInit();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).EndInit();
            this.groupBox4.ResumeLayout(false);
            this.groupBox4.PerformLayout();
            this.groupBox5.ResumeLayout(false);
            this.groupBox5.PerformLayout();
            this.groupBox6.ResumeLayout(false);
            this.groupBox6.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.NotifyIcon notifyIcon1;
        private System.Windows.Forms.Timer timer1;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.GroupBox groupBox3;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.NumericUpDown numericUpDown6;
        private System.Windows.Forms.NumericUpDown numericUpDown5;
        private System.Windows.Forms.NumericUpDown numericUpDown4;
        private System.Windows.Forms.NumericUpDown numericUpDown3;
        private System.Windows.Forms.NumericUpDown numericUpDown2;
        private System.Windows.Forms.NumericUpDown numericUpDown1;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.ComboBox comboBox1;
        private System.Windows.Forms.ComboBox comboBox2;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.ComboBox comboBox3;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.CheckBox checkBox1;
        private System.Windows.Forms.RichTextBox richTextBox1;
        private System.Windows.Forms.ProgressBar progressBar1;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Timer timer2;
        private System.Windows.Forms.GroupBox groupBox4;
        private System.Windows.Forms.TextBox textBox4;
        private System.Windows.Forms.Label label13;
        private System.Windows.Forms.TextBox textBox3;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.TextBox textBox2;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.ToolTip toolTip1;
        private System.Windows.Forms.GroupBox groupBox5;
        private System.Windows.Forms.TextBox textBox6;
        private System.Windows.Forms.Label label15;
        private System.Windows.Forms.TextBox textBox7;
        private System.Windows.Forms.Label label16;
        private System.Windows.Forms.GroupBox groupBox6;
        private System.Windows.Forms.TextBox textBox5;
        private System.Windows.Forms.Label label14;
        private System.Windows.Forms.TextBox textBox8;
        private System.Windows.Forms.Label label17;
        private System.Windows.Forms.TextBox textBox9;
        private System.Windows.Forms.Label label18;
        private System.Windows.Forms.Button button5;
        private System.Windows.Forms.ComboBox comboBox4;
        private System.Windows.Forms.NumericUpDown numericUpDown7;
        private System.Windows.Forms.Label label20;
        private System.Windows.Forms.Label label19;
        private System.Windows.Forms.ComboBox comboBox5;
        private System.Windows.Forms.CheckBox checkBox2;
        private System.Windows.Forms.Timer timer3;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.NumericUpDown numericUpDown8;
        private System.Windows.Forms.CheckBox checkBox3;
        private System.Windows.Forms.TextBox textBox10;
        private System.Windows.Forms.CheckBox checkBox4;
        private System.Windows.Forms.Button button6;
        private System.Windows.Forms.Timer timer4;
        private System.Windows.Forms.Button button7;
        private System.Windows.Forms.TextBox textBox11;
        private System.Windows.Forms.LinkLabel linkLabel1;
        private System.Windows.Forms.Button button8;
        private System.Windows.Forms.CheckBox checkBox5;
    }
}

//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:4.0.30319.42000
//
//     对此文件的更改可能会导致不正确的行为，并且如果
//     重新生成代码，这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace subs_check.win.gui.Properties {
    using System;

    /// <summary>
    ///   一个强类型的资源类，用于查找本地化的字符串等。
    /// </summary>
    // 此类是由 StronglyTypedResourceBuilder
    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
    // 若要添加或移除成员，请编辑 .ResX 文件，然后重新运行 ResGen
    // (以 /str 作为命令选项)，或重新生成 VS 项目。
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }

        /// <summary>
        ///   返回此类使用的缓存的 ResourceManager 实例。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("subs_check.win.gui.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   重写当前线程的 CurrentUICulture 属性，对
        ///   使用此强类型资源类的所有资源查找执行重写。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        /// <summary>
        ///   查找 System.Byte[] 类型的本地化资源。
        /// </summary>
        internal static byte[] going {
            get {
                object obj = ResourceManager.GetObject("going", resourceCulture);
                return ((byte[])(obj));
            }
        }
    }
}

namespace subs_check.win.gui
{
    partial class CheckUpdates
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.label4 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.label5 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.button2 = new System.Windows.Forms.Button();
            this.label7 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.label4);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.button1);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Location = new System.Drawing.Point(12, 12);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(144, 89);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "SubsCheck Win GUI";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(77, 37);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(53, 12);
            this.label4.TabIndex = 4;
            this.label4.Text = "v0.0.0.0";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(77, 17);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(53, 12);
            this.label3.TabIndex = 3;
            this.label3.Text = "v0.0.0.0";
            //
            // button1
            //
            this.button1.Enabled = false;
            this.button1.Location = new System.Drawing.Point(8, 57);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(122, 23);
            this.button1.TabIndex = 2;
            this.button1.Text = "正在获取版本";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(10, 37);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(65, 12);
            this.label2.TabIndex = 1;
            this.label2.Text = "当前版本：";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(10, 17);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(65, 12);
            this.label1.TabIndex = 0;
            this.label1.Text = "最新版本：";
            //
            // groupBox2
            //
            this.groupBox2.Controls.Add(this.label5);
            this.groupBox2.Controls.Add(this.label6);
            this.groupBox2.Controls.Add(this.button2);
            this.groupBox2.Controls.Add(this.label7);
            this.groupBox2.Controls.Add(this.label8);
            this.groupBox2.Location = new System.Drawing.Point(162, 12);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(144, 89);
            this.groupBox2.TabIndex = 5;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Subs-Check 内核";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(77, 37);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(53, 12);
            this.label5.TabIndex = 4;
            this.label5.Text = "v0.0.0.0";
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(77, 17);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(53, 12);
            this.label6.TabIndex = 3;
            this.label6.Text = "正在获取";
            //
            // button2
            //
            this.button2.Enabled = false;
            this.button2.Location = new System.Drawing.Point(8, 57);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(122, 23);
            this.button2.TabIndex = 2;
            this.button2.Text = "正在获取版本";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // label7
            //
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(10, 37);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(65, 12);
            this.label7.TabIndex = 1;
            this.label7.Text = "当前版本：";
            //
            // label8
            //
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(10, 17);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(65, 12);
            this.label8.TabIndex = 0;
            this.label8.Text = "最新版本：";
            //
            // timer1
            //
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            //
            // comboBox1
            //
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Location = new System.Drawing.Point(12, 107);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new System.Drawing.Size(294, 20);
            this.comboBox1.TabIndex = 23;
            this.comboBox1.Visible = false;
            //
            // CheckUpdates
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.AutoSize = true;
            this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.ClientSize = new System.Drawing.Size(319, 138);
            this.Controls.Add(this.comboBox1);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "CheckUpdates";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "检查更新";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Timer timer1;
        private System.Windows.Forms.ComboBox comboBox1;
    }
}

namespace subs_check.win.gui
{
    partial class about
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(about));
            this.button1 = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.linkLabel1 = new System.Windows.Forms.LinkLabel();
            this.label6 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.linkLabel2 = new System.Windows.Forms.LinkLabel();
            this.label8 = new System.Windows.Forms.Label();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.label13 = new System.Windows.Forms.Label();
            this.linkLabel4 = new System.Windows.Forms.LinkLabel();
            this.label12 = new System.Windows.Forms.Label();
            this.linkLabel3 = new System.Windows.Forms.LinkLabel();
            this.label11 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.label14 = new System.Windows.Forms.Label();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.label15 = new System.Windows.Forms.Label();
            this.linkLabel8 = new System.Windows.Forms.LinkLabel();
            this.linkLabel6 = new System.Windows.Forms.LinkLabel();
            this.linkLabel5 = new System.Windows.Forms.LinkLabel();
            this.groupBox4 = new System.Windows.Forms.GroupBox();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.label4 = new System.Windows.Forms.Label();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox3.SuspendLayout();
            this.groupBox4.SuspendLayout();
            this.SuspendLayout();
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(513, 619);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 0;
            this.button1.Text = "确定";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("微软雅黑", 24.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label1.Location = new System.Drawing.Point(10, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(354, 44);
            this.label1.TabIndex = 1;
            this.label1.Text = "SubsCheck-Win-GUI";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(113, 19);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(53, 12);
            this.label2.TabIndex = 2;
            this.label2.Text = "未知版本";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(113, 119);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(53, 12);
            this.label3.TabIndex = 3;
            this.label3.Text = "未知版本";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(18, 119);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(65, 12);
            this.label5.TabIndex = 5;
            this.label5.Text = "内核版本：";
            //
            // linkLabel1
            //
            this.linkLabel1.AutoSize = true;
            this.linkLabel1.Location = new System.Drawing.Point(113, 39);
            this.linkLabel1.Name = "linkLabel1";
            this.linkLabel1.Size = new System.Drawing.Size(257, 12);
            this.linkLabel1.TabIndex = 6;
            this.linkLabel1.TabStop = true;
            this.linkLabel1.Text = "https://github.com/cmliu/SubsCheck-Win-GUI";
            this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(18, 139);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(89, 12);
            this.label6.TabIndex = 8;
            this.label6.Text = "内核项目地址：";
            //
            // label7
            //
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(18, 39);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(65, 12);
            this.label7.TabIndex = 7;
            this.label7.Text = "项目地址：";
            //
            // linkLabel2
            //
            this.linkLabel2.AutoSize = true;
            this.linkLabel2.Location = new System.Drawing.Point(113, 139);
            this.linkLabel2.Name = "linkLabel2";
            this.linkLabel2.Size = new System.Drawing.Size(221, 12);
            this.linkLabel2.TabIndex = 9;
            this.linkLabel2.TabStop = true;
            this.linkLabel2.Text = "https://github.com/beck-8/subs-check";
            this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
            //
            // label8
            //
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(18, 159);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(317, 12);
            this.label8.TabIndex = 10;
            this.label8.Text = "基于.NET Framework 4.7.2 开发  开源协议：MIT License";
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.label4);
            this.groupBox1.Controls.Add(this.label13);
            this.groupBox1.Controls.Add(this.linkLabel4);
            this.groupBox1.Controls.Add(this.label12);
            this.groupBox1.Controls.Add(this.linkLabel3);
            this.groupBox1.Controls.Add(this.label11);
            this.groupBox1.Controls.Add(this.label10);
            this.groupBox1.Controls.Add(this.label9);
            this.groupBox1.Controls.Add(this.label8);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.linkLabel2);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.label6);
            this.groupBox1.Controls.Add(this.label5);
            this.groupBox1.Controls.Add(this.label7);
            this.groupBox1.Controls.Add(this.linkLabel1);
            this.groupBox1.Location = new System.Drawing.Point(12, 105);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(576, 183);
            this.groupBox1.TabIndex = 11;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "基本信息：";
            //
            // label13
            //
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(113, 59);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(215, 12);
            this.label13.TabIndex = 17;
            this.label13.Text = "CM 就是这么简单！就是这么方便！！！";
            //
            // linkLabel4
            //
            this.linkLabel4.AutoSize = true;
            this.linkLabel4.Location = new System.Drawing.Point(113, 79);
            this.linkLabel4.Name = "linkLabel4";
            this.linkLabel4.Size = new System.Drawing.Size(47, 12);
            this.linkLabel4.TabIndex = 16;
            this.linkLabel4.TabStop = true;
            this.linkLabel4.Text = "Youtube";
            this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked);
            //
            // label12
            //
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(18, 79);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(65, 12);
            this.label12.TabIndex = 15;
            this.label12.Text = "视频教程：";
            //
            // linkLabel3
            //
            this.linkLabel3.AutoSize = true;
            this.linkLabel3.Location = new System.Drawing.Point(113, 99);
            this.linkLabel3.Name = "linkLabel3";
            this.linkLabel3.Size = new System.Drawing.Size(89, 12);
            this.linkLabel3.TabIndex = 14;
            this.linkLabel3.TabStop = true;
            this.linkLabel3.Text = "Telegram交流群";
            this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked);
            //
            // label11
            //
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(18, 99);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(65, 12);
            this.label11.TabIndex = 13;
            this.label11.Text = "联系方式：";
            //
            // label10
            //
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(18, 59);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(53, 12);
            this.label10.TabIndex = 12;
            this.label10.Text = "开发者：";
            //
            // label9
            //
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(18, 19);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(65, 12);
            this.label9.TabIndex = 11;
            this.label9.Text = "当前版本：";
            //
            // groupBox2
            //
            this.groupBox2.Controls.Add(this.label14);
            this.groupBox2.Location = new System.Drawing.Point(12, 58);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(576, 41);
            this.groupBox2.TabIndex = 12;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "软件简介：";
            //
            // label14
            //
            this.label14.AutoSize = true;
            this.label14.Location = new System.Drawing.Point(18, 19);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(365, 12);
            this.label14.TabIndex = 0;
            this.label14.Text = "节点测速与订阅管理工具，可帮助用户测试、筛选和管理网络节点。";
            //
            // groupBox3
            //
            this.groupBox3.Controls.Add(this.label15);
            this.groupBox3.Controls.Add(this.linkLabel8);
            this.groupBox3.Controls.Add(this.linkLabel6);
            this.groupBox3.Controls.Add(this.linkLabel5);
            this.groupBox3.Location = new System.Drawing.Point(12, 294);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(576, 43);
            this.groupBox3.TabIndex = 13;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "诚挚感谢下列开源项目及其维护者为软件开发提供的支持（排名不分先后，未能及时列出也会心存感激）";
            //
            // label15
            //
            this.label15.AutoSize = true;
            this.label15.Location = new System.Drawing.Point(201, 19);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(65, 12);
            this.label15.TabIndex = 19;
            this.label15.Text = "ChatGPT 等";
            //
            // linkLabel8
            //
            this.linkLabel8.AutoSize = true;
            this.linkLabel8.Location = new System.Drawing.Point(136, 19);
            this.linkLabel8.Name = "linkLabel8";
            this.linkLabel8.Size = new System.Drawing.Size(59, 12);
            this.linkLabel8.TabIndex = 20;
            this.linkLabel8.TabStop = true;
            this.linkLabel8.Text = "Sub-Store";
            this.linkLabel8.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel8_LinkClicked);
            //
            // linkLabel6
            //
            this.linkLabel6.AutoSize = true;
            this.linkLabel6.Location = new System.Drawing.Point(65, 19);
            this.linkLabel6.Name = "linkLabel6";
            this.linkLabel6.Size = new System.Drawing.Size(65, 12);
            this.linkLabel6.TabIndex = 19;
            this.linkLabel6.TabStop = true;
            this.linkLabel6.Text = "bestruirui";
            this.linkLabel6.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel6_LinkClicked);
            //
            // linkLabel5
            //
            this.linkLabel5.AutoSize = true;
            this.linkLabel5.Location = new System.Drawing.Point(18, 19);
            this.linkLabel5.Name = "linkLabel5";
            this.linkLabel5.Size = new System.Drawing.Size(41, 12);
            this.linkLabel5.TabIndex = 18;
            this.linkLabel5.TabStop = true;
            this.linkLabel5.Text = "beck-8";
            this.linkLabel5.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel5_LinkClicked);
            //
            // groupBox4
            //
            this.groupBox4.Controls.Add(this.textBox1);
            this.groupBox4.Location = new System.Drawing.Point(12, 343);
            this.groupBox4.Name = "groupBox4";
            this.groupBox4.Size = new System.Drawing.Size(576, 270);
            this.groupBox4.TabIndex = 14;
            this.groupBox4.TabStop = false;
            this.groupBox4.Text = "使用条款 与 免责声明";
            //
            // textBox1
            //
            this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBox1.Location = new System.Drawing.Point(6, 20);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.ReadOnly = true;
            this.textBox1.Size = new System.Drawing.Size(564, 244);
            this.textBox1.TabIndex = 0;
            this.textBox1.Text = resources.GetString("textBox1.Text");
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(166, 79);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(390, 12);
            this.label4.TabIndex = 18;
            this.label4.Text = "公益项目！请给我一个免费的点赞和订阅！ヾ(≧∇≦*)ゝ万分感谢！！！";
            //
            // about
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.AutoSize = true;
            this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.ClientSize = new System.Drawing.Size(598, 651);
            this.Controls.Add(this.groupBox4);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.groupBox3);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.label1);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "about";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "关于 SubsCheck Win GUI";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.groupBox4.ResumeLayout(false);
            this.groupBox4.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.LinkLabel linkLabel1;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.LinkLabel linkLabel2;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.LinkLabel linkLabel3;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.LinkLabel linkLabel4;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.Label label13;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Label label14;
        private System.Windows.Forms.GroupBox groupBox3;
        private System.Windows.Forms.LinkLabel linkLabel6;
        private System.Windows.Forms.LinkLabel linkLabel5;
        private System.Windows.Forms.Label label15;
        private System.Windows.Forms.LinkLabel linkLabel8;
        private System.Windows.Forms.GroupBox groupBox4;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Label label4;
    }
}

using System;
using System.Threading;
using System.Windows.Forms;

namespace subs_check.win.gui
{
    static class Program
    {
        // 定义一个全局唯一的标识符，使用项目名称作为互斥体的名称
        private static string appMutexName = "cmliu/SubsCheck-Win-GUI";
        private static Mutex mutex;

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            // 尝试创建一个命名互斥体，如果已存在，则获取它
            bool createdNew;
            mutex = new Mutex(true, appMutexName, out createdNew);

            if (!createdNew)
            {
                // 如果互斥体已存在（即程序已在运行），则终止当前实例
                MessageBox.Show("应用程序已经在运行中。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
            finally
            {
                // 确保释放互斥体
                mutex.ReleaseMutex();
            }
        }
    }
}

namespace subs_check.win.gui
{
    partial class EditURLs
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.button1 = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.button2 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.button4 = new System.Windows.Forms.Button();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.SuspendLayout();
            //
            // button1
            //
            this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button1.Location = new System.Drawing.Point(12, 415);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 0;
            this.button1.Text = "保存";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // textBox1
            //
            this.textBox1.Location = new System.Drawing.Point(12, 12);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.textBox1.Size = new System.Drawing.Size(776, 397);
            this.textBox1.TabIndex = 1;
            //
            // button2
            //
            this.button2.Enabled = false;
            this.button2.Location = new System.Drawing.Point(174, 415);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(75, 23);
            this.button2.TabIndex = 2;
            this.button2.Text = "等待获取";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // button3
            //
            this.button3.Location = new System.Drawing.Point(93, 415);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(75, 23);
            this.button3.TabIndex = 3;
            this.button3.Text = "去重";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            //
            // button4
            //
            this.button4.Location = new System.Drawing.Point(713, 415);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(75, 23);
            this.button4.TabIndex = 4;
            this.button4.Text = "返回";
            this.button4.UseVisualStyleBackColor = true;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            //
            // timer1
            //
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            //
            // comboBox1
            //
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Location = new System.Drawing.Point(255, 418);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new System.Drawing.Size(120, 20);
            this.comboBox1.TabIndex = 22;
            this.comboBox1.Visible = false;
            //
            // EditURLs
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(800, 450);
            this.Controls.Add(this.comboBox1);
            this.Controls.Add(this.button4);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.button1);
            this.MinimizeBox = false;
            this.Name = "EditURLs";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "编辑 节点池订阅链接";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.Timer timer1;
        private System.Windows.Forms.ComboBox comboBox1;
    }
}

namespace subs_check.win.gui
{
    partial class MoreYAML
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MoreYAML));
            this.button1 = new System.Windows.Forms.Button();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.button2 = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.linkLabel1 = new System.Windows.Forms.LinkLabel();
            this.button3 = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            //
            // button1
            //
            this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button1.Location = new System.Drawing.Point(12, 415);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 0;
            this.button1.Text = "保存";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.linkLabel1);
            this.groupBox1.Controls.Add(this.textBox1);
            this.groupBox1.Location = new System.Drawing.Point(12, 12);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(776, 397);
            this.groupBox1.TabIndex = 1;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "YAML";
            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(713, 415);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(75, 23);
            this.button2.TabIndex = 2;
            this.button2.Text = "返回";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // textBox1
            //
            this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.textBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.textBox1.Location = new System.Drawing.Point(6, 13);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.textBox1.Size = new System.Drawing.Size(764, 378);
            this.textBox1.TabIndex = 0;
            this.textBox1.Text = resources.GetString("textBox1.Text");
            this.textBox1.UseWaitCursor = true;
            //
            // linkLabel1
            //
            this.linkLabel1.AutoSize = true;
            this.linkLabel1.Location = new System.Drawing.Point(585, 0);
            this.linkLabel1.Name = "linkLabel1";
            this.linkLabel1.Size = new System.Drawing.Size(191, 12);
            this.linkLabel1.TabIndex = 1;
            this.linkLabel1.TabStop = true;
            this.linkLabel1.Text = "更多请参考 config.yaml 参数文档";
            this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
            //
            // button3
            //
            this.button3.Location = new System.Drawing.Point(93, 415);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(75, 23);
            this.button3.TabIndex = 3;
            this.button3.Text = "重置";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            //
            // MoreYAML
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(800, 450);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.button1);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "MoreYAML";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "编辑 补充参数";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.LinkLabel linkLabel1;
        private System.Windows.Forms.Button button3;
    }
}

//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:4.0.30319.42000
//
//     对此文件的更改可能会导致不正确的行为，并且如果
//     重新生成代码，这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace subs_check.win.gui.Properties {

    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

        public static Settings Default {
            get {
                return defaultInstance;
            }
        }
    }
}

protected override void OnLoad (EventArgs e) {}

This code segment functions to: Initialize user interface components during form loading by populating a selection list from a predefined collection and activating a timed process for subsequent operations

```c_sharp
[TASK_BEGIN]
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);

    // 初始化版本号显示
    label4.Text = 当前GUI版本号;
    label5.Text = 当前subsCheck版本号;

    // 初始化GitHub代理下拉框
    if(githubProxys != null)
    {
        comboBox1.BeginUpdate();
        comboBox1.Items.Clear();
        comboBox1.Items.AddRange(githubProxys.Cast<object>().ToArray());
        comboBox1.EndUpdate();

        // 设置默认选择
        comboBox1.Text = !string.IsNullOrEmpty(githubProxy) ? githubProxy : "自动选择";
    }
}
[TASK_END]
```

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    label4.Text = 当前GUI版本号;
    label5.Text = 当前subsCheck版本号;
    if(githubProxys != null)
    {
        comboBox1.BeginUpdate();
        comboBox1.Items.Clear();
        comboBox1.Items.AddRange(githubProxys.Cast<object>().ToArray());
        comboBox1.EndUpdate();
        comboBox1.Text = !string.IsNullOrEmpty(githubProxy) ? githubProxy : "自动选择";
    }
}