Beispiel #1
0
        private void LoadConfigFile(bool launchEditSnapRAID = true)
        {
            srConfig.LoadConfigFile(Properties.Settings.Default.ConfigFileLocation);

            Properties.Settings.Default.ConfigFileIsValid = srConfig.IsValid;
            bool exists = File.Exists(Properties.Settings.Default.SnapRAIDFileLocation);

            SetCommonButtonsEnabledState(srConfig.IsValid && exists);

            if (srConfig.IsValid &&
                exists
                )
            {
                BeginInvoke((MethodInvoker) delegate { SetElucidateFormTitle(Properties.Settings.Default.ConfigFileLocation); });
                driveSpaceDisplay.RefreshGrid(srConfig, false);
            }
            else
            {
                srConfig.ConfigErrors.Add(@"Please Edit the Settings and ensure no errors when saving!");
                Log.Fatal("The config file is not valid.[{0}]\n{1}", Properties.Settings.Default.ConfigFileLocation,
                          string.Join($@"{Environment.NewLine} - ", srConfig.ConfigErrors));
                if (launchEditSnapRAID)
                {
                    BeginInvoke((MethodInvoker) delegate
                    {
                        EditSnapRAIDConfigToolStripMenuItem_Click(this, EventArgs.Empty);
                    });
                }
            }
        }