Root Console Hook Class
Inheritance: System.Diagnostics.Process
示例#1
0
        private void Process_ECompile_Exited(object sender, EventArgs e)
        {
            ((MyConsole)sender).Dispose();
            Process_ECompile = null;

            if (this.InvokeRequired)
            {
                this.Invoke((MethodInvoker)delegate() { ProgressBar.PerformStep(); });
                this.Invoke((MethodInvoker)delegate() { TB_ECompile.Text += ECompileOutput; });
                this.Invoke((MethodInvoker)delegate() { Cursor = Cursors.Default; });
            }
            else
            {
                ProgressBar.PerformStep();
                TB_ECompile.Text += ECompileOutput;
                Cursor = Cursors.Default;
            }

            BTN_ECompile.Invoke((MethodInvoker)delegate() { BTN_ECompile.Enabled = true; });
            if (this.InvokeRequired)
                this.Invoke((MethodInvoker)delegate() { ProgressBar.Value = 0; });
            else
                ProgressBar.Value = 0;
            MessageBox.Show("Compile has completed! See text box for details about the compile process.");
            if (this.InvokeRequired)
                this.Invoke((MethodInvoker)delegate() { ProgressBar.Visible = false; });
            else
                ProgressBar.Visible = false;
        }
示例#2
0
        private void BTN_ECompile_Click(object sender, EventArgs e)
        {
            if (this.Process_ECompile != null)
            { // already running
                MessageBox.Show("ECompile's already running"); // How?!
                return;
            }

            string exepath = Settings.Global.Properties["ECompileExePath"];
            string dirpath = Settings.Global.Properties["POLPath"];

            if (!File.Exists(exepath))
            {
                MessageBox.Show("File does not exist in EcompileExePath!");
                return;
            }
            if (!Directory.Exists(dirpath))
            {
                dirpath = Path.GetDirectoryName(exepath);
            }

            POLChecks.ScriptCounts();

            this.Process_ECompile = new MyConsole();
            this.Process_ECompile.Start(Path.GetFullPath(exepath), Path.GetFullPath(dirpath), "-A -b -f");
            this.Process_ECompile.Exited += new EventHandler(Process_ECompile_Exited);
            this.Process_ECompile.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(Process_ECompile_OutputDataReceived);

            TB_ECompile.Text = String.Empty;
            BTN_ECompile.Enabled = false;
            Cursor = Cursors.WaitCursor;
            ProgressBar.Minimum = 0;
            ProgressBar.Maximum = 1;
            ProgressBar.Visible = true;
            ProgressBar.Step = 1;
            TB_ECompile.Text = "Ecompile Process Started for " + POLChecks.ScriptCount["SRC"] + " Scripts... This May Take A While...." + System.Environment.NewLine + System.Environment.NewLine;
        }
示例#3
0
        void POLConsole_Exited(object sender, EventArgs e)
        {
            txtPOLConsole.Invoke((MethodInvoker)delegate() { txtPOLConsole.Text += "<Process exited>" + System.Environment.NewLine; });

            ((MyConsole)sender).Dispose();
            this.POLConsole = null;

            BTN_StartPOL.Invoke((MethodInvoker)delegate() { BTN_StartPOL.Enabled = true; });
        }
示例#4
0
        private void BTN_StartPOL_Click(object sender, EventArgs e)
        {
            if (this.POLConsole != null)
            { // already running
                MessageBox.Show("POL's already running"); // How?!
                return;
            }

            string exepath = Settings.Global.Properties["POLExePath"];
            string dirpath = Settings.Global.Properties["POLPath"];

            if (!File.Exists(exepath))
            {
                MessageBox.Show("File does not exist in POLExePath!");
                return;
            }

            if (!Directory.Exists(dirpath))
            {
                dirpath = Path.GetDirectoryName(exepath);
            }

            // begin pol console...          

            this.POLConsole = new MyConsole();
            this.POLConsole.Start(Path.GetFullPath(exepath), Path.GetFullPath(dirpath), true);
            this.POLConsole.Exited += new EventHandler(POLConsole_Exited);
            this.POLConsole.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(POLConsole_OutputDataReceived);
            BTN_StartPOL.Enabled = false;
        }
示例#5
0
        void UOCConsole_Exited(object sender, EventArgs e)
        {
            ((MyConsole)sender).Dispose();
            Process_UOConvert = null;

            if (this.InvokeRequired)
            {
                this.Invoke((MethodInvoker)delegate() { TB_UOCOutput.Text += UOConvertOutput + System.Environment.NewLine + System.Environment.NewLine; });
            }
            else
            {
                TB_UOCOutput.Text += UOConvertOutput + System.Environment.NewLine + System.Environment.NewLine;
            }

            if (File.Exists(Settings.Global.Properties["POLPath"] + @"\multis.cfg"))
            {
                PL_UOConvert.MoveConfigFile(Settings.Global.Properties["POLPath"] + @"\multis.cfg", Settings.Global.Properties["POLPath"] + "\\config\\multis.cfg");
            }
            if (File.Exists(Settings.Global.Properties["POLPath"] + @"\landtiles.cfg"))
            {
                PL_UOConvert.MoveConfigFile(Settings.Global.Properties["POLPath"] + @"\landtiles.cfg", Settings.Global.Properties["POLPath"] + "\\config\\landtiles.cfg");
            }
            if (File.Exists(Settings.Global.Properties["POLPath"] + @"\tiles.cfg"))
            {
                PL_UOConvert.MoveConfigFile(Settings.Global.Properties["POLPath"] + @"\tiles.cfg", Settings.Global.Properties["POLPath"] + "\\config\\tiles.cfg");
            }

            if (this.InvokeRequired)
                this.Invoke((MethodInvoker)delegate() { ProgressBar.PerformStep(); });
            else
                ProgressBar.PerformStep();

            if (PL_UOConvert.BuildList.Count != 0)
            {
                PL_UOConvert.BuildList.RemoveAt(0);
                if (PL_UOConvert.BuildList.Count != 0)
                    RunUOConvert();
                else
                {
                    if (this.InvokeRequired)
                    {
                        BTN_UOConvert.Invoke((MethodInvoker)delegate() { BTN_UOConvert.Enabled = true; });
                        this.Invoke((MethodInvoker)delegate() { ProgressBar.Value = 0; });
                        this.Invoke((MethodInvoker)delegate() { ProgressBar.Visible = false; });
                        this.Invoke((MethodInvoker)delegate() { Cursor = Cursors.Default; });
                    }
                    else
                    {
                        BTN_UOConvert.Enabled = true;
                        ProgressBar.Value = 0;
                        ProgressBar.Visible = false;
                        Cursor = Cursors.Default;
                    }
                    MessageBox.Show("Conversion has completed! See text box for details about the conversion process.");
                }
            }
            else
            {
                if (this.InvokeRequired)
                {
                    BTN_UOConvert.Invoke((MethodInvoker)delegate() { BTN_UOConvert.Enabled = true; });
                    this.Invoke((MethodInvoker)delegate() { ProgressBar.Value = 0; });
                    this.Invoke((MethodInvoker)delegate() { ProgressBar.Visible = false; });
                    this.Invoke((MethodInvoker)delegate() { Cursor = Cursors.Default; });
                }
                else
                {
                    BTN_UOConvert.Enabled = true;
                    ProgressBar.Value = 0;
                    ProgressBar.Visible = false;
                    Cursor = Cursors.Default;
                }
                MessageBox.Show("Conversion has completed! See text box for details about the conversion process.");
            }
        }
示例#6
0
        void RunUOConvert()
        {
            if (this.Process_UOConvert != null)
            { // already running
                MessageBox.Show("UOConvert's already running"); // How?!
                return;
            }

            string exepath = Settings.Global.Properties["UOConvertExePath"];
            string dirpath = Settings.Global.Properties["POLPath"];

            if (!File.Exists(exepath))
            {
                MessageBox.Show("File does not exist in UOConvertExePath!");
                return;
            }
            if (!Directory.Exists(dirpath))
            {
                dirpath = Path.GetDirectoryName(exepath);
            }

            TB_UOCOutput.Text += "A New UOConvert Process Has Started... This May Take A While....";

            UOConvertOutput = String.Empty;
            string Cmd = String.Empty;
            if (PL_UOConvert.BuildList.Count != 0)
                Cmd += PL_UOConvert.BuildList[0].ToString();
            if (TB_MULFilePath.Text.Length > 0)
                Cmd += " uodata=\"" + TB_MULFilePath.Text + "\"";

            this.Process_UOConvert = new MyConsole();
            this.Process_UOConvert.Start(Path.GetFullPath(exepath), Path.GetFullPath(dirpath), Cmd);
            this.Process_UOConvert.Exited += new EventHandler(UOCConsole_Exited);
            this.Process_UOConvert.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(UOCConsole_OutputDataReceived);
        }