Пример #1
0
        public void Restore()
        {
            string filename = "";
            OpenFileDialog f2 = new OpenFileDialog();
            f2.Title = "Open Database Backup File";
            f2.Filter = "*." + FileExtension + "|*." + FileExtension + "|All Files|*.*";
            if (Directory.Exists(textBox_folder.Text.Trim()))
                f2.InitialDirectory = textBox_folder.Text.Trim();
            if (DialogResult.OK != f2.ShowDialog())
                return;

            filename = f2.FileName;

            // End of Locate backup file ----------------------

            try
            {
                MySqlBackupRestore mb = new MySqlBackupRestore();

                mb.Restore(filename);

                MessageBox.Show("Restore successfull.", "Restore");
            }
            catch (Exception ex) // Log any error that occur during the backup process
            {
                string errorMessage = "Restore fail.\r\n\r\n" + ex.ToString();
                MessageBox.Show(errorMessage, "Error");
            }
        }