示例#1
0
        private void BGWorker_RunWorkerCompleted(
            object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Error != null || e.Cancelled)
            {
                return;
            }
            MyArgument result = (MyArgument)e.Result;

            if (result.TypeArg == MyArgument.WorkType.RELEASE_UPDATE)
            {
                BtnUpdateRelease.Enabled = true;
                LoadReleaseGames();
                LoadPlatormGames();
            }
            else if (result.TypeArg == MyArgument.WorkType.PLATFORM_UPDATE)
            {
                BtnUpdatePlat.Enabled = true;
                LoadPlatormGames();
            }
            else if (result.TypeArg == MyArgument.WorkType.FRAME_UPDATE)
            {
                BtnUpdateFrame.Enabled = true;
            }
            OutputToTextBox(result.StrArg);
        }
示例#2
0
        private void BGWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            MyArgument arg     = (MyArgument)e.Argument;
            Process    process = new Process();

            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.FileName               = "git.exe";
            process.StartInfo.WorkingDirectory       = arg.StrArg;
            process.StartInfo.Arguments              = "pull";
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
            //process.StartInfo.CreateNoWindow = true;
            process.Start();

            StreamReader reader = process.StandardOutput;
            string       output = reader.ReadToEnd();

            output = output.Trim();
            output = output.Replace("\n", "\r\n");
            //MessageBox.Show(output, "提示", MessageBoxButtons.OK);
            e.Result = new MyArgument(output, arg.TypeArg);
            //Console.WriteLine(output);
            process.WaitForExit();
            process.Close();
        }
示例#3
0
        private void CommitBGWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker bw      = sender as BackgroundWorker;
            MyArgument       arg     = (MyArgument)e.Argument;
            Process          process = new Process();

            process.StartInfo.UseShellExecute  = false;
            process.StartInfo.FileName         = "git.exe";
            process.StartInfo.WorkingDirectory = arg.StrArg;
            process.StartInfo.Arguments        = "add res/game/. src/game/game/.";
            process.StartInfo.CreateNoWindow   = true;
            process.Start();
            process.WaitForExit();
            process.Close();

            process = new Process();
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.FileName               = "git.exe";
            process.StartInfo.WorkingDirectory       = arg.StrArg;
            process.StartInfo.Arguments              = "commit -m \"" + arg.StrArg2 + "\"";
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
            process.StartInfo.CreateNoWindow         = true;
            process.Start();

            StreamReader reader       = process.StandardOutput;
            string       commitoutput = reader.ReadToEnd();

            commitoutput = commitoutput.Replace("\n", "\r\n");
            process.WaitForExit();
            process.Close();

            process = new Process();
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.FileName               = "git.exe";
            process.StartInfo.WorkingDirectory       = arg.StrArg;
            process.StartInfo.Arguments              = "push";
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
            process.StartInfo.CreateNoWindow         = true;
            process.Start();

            reader = process.StandardOutput;
            string pushoutput = reader.ReadToEnd();

            pushoutput = pushoutput.Replace("\n", "\r\n");
            process.WaitForExit();
            process.Close();

            e.Result = new MyArgument(commitoutput + pushoutput);
        }
示例#4
0
        private void CopyBGWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            MyArgument arg     = (MyArgument)e.Argument;
            Process    process = new Process();

            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.FileName               = "git.exe";
            process.StartInfo.WorkingDirectory       = arg.StrArg;
            process.StartInfo.Arguments              = "status";
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
            process.StartInfo.CreateNoWindow         = true;
            process.Start();

            StreamReader reader = process.StandardOutput;
            string       output = reader.ReadToEnd();

            output   = output.Trim();
            output   = output.Replace("\n", "\r\n");
            e.Result = new MyArgument(output, arg.TypeArg, arg.StrArg2);
            process.WaitForExit();
            process.Close();
        }
示例#5
0
        private void OutputBGWorker_RunWorkerCompleted(
            object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Error != null || e.Cancelled)
            {
                return;
            }
            MyArgument result = (MyArgument)e.Result;

            OutputToTextBox(result.StrArg);

            if (result.TypeArg == MyArgument.WorkType.COPY_CHECK && CBCopyPush.Checked == true)
            {
                if (!CommitWork.IsBusy)
                {
                    OutputToTextBox("开始提交");
                    CommitWork.RunWorkerAsync(new MyArgument(TbPlatform.Text.Trim(), MyArgument.WorkType.COMMIT_WORK, result.StrArg2));
                }
                else
                {
                    OutputToTextBox("提交后台任务繁忙中,请等待");
                }
            }
        }