Ejemplo n.º 1
0
        private string Xcopy(bool pc)
        {
            string filePath;
            string text;
            string cmd;

            if (pc)
            {
                filePath = $@"\\192.168.9.179\data\{NewBaseTextBox.Text}.bat";
                text     = $@"XCOPY /Y /E /C /H /S /I F:\MYSQL40\data\{_oldBase}_bak F:\MYSQL40\data\{NewBaseTextBox.Text}";
                cmd      = $@"{AppDomain.CurrentDomain.SetupInformation.ApplicationBase}Tools\\PsExec.exe \\192.168.9.179 -u blacknull -p shangjia!@#123.idc1  -i  F:\MYSQL40\data\{NewBaseTextBox.Text}.bat";
            }
            else
            {
                filePath = $@"\\172.24.140.83\data\{NewBaseTextBox.Text}.bat";
                text     = $@"XCOPY /Y /E /C /H /S /I G:\mysql40\data\{_oldBase} G:\mysql40\data\{NewBaseTextBox.Text}";
                cmd      = $@"{AppDomain.CurrentDomain.SetupInformation.ApplicationBase}Tools\\PsExec.exe \\172.24.140.83 -u blacknull -p IDC2.passwd*()  -i G:\mysql40\data\{NewBaseTextBox.Text}.bat";
            }

            DirFile.CreateFile(filePath);
            DirFile.WriteText(filePath, text, Encoding.Default);

            var runCmd = new RunCmd();
            var result = runCmd.Exe(cmd);

            File.Delete(filePath);

            return(result);
        }
Ejemplo n.º 2
0
 private void PczfDelete()
 {
     foreach (var variable in pczfPanel.Panel.Controls)
     {
         try
         {
             if (variable is CheckBox ck)
             {
                 if (ck.Checked)
                 {
                     DirFile.DeleteDirectory($@"\\172.24.140.84\data\{ck.Text}");
                 }
             }
         }
         catch (Exception)
         {
             // ignored
         }
     }
 }
Ejemplo n.º 3
0
 private void MyhtDelete()
 {
     foreach (var variable in myhtPanel.Panel.Controls)
     {
         try
         {
             if (variable is CheckBox ck)
             {
                 if (ck.Checked)
                 {
                     DirFile.DeleteDirectory($@"\\192.168.9.179\data\{ck.Text}");
                 }
             }
         }
         catch (Exception)
         {
             // ignored
         }
     }
 }
Ejemplo n.º 4
0
 private void PbzDelete()
 {
     foreach (var variable in pbzPanel.Panel.Controls)
     {
         try
         {
             if (variable is CheckBox ck)
             {
                 if (ck.Checked)
                 {
                     DirFile.DeleteDirectory($@"\\192.168.255.241\upload\PBZ\{ck.Text}");
                 }
             }
         }
         catch (Exception)
         {
             // ignored
         }
     }
 }
Ejemplo n.º 5
0
 private void RepairDelete()
 {
     foreach (var variable in repairPanel.Panel.Controls)
     {
         try
         {
             if (variable is CheckBox ck)
             {
                 if (ck.Checked)
                 {
                     DirFile.DeleteDirectory($@"\\192.168.255.241\upload\维护\{ck.Text}");
                     //var filePath = $@"\\192.168.255.241\upload\维护\{ck.Text}";
                 }
             }
         }
         catch (Exception)
         {
             // ignored
         }
     }
 }
Ejemplo n.º 6
0
        private void Start()
        {
            SetEnbled(false);

            ShowMsg(RemoteConnect.ConnectState(@"\\192.168.255.187", "blacknull", "ndqatest2021.*+"));
            ShowMsg(RemoteConnect.ConnectState(@"\\192.168.255.131", "blacknull", "ndqatest2021.*+"));
            ShowMsg(RemoteConnect.ConnectState(@"\\192.168.255.63", "blacknull", "ndqatest2021.*+"));
            //ShowMsg(RemoteConnect.ConnectState(@"\\192.168.9.179", "blacknull", "shangjia!@#123.idc1"));
            //ShowMsg(RemoteConnect.ConnectState(@"\\172.24.140.83", "blacknull", "IDC2.passwd*()"));
            //ShowMsg(RemoteConnect.ConnectState(@"\\172.24.140.84", "blacknull", "..acquiescence1"));
            ShowMsg("开始执行复制操作!");

            //数据库记录
            insertion();

            string remote;
            string aimPath;

            if (Commb(projectComboBox) == "简体征服 cnzf")
            {
                //ftp复制

                aimPath = $@"\\172.24.140.84\data\{NewBaseTextBox.Text}";

                if (Directory.Exists(aimPath))
                {
                    ShowMsg("自动生成的数据库名称已存在,请选择项目重新生成");
                    SetEnbled(true);
                    return;
                }
                Directory.CreateDirectory(aimPath);
                var ftp = new FtpHelper("192.168.9.250", "/data5/cnzf", "QAyyq", "QAyyq..!!~~");

                var max = ftp.GetAllList().Length;
                var i   = 0;
                max = max / 100 + 1;
                foreach (var file in ftp.GetAllList())
                {
                    ftp.Download(aimPath, file);
                    ShowMsg($"{file}复制完成。");
                    dS进度条1.当前值 = i / max;
                    i         += 1;
                }
                dS进度条1.当前值 = 100;
                ShowMsg($"{NewBaseTextBox.Text}复制完成");
                ShowMsg("等待刷库");
            }
            else
            {
                bool isContains;
                dS进度条1.当前值 = 30;

                if (Commb(projectComboBox) == "手机魔域  init_ndsdk" || Commb(projectComboBox) == "西山居魔域  init_xsj")
                {
                    //remote = $@"\\172.24.140.83\data\{_oldBase}";
                    //aimPath = $@"\\172.24.140.83\data\{NewBaseTextBox.Text}";

                    if (Xcopy(false).IndexOf("error code 0.", StringComparison.OrdinalIgnoreCase) < 0)
                    {
                        ShowMsg("远程命令执行失败导致复制失败!");
                        SetEnbled(true);
                        return;
                    }
                }

                else
                {
                    //使用wmic的方式复制
                    //remote = $@"\\192.168.9.179\data\{_oldBase}_bak";
                    //aimPath = $@"\\192.168.9.179\data\{NewBaseTextBox.Text}";

                    if (Wcopy().IndexOf("ReturnValue = 0", StringComparison.OrdinalIgnoreCase) < 0)
                    {
                        ShowMsg("远程命令执行失败导致复制失败!");
                        SetEnbled(true);
                        return;
                    }

                    var initialDir = $@"\\192.168.9.179\data\{_oldBase}_bak";
                    var endDir     = $@"\\192.168.9.179\data\{NewBaseTextBox.Text}";


                    var initialSize = DirSize(new DirectoryInfo(initialDir));


                    for (var i = 0; i < 100; i++)
                    {
                        if (DirFile.IsExistDirectory(endDir))
                        {
                            var endSize = DirSize(new DirectoryInfo(endDir));
                            ShowMsg($@"目标库大小{endSize}--初始库大小{initialSize}");
                            if (initialSize == endSize)
                            {
                                break;
                            }

                            System.Threading.Thread.Sleep(2000);

                            if (i > 90)
                            {
                                ShowMsg("复制时间超时,判断复制失败,不执行刷库");
                                SetEnbled(true);
                                return;
                            }
                        }

                        System.Threading.Thread.Sleep(2000);
                    }
                }



                /*
                 * // 共享文件形式
                 * if (!Directory.Exists(remote))
                 * {
                 * ShowMsg($"初始库不存在{remote},请检查");
                 * SetEnbled(true);
                 * return;
                 *
                 * }
                 *
                 * if (Directory.Exists(aimPath))
                 * {
                 * ShowMsg("自动生成的数据库名称已存在,请选择项目重新生成");
                 * SetEnbled(true);
                 * return;
                 * }
                 *
                 * if (aimPath[aimPath.Length - 1] != Path.DirectorySeparatorChar)
                 * {
                 * aimPath += Path.DirectorySeparatorChar;
                 * }
                 * ///
                 * Directory.CreateDirectory(aimPath);
                 * var fileList = Directory.GetFiles(remote);
                 *
                 * var max = fileList.Length;
                 * var i = 0;
                 * max = max / 100 + 1;
                 * foreach (var file in fileList)
                 * {
                 * File.Copy(file, aimPath + Path.GetFileName(file), true);
                 * ShowMsg($"{file}复制完成。");
                 * dS进度条1.当前值 = i / max;
                 * i += 1;
                 * }
                 */
            }


            dS进度条1.当前值 = 50;
            ShowMsg($"{NewBaseTextBox.Text}复制完成");
            ShowMsg("等待刷库");

            #region sql地址 常量

            const string quickPath206My       = @"\\192.168.255.187\developer\pc\xmlconfig\mynfkuaice.sql";
            const string userPath206My        = @"\\192.168.255.187\developer\pc\xmlconfig\userinfo.sql";
            const string dataPath206My        = @"\\192.168.255.187\developer\pc\xmlconfig\updateSql_pcmy.sql";
            const string quickPath206Xf       = @"\\192.168.255.187\developer\xf\xmlconfig\mynfkuaice.sql";
            const string userPath206Xf        = @"\\192.168.255.187\developer\xf\xmlconfig\userinfo.sql";
            const string dataPath206Xf        = @"\\192.168.255.187\developer\xf\xmlconfig\updateSql_pcxf.sql";
            const string quickPath206Enmy     = @"\\192.168.255.187\developer\enmy\xmlconfig\mynfkuaice.sql";
            const string userPath206Enmy      = @"\\192.168.255.187\developer\enmy\xmlconfig\userinfo.sql";
            const string dataPath206Enmy      = @"\\192.168.255.187\developer\enmy\xmlconfig\updateSql_enmy.sql";
            const string dataPath31Sj         = @"\\192.168.255.131\developer\sjmy\main\updateSql_sjmy.sql";
            const string dataPath31Xsj        = @"\\192.168.255.131\developer\xsjmy\main\updateSql_xsjmy.sql";
            const string quickPath206Zf       = @"\\192.168.255.187\developer\zf\xmlconfig\mynfkuaice.sql";
            const string userPath206Zf        = @"\\192.168.255.187\developer\zf\xmlconfig\userinfo.sql";
            const string dataPath206Zf        = @"\\192.168.255.187\developer\zf\xmlconfig\updateSql_pczf.sql";
            const string myhtQuick            = @"\\192.168.255.63\developer\myht\main\mynfkuaice.sql";
            const string myhtUser             = @"\\192.168.255.63\developer\myht\main\userinfo.sql";
            const string myhtData             = @"\\192.168.255.63\developer\myht\main\updateSql_myht.sql";
            const string quickPath206More     = @"\\192.168.255.187\developer\pcmore\xmlconfig\mynfkuaice.sql";
            const string userPath206More      = @"\\192.168.255.187\developer\pcmore\xmlconfig\userinfo.sql";
            const string userPath206MoreTsfqm = @"\\192.168.255.187\developer\pcmore\xmlconfig\userinfo_tsfqm.sql";
            const string dataPath206More      = @"\\192.168.255.187\developer\pcmore\xmlconfig\updateSql_pcmore.sql";

            const string dataPathTsfqm = @"\\192.168.255.187\developer\pcmore\xmlconfig\updateSql_tsfqm.sql";
            const string dataPathNew   = @"\\192.168.255.187\developer\pcmore\xmlconfig\updateSql_new.sql";
            #endregion

            #region 刷库操作
            switch (Commb(projectComboBox))
            {
            case "简体魔域  my":


                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206My);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206My);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath206My);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "先锋魔域  xf":

                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206Xf);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206Xf);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath206Xf);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "英文魔域  enmy":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206Enmy);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206Enmy);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath206Enmy);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "魔域互通 my":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, myhtUser);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, myhtQuick);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, myhtData);
                    dS进度条1.当前值 = 100;
                }
                break;


            case "手机魔域  init_ndsdk":

                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 50;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath31Sj);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "西山居魔域  init_xsj":
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 50;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath31Xsj);
                    dS进度条1.当前值 = 100;
                }

                break;

            case "简体征服 cnzf":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206Zf);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206Zf);
                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath206Zf);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "怀旧魔域 hjmy":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206More);

                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206More);
                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath206More);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "魔域时间版 sjbmy":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206More);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206More);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath206More);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "boos版魔域 bossmy":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206More);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206More);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath206More);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "幻兽特色服 tsfhs":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206More);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206More);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath206More);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "千面特色服 tsfqm":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206MoreTsfqm);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206More);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPathTsfqm);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "战士特色服 myzs":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206More);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206More);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPath206More);
                    dS进度条1.当前值 = 100;
                }
                break;

            case "新服特色服 new":
                if (useSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, userPath206More);
                    dS进度条1.当前值 = 20;
                }
                if (QuickSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, quickPath206More);

                    dS进度条1.当前值 = 40;
                }
                if (ScriptTextBox.Text != string.Empty)
                {
                    IntoSql(NewBaseTextBox.Text, ScriptTextBox.Text);
                    dS进度条1.当前值 = 60;
                }
                if (restSwitch.开关状态 == DS开关.状态.ON)
                {
                    IntoSql(NewBaseTextBox.Text, dataPathNew);
                    dS进度条1.当前值 = 100;
                }
                break;
            }
            #endregion
            SetEnbled(true);
            dS进度条1.当前值 = 100;
            ShowMsg("已完成!复制库名进行使用!!!");
        }