Exemplo n.º 1
0
        private void RestoreEnvironment()
        {
            string startTime = _application.Status.StartTime;

            // locate backup file
            DirectoryInfo dirInfo = new DirectoryInfo(_backupDir);

            FileInfo[] files = dirInfo.GetFiles();

            string backupFile = files[0].FullName;

            hMailServer.Backup backup = _application.BackupManager.LoadBackup(backupFile);

            backup.RestoreDomains  = true;
            backup.RestoreMessages = _backupMessages;
            backup.RestoreSettings = true;
            backup.StartRestore();

            WaitForRestoreCompletion(startTime);
        }
Exemplo n.º 2
0
        private void buttonStartRestore_Click(object sender, EventArgs e)
        {
            string message = "WARNING! All settings will be cleared & ALL MESSAGES DELETED prior to restore. Are you sure?";

            if (MessageBox.Show(Strings.Localize(message), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (_backup != null)
                {
                    if (checkRestoreSettings.Enabled ||
                        checkRestoreDomains.Enabled ||
                        checkRestoreMessages.Enabled)
                    {
                        _backup.RestoreDomains  = checkRestoreDomains.Checked;
                        _backup.RestoreMessages = checkRestoreMessages.Checked;
                        _backup.RestoreSettings = checkRestoreSettings.Checked;

                        _backup.StartRestore();
                    }
                }
            }
        }