Ejemplo n.º 1
0
        private void ConverterSettingsForm_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(SettingsFileName)) // if no file name set load defaults
            {
                string filePath;
                var settings = new ConverterSettings();
                DefaultSettingsLocatorHelper.EnsureDefaultSettingsFilePresent(out filePath,settings);
                SettingsFileName = filePath;
            }
            else if (!File.Exists(SettingsFileName)) // if file not exist load default settings
            {
                string filePath;
                var settings = new ConverterSettings();
                DefaultSettingsLocatorHelper.EnsureDefaultSettingsFilePresent(out filePath, settings);
                SettingsFileName = filePath;
            }

            try
            {
                ConverterSettingsFile settingsFile = new ConverterSettingsFile();
                settingsFile.Load(SettingsFileName);
                _settings.CopyFrom(settingsFile.Settings);
            }
            catch(Exception ex)
            {
                Logger.Log.Error(ex);
                // ignored
            }
            checkBoxTransliterateTOC.Checked = _settings.CommonSettings.TransliterateToc;
            checkBoxTransliterateFileName.Checked = _settings.ConversionSettings.TransliterateFileName;
            checkBoxTransliterateAdditional.Checked = _settings.ConversionSettings.TransliterationSettings.Transliterate;
            textBoxAuthorFormat.Text = _settings.ConversionSettings.AuthorFormat;
            textBoxFileAsFormat.Text = _settings.ConversionSettings.FileAsFormat;
            textBoxNoSequenceFormat.Text = _settings.ConversionSettings.NoSequenceFormat;
            textBoxSequenceFormat.Text = _settings.ConversionSettings.SequenceFormat;
            textBoxNoSeriesFormat.Text = _settings.ConversionSettings.NoSeriesFormat;
            checkBoxAddSequences.Checked = _settings.ConversionSettings.AddSeqToTitle;
            checkBoxFb2Info.Checked = _settings.ConversionSettings.Fb2Info;
            checkBoxConvertAlphaPNG.Checked = _settings.FB2ImportSettings.ConvertAlphaPng;
            checkBoxFlatStructure.Checked = _settings.CommonSettings.FlatStructure;
            checkBoxEmbedStyles.Checked = _settings.CommonSettings.EmbedStyles;
            checkBoxCapitalize.Checked = _settings.CommonSettings.CapitalDrop;
            checkBoxCalibreMetadata.Checked = _settings.V2Settings.AddCalibreMetadata;
            checkBoxSkipAboutPage.Checked = _settings.ConversionSettings.SkipAboutPage;
            checkBoxUseXPGT.Checked = _settings.V2Settings.EnableAdobeTemplate;
            textBoxTemplatePath.Text = _settings.V2Settings.AdobeTemplatePath;
            LoadFixMode();
            LoadIgnoreTitleMode();
            UpdateSequencesGroup();
            _locationsLoaded = _locations.Init();
            if (!_locationsLoaded)
            {
                const string error = "No FB2EPUBExt.INI file found in any of the paths";
                toolTipControl.SetToolTip(tabPagePaths, error);
                toolTipControl.SetToolTip(listBoxPaths, error);
                Logger.Log.Error(error);
            }
            LoadPathsGroup();
            UpdateXPGTGroupGUI();
            LoadFontsList();
            SetupCSSElements();
            UpdateCCSElements();
            LoadAppleSettingsTab();
            appleV2SettingsControl.LoadSettings(_settings);
        }