Esempio n. 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!CommonFunctions.SetRoot(txtPath.Text))
            {
                if (CommonFunctions.ErrorMessage != string.Empty)
                {
                    CommonFunctions.ErrMessage(CommonFunctions.ErrorMessage);
                    return;
                }
            }

            this.Close();
        }
Esempio n. 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string[] cli = Environment.GetCommandLineArgs();
            if (cli.Length > 1)
            {
                switch (cli[1])
                {
                case "--help":
                {
                    CommonFunctions.ShowHelp("");
                }; break;

                case "--clear":
                {
                    CommonFunctions.ClearConfig();
                }; break;

                case "--setroot":
                {
                    if (cli.Length > 2)
                    {
                        if (!CommonFunctions.SetRoot(cli[2]))
                        {
                            CommonFunctions.ErrMessage("Can't set " +
                                                       cli[2] + " as Roadsend root " +
                                                       CommonFunctions.ErrorMessage);
                        }
                    }
                    else
                    {
                        CommonFunctions.ShowHelp("\n No directory parameter!");
                    }
                }; break;

                default:
                {
                    CommonFunctions.ShowHelp("\n Wrong parameter: " + cli[1]);
                }; break;
                }
            }
            else
            {
                Application.Run(new frmMain());
            }
        }
        private void frmMain_Shown(object sender, EventArgs e)
        {
            lvMessages.Items.Add("Checking root directory...");
            if (!CommonFunctions.GetRoot())
            {
                lvMessages.Items[Item].Text     += "ERROR";
                lvMessages.Items[Item].ForeColor = Color.Red;
                if (CommonFunctions.ErrorMessage != string.Empty)
                {
                    CommonFunctions.ErrMessage(CommonFunctions.ErrorMessage);
                }

                SelectDir();
                return;
            }
            else
            {
                lvMessages.Items[Item].Text     += "OK";
                lvMessages.Items[Item].ForeColor = Color.Lime;
            }
            Item++;
            lvMessages.Items.Add("Checking files...");
            Item++;

            bool checkerror = false;

            foreach (string filename in CommonFunctions.FileList)
            {
                string filepath = CommonFunctions.RoadsendRoot + filename;
                lvMessages.Items.Add(filename + "...");
                if (!CommonFunctions.CheckFile(filepath))
                {
                    checkerror = true;
                    lvMessages.Items[Item].Text     += "ERROR";
                    lvMessages.Items[Item].ForeColor = Color.Red;
                }
                else
                {
                    lvMessages.Items[Item].Text     += "OK";
                    lvMessages.Items[Item].ForeColor = Color.Lime;
                }
                Item++;
            }

            if (checkerror)
            {
                DialogResult Ans = MessageBox.Show("Select Roadsend root directory?",
                                                   "Files not found", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Ans == DialogResult.Yes)
                {
                    SelectDir();
                    return;
                }
                else
                {
                    return;
                }
            }

            lvMessages.Items.Add("Launch...");
            //Item++;

            if (!Launch.RunIDE())
            {
                lvMessages.Items[Item].Text     += "ERROR";
                lvMessages.Items[Item].ForeColor = Color.Red;

                CommonFunctions.ErrMessage(Launch.ErrorMessage);
                return;
            }
            else
            {
                lvMessages.Items[Item].Text     += "OK";
                lvMessages.Items[Item].ForeColor = Color.Lime;
                //System.Threading.Thread.Sleep(15000);
                Application.Exit();
            }
        }