示例#1
0
 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);
     }
 }
示例#2
0
        /// <summary>
        /// RunButton_Click_1
        /// RunButton按下事件,刷新列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RunButton_Click_1(object sender, RoutedEventArgs e)
        {
            //判断私隐密码
            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)
            {
                return;
            }
            LoadingSetter.PasswordPass = false;
            if (!err)
            {
                //判断存档版本
                if (Notes["Stat"]["Version"].ToString() != FileVersion.ToString())
                {
                    SSMessageHelper.noNo = true;
                    ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
                    SSMessageHelper.Title = "存档版本不符";
                    SSMessageHelper.Says  = "我们将取消读取档案,请至 File/Setups 文件夹下备份 NoteSaves.json 文件并删除以继续使用。\n(为什么要你手动删除而不自动?因为我想确保你确实去备份了,并且顺便删了。)";
                    SSMessageBox MB = new SSMessageBox();
                    ParentWindow.IsMaskVisible = true;
                    MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
                    MB.Owner = ParentWindow;
                    MB.ShowDialog();
                    ParentWindow.IsMaskVisible = false;

                    this.RunCard.Visibility = Visibility.Visible;
                    error.ErrorTo("存档版本不符。", Percent, Errorsay);
                    error.logWriter("Tool7:存档版本不符。", false);
                    err = true;
                    return;
                }
            }

            int[] things = new int[3];
            try
            {
                if (!err && int.Parse(Notes["Stat"]["NumOfDef"].ToString()) != 0)
                {
                    for (int i = 1; i <= int.Parse(Notes["Stat"]["NumOfDef"].ToString()); i++)
                    {
                        if (int.Parse(Notes["Cards"]["Def"][i.ToString()]["Stat"].ToString()) != 0)
                        {
                            for (int j = 1; j <= int.Parse(Notes["Cards"]["Def"][i.ToString()]["Stat"].ToString()); j++)
                            {
                                things[0] = j;
                                things[1] = i;
                                if (bool.Parse(Notes["Cards"]["Def"][i.ToString()][j.ToString()]["CantDel"].ToString()))
                                {
                                    things[2] = 1;
                                }
                                else
                                {
                                    things[2] = 0;
                                }
                                AddColtrols(2, things, Notes["Cards"]["Def"][i.ToString()][j.ToString()]["Title"].ToString());
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SSMessageHelper.noNo = false;
                ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
                SSMessageHelper.Title   = "读取JSON错误";
                SSMessageHelper.bNOtext = "不用不用";
                SSMessageHelper.bOKtext = "打开日志";
                SSMessageHelper.Says    = "我们发现了一个崩溃性的错误,是否反馈它,如果不反馈,这个错误将永远得不到修复!\n" + ex;
                SSMessageBox MB = new SSMessageBox();
                ParentWindow.IsMaskVisible = true;
                MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
                MB.Owner = ParentWindow;
                MB.ShowDialog();
                ParentWindow.IsMaskVisible = false;

                error.logWriter("Tool7:读取JSON错误。" + ex, false);
                if (SSMessageHelper.buttonOK)
                {
                    string where = Directory.GetCurrentDirectory();
                    where        = where + @"\SSTB\Log\log.log";
                    Process process;
                    process = System.Diagnostics.Process.Start(@where);
                }
                Application.Current.Shutdown();
            }
            this.CD1.Visibility  = Visibility.Visible;
            this.LOAD.Visibility = Visibility.Collapsed;
            this.MT1.Visibility  = Visibility.Collapsed;
        }