Exemplo n.º 1
0
        public void SaveSettingsInRegistry(PdfCreatorSettings settings)
        {
            CheckGuids(settings);
            var regStorage = BuildStorage();

            _logger.Debug("Saving settings");
            settings.SaveData(regStorage, "");
            LogProfiles(settings);
        }
Exemplo n.º 2
0
        public void Settings_Save_ExpectsNothing()
        {
            var settings = new PdfCreatorSettings(Substitute.For <IStorage>());

            settings.ConversionProfiles.Add(new ConversionProfile {
                Guid = "p1"
            });
            settings.ConversionProfiles.Add(new ConversionProfile {
                Guid = "p2"
            });

            settings.SaveData("");
        }
Exemplo n.º 3
0
        public void Settings_Save_ExpectsNothing()
        {
            var settings = new PdfCreatorSettings();

            settings.ConversionProfiles.Add(new ConversionProfile {
                Guid = "p1"
            });
            settings.ConversionProfiles.Add(new ConversionProfile {
                Guid = "p2"
            });
            var storage = new DataStorageFactory().BuildIniStorage("");

            settings.SaveData(storage);
        }
Exemplo n.º 4
0
        public void SaveSettings(PdfCreatorSettings settings)
        {
            var path = _appDataProvider.LocalAppDataFolder;

            var backupFile = DateTime.Now.ToString("yyyyMMdd") + "_backup.ini";

            backupFile = PathSafe.Combine(path, backupFile);

            _directory.CreateDirectory(path);

            var storage = _storageFactory.BuildIniStorage(backupFile);

            settings.SaveData(storage);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Saves the settings. An Exception will be thrown if the settings have not been previously loaded
        /// </summary>
        public static void SaveSettings()
        {
            if (_settings == null)
            {
                throw new NullReferenceException("The settings have not been loaded before");
            }

            // Get the NextUpdate value from the update manager
            _settings.ApplicationProperties.NextUpdate = UpdateAssistant.NextUpdate;
            CheckGuids();

            _logger.Debug("Saving settings");
            _settings.SaveData("");

            if (_logger.IsTraceEnabled)
            {
                _logger.Trace("Profiles:");
                foreach (var conversionProfile in _settings.ConversionProfiles)
                {
                    _logger.Trace(conversionProfile.Name);
                }
            }
        }