Exemplo n.º 1
0
 private void tabControl1_Selected(object sender, TabControlEventArgs e)
 {
     if (e.TabPage == RecoveryOperations)
     {
         WindowState     = FormWindowState.Maximized;
         webBrowser1.Url = new Uri("http://snapraid.sourceforge.net/manual.html#9", UriKind.Absolute);
     }
     else if (e.TabPage == coveragePage)
     {
         if (Properties.Settings.Default.ConfigFileIsValid)
         {
             try
             {
                 ConfigFileHelper cfg = new ConfigFileHelper(Properties.Settings.Default.ConfigFileLocation);
                 cfg.Read();
                 List <string> displayLines = cfg.SnapShotSources;
                 // Add the Parity lines to show the amount of drive space currently occupied by SnapRaid
                 displayLines.Add(new FileInfo(cfg.ParityFile).DirectoryName);
                 if (!string.IsNullOrEmpty(cfg.QParityFile))
                 {
                     displayLines.Add(new FileInfo(cfg.QParityFile).DirectoryName);
                 }
                 driveSpace.StartProcessing(displayLines);
             }
             catch
             {
             }
         }
     }
 }
Exemplo n.º 2
0
        //private void tabControl_Selected(object sender, TabControlEventArgs e)
        //{

        //    else if (e.TabPage == tabCoveragePage)
        //    {
        //        if (!Properties.Settings.Default.ConfigFileIsValid) return;
        //        try
        //        {
        //            ConfigFileHelper cfg = new ConfigFileHelper(Properties.Settings.Default.ConfigFileLocation);
        //            cfg.Read();
        //            List<string> displayLines = cfg.SnapShotSources;
        //            // Add the Parity lines to show the amount of drive space currently occupied by SnapRaid
        //            displayLines.Add(new FileInfo(cfg.ParityFile1).DirectoryName);
        //            if (!string.IsNullOrEmpty(cfg.ParityFile2))
        //            {
        //                displayLines.Add(new FileInfo(cfg.ParityFile2).DirectoryName);
        //            }
        //            driveSpace.StartProcessing(displayLines);
        //        }
        //        catch
        //        {
        //            // ignored
        //        }
        //    }
        //}

        //private void tabControl_Deselected(object sender, TabControlEventArgs e)
        //{
        //    if (e.TabPage != RecoveryOperations) return;
        //    if (WindowState == FormWindowState.Maximized)
        //    {
        //        WindowState = FormWindowState.Normal;
        //    }
        //}

        private void btnRemoveOutput_Click(object sender, EventArgs e)
        {
            if (DialogResult.Yes != MessageBoxExt.Show(this, @"Are you sure you want to perform this task ?",
                                                       "Remove SnapRAID Output files.", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                return;
            }

            try
            {
                ConfigFileHelper cfg = new ConfigFileHelper(Properties.Settings.Default.ConfigFileLocation);
                if (!cfg.Read())
                {
                    MessageBoxExt.Show(this, "Failed to read the config file.", "Config Read Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                FileInfo fi;
                if (!string.IsNullOrEmpty(cfg.ParityFile1))
                {
                    fi = new FileInfo(cfg.ParityFile1);
                    if (fi.Exists)
                    {
                        fi.Delete();
                    }
                }
                if (!string.IsNullOrEmpty(cfg.ParityFile2))
                {
                    fi = new FileInfo(cfg.ParityFile2);
                    if (fi.Exists)
                    {
                        fi.Delete();
                    }
                }

                if (cfg.ContentFiles == null)
                {
                    return;
                }

                foreach (string contentFile in cfg.ContentFiles.Where(contentFile => !string.IsNullOrEmpty(contentFile)))
                {
                    fi = new FileInfo(contentFile);
                    if (fi.Exists)
                    {
                        fi.Delete();
                    }
                }
            }
            catch (Exception ex)
            {
                //ExceptionHandler.ReportException(ex, "btnRemoveOutput_Click has thrown: ");
                KryptonMessageBox.Show(this, ex.Message, @"Remove SnapRAID Output files.");
            }
        }
Exemplo n.º 3
0
 private void btnRemoveOutput_Click(object sender, EventArgs e)
 {
     if (DialogResult.Yes == MessageBoxExt.Show(this, "Are you sure you want to perform this task ?",
                                                "Remove SnapRAID Output files.", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
     {
         try
         {
             ConfigFileHelper cfg = new ConfigFileHelper(Properties.Settings.Default.ConfigFileLocation);
             string           readResult;
             if (!string.IsNullOrEmpty(readResult = cfg.Read()))
             {
                 MessageBoxExt.Show(this, readResult, "Config Read Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 FileInfo fi;
                 if (!string.IsNullOrEmpty(cfg.ParityFile))
                 {
                     fi = new FileInfo(cfg.ParityFile);
                     if (fi.Exists)
                     {
                         fi.Delete();
                     }
                 }
                 if (!string.IsNullOrEmpty(cfg.QParityFile))
                 {
                     fi = new FileInfo(cfg.QParityFile);
                     if (fi.Exists)
                     {
                         fi.Delete();
                     }
                 }
                 if (cfg.ContentFiles != null)
                 {
                     foreach (string contentFile in cfg.ContentFiles.Where(contentFile => !string.IsNullOrEmpty(contentFile)))
                     {
                         fi = new FileInfo(contentFile);
                         if (fi.Exists)
                         {
                             fi.Delete();
                         }
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             Log.Error(ex, "btnRemoveOutput_Click has thrown: ");
             MessageBox.Show(this, ex.Message, "Remove SnapRAID Output files.");
         }
     }
 }
Exemplo n.º 4
0
        private void ReadConfigDetails()
        {
            exludedFilesView.Rows.Clear();
            snapShotSourcesTreeView.Nodes.Clear();

            if (!File.Exists(configFileLocation.Text))
            {
                if (Properties.Settings.Default.UseWindowsSettings)
                {
                    exludedFilesView.Rows.Add(@"\$RECYCLE.BIN\");
                    exludedFilesView.Rows.Add(@"\System Volume Information\");
                    exludedFilesView.Rows.Add(@"*.bak");
                    exludedFilesView.Rows.Add(@"Thumbs.db");
                }
                else
                {
                    exludedFilesView.Rows.Add(@"*.bak");
                    exludedFilesView.Rows.Add(@"/lost+found/");
                    exludedFilesView.Rows.Add(@"/tmp/");
                }
            }
            else
            {
                ConfigFileHelper cfg = new ConfigFileHelper(configFileLocation.Text);
                string           readResult;
                if (!string.IsNullOrEmpty(readResult = cfg.Read()))
                {
                    MessageBoxExt.Show(this, readResult, "Config Read Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                IncludePatterns               = cfg.IncludePatterns;
                numBlockSizeKB.Value          = cfg.BlockSizeKB;
                advSettingsList[3].CheckState = cfg.Nohidden;
                numAutoSaveGB.Value           = cfg.AutoSaveGB;
                foreach (string excludePattern in cfg.ExcludePatterns.Where(excludePattern => !string.IsNullOrWhiteSpace(excludePattern)))
                {
                    exludedFilesView.Rows.Add(excludePattern);
                }
                foreach (string source in cfg.SnapShotSources.Where(source => !string.IsNullOrWhiteSpace(source)))
                {
                    snapShotSourcesTreeView.Nodes.Add(new TreeNode(source, 7, 7));
                }
                raid5Location.Text = cfg.ParityFile;
                raid6Location.Text = cfg.QParityFile;
            }
            UnsavedChangesMade = false;
            driveSpace.StartProcessing((from TreeNode node in snapShotSourcesTreeView.Nodes select node.Text).ToList());
        }
Exemplo n.º 5
0
        private void ElucidateForm_Shown(object sender, EventArgs e)
        {
            ConfigFileHelper cfg = new ConfigFileHelper(Properties.Settings.Default.ConfigFileLocation);

            if (!cfg.Read())
            {
                MessageBoxExt.Show(this, "Failed to read the config file.", "Config Read Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Properties.Settings.Default.ConfigFileIsValid = cfg.ConfigFileExists;

            EnableIfValid(Properties.Settings.Default.ConfigFileIsValid);

            if (!Properties.Settings.Default.ConfigFileIsValid)
            {
                // open the settings form since the config is not valid
                settingsToolStripMenuItem_Click(sender, e);
            }
        }