示例#1
0
        private void btnReparerWinUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                //try
                //{
                //}
                //catch
                //{
                //    MessageBox.Show("Oh. Vous n'avez pas de connexion à internet... Pas grave ! Continuons.", "Pas de réseau", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //}

                try
                {
                    if (VERIFICATION_ACTIFOUPAS == true)
                    {
                        Cursor.Current = Cursors.AppStarting;
                        WebClient MAJ          = new WebClient();
                        string    ACTIF_OU_PAS = MAJ.DownloadString("https://brunopaiva.ch/Actif.txt");

                        if (ACTIF_OU_PAS != "1")
                        {
                            Cursor.Current = Cursors.Default;
                            MessageBox.Show("Redows is not available at the moment.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                            Quit quit = new Quit();

                            this.Hide();

                            quit.ShowDialog();
                        }
                    }
                }
                catch
                {
                    if (VERIFICATION_ACTIFOUPAS == true)
                    {
                        VERIFICATION_ACTIFOUPAS = true;
                    }
                    else
                    {
                        MessageBox.Show("Redows was unable to contact the central server. We strongly recommend that you do not carry out any repairs.", "Network error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Cursor.Current          = Cursors.Default;
                        VERIFICATION_ACTIFOUPAS = false;
                    }
                }

                lblTitre.Visible        = false;
                lblEnReparation.Visible = true;

                btnModeBasique.Enabled  = false;
                btnReparerWIM.Enabled   = false;
                btnConnaitre.Enabled    = false;
                btnOpenNumIndex.Enabled = false;

                Cursor.Current = Cursors.AppStarting;

                Process procSFC = new Process();
                procSFC.StartInfo.FileName = "cmd.exe";
                if (bCacherFenetre == true)
                {
                    procSFC.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /ScanHealth & exit";
                }
                else
                {
                    procSFC.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /ScanHealth";
                }
                procSFC.StartInfo.ErrorDialog = true;
                procSFC.StartInfo.Verb        = "runas";
                if (bCacherFenetre == true)
                {
                    procSFC.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                }
                else
                {
                    procSFC.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                }
                procSFC.Start();
                Cursor.Current = Cursors.WaitCursor;
                procSFC.WaitForExit();

                Cursor.Current = Cursors.Default;
                Cursor.Current = Cursors.AppStarting;

                Process proc = new Process();
                proc.StartInfo.FileName = "cmd.exe";
                if (bCacherFenetre == true)
                {
                    proc.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /CheckHealth & exit";
                }
                else
                {
                    proc.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /CheckHealth";
                }
                proc.StartInfo.ErrorDialog = true;
                proc.StartInfo.Verb        = "runas";
                if (bCacherFenetre == true)
                {
                    proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                }
                else
                {
                    proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                }
                proc.Start();
                Cursor.Current = Cursors.WaitCursor;
                proc.WaitForExit();

                Cursor.Current = Cursors.Default;
                Cursor.Current = Cursors.AppStarting;

                Process proc1 = new Process();
                proc1.StartInfo.FileName = "cmd.exe";
                if (bCacherFenetre == true)
                {
                    proc1.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /RestoreHealth & exit";
                }
                else
                {
                    proc1.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /RestoreHealth";
                }
                proc1.StartInfo.ErrorDialog = true;
                proc1.StartInfo.Verb        = "runas";
                if (bCacherFenetre == true)
                {
                    proc1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                }
                else
                {
                    proc1.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                }
                proc1.Start();
                Cursor.Current = Cursors.WaitCursor;
                proc1.WaitForExit();

                btnModeBasique.Enabled  = true;
                btnReparerWIM.Enabled   = true;
                btnConnaitre.Enabled    = true;
                btnOpenNumIndex.Enabled = true;

                End end = new End();

                this.Hide();

                end.ShowDialog();
            }
            catch
            {
                MessageBox.Show("Oh. An unknown error occurred.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                btnReparerWIM.Enabled   = true;
                btnConnaitre.Enabled    = true;
                btnOpenNumIndex.Enabled = true;
                btnModeBasique.Enabled  = true;
            }
        }
示例#2
0
        private void btnReparerWIM_Click(object sender, EventArgs e)
        {
            try
            {
                if (File.Exists(tbxPathNumIndex.Text))
                {
                    if (tbxPathNumIndex.Text != "")
                    {
                        if (tbxIndex.Text != "" && Convert.ToDouble(tbxIndex.Text) >= 0 && Convert.ToDouble(tbxIndex.Text) <= 20)
                        {
                            try
                            {
                                if (VERIFICATION_ACTIFOUPAS == true)
                                {
                                    Cursor.Current = Cursors.AppStarting;
                                    WebClient MAJ          = new WebClient();
                                    string    ACTIF_OU_PAS = MAJ.DownloadString("https://brunopaiva.ch/Actif.txt");

                                    if (ACTIF_OU_PAS != "1")
                                    {
                                        Cursor.Current = Cursors.Default;
                                        MessageBox.Show("Redows is not available at the moment.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                                        Quit quit = new Quit();

                                        this.Hide();

                                        quit.ShowDialog();
                                    }
                                }
                            }
                            catch
                            {
                                if (VERIFICATION_ACTIFOUPAS == true)
                                {
                                    VERIFICATION_ACTIFOUPAS = true;
                                }
                                else
                                {
                                    MessageBox.Show("Redows was unable to contact the central server. We strongly recommend that you do not carry out any repairs.", "Network error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    Cursor.Current          = Cursors.Default;
                                    VERIFICATION_ACTIFOUPAS = false;
                                }
                            }

                            lblTitre.Visible        = false;
                            lblEnReparation.Visible = true;

                            Cursor.Current = Cursors.WaitCursor;

                            btnModeBasique.Enabled  = false;
                            btnReparerWIM.Enabled   = false;
                            btnConnaitre.Enabled    = false;
                            btnOpenNumIndex.Enabled = false;

                            Process proc = new Process();
                            proc.StartInfo.FileName = "cmd.exe";
                            if (bCacherFenetre == true)
                            {
                                proc.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:" + tbxPathNumIndex.Text + ":" + tbxIndex.Text + " /limitaccess & exit";
                            }
                            else
                            {
                                proc.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:" + tbxPathNumIndex.Text + ":" + tbxIndex.Text + " /limitaccess";
                            }
                            proc.StartInfo.ErrorDialog = true;
                            proc.StartInfo.Verb        = "runas";
                            btnReparerWIM.Text         = "Repair in progress....";
                            if (bCacherFenetre == true)
                            {
                                proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                            }
                            else
                            {
                                proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                            }
                            proc.Start();
                            Cursor.Current = Cursors.WaitCursor;
                            proc.WaitForExit();

                            Cursor.Current = Cursors.Default;

                            lblTitre.Visible        = true;
                            lblEnReparation.Visible = false;

                            btnReparerWIM.Text = "Repair completed.";
                            End end = new End();

                            this.Hide();

                            end.ShowDialog();

                            // Lancer message final
                        }
                        else
                        {
                            MessageBox.Show("Please enter a valid index number before performing this action.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                            btnReparerWIM.Enabled   = true;
                            btnConnaitre.Enabled    = true;
                            btnOpenNumIndex.Enabled = true;
                            btnModeBasique.Enabled  = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please open a WIM file before performing this action.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("What the hell are you doing ? How do you expect the repair to work when the file does not exist ?\n\n(I thought you were an expert.)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                MessageBox.Show("Oh. An unknown error occurred.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                btnReparerWIM.Enabled   = true;
                btnConnaitre.Enabled    = true;
                btnOpenNumIndex.Enabled = true;
            }
        }
示例#3
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    if (VERIFICATION_ACTIFOUPAS == true)
                    {
                        //Cursor.Current = Cursors.AppStarting;
                        WebClient MAJ          = new WebClient();
                        string    ACTIF_OU_PAS = MAJ.DownloadString("https://brunopaiva.ch/Actif.txt");

                        if (ACTIF_OU_PAS != "1")
                        {
                            //Cursor.Current = Cursors.Default;
                            MessageBox.Show("Redows is not available at the moment.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                            Quit quit = new Quit();

                            this.Hide();

                            quit.ShowDialog();
                        }
                    }
                }
                catch
                {
                    if (VERIFICATION_ACTIFOUPAS == true)
                    {
                        VERIFICATION_ACTIFOUPAS = true;
                    }
                    else
                    {
                        MessageBox.Show("Redows was unable to contact the central server. We strongly recommend that you do not carry out any repairs.", "Network error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        //Cursor.Current = Cursors.Default;
                        VERIFICATION_ACTIFOUPAS = false;
                    }
                }

                //Wait wait = new Wait();

                //wait.Show();

                lblTitre.Visible        = false;
                lblEnReparation.Visible = true;

                lblEnReparation.ForeColor = Color.White;
                this.BackColor            = Color.Red;

                btnModeExpert.Enabled = false;
                btnStart.Enabled      = false;

                Cursor.Current = Cursors.WaitCursor;

                btnStart.Text = "Repair in progress (Step 1/3)...";

                Process procSFC = new Process();
                procSFC.StartInfo.FileName = "cmd.exe";
                if (bCacherFenetre == true)
                {
                    procSFC.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /ScanHealth & exit";
                }
                else
                {
                    procSFC.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /ScanHealth";
                }
                procSFC.StartInfo.ErrorDialog = true;
                procSFC.StartInfo.Verb        = "runas";
                if (bCacherFenetre == true)
                {
                    procSFC.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                }
                else
                {
                    procSFC.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                }
                procSFC.Start();
                procSFC.WaitForExit();

                //Cursor.Current = Cursors.Default;
                //Cursor.Current = Cursors.AppStarting;

                Process proc = new Process();
                proc.StartInfo.FileName = "cmd.exe";
                if (bCacherFenetre == true)
                {
                    proc.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /CheckHealth & exit";
                }
                else
                {
                    proc.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /CheckHealth";
                }
                proc.StartInfo.ErrorDialog = true;
                proc.StartInfo.Verb        = "runas";
                if (bCacherFenetre == true)
                {
                    proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                }
                else
                {
                    proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                }
                proc.Start();
                //Cursor.Current = Cursors.WaitCursor;
                proc.WaitForExit();

                btnStart.Text = "Repair in progress (Step 2/3)....";

                //Cursor.Current = Cursors.Default;
                //Cursor.Current = Cursors.AppStarting;

                Process proc1 = new Process();
                proc1.StartInfo.FileName = "cmd.exe";
                if (bCacherFenetre == true)
                {
                    proc1.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /RestoreHealth & exit";
                }
                else
                {
                    proc1.StartInfo.Arguments = "/k Dism /Online /Cleanup-Image /RestoreHealth";
                }
                proc1.StartInfo.ErrorDialog = true;
                proc1.StartInfo.Verb        = "runas";
                if (bCacherFenetre == true)
                {
                    proc1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                }
                else
                {
                    proc1.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                }
                proc1.Start();
                //Cursor.Current = Cursors.WaitCursor;
                proc1.WaitForExit();

                btnStart.Text = "Repair in progress (Step 3/3)...";

                //Cursor.Current = Cursors.Default;
                //Cursor.Current = Cursors.AppStarting;

                Process proc2 = new Process();
                proc2.StartInfo.FileName = "cmd.exe";
                if (bCacherFenetre == true)
                {
                    proc2.StartInfo.Arguments = "/k chkdsk c: /scan /forceofflinefix & exit";
                }
                else
                {
                    proc2.StartInfo.Arguments = "/k chkdsk c: /scan /forceofflinefix";
                }
                proc2.StartInfo.ErrorDialog = true;
                proc2.StartInfo.Verb        = "runas";
                if (bCacherFenetre == true)
                {
                    proc2.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                }
                else
                {
                    proc2.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                }
                proc2.Start();
                //Cursor.Current = Cursors.WaitCursor;
                proc2.WaitForExit();

                btnStart.Text = "Repair completed";

                Cursor.Current = Cursors.Default;

                this.BackColor          = Color.White;
                lblTitre.Visible        = true;
                lblEnReparation.Visible = false;

                //wait.Close();

                MessageBox.Show("Repair successfully completed.", "Success", MessageBoxButtons.OK);

                End end = new End();

                this.Hide();

                end.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Oh. An unknown error occurred.\n\nError : " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }