示例#1
0
        public PdfCreatorSettings LoadPdfCreatorSettings()
        {
            MoveSettingsIfRequired();

            var settings         = (PdfCreatorSettings)DefaultSettingsBuilder.CreateEmptySettings();
            var migrationStorage = BuildMigrationStorage();

            settings.LoadData(migrationStorage);

            ApplySharedSettings(settings);

            if (settings.ConversionProfiles.Count <= 0)
            {
                settings = CreateDefaultSettings(FindPrimaryPrinter(), settings.ApplicationSettings.Language);
            }

            CheckLanguage(settings);
            CheckAndAddMissingDefaultProfile(settings);
            CheckPrinterMappings(settings);
            CheckTitleReplacement(settings);
            CheckUpdateInterval(settings);
            CheckDefaultViewers(settings);
            _actionOrderChecker.Check(settings.ConversionProfiles);

            _translationHelper.TranslateProfileList(settings.ConversionProfiles);

            LogProfiles(settings);

            return(settings);
        }
        public override bool LoadIniSettings()
        {
            var fileName = QueryLoadFileName();

            if (string.IsNullOrWhiteSpace(fileName))
            {
                return(false);
            }

            var overwriteSettings = QueryOverwriteSettings();

            if (!overwriteSettings)
            {
                return(false);
            }

            if (_iniSettingsLoader.LoadIniSettings(fileName) is PdfCreatorSettings settings)
            {
                if (!_settingsProvider.CheckValidSettings(settings))
                {
                    DisplayInvalidSettingsWarning();
                    return(false);
                }

                var missingPrinters = FindMissingPrinters(settings.ApplicationSettings.PrinterMappings);

                var unusedPrinters = GetUnusedPrinters(settings.ApplicationSettings.PrinterMappings);
                if (unusedPrinters.Any())
                {
                    QueryAndDeleteUnusedPrinters(unusedPrinters);
                }

                if (missingPrinters.Any())
                {
                    QueryAndAddMissingPrinters(missingPrinters);
                }

                _actionOrderChecker.Check(settings.ConversionProfiles);

                foreach (var profile in settings.ConversionProfiles)
                {
                    profile.Properties.IsShared = false;
                }

                _settingsManager.ApplyAndSaveSettings(settings);
            }

            return(true);
        }
示例#3
0
 public void SortAndUpdateActions()
 {
     _actionOrderChecker.Check(new[] { Job.Profile });
 }