public static bool loadSettings()
        {
            if (!File.Exists(settingsFile))
            {
                settings = new Settings();
            }
            else
            {

                try
                {

                    settings = Serializer.loadFromFile<Settings>(settingsFile);
                }
                catch (InvalidOperationException ioe)
                {
                    MessageBox.Show(ioe.ToString());
                    MessageBoxResult res = MessageBox.Show("Failed to load settings. Create new?", "Failed to load settings", MessageBoxButton.YesNo);
                    if (res == MessageBoxResult.Yes)
                    {
                        settings = new Settings();
                    }
                    else
                    {
                        MessageBox.Show("Can't continue without database. Exiting.");
                        return false;
                    }
                }
            }
            if (settings != null)
                app.Exit += storeSettings;
            else
            {
                MessageBox.Show("Failed to create settings object.");
                return false;
            }
            if (SettingsLoaded != null)
                SettingsLoaded(settings);
            return true;
        }
Example #2
0
 public Patcher(PatchInformation patchInformation, Settings settings)
 {
     this.patchInformation = patchInformation;
     this.settings = settings;
 }