Example #1
0
        public void SettingsUpdateV3To4_VersionBecomes4_TiffColorBlackWihteGetsBlackWhiteG4Fax()
        {
            const int oldSettingsVersion = 3;
            const int newSettingsVersion = 4;

            var iniFile = Path.Combine(_th.TmpTestFolder, "TestSettings.ini");

            var iniStorage  = new IniStorage(iniFile, Encoding.UTF8);
            var builder     = new CreatorDefaultSettingsBuilder();
            var oldSettings = (PdfCreatorSettings)builder.CreateDefaultSettings("PDFCreator", "English");

            oldSettings.ConversionProfiles[0].TiffSettings.Color = TiffColor.BlackWhiteG4Fax;
            oldSettings.CreatorAppSettings.SettingsVersion       = oldSettingsVersion;

            oldSettings.SaveData(iniStorage);

            var settingsFromIni = File.ReadAllText(iniFile);

            settingsFromIni = settingsFromIni.Replace("BlackWhiteG4Fax", "BlackWhite");
            File.WriteAllText(iniFile, settingsFromIni);

            var settings = (PdfCreatorSettings) new CreatorDefaultSettingsBuilder().CreateEmptySettings();

            var storage = new CreatorSettingsMigrationStorage(iniStorage, newSettingsVersion);

            settings.LoadData(storage);

            Assert.AreEqual(newSettingsVersion, settings.CreatorAppSettings.SettingsVersion, "Did not update SettingsVersion.");
            Assert.AreEqual(TiffColor.BlackWhiteG4Fax, settings.ConversionProfiles[0].TiffSettings.Color, "Did not update TiffColor BlackWhite to BlackWhiteG4Fax");
        }
Example #2
0
        private PdfCreatorSettings CreateSettings()
        {
            var profileBuilder = new CreatorDefaultSettingsBuilder();
            var settings       = (PdfCreatorSettings)profileBuilder.CreateDefaultSettings("MySpecialPrinter", "Elbisch");

            settings.ApplicationSettings.NextUpdate = new DateTime(2020, 1, 15);
            settings.ConversionProfiles.Add(new ConversionProfile());
            return(settings);
        }