/// <summary>
        ///   Migrates the options from the storage of older LHM versions to the storage of new versions.
        /// </summary>
        public void MigrateOptions()
        {
            //Could happen if you install a LicenseHeaderManager (LHM) version which is older than the ever installed highest version
            //Should only happen to developers of LHM, but could theoretically also happen if someone downgrades LHM.

            var parsedVersion             = GetParsedVersion();
            var currentlyInstalledVersion = GetCurrentlyInstalledVersion();

            s_log.Debug($"Parsed version: {parsedVersion}, currently installed version: {currentlyInstalledVersion}");

            if (parsedVersion > currentlyInstalledVersion)
            {
                if (s_firstDialogPageLoaded)
                {
                    MessageBoxHelper.ShowMessage(
                        "We detected that you are downgrading LicenseHeaderManager from a higher version." + Environment.NewLine +
                        "As we don't know what you did to get to that state, it is possible that you missed an update for the Language Settings."
                        + Environment.NewLine +
                        "If some of your license headers do not update, check if your Language Settings (Options -> LicenseHeaderManager -> Languages) "
                        + Environment.NewLine +
                        "contain all the extensions you require.");

                    s_firstDialogPageLoaded = false;
                }

                Version = LicenseHeadersPackage.Version;
                Model.Save();
            }
            else
            {
                var saveRequired = false;

                foreach (var updateStep in GetVersionUpdateSteps())
                {
                    saveRequired |= Update(updateStep);
                }

                if (Version != LicenseHeadersPackage.Version)
                {
                    saveRequired |= Update(new UpdateStep(currentlyInstalledVersion));
                }

                if (saveRequired)
                {
                    Model.Save();
                }
            }
        }
Ejemplo n.º 2
0
 public override void SaveSettingsToStorage()
 {
     _model.Save();
 }