private void RunButton_Click(object sender, RoutedEventArgs e) { Set.Visibility = Visibility.Collapsed; Topmost = false; if (op) { CMDIN.Visibility = Visibility.Visible; } this.MainPage.Visibility = Visibility.Collapsed; //隐藏主页 try { string urls = "http://q1.qlogo.cn/g?b=qq&nk=1917934706&s=3"; this.Hand.Source = new BitmapImage(new Uri(urls)); } catch { } this.MainGame.Visibility = Visibility.Visible; //显示主游戏页面 ProgressBarHelper.SetAnimateTo(Health, health); ProgressBarHelper.SetAnimateTo(Love, love); ProgressBarHelper.SetAnimateTo(Hug, hug); ProgressBarHelper.SetAnimateTo(Duang, duang); ProgressBarHelper.SetAnimateTo(yHealth, yhealth); ProgressBarHelper.SetAnimateTo(yLove, ylove); ProgressBarHelper.SetAnimateTo(yHug, yhug); ProgressBarHelper.SetAnimateTo(yDuang, yduang); CMD.Text = logs; CMD.Text = addtext(you + ":你好!"); CMDCOL.Text = cmd; TYN.Text = you; TPASS.Text = "第" + pass + "回合"; }
private void NO_Click(object sender, RoutedEventArgs e) { panErrorMsg.Visibility = Visibility.Collapsed; switch (errMode) { case 2: { Application.Current.Shutdown(); } break; case 3: { Application.Current.Shutdown(); } break; case 5: { ProgressBarHelper.SetAnimateTo(openPer, 0); isOpen.Text = "未启用"; } break; } }
public void SetProgressBar(double value) { if (downFin) { return; } ProgressBarHelper.SetAnimateTo(pbDown, value); if (Convert.ToInt32(value / Max * 100) >= 100) { downFin = true; FileInfo fileInfo = null; try { fileInfo = new FileInfo(@"[Upd]SSTB.exe"); } catch (Exception ex) { Log.AddLog("update", "检查更新文件大小错误:" + ex); } Log.AddLog("update", "下载完成,大小:" + fileInfo.Length); Thread thread = new Thread(RunUpdate); MainWindow.threads.Push(thread); thread.Start(); Log.AddLog("update", "开始执行更新……"); } }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { _value += 20; _value = _value > 100 ? 100 : _value; ProgressBarHelper.SetAnimateTo(Pgb1, _value); ProgressBarHelper.SetAnimateTo(Pgb2, _value); }
private void BtnMinus_Click(object sender, RoutedEventArgs e) { _value -= 20; _value = _value < 0 ? 0 : _value; ProgressBarHelper.SetAnimateTo(Pgb1, _value); ProgressBarHelper.SetAnimateTo(Pgb2, _value); }
private void Clear(object sebder, RoutedEventArgs s) { this.J16.Text = ""; this.RGBA.Text = ""; this.Errorsay.Visibility = Visibility.Collapsed; this.RunCard.Visibility = Visibility.Collapsed; this.Percent.Foreground = ColorFst; ProgressBarHelper.SetAnimateTo(Percent, 0); }
private void updatePBar() //刷新进度条 { ProgressBarHelper.SetAnimateTo(Health, health); ProgressBarHelper.SetAnimateTo(yHealth, yhealth); ProgressBarHelper.SetAnimateTo(Hug, hug); ProgressBarHelper.SetAnimateTo(yHug, yhug); ProgressBarHelper.SetAnimateTo(Duang, duang); ProgressBarHelper.SetAnimateTo(yDuang, yduang); ProgressBarHelper.SetAnimateTo(Love, love); ProgressBarHelper.SetAnimateTo(yLove, ylove); }
private void TaskBarRun_Click(object sender, RoutedEventArgs e) { if (!isRun) { isOpen.Text = "正在启动"; ProgressBarHelper.SetAnimateTo(openPer, 50); RunFun(); } else { SSUserClass.Proc.KillProc(SSUserClass.Proc.GetProc("edge")); } }
public void SetProgressBar(double value) { ProgressBarHelper.SetAnimateTo(pbDown, value); T2.Text = Convert.ToInt32(value / Max * 100) + " %"; if (value < Max) { T1.Text = "正在下载……"; } if (Convert.ToInt32(value / Max * 100) >= 100) { T1.Text = "正在生成更新脚本……"; Thread thread = new Thread(RunUpdate); thread.Start(); } }
private void RunFun() { ButtonHelper.SetIsWaiting(Run, true); //基本数据 string IPADRESS = nowUsed.isDHCP ? "dhcp:" + nowUsed.iP : nowUsed.iP; //自定义本机IP,DHCP请在DHCP服务器IP前加:"dhcp:" string DHCP = nowUsed.isDHCP ? "-r" : ""; //如果为DHCP请将此项改为:"-r",不是DHCP请留空:""。 string GROUPNAME = "\"" + nowUsed.teamName + "\""; //填写组名 string PASSWORD = nowUsed.teamPassword; //填写密码 string SUPERNODEIP = nowUsed.severIP; //此项为SuperNode服务器IP(公网) string SUPERNODEPORT = nowUsed.severPost.ToString(); //此项为SuperNode服务器端口 string OTHERARG = " " + nowUsed.iPAdditional; //其他参数 string APPADDRESS = Directory.GetCurrentDirectory(); //程序所在目录 //准备配置文件 string edgearg = DHCP + " -a " + IPADRESS + " -c " + GROUPNAME + " -k " + PASSWORD + " -l " + SUPERNODEIP + ":" + SUPERNODEPORT + OTHERARG; ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = "System\\edge.exe"; psi.Verb = "runas"; psi.Arguments = edgearg; psi.UseShellExecute = false; psi.CreateNoWindow = true; psi.WindowStyle = ProcessWindowStyle.Minimized; psi.RedirectStandardOutput = true; process.StartInfo = psi; process.Start(); //process. try { //监控进程 this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { RunInfo.Visibility = Visibility.Visible; isOpen.Text = "正在启动线程维护"; ProgressBarHelper.SetAnimateTo(openPer, 99); }); Thread thread = new Thread(Seeing); thread.Start(); } catch { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { ProgressBarHelper.SetAnimateTo(openPer, 0); isOpen.Text = "未启用"; }); } }
private void RunTool(object sebder, RoutedEventArgs s) { this.RunCard.Visibility = Visibility.Visible; ProgressBarHelper.SetAnimateTo(Percent, 0); this.Errorsay.Visibility = Visibility.Collapsed; bool Error; ButtonHelper.SetIsWaiting(RunButton, true); Error = SeachFile(Address.Text); ButtonHelper.SetIsWaiting(RunButton, false); if (Error) { this.Percent.Foreground = ColorFst; ProgressBarHelper.SetAnimateTo(Percent, 100); } Error = false; }
public PageHD2() { InitializeComponent(); this.Height = 477; this.RunCard.Background = baseColora.Card; this.IconCard.Background = baseColora.Card; this.Percent.Background = baseColora.DBg; this.Percent.Foreground = baseColora.Main; CMD.Foreground = baseColora.Font; Errorsay.Foreground = baseColora.Font; Errorsay.Text = "初始化启动成功!"; ProgressBarHelper.SetAnimateTo(Percent, 100); CMD.Text = "Stapx Steve Tool Box [ 版本 1.0.16.33 ] \n(c) Stapx Steve Team. 保留所有权利。\n\n注意事项:\n使用任何删除操作或者使用输入法将会使当前行失效。\n输入Y继续>"; loading = false; }
private void updateUI() { timePass++; if (!String.IsNullOrWhiteSpace(Password.Password)) { if (Password.Password.Equals(Main.Settings["Features"]["Privacy"]["Password"].ToString())) { LoadingSetter.PasswordPass = true; ForceClose(); } else { LoadingSetter.PasswordPass = false; } } ProgressBarHelper.SetAnimateTo(Time, timePass * 10); if (timePass == 11) { if (!String.IsNullOrWhiteSpace(Password.Password)) { if (Password.Password.Equals(Main.Settings["Features"]["Privacy"]["Password"].ToString())) { LoadingSetter.PasswordPass = true; } else { LoadingSetter.PasswordPass = false; } } else { LoadingSetter.PasswordPass = false; } ForceClose(); } }
private void UpdateTemplate() { var color = Helper.GetColorByOffset(_linearGradientBrush.GradientStops, SldTheme.Value / 7); ProgressBarHelper.SetCornerRadius(PgbCustom, SldCornerRadius.Value); if (_usingAnimation) { ProgressBarHelper.SetAnimateTo(PgbCustom, SldProgress.Value); } else { PgbCustom.Value = SldProgress.Value; } switch (ProgressBarHelper.GetProgressBarStyle(PgbCustom)) { case ProgressBarStyle.Standard: PgbCustom.Background = new Color() { A = 30, R = color.R, G = color.G, B = color.B }.ToBrush(); PgbCustom.BorderBrush = Colors.Transparent.ToBrush(); PgbCustom.Foreground = color.ToBrush(); break; case ProgressBarStyle.Ring: PgbCustom.Background = Colors.White.ToBrush(); PgbCustom.BorderBrush = new Color() { A = 30, R = color.R, G = color.G, B = color.B }.ToBrush(); PgbCustom.Foreground = color.ToBrush(); break; } }
private bool SeachFile(string Sdir) { DirectoryInfo dir = new DirectoryInfo("C:"); try { dir = new DirectoryInfo(Sdir); } catch (Exception ex) { error.ErrorTo("发现错误(OPF - 003):在检索文件时发生未知错误,错误原因为文件或目录格式有误。", Percent, Errorsay); return(false); } try { //判断所指的文件夹/文件是否存在 if (!dir.Exists) { error.ErrorTo("发现错误(OPF - 002):在检索文件时发生未知错误,错误原因为文件或目录不存在。", Percent, Errorsay); return(false); } int filenum = 0; DirectoryInfo dirD = dir as DirectoryInfo; FileSystemInfo[] files = dirD.GetFileSystemInfos();//获取文件夹下所有文件和文件夹 //对单个FileSystemInfo进行判断,统计个数 String add = ""; foreach (FileSystemInfo FSys in files) { FileInfo fileInfo = FSys as FileInfo; if (fileInfo != null) { if (String.IsNullOrWhiteSpace(AddressAdd.Text)) { filenum++; } else if (!(String.IsNullOrWhiteSpace(AddressAdd.Text))) { if (AddressAdd.Text.LastIndexOf("*.") != -1) { string[] sArray = AddressAdd.Text.Split('*'); add = sArray[1]; } else { error.ErrorTo("发现错误(OPF - 004):在检索文件时发生未知错误,错误原因为附加后缀格式有误。", Percent, Errorsay); return(false); } if (fileInfo.Name.LastIndexOf(add) != -1) { filenum++; } } } } foreach (FileSystemInfo FSys in files) { FileInfo fileInfo = FSys as FileInfo; if (fileInfo != null) { //如果是文件,进行文件操作 String Address = ""; FileInfo SFInfo = new FileInfo(fileInfo.DirectoryName + "\\" + fileInfo.Name);//获取文件所在原始路径 if (String.IsNullOrWhiteSpace(AddressAdd.Text)) { Address = fileInfo.DirectoryName + "\\" + fileInfo.Name; } else if (!(String.IsNullOrWhiteSpace(AddressAdd.Text))) { if (fileInfo.Name.LastIndexOf(add) != -1) { Address = fileInfo.DirectoryName + "\\" + fileInfo.Name; } else { continue; } } Process process; Errorsay.Visibility = Visibility.Collapsed; Errorsay.Text = "打开成功,共打开了 " + filenum + " 个文件。"; PercentP = PercentP + 100 / filenum; ProgressBarHelper.SetAnimateTo(Percent, PercentP); process = System.Diagnostics.Process.Start(@Address); System.Windows.Media.SolidColorBrush ColorBrush = new SolidColorBrush(); ColorBrush.Color = System.Windows.Media.Color.FromArgb(255, 100, 100, 100); FontFamily font = new FontFamily("方正兰亭简黑"); Percent.Foreground = ColorFst; Errorsay.Foreground = ColorBrush; Errorsay.FontFamily = font; Errorsay.FontSize = 13; Errorsay.Visibility = Visibility.Visible; } } return(true); } catch (Exception ex) { error.ErrorTo("发现错误(OPF - 001):在检索文件时发生未知错误,错误内容为\n" + ex + "\n错误原因未知,请及时反馈。", Percent, Errorsay); MessageBoxX.Show("发现错误(OPF - 001),是否反馈。", "错误", Application.Current.MainWindow); return(false); } }
private void BtnMinus_Click(object sender, RoutedEventArgs e) { ProgressBarHelper.SetAnimateTo(Pgb1, Pgb1.Value - 10); ProgressBarHelper.SetAnimateTo(Pgb2, Pgb2.Value - 10); }
private void Run_Click(object sender, RoutedEventArgs e) { if (isRun) { SSUserClass.Proc.KillProc(SSUserClass.Proc.GetProc("edge")); } else if (a.IsSelected) { RunFun(); isOpen.Text = "正在启动"; ProgressBarHelper.SetAnimateTo(openPer, 50); } else if (b.IsSelected) { //添加 if (configs[0].iP == "new" && !canAdd) { canAdd = true; panErrorMsg.Visibility = Visibility.Visible; errMode = 0; errorTitle.Text = "提醒"; errorSays.Text = "点击添加将将当前配置显示区的配置添加入列表(本次点击无效)。"; return; } bool noSave = false; SaveLoader.N2NConfig config = new SaveLoader.N2NConfig(); if (!String.IsNullOrWhiteSpace(Name.Text)) { for (int i = 0; i <= configs.Count - 1; i++) { if ((configs[i].Name) == Name.Text) { errMode = 4; panErrorMsg.Visibility = Visibility.Visible; errorTitle.Text = "提醒"; errorSays.Text = "存在同名的配置将覆盖保存。"; return; } } } if (!String.IsNullOrWhiteSpace(IP.Text)) { config.iP = IP.Text; } else { noSave = true; } if (!String.IsNullOrWhiteSpace(IPAdd.Text)) { config.iPAdditional = IPAdd.Text; } config.isDHCP = isDHCP.IsChecked == true ? true : false; if (!String.IsNullOrWhiteSpace(SeverIP.Text)) { config.severIP = SeverIP.Text; } else { noSave = true; } if (!String.IsNullOrWhiteSpace(SeverPost.Text)) { config.severPost = Convert.ToInt32(SeverPost.Text); } else { noSave = true; } if (!String.IsNullOrWhiteSpace(TeamName.Text)) { config.teamName = TeamName.Text; } else { noSave = true; } if (!String.IsNullOrWhiteSpace(Password.Text)) { config.teamPassword = Password.Text; } else { noSave = true; } if (!String.IsNullOrWhiteSpace(Name.Text)) { config.Name = Name.Text; } else { noSave = true; } config.isUsed = false; config.UUID = DateTime.Now.ToString("yyyyMMddhhmmssfff"); if (!noSave) { SaveLoader.AddSave(config); configs.Add(config); AddList(config); } else { panErrorMsg.Visibility = Visibility.Visible; errMode = 0; errorTitle.Text = "提醒"; errorSays.Text = "请将数据填写完整。"; } } }
/// <summary> /// 点击启用单选框触发更改启用的配置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChangeUsed(object sender, RoutedEventArgs e) { RadioButton button = (RadioButton)sender; if (nowUsed != null) { //try { if (isTaskChange) { isTaskChange = false; isListChange = false; return; } button.IsChecked = true; ListViewItem list = (ListViewItem)New.FindName("UUID" + nowUsed.UUID); RadioButton radio = (RadioButton)list.FindName("CHECK" + nowUsed.UUID); radio.IsChecked = false; for (int i = 0; i <= TaskBarConfigList.Items.Count - 1; i++) { MenuItem menuItem = (MenuItem)TaskBarConfigList.Items[i]; if (menuItem.Name == "MENU" + button.Name.Substring(5)) { isListChange = true; menuItem.IsChecked = true; break; } } for (int i = 0; i <= TaskBarConfigList.Items.Count - 1; i++) { MenuItem menuItem = (MenuItem)TaskBarConfigList.Items[i]; if (menuItem.Name == "MENU" + nowUsed.UUID) { isListChange = true; menuItem.IsChecked = false; break; } } } //catch { } } for (int i = 0; i <= configs.Count - 1; i++) { if (configs[i].isUsed == true) { if (configs[i].UUID == button.Name.Substring(5)) { return; } configs[i].isUsed = false; break; } } for (int i = 0; i <= configs.Count - 1; i++) { if (configs[i].UUID == button.Name.Substring(5)) { configs[i].isUsed = true; nName.Text = configs[i].Name; nIP.Text = configs[i].iP; nAdd.Text = configs[i].iPAdditional; nSever.Text = configs[i].severIP + ":" + configs[i].severPost; nTeamName.Text = configs[i].teamName; nPassword.Text = configs[i].teamPassword; nowUsed = configs[i]; break; } } File.Delete("Save\\Config.ssn2n"); for (int i = 0; i <= configs.Count - 1; i++) { SaveLoader.AddSave(configs[i]); } isListChange = false; if (isRun) { SSUserClass.Proc.KillProc(SSUserClass.Proc.GetProc("edge")); isOpen.Text = "正在启动"; ProgressBarHelper.SetAnimateTo(openPer, 50); RunFun(); } }
private void Seeing() { if (!Directory.Exists("Cache")) { Directory.CreateDirectory("Cache"); } if (File.Exists("Cache\\logs.log")) { File.Delete("Cache\\logs.log"); } this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { NamePorc.Text = "加载中"; IDPorc.Text = "加载中"; UsePorc.Text = "加载中"; Ping.Text = "加载中"; }); Process p = SSUserClass.Proc.GetProc("edge"); PerformanceCounter pf1 = new PerformanceCounter("Process", "Working Set - Private", p.ProcessName); this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { isRun = true; ButtonHelper.SetIcon(Run, ""); IconHelper.SetFontSize(Run, 15); NamePorc.Text = p.ProcessName; IDPorc.Text = p.Id + "/" + p.SessionId; UsePorc.Text = pf1.NextValue() / 1024 + "KB"; ProgressBarHelper.SetAnimateTo(openPer, 100); isOpen.Text = "启动完成"; TaskBar.ToolTipText = "N2N Desktop Launcher - 正在运行"; taskBarRun.IsChecked = true; logTextBox.Text = ">[ 进程守护 ] 进程监控已正常运转——\n"; PingReply reply = SSUserClass.Net.GetPing(nowUsed.severIP, "abcd"); ButtonHelper.SetIsWaiting(Run, false); if (reply.Status == IPStatus.Success) { Ping.Text = (reply.RoundtripTime).ToString() + "ms"; } }); int failepingTimes = 0; int passtime = 0; while (SSUserClass.Proc.HasProc("edge")) { String nexline = process.StandardOutput.ReadLine(); if (!String.IsNullOrWhiteSpace(nexline)) { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { using (StreamWriter sw = File.AppendText("Cache\\logs.log")) { sw.WriteLine(nexline); } if (nexline.IndexOf("WARNING") > 0) { logTextBox.Text += nexline + "\n"; logTextBox.Text += ">[ 进程守护 ] 发现疑似报错!\n"; } else if (nexline.IndexOf("ERROR") > 0) { logTextBox.Text += nexline + "\n"; logTextBox.Text += ">[ 进程守护 ] 发现严重错误!\n"; panErrorMsg.Visibility = Visibility.Visible; errMode = 0; errorTitle.Text = "错误"; errorSays.Text = "发现了错误:" + nexline; SSUserClass.Proc.KillProc(SSUserClass.Proc.GetProc("edge")); } else { logTextBox.Text += nexline + "\n"; } }); } if (passtime >= 30000) { passtime = 0; } if (passtime % 2000 == 0) { //刷新进程信息 try { p = SSUserClass.Proc.GetProc("edge"); pf1 = new PerformanceCounter("Process", "Working Set - Private", p.ProcessName); this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { NamePorc.Text = p.ProcessName; IDPorc.Text = p.Id + "/" + p.SessionId; UsePorc.Text = pf1.NextValue() / 1024 + "KB"; ProgressBarHelper.SetAnimateTo(openPer, 100); }); } catch { } //刷新Ping PingReply reply = SSUserClass.Net.GetPing(nowUsed.severIP, "abcd"); if (reply.Status == IPStatus.Success) { failepingTimes = 0; this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { Ping.Text = (reply.RoundtripTime).ToString() + "ms"; }); } else { failepingTimes++; if (failepingTimes >= 5) { //判定掉线重启 SSUserClass.Proc.KillProc(SSUserClass.Proc.GetProc("edge")); RunFun(); } } } passtime += 20; Thread.Sleep(20); } this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { RunInfo.Visibility = Visibility.Collapsed; ProgressBarHelper.SetAnimateTo(openPer, 0); isOpen.Text = "未启用"; TaskBar.ToolTipText = "N2N Desktop Launcher -未启用"; ButtonHelper.SetIcon(Run, ""); IconHelper.SetFontSize(Run, 25); taskBarRun.IsChecked = false; }); isRun = false; }
private void RunTool(object sebder, RoutedEventArgs s) { bool Error = false; bool[] InPutHas = new bool[4]; String ErrorString = ""; int which = 0; String[] ColorList = new string[2]; ButtonHelper.SetIsWaiting(RunButton, true); this.Errorsay.Visibility = Visibility.Collapsed; this.RunCard.Visibility = Visibility.Visible; this.Percent.Foreground = ColorFst; ProgressBarHelper.SetAnimateTo(Percent, 0); for (int i = 0; i < 2; i++) { InPutHas[i] = true; } if (String.IsNullOrWhiteSpace(J16.Text)) { InPutHas[0] = false; } if (String.IsNullOrWhiteSpace(RGBA.Text)) { InPutHas[1] = false; } { bool has = false; for (int i = 0; i < 2; i++) { if (InPutHas[i] && !has) { has = true; which = i; continue; } if (InPutHas[i] && has) { Error = true; ErrorString = "发现错误(ECC - 002):有多个无法统一的输入。"; } } } if ((InPutHas[0] || InPutHas[1]) == false) { Error = true; ErrorString = "发现错误(ECC - 001):输入内容为空。"; } ProgressBarHelper.SetAnimateTo(Percent, 100 / 3); if (Error) { error.ErrorTo(ErrorString, Percent, Errorsay); } else { SolidColorBrush ChangeColor = new SolidColorBrush(); ChangeColor.Color = System.Windows.Media.Color.FromArgb(255, 209, 93, 93); switch (which + 1) { case 1: { //十六进制 ColorList[0] = this.J16.Text; int[] Color; if (this.J16.Text[0] != '#' || this.J16.Text.Length != 9) { Error = true; error.ErrorTo("发现错误(ECC - 003):输入内容无效,请检查。错误内容为……你瞎几把输入了些什么玩意。", Percent, Errorsay); break; } for (int i = 1; i <= 8; i++) { if (this.J16.Text[i] != '0' && this.J16.Text[i] != '1' && this.J16.Text[i] != '2' && this.J16.Text[i] != '3' && this.J16.Text[i] != '4' && this.J16.Text[i] != '5' && this.J16.Text[i] != '6' && this.J16.Text[i] != '7' && this.J16.Text[i] != '8' && this.J16.Text[i] != '9' && this.J16.Text[i] != 'A' && this.J16.Text[i] != 'B' && this.J16.Text[i] != 'C' && this.J16.Text[i] != 'D' && this.J16.Text[i] != 'E' && this.J16.Text[i] != 'F') { Error = true; error.ErrorTo("发现错误(ECC - 003):输入内容无效,请检查。错误内容为十六进制值大于F", Percent, Errorsay); } else { goto A; } } break; A : Color = toRGBA(this.J16.Text, 1); if (Color[4] == -1) { Error = true; break; } ColorList[1] = Color[1] + "," + Color[2] + "," + Color[3] + "," + Color[0]; ChangeColor.Color = System.Windows.Media.Color.FromArgb(byte.Parse(Color[0].ToString()), byte.Parse(Color[1].ToString()), byte.Parse(Color[2].ToString()), byte.Parse(Color[3].ToString())); SolidColorBrush CardColor = new SolidColorBrush(); if (Color[0] != 255) { CardColor.Color = System.Windows.Media.Color.FromArgb(0, 255, 255, 255); } else { CardColor.Color = System.Windows.Media.Color.FromArgb(255, 255, 255, 255); } this.ColorCard.Background = CardColor; this.Color.Fill = ChangeColor; } break; case 2: { //RGBA ColorList[1] = this.RGBA.Text; byte r, g, b, a; string[] sArray = this.RGBA.Text.Split(','); int row = sArray.GetLength(0); //第一维的长度(即行数),结果为2 if (row == 4) { if (int.Parse(sArray[0]) > 255 || int.Parse(sArray[1]) > 255 || int.Parse(sArray[2]) > 255 || int.Parse(sArray[3]) > 255) { Error = true; error.ErrorTo("发现错误(ECC - 003):输入内容无效,请检查。错误内容为RGBA值大于255。", Percent, Errorsay); break; } r = byte.Parse(sArray[0]); g = byte.Parse(sArray[1]); b = byte.Parse(sArray[2]); a = byte.Parse(sArray[3]); ChangeColor.Color = System.Windows.Media.Color.FromArgb(a, r, g, b); SolidColorBrush CardColor = new SolidColorBrush(); if (a != 255) { CardColor.Color = System.Windows.Media.Color.FromArgb(0, 255, 255, 255); } else { CardColor.Color = System.Windows.Media.Color.FromArgb(255, 255, 255, 255); } String aa = RGBATo(r, g, b, a, 1); ColorList[0] = aa.ToUpper(); this.ColorCard.Background = CardColor; this.Color.Fill = ChangeColor; } else { Error = true; error.ErrorTo("发现错误(ECC - 003):输入内容无效,请检查。错误内容为……你瞎几把输入了些什么玩意。", Percent, Errorsay); break; } } break; default: { Error = true; error.ErrorTo("发现错误(ECC - 004):在判断输入时发生未知错误,错误变量为which,数值为" + which + ",错误类型为无法匹配。", Percent, Errorsay); MessageBoxX.Show("发现错误(ECC - 004),是否反馈。", "错误", Application.Current.MainWindow); } break; } ProgressBarHelper.SetAnimateTo(Percent, 100 / 3 * 2); } ButtonHelper.SetIsWaiting(RunButton, false); this.J16.Text = ColorList[0]; this.RGBA.Text = ColorList[1]; if (!Error) { this.Errorsay.Visibility = Visibility.Collapsed; this.RunCard.Visibility = Visibility.Collapsed; this.Percent.Foreground = ColorFst; ProgressBarHelper.SetAnimateTo(Percent, 0); } Error = false; ErrorString = ""; which = 0; ColorList = new string[2]; }
private void CMD_TextChanged(object sender, TextChangedEventArgs e) { if (loading) { return; } str = CMD.Text; if (fist) { if (str.Substring(str.Length - 1, 1) == "Y" || str.Substring(str.Length - 1, 1) == "y") { loading = true; CMD.Text = "Stapx Steve Tool Box [ 版本 1.0.16.33 ] \n(c) Stapx Steve Team. 保留所有权利。\n\nX:\\User\\Admin>"; CMD.SelectionStart = CMD.Text.Length; fist = false; loading = false; return; } else { loading = true; CMD.Text = Addtext("\n输入Y继续>"); CMD.SelectionStart = CMD.Text.Length; loading = false; return; } } try { if (str.Substring(str.Length - 1, 1) == "\n") { bool runpass = false; if (strin.Equals("help")) { loading = true; CMD.Text = Addtext("cls\t\t清屏\ndev\t\t开发者选项\nexit\t\t退出\nhelp\t\t查看所有的帮助\nrun\t\t运行程式\n\n"); loading = false; runpass = true; } if (strin.Equals("cls")) { loading = true; CMD.Text = "Stapx Steve Tool Box [ 版本 1.0.16.33 ] \n(c) Stapx Steve Team. 保留所有权利。\n\n"; loading = false; runpass = true; } if (strin.Equals("run")) { loading = true; CMD.Text = Addtext("run -<appname> -[parameter]\n运行一个程式,这个程式可以是工具箱内含的工具。\n-<appname> \t\t程式名:程式的名字或者工具箱工具的全称。\n-[parameter]\t\t运行参数:传递给程式的参数。\n\n"); loading = false; runpass = true; } else if (strin.Equals("run -kill -STL")) { opin = false; Run(); runpass = true; } else if (strin.Equals("kill -S")) { if (Main.Settings["Features"]["Privacy"]["Password"].ToString() != "NULL") { PassWordEnterF7 EP = new PassWordEnterF7(); ParentWindow.IsMaskVisible = true; EP.WindowStartupLocation = WindowStartupLocation.CenterOwner; EP.Owner = ParentWindow; EP.ShowDialog(); ParentWindow.IsMaskVisible = false; } else { LoadingSetter.PasswordPass = true; } if (LoadingSetter.PasswordPass) { LoadingSetter.PasswordPass = false; opin = true; Run(); runpass = true; } else { ProgressBarHelper.SetAnimateTo(Percent, 50); Errorsay.Text = "指令 " + strin + " 执行异常。"; } } if (strin.Equals("exit")) { loading = true; CMD.Text = ""; error.ErrorTo("线程已关闭。", Percent, Errorsay); ProgressBarHelper.SetAnimateTo(Percent, 0); this.Errorsay.Visibility = Visibility.Visible; Errorsay.Text = "线程已关闭。"; return; } if (runpass) { ProgressBarHelper.SetAnimateTo(Percent, 100); Errorsay.Text = "指令 " + strin + " 执行成功!"; } else { ProgressBarHelper.SetAnimateTo(Percent, 50); Errorsay.Text = "指令 " + strin + " 执行异常。"; } loading = true; strin = ""; CMD.Text = CMD.Text.Substring(0, CMD.Text.Length - 1); CMD.Text = Addtext("\nX:\\User\\Admin>"); loading = false; CMD.SelectionStart = CMD.Text.Length; } else { strin = strin + (str.Substring(str.Length - 1, 1)); } } catch (Exception ex) { MessageBox.Show("" + ex); } }