/* * private void UpdateCount() * { * Regex re = new Regex("\\[\\d*\\]"); #if DEBUG * Console.WriteLine(count); #endif * Recall_Text.Text = re.Replace(Recall_Text.Text, "["+Convert.ToString(Math.Ceiling(count / 8))+"]"); * } * * public void ModifyRecallCount() * { * Recall_Text.Dispatcher.Invoke( * System.Windows.Threading.DispatcherPriority.Normal, * new TextChanger(UpdateCount)); * }*/ public MainWindow() { InitializeComponent(); ShortCut.init_shortcut("AntiRecall"); Xml.init_xml(); CheckUpdate.init_checkUpdate(); init_minimize(); if (Xml.CheckXml()) { Xml.antiRElement["PortText"] = Xml.QueryXml("PortText"); Xml.antiRElement["QQPath"] = Xml.QueryXml("QQPath"); Xml.antiRElement["Mode"] = Xml.QueryXml("Mode"); PortText.Text = Xml.antiRElement["PortText"]; } else { Xml.CreateXml(Xml.antiRElement); } ModeCheck(); this.Descript_text.Text = Xml.antiRElement["Descript"]; }
/* * private void UpdateCount() * { * Regex re = new Regex("\\[\\d*\\]"); #if DEBUG * Console.WriteLine(count); #endif * Recall_Text.Text = re.Replace(Recall_Text.Text, "["+Convert.ToString(Math.Ceiling(count / 8))+"]"); * } * * public void ModifyRecallCount() * { * Recall_Text.Dispatcher.Invoke( * System.Windows.Threading.DispatcherPriority.Normal, * new TextChanger(UpdateCount)); * }*/ public MainWindow() { InitializeComponent(); //ShortCut.init_shortcut("MoRecall"); Xml.init_xml(); CheckUpdate.init_checkUpdate(); init_minimize(); if (Xml.CheckXml()) { Xml.antiRElement["PortText"] = Xml.QueryXml("PortText"); Xml.antiRElement["PortText_Copy"] = Xml.QueryXml("PortText_Copy"); Xml.antiRElement["QQPath"] = Xml.QueryXml("QQPath"); Xml.antiRElement["TIMPath"] = Xml.QueryXml("TIMPath"); //Xml.antiRElement["NewUser"] = Xml.QueryXml("NewUser"); Xml.antiRElement["Mode"] = Xml.QueryXml("Mode"); PortText.Text = Xml.antiRElement["PortText"]; PortText_Copy.Text = Xml.antiRElement["PortText_Copy"]; } else { Xml.CreateXml(Xml.antiRElement); } Loaded += MainWindow_Loaded; this.jc.Foreground = System.Windows.Media.Brushes.Black; this.jc.IsEnabled = true; //if (Xml.antiRElement["NewUser"] == "new") //{ this.Descript_text.Content = "一个不修改文件的防撤回工具"; // } //else //{ // this.Descript_text.Content = "你好新用户"; //} ModeCheck(); }
private void StartButton_Copy_Click(object sender, RoutedEventArgs e) { if (this.Start_Copy.IsChecked == false) { if (Xml.antiRElement["Mode"] == "proxy") { proxy.Stop(); } if (Xml.antiRElement["Mode"] == "patch") { } } if (this.Start_Copy.IsChecked == true) { port = PortText_Copy.Text; if (Xml.antiRElement["Mode"] == "proxy") { init_socks5(); //Startup.init_startup(); //Modify xml Xml.antiRElement["PortText_Copy"] = PortText_Copy.Text; if (!Xml.CheckXml()) { Xml.CreateXml(Xml.antiRElement); } else { Xml.ModifyXml(Xml.antiRElement); } } else if (Xml.antiRElement["Mode"] == "patch") { Xml.antiRElement["PortText_Copy"] = PortText_Copy.Text; if (!Xml.CheckXml()) { Xml.CreateXml(Xml.antiRElement); } else { Xml.ModifyXml(Xml.antiRElement); } var th = new Thread(() => patch_memory.StartPatch()); th.Start(); } else { System.Windows.MessageBox.Show("请选择一个有效的防撤回模式"); return; } if (-1 != Xml.antiRElement["TIMPath"].IndexOf("TIM.exe")) { try { Process process = new Process(); process.StartInfo.FileName = Xml.antiRElement["TIMPath"]; //process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; process.StartInfo.CreateNoWindow = true; process.Start(); } catch (Exception) { System.Windows.MessageBox.Show("启动TIM失败,请确认路径正确或手动启动"); } MinimizeWindow(); } } }
private void StartButton_Click(object sender, RoutedEventArgs e) { if (this.Start.IsChecked == false) { if (Xml.currentElement["Mode"] == "proxy") { proxy.Stop(); } if (Xml.currentElement["Mode"] == "patch") { } } if (this.Start.IsChecked == true) { port = PortText.Text; if (Xml.currentElement["Mode"] == "proxy") { Init_socks5(); //Startup.init_startup(); //Modify xml Xml.currentElement["Port"] = PortText.Text; if (!Xml.CheckXml()) { Xml.CreateXml(Xml.antiRElement); } else { Xml.ModifyXml(Xml.currentApp, Xml.currentElement); } } else if (Xml.currentElement["Mode"] == "patch") { Xml.currentElement["Port"] = PortText.Text; Xml.ModifyXml(Xml.currentApp, Xml.currentElement); var th = new Thread(() => instances[Xml.currentApp].StartPatch()); th.Start(); } else { System.Windows.MessageBox.Show(Strings.invalid_method); this.Start.IsChecked = false; return; } if (-1 != Xml.currentElement["Path"].IndexOf("exe")) { try { Process process = new Process(); process.StartInfo.FileName = Xml.currentElement["Path"]; //process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; process.StartInfo.CreateNoWindow = true; process.Start(); MinimizeWindow(); } catch (Exception) { System.Windows.MessageBox.Show(Strings.incorrect_target_path); this.Start.IsChecked = false; } } else { System.Windows.MessageBox.Show(Strings.invalid_target_path); this.Start.IsChecked = false; } } }