Beispiel #1
0
        private void setProcess()
        {
            process = new Process();
            //ProcessStartInfo si = new ProcessStartInfo("cmd.exe", "/c " + Tsukasa_starter.exe_param());
            //ProcessStartInfo si = new ProcessStartInfo("cmd.exe", "/c " + exe_str);
            ProcessStartInfo si = new ProcessStartInfo(Tsukasa_starter.tsukasa_path, Tsukasa_starter.exe_param());

            //ProcessStartInfo si = new ProcessStartInfo("cmd.exe", "/c " + "dotnet --info");
            //ProcessStartInfo si = new ProcessStartInfo("ruby", "newline.rb");
            //ProcessStartInfo si = new ProcessStartInfo("ffmpeg", "-version");
            //ProcessStartInfo si = new ProcessStartInfo("notepad");
            si.CreateNoWindow           = true;
            si.UseShellExecute          = false;
            si.RedirectStandardOutput   = true;
            si.RedirectStandardError    = true;
            process.StartInfo           = si;
            process.EnableRaisingEvents = true;

            process.OutputDataReceived += (sender, e) =>
            {
                Invoke(new deleSetRichText(SetRichText), e.Data);
                //Console.WriteLine($"stdout={e.Data}");
            };

            process.ErrorDataReceived += (sender, e) =>
            {
                Invoke(new deleSetRichText(SetRichText), e.Data);
                //Console.WriteLine($"stderr={e.Data}");
            };

            process.Exited += (sender, e) =>
            {
                KillChildren(process.Id);
                System.Threading.Thread.Sleep(500);

                Invoke(new deleSetRichText(SetRichText), "--------------------");
                if (beginReadline)
                {
                    process.CancelOutputRead();
                    process.CancelErrorRead();
                    beginReadline = false;
                }
                runProcess = false;

                if (!Tsukasa_starter.tsukasa_rerun)
                {
                    Invoke(new deleStartUIEnabler(startUIEnabler), true);
                    startButton = false;
                }
            };
        }
Beispiel #2
0
        private void LoadSetting()
        {
            Tsukasa_starter.LoadSetting();

            tsukasa_textBox.Text = Tsukasa_starter.tsukasa_path;
            tsukasa_rtmp_comboBox.Items.AddRange(Tsukasa_starter.tsukasa_rtmp.ToArray());
            tsukasa_rtmp_comboBox.SelectedIndex = (int)Tsukasa_starter.tsukasa_rtmp_ch;
            tsukasa_param_comboBox.Items.AddRange(Tsukasa_starter.tsukasa_param.ToArray());
            tsukasa_param_comboBox.SelectedIndex = (int)Tsukasa_starter.tsukasa_param_ch;
            rerun_checkBox.Checked = Tsukasa_starter.tsukasa_rerun;

            okiba_URL_comboBox.Items.Clear();
            okiba_URL_comboBox.Items.AddRange(Tsukasa_starter.okiba_URL.ToArray());
            okiba_URL_comboBox.SelectedIndex = (int)Tsukasa_starter.okiba_URL_ch;

            okiba_port_comboBox.Items.Clear();
            okiba_port_comboBox.Items.AddRange(Tsukasa_starter.okiba_port[Tsukasa_starter.okiba_URL[(int)Tsukasa_starter.okiba_URL_ch]].ToArray());
            okiba_port_comboBox.SelectedIndex = (int)Tsukasa_starter.okiba_port_ch;
            //tsukasa_param_comboBox tsukasa_starter
        }
Beispiel #3
0
        private void start_button_Click(object sender, EventArgs e)
        {
            if (!startButton)
            {
                save_input();
                out_richTextBox_tmp = "";
                SetRichText(Tsukasa_starter.tsukasa_path + " " + Tsukasa_starter.exe_param());

                startButton = true;
                setProcess();
                startUIEnabler(false);

                runProcess = true;
                process.Start();
                process.BeginOutputReadLine();
                process.BeginErrorReadLine();
                beginReadline = true;

                // 連打禁止
                System.Threading.Thread.Sleep(500);
            }
            else
            {
                if (beginReadline)
                {
                    process.CancelOutputRead();
                    process.CancelErrorRead();
                    beginReadline = false;
                }


                KillProcessAndChildren(process.Id);
                process.Close();

                startUIEnabler(true);
                runProcess  = false;
                startButton = false;

                SetRichText("--------------------");
            }
        }
Beispiel #4
0
 // 各入力項目をtsukasa_starterに代入
 private void save_input()
 {
     applyTsukasa_starter();
     Tsukasa_starter.SaveSetting();
 }
Beispiel #5
0
 private void save_setting_button_Click(object sender, EventArgs e)
 {
     save_input();
     out_richTextBox_tmp = "";
     SetRichText(Tsukasa_starter.tsukasa_path + " " + Tsukasa_starter.exe_param());
 }