예제 #1
0
        public void InitializeLanguage(LanguageStructure.General general, Settings settings)
        {
            Columns[ColumnIndexNumber].Text = general.NumberSymbol;
            Columns[ColumnIndexStart].Text = general.StartTime;
            Columns[ColumnIndexEnd].Text = general.EndTime;
            Columns[ColumnIndexDuration].Text = general.Duration;
            Columns[ColumnIndexText].Text = general.Text;
            if (settings.General.ListViewLineSeparatorString != null)
                _lineSeparatorString = settings.General.ListViewLineSeparatorString;

            if (!string.IsNullOrEmpty(settings.General.SubtitleFontName))
                _subtitleFontName = settings.General.SubtitleFontName;
            SubtitleFontBold = settings.General.SubtitleFontBold;
            if (settings.General.SubtitleFontSize > 6 && settings.General.SubtitleFontSize < 72)
                SubtitleFontSize = settings.General.SubtitleFontSize;
            ForeColor = settings.General.SubtitleFontColor;
            BackColor = settings.General.SubtitleBackgroundColor;
            _settings = settings;
        }
예제 #2
0
        private static void CustomSerialize(string fileName, Settings settings)
        {
            var textWriter = new XmlTextWriter(fileName, null) {Formatting = Formatting.Indented};
            textWriter.WriteStartDocument();

            textWriter.WriteStartElement("Settings", "");

            textWriter.WriteStartElement("RecentFiles", "");
            textWriter.WriteStartElement("FileNames", "");
            foreach (var item in settings.RecentFiles.Files)
            {
                textWriter.WriteStartElement("FileName");
                if (item.OriginalFileName != null)
                    textWriter.WriteAttributeString("OriginalFileName", item.OriginalFileName);
                if (item.VideoFileName != null)
                    textWriter.WriteAttributeString("VideoFileName", item.VideoFileName);
                textWriter.WriteAttributeString("FirstVisibleIndex", item.FirstVisibleIndex.ToString());
                textWriter.WriteAttributeString("FirstSelectedIndex", item.FirstSelectedIndex.ToString());
                textWriter.WriteString(item.FileName);
                textWriter.WriteEndElement();
            }
            textWriter.WriteEndElement();
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("General", "");
            textWriter.WriteElementString("ShowToolbarNew", settings.General.ShowToolbarNew.ToString());
            textWriter.WriteElementString("ShowToolbarOpen", settings.General.ShowToolbarOpen.ToString());
            textWriter.WriteElementString("ShowToolbarSave", settings.General.ShowToolbarSave.ToString());
            textWriter.WriteElementString("ShowToolbarSaveAs", settings.General.ShowToolbarSaveAs.ToString());
            textWriter.WriteElementString("ShowToolbarFind", settings.General.ShowToolbarFind.ToString());
            textWriter.WriteElementString("ShowToolbarReplace", settings.General.ShowToolbarReplace.ToString());
            textWriter.WriteElementString("ShowToolbarFixCommonErrors", settings.General.ShowToolbarFixCommonErrors.ToString());
            textWriter.WriteElementString("ShowToolbarVisualSync", settings.General.ShowToolbarVisualSync.ToString());
            textWriter.WriteElementString("ShowToolbarSpellCheck", settings.General.ShowToolbarSpellCheck.ToString());
            textWriter.WriteElementString("ShowToolbarSettings", settings.General.ShowToolbarSettings.ToString());
            textWriter.WriteElementString("ShowToolbarHelp", settings.General.ShowToolbarHelp.ToString());
            textWriter.WriteElementString("ShowFrameRate", settings.General.ShowFrameRate.ToString());
            textWriter.WriteElementString("ShowVideoPlayer", settings.General.ShowVideoPlayer.ToString());
            textWriter.WriteElementString("ShowAudioVisualizer", settings.General.ShowAudioVisualizer.ToString());
            textWriter.WriteElementString("ShowWaveform", settings.General.ShowWaveform.ToString());
            textWriter.WriteElementString("ShowSpectrogram", settings.General.ShowSpectrogram.ToString());
            textWriter.WriteElementString("DefaultFrameRate", settings.General.DefaultFrameRate.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("DefaultSubtitleFormat", settings.General.DefaultSubtitleFormat);
            textWriter.WriteElementString("DefaultEncoding", settings.General.DefaultEncoding);
            textWriter.WriteElementString("AutoConvertToUtf8", settings.General.AutoConvertToUtf8.ToString());
            textWriter.WriteElementString("AutoGuessAnsiEncoding", settings.General.AutoGuessAnsiEncoding.ToString());
            textWriter.WriteElementString("_subtitleFontName", settings.General.SubtitleFontName);
            textWriter.WriteElementString("SubtitleFontSize", settings.General.SubtitleFontSize.ToString());
            textWriter.WriteElementString("SubtitleFontBold", settings.General.SubtitleFontBold.ToString());
            textWriter.WriteElementString("SubtitleFontColor", settings.General.SubtitleFontColor.ToArgb().ToString());
            textWriter.WriteElementString("SubtitleBackgroundColor", settings.General.SubtitleBackgroundColor.ToArgb().ToString());
            textWriter.WriteElementString("CenterSubtitleInTextBox", settings.General.CenterSubtitleInTextBox.ToString());
            textWriter.WriteElementString("ShowRecentFiles", settings.General.ShowRecentFiles.ToString());
            textWriter.WriteElementString("RememberSelectedLine", settings.General.RememberSelectedLine.ToString());
            textWriter.WriteElementString("StartLoadLastFile", settings.General.StartLoadLastFile.ToString());
            textWriter.WriteElementString("StartRememberPositionAndSize", settings.General.StartRememberPositionAndSize.ToString());
            textWriter.WriteElementString("StartPosition", settings.General.StartPosition);
            textWriter.WriteElementString("StartSize", settings.General.StartSize);
            textWriter.WriteElementString("SplitContainerMainSplitterDistance", settings.General.SplitContainerMainSplitterDistance.ToString());
            textWriter.WriteElementString("SplitContainer1SplitterDistance", settings.General.SplitContainer1SplitterDistance.ToString());
            textWriter.WriteElementString("SplitContainerListViewAndTextSplitterDistance", settings.General.SplitContainerListViewAndTextSplitterDistance.ToString());
            textWriter.WriteElementString("StartInSourceView", settings.General.StartInSourceView.ToString());
            textWriter.WriteElementString("RemoveBlankLinesWhenOpening", settings.General.RemoveBlankLinesWhenOpening.ToString());
            textWriter.WriteElementString("SubtitleLineMaximumLength", settings.General.SubtitleLineMaximumLength.ToString());
            textWriter.WriteElementString("SubtitleMinimumDisplayMilliseconds", settings.General.SubtitleMinimumDisplayMilliseconds.ToString());
            textWriter.WriteElementString("SubtitleMaximumDisplayMilliseconds", settings.General.SubtitleMaximumDisplayMilliseconds.ToString());
            textWriter.WriteElementString("MininumMillisecondsBetweenLines", settings.General.MininumMillisecondsBetweenLines.ToString());
            textWriter.WriteElementString("SetStartEndHumanDelay", settings.General.SetStartEndHumanDelay.ToString());
            textWriter.WriteElementString("AutoWrapLineWhileTyping", settings.General.AutoWrapLineWhileTyping.ToString());
            textWriter.WriteElementString("SubtitleMaximumCharactersPerSeconds", settings.General.SubtitleMaximumCharactersPerSeconds.ToString(System.Globalization.CultureInfo.InvariantCulture));
            textWriter.WriteElementString("SubtitleOptimalCharactersPerSeconds", settings.General.SubtitleOptimalCharactersPerSeconds.ToString(System.Globalization.CultureInfo.InvariantCulture));
            textWriter.WriteElementString("SpellCheckLanguage", settings.General.SpellCheckLanguage);
            textWriter.WriteElementString("VideoPlayer", settings.General.VideoPlayer);
            textWriter.WriteElementString("VideoPlayerDefaultVolume", settings.General.VideoPlayerDefaultVolume.ToString());
            textWriter.WriteElementString("VideoPlayerPreviewFontSize", settings.General.VideoPlayerPreviewFontSize.ToString());
            textWriter.WriteElementString("VideoPlayerShowStopButton", settings.General.VideoPlayerShowStopButton.ToString());
            textWriter.WriteElementString("VideoPlayerShowStopMute", settings.General.VideoPlayerShowMuteButton.ToString());
            textWriter.WriteElementString("VideoPlayerShowStopFullscreen", settings.General.VideoPlayerShowFullscreenButton.ToString());
            textWriter.WriteElementString("Language", settings.General.Language);
            textWriter.WriteElementString("ListViewLineSeparatorString", settings.General.ListViewLineSeparatorString);
            textWriter.WriteElementString("ListViewDoubleClickAction", settings.General.ListViewDoubleClickAction.ToString());
            textWriter.WriteElementString("UppercaseLetters", settings.General.UppercaseLetters);
            textWriter.WriteElementString("DefaultAdjustMilliseconds", settings.General.DefaultAdjustMilliseconds.ToString());
            textWriter.WriteElementString("AutoRepeatOn", settings.General.AutoRepeatOn.ToString());
            textWriter.WriteElementString("AutoRepeatCount", settings.General.AutoRepeatCount.ToString(System.Globalization.CultureInfo.InvariantCulture));
            textWriter.WriteElementString("AutoContinueOn", settings.General.AutoContinueOn.ToString());
            textWriter.WriteElementString("SyncListViewWithVideoWhilePlaying", settings.General.SyncListViewWithVideoWhilePlaying.ToString());
            textWriter.WriteElementString("AutoBackupSeconds", settings.General.AutoBackupSeconds.ToString());
            textWriter.WriteElementString("SpellChecker", settings.General.SpellChecker);
            textWriter.WriteElementString("AllowEditOfOriginalSubtitle", settings.General.AllowEditOfOriginalSubtitle.ToString());
            textWriter.WriteElementString("PromptDeleteLines", settings.General.PromptDeleteLines.ToString());
            textWriter.WriteElementString("Undocked", settings.General.Undocked.ToString());
            textWriter.WriteElementString("UndockedVideoPosition", settings.General.UndockedVideoPosition);
            textWriter.WriteElementString("UndockedWaveformPosition", settings.General.UndockedWaveformPosition);
            textWriter.WriteElementString("UndockedVideoControlsPosition", settings.General.UndockedVideoControlsPosition);
            textWriter.WriteElementString("WaveFormCenter", settings.General.WaveFormCenter.ToString());
            textWriter.WriteElementString("SmallDelayMilliseconds", settings.General.SmallDelayMilliseconds.ToString());
            textWriter.WriteElementString("LargeDelayMilliseconds", settings.General.LargeDelayMilliseconds.ToString());
            textWriter.WriteElementString("ShowOriginalAsPreviewIfAvailable", settings.General.ShowOriginalAsPreviewIfAvailable.ToString());
            textWriter.WriteElementString("LastPacCodePage", settings.General.LastPacCodePage.ToString());
            textWriter.WriteElementString("OpenSubtitleExtraExtensions", settings.General.OpenSubtitleExtraExtensions);
            textWriter.WriteElementString("ListViewColumsRememberSize", settings.General.ListViewColumsRememberSize.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("ListViewNumberWidth", settings.General.ListViewNumberWidth.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("ListViewStartWidth", settings.General.ListViewStartWidth.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("ListViewEndWidth", settings.General.ListViewEndWidth.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("ListViewDurationWidth", settings.General.ListViewDurationWidth.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("ListViewTextWidth", settings.General.ListViewTextWidth.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("VlcWaveTranscodeSettings", settings.General.VlcWaveTranscodeSettings);
            textWriter.WriteElementString("VlcLocation", settings.General.VlcLocation);
            textWriter.WriteElementString("UseFFMPEGForWaveExtraction", settings.General.UseFFMPEGForWaveExtraction.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("FFMPEGLocation", settings.General.FFMPEGLocation);
            textWriter.WriteElementString("UseTimeFormatHHMMSSFF", settings.General.UseTimeFormatHHMMSSFF.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("ClearStatusBarAfterSeconds", settings.General.ClearStatusBarAfterSeconds.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("Company", settings.General.Company);
            textWriter.WriteElementString("MoveVideo100Or500MsPlaySmallSample", settings.General.MoveVideo100Or500MsPlaySmallSample.ToString());
            textWriter.WriteElementString("DisableVideoAutoLoading", settings.General.DisableVideoAutoLoading.ToString());
            textWriter.WriteElementString("RightToLeftMode", settings.General.RightToLeftMode.ToString());
            textWriter.WriteElementString("LastSaveAsFormat", settings.General.LastSaveAsFormat);
            textWriter.WriteElementString("ShowBetaStuff", settings.General.ShowBetaStuff.ToString());
            textWriter.WriteElementString("NewEmptyDefaultMs", settings.General.NewEmptyDefaultMs.ToString(CultureInfo.InvariantCulture));

            textWriter.WriteEndElement();

            textWriter.WriteStartElement("Tools", "");
            textWriter.WriteElementString("StartSceneIndex", settings.Tools.StartSceneIndex.ToString());
            textWriter.WriteElementString("EndSceneIndex", settings.Tools.EndSceneIndex.ToString());
            textWriter.WriteElementString("VerifyPlaySeconds", settings.Tools.VerifyPlaySeconds.ToString());
            textWriter.WriteElementString("MergeLinesShorterThan", settings.Tools.MergeLinesShorterThan.ToString());
            textWriter.WriteElementString("FixShortDisplayTimesAllowMoveStartTime", settings.Tools.FixShortDisplayTimesAllowMoveStartTime.ToString());
            textWriter.WriteElementString("MusicSymbol", settings.Tools.MusicSymbol);
            textWriter.WriteElementString("MusicSymbolToReplace", settings.Tools.MusicSymbolToReplace);
            textWriter.WriteElementString("UnicodeSymbolsToInsert", settings.Tools.UnicodeSymbolsToInsert);
            textWriter.WriteElementString("SpellCheckAutoChangeNames", settings.Tools.SpellCheckAutoChangeNames.ToString());
            textWriter.WriteElementString("SpellCheckOneLetterWords", settings.Tools.SpellCheckOneLetterWords.ToString());
            textWriter.WriteElementString("SpellCheckEnglishAllowInQuoteAsIng", settings.Tools.SpellCheckEnglishAllowInQuoteAsIng.ToString());
            textWriter.WriteElementString("OcrFixUseHardcodedRules", settings.Tools.OcrFixUseHardcodedRules.ToString());
            textWriter.WriteElementString("Interjections", settings.Tools.Interjections);
            textWriter.WriteElementString("MicrosoftBingApiId", settings.Tools.MicrosoftBingApiId);
            textWriter.WriteElementString("GoogleApiKey", settings.Tools.GoogleApiKey);
            textWriter.WriteElementString("UseGooleApiPaidService", settings.Tools.UseGooleApiPaidService.ToString());
            textWriter.WriteElementString("GoogleTranslateLastTargetLanguage", settings.Tools.GoogleTranslateLastTargetLanguage);
            textWriter.WriteElementString("ListViewSyntaxColorDurationSmall", settings.Tools.ListViewSyntaxColorDurationSmall.ToString());
            textWriter.WriteElementString("ListViewSyntaxColorDurationBig", settings.Tools.ListViewSyntaxColorDurationBig.ToString());
            textWriter.WriteElementString("ListViewSyntaxColorLongLines", settings.Tools.ListViewSyntaxColorLongLines.ToString());
            textWriter.WriteElementString("ListViewSyntaxMoreThanXLines", settings.Tools.ListViewSyntaxMoreThanXLines.ToString());
            textWriter.WriteElementString("ListViewSyntaxMoreThanXLinesX", settings.Tools.ListViewSyntaxMoreThanXLinesX.ToString());
            textWriter.WriteElementString("ListViewSyntaxColorOverlap", settings.Tools.ListViewSyntaxColorOverlap.ToString());
            textWriter.WriteElementString("ListViewSyntaxErrorColor", settings.Tools.ListViewSyntaxErrorColor.ToArgb().ToString());
            textWriter.WriteElementString("ListViewUnfocusedSelectedColor", settings.Tools.ListViewUnfocusedSelectedColor.ToArgb().ToString());
            textWriter.WriteElementString("SplitAdvanced", settings.Tools.SplitAdvanced.ToString());
            textWriter.WriteElementString("SplitOutputFolder", settings.Tools.SplitOutputFolder);
            textWriter.WriteElementString("SplitNumberOfParts", settings.Tools.SplitNumberOfParts.ToString());
            textWriter.WriteElementString("SplitVia", settings.Tools.SplitVia);
            textWriter.WriteElementString("NewEmptyTranslationText", settings.Tools.NewEmptyTranslationText);
            textWriter.WriteElementString("BatchConvertOutputFolder", settings.Tools.BatchConvertOutputFolder);
            textWriter.WriteElementString("BatchConvertOverwrite", settings.Tools.BatchConvertOverwrite.ToString());
            textWriter.WriteElementString("BatchConvertRemoveFormatting", settings.Tools.BatchConvertRemoveFormatting.ToString());
            textWriter.WriteElementString("BatchConvertFixCasing", settings.Tools.BatchConvertFixCasing.ToString());
            textWriter.WriteElementString("BatchConvertRemoveTextForHI", settings.Tools.BatchConvertRemoveTextForHI.ToString());
            textWriter.WriteElementString("BatchConvertSplitLongLines", settings.Tools.BatchConvertSplitLongLines.ToString());
            textWriter.WriteElementString("BatchConvertFixCommonErrors", settings.Tools.BatchConvertFixCommonErrors.ToString());
            textWriter.WriteElementString("BatchConvertMultipleReplace", settings.Tools.BatchConvertMultipleReplace.ToString());
            textWriter.WriteElementString("BatchConvertAutoBalance", settings.Tools.BatchConvertAutoBalance.ToString());
            textWriter.WriteElementString("BatchConvertSetMinDisplayTimeBetweenSubtitles", settings.Tools.BatchConvertSetMinDisplayTimeBetweenSubtitles.ToString());
            textWriter.WriteElementString("BatchConvertLanguage", settings.Tools.BatchConvertLanguage);
            textWriter.WriteElementString("ModifySelectionRule", settings.Tools.ModifySelectionRule);
            textWriter.WriteElementString("ModifySelectionText", settings.Tools.ModifySelectionText);
            textWriter.WriteElementString("ModifySelectionCaseSensitive", settings.Tools.ModifySelectionCaseSensitive.ToString());
            textWriter.WriteElementString("ExportVobSubFontName", settings.Tools.ExportVobSubFontName);
            textWriter.WriteElementString("ExportVobSubFontSize", settings.Tools.ExportVobSubFontSize.ToString());
            textWriter.WriteElementString("ExportVobSubVideoResolution", settings.Tools.ExportVobSubVideoResolution);
            textWriter.WriteElementString("ExportVobSubLanguage", settings.Tools.ExportVobSubLanguage);
            textWriter.WriteElementString("ExportVobSubSimpleRendering", settings.Tools.ExportVobSubSimpleRendering.ToString());
            textWriter.WriteElementString("ExportBluRayFontName", settings.Tools.ExportBluRayFontName);
            textWriter.WriteElementString("ExportBluRayFontSize", settings.Tools.ExportBluRayFontSize.ToString());
            textWriter.WriteElementString("ExportFcpFontName", settings.Tools.ExportFcpFontName);
            textWriter.WriteElementString("ExportFcpFontSize", settings.Tools.ExportFcpFontSize.ToString());
            textWriter.WriteElementString("ExportFcpImageType", settings.Tools.ExportFcpImageType);
            textWriter.WriteElementString("ExportLastFontSize", settings.Tools.ExportLastFontSize.ToString());
            textWriter.WriteElementString("ExportLastLineHeight", settings.Tools.ExportLastLineHeight.ToString());
            textWriter.WriteElementString("ExportLastBorderWidth", settings.Tools.ExportLastBorderWidth.ToString());
            textWriter.WriteElementString("ExportLastFontBold", settings.Tools.ExportLastFontBold.ToString());
            textWriter.WriteElementString("ExportBluRayVideoResolution", settings.Tools.ExportBluRayVideoResolution);
            textWriter.WriteElementString("ExportFontColor", settings.Tools.ExportFontColor.ToArgb().ToString());
            textWriter.WriteElementString("ExportBorderColor", settings.Tools.ExportBorderColor.ToArgb().ToString());
            textWriter.WriteElementString("ExportBottomMargin", settings.Tools.ExportBottomMargin.ToString());
            textWriter.WriteElementString("ExportHorizontalAlignment", settings.Tools.ExportHorizontalAlignment.ToString());
            textWriter.WriteElementString("ExportBluRayBottomMargin", settings.Tools.ExportBluRayBottomMargin.ToString());
            textWriter.WriteElementString("ExportBluRayShadow", settings.Tools.ExportBluRayShadow.ToString());
            textWriter.WriteElementString("Export3DType", settings.Tools.Export3DType.ToString());
            textWriter.WriteElementString("Export3DDepth", settings.Tools.Export3DDepth.ToString());
            textWriter.WriteElementString("FixCommonErrorsFixOverlapAllowEqualEndStart", settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart.ToString());
            textWriter.WriteElementString("ImportTextSplitting", settings.Tools.ImportTextSplitting);
            textWriter.WriteElementString("ImportTextMergeShortLines", settings.Tools.ImportTextMergeShortLines.ToString());
            textWriter.WriteElementString("GenerateTimeCodePatterns", settings.Tools.GenerateTimeCodePatterns);
            textWriter.WriteElementString("MusicSymbolStyle", settings.Tools.MusicSymbolStyle);
            textWriter.WriteElementString("BridgeGapMilliseconds", settings.Tools.BridgeGapMilliseconds.ToString());
            textWriter.WriteElementString("ExportCustomTemplates", settings.Tools.ExportCustomTemplates);
            textWriter.WriteElementString("ChangeCasingChoice", settings.Tools.ChangeCasingChoice);

            textWriter.WriteEndElement();

            textWriter.WriteStartElement("SubtitleSettings", "");
            textWriter.WriteElementString("SsaFontName", settings.SubtitleSettings.SsaFontName);
            textWriter.WriteElementString("SsaFontSize", settings.SubtitleSettings.SsaFontSize.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("SsaFontColorArgb", settings.SubtitleSettings.SsaFontColorArgb.ToString());
            textWriter.WriteElementString("SsaOutline", settings.SubtitleSettings.SsaOutline.ToString());
            textWriter.WriteElementString("SsaShadow", settings.SubtitleSettings.SsaShadow.ToString());
            textWriter.WriteElementString("SsaOpaqueBox", settings.SubtitleSettings.SsaOpaqueBox.ToString());
            textWriter.WriteElementString("DCinemaFontFile", settings.SubtitleSettings.DCinemaFontFile);
            textWriter.WriteElementString("DCinemaFontSize", settings.SubtitleSettings.DCinemaFontSize.ToString());
            textWriter.WriteElementString("DCinemaBottomMargin", settings.SubtitleSettings.DCinemaBottomMargin.ToString());
            textWriter.WriteElementString("DCinemaZPosition", settings.SubtitleSettings.DCinemaZPosition.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("DCinemaFadeUpDownTime", settings.SubtitleSettings.DCinemaFadeUpDownTime.ToString());
            textWriter.WriteElementString("SamiDisplayTwoClassesAsTwoSubtitles", settings.SubtitleSettings.SamiDisplayTwoClassesAsTwoSubtitles.ToString());
            textWriter.WriteElementString("SamiFullHtmlEncode", settings.SubtitleSettings.SamiFullHtmlEncode.ToString());
            textWriter.WriteElementString("SamiFullHtmlEncodeNumeric", settings.SubtitleSettings.SamiFullHtmlEncodeNumeric.ToString());
            textWriter.WriteElementString("TimedText10TimeCodeFormat", settings.SubtitleSettings.TimedText10TimeCodeFormat);
            textWriter.WriteElementString("FcpFontSize", settings.SubtitleSettings.FcpFontSize.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("FcpFontName", settings.SubtitleSettings.FcpFontName);
            textWriter.WriteElementString("NuendoCharacterListFile", settings.SubtitleSettings.NuendoCharacterListFile);
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("Proxy", "");
            textWriter.WriteElementString("ProxyAddress", settings.Proxy.ProxyAddress);
            textWriter.WriteElementString("UserName", settings.Proxy.UserName);
            textWriter.WriteElementString("Password", settings.Proxy.Password);
            textWriter.WriteElementString("Domain", settings.Proxy.Domain);
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("WordLists", "");
            textWriter.WriteElementString("LastLanguage", settings.WordLists.LastLanguage);
            textWriter.WriteElementString("NamesEtcUrl", settings.WordLists.NamesEtcUrl);
            textWriter.WriteElementString("UseOnlineNamesEtc", settings.WordLists.UseOnlineNamesEtc.ToString());
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("CommonErrors", "");
            textWriter.WriteElementString("StartPosition", settings.CommonErrors.StartPosition);
            textWriter.WriteElementString("StartSize", settings.CommonErrors.StartSize);
            textWriter.WriteElementString("EmptyLinesTicked", settings.CommonErrors.EmptyLinesTicked.ToString());
            textWriter.WriteElementString("OverlappingDisplayTimeTicked", settings.CommonErrors.OverlappingDisplayTimeTicked.ToString());
            textWriter.WriteElementString("TooShortDisplayTimeTicked", settings.CommonErrors.TooShortDisplayTimeTicked.ToString());
            textWriter.WriteElementString("TooLongDisplayTimeTicked", settings.CommonErrors.TooLongDisplayTimeTicked.ToString());
            textWriter.WriteElementString("InvalidItalicTagsTicked", settings.CommonErrors.InvalidItalicTagsTicked.ToString());
            textWriter.WriteElementString("BreakLongLinesTicked", settings.CommonErrors.BreakLongLinesTicked.ToString());
            textWriter.WriteElementString("MergeShortLinesTicked", settings.CommonErrors.MergeShortLinesTicked.ToString());
            textWriter.WriteElementString("MergeShortLinesAllTicked", settings.CommonErrors.MergeShortLinesAllTicked.ToString());
            textWriter.WriteElementString("UnneededSpacesTicked", settings.CommonErrors.UnneededSpacesTicked.ToString());
            textWriter.WriteElementString("UnneededPeriodsTicked", settings.CommonErrors.UnneededPeriodsTicked.ToString());
            textWriter.WriteElementString("MissingSpacesTicked", settings.CommonErrors.MissingSpacesTicked.ToString());
            textWriter.WriteElementString("AddMissingQuotesTicked", settings.CommonErrors.AddMissingQuotesTicked.ToString());
            textWriter.WriteElementString("Fix3PlusLinesTicked", settings.CommonErrors.Fix3PlusLinesTicked.ToString());
            textWriter.WriteElementString("FixHyphensTicked", settings.CommonErrors.FixHyphensTicked.ToString());
            textWriter.WriteElementString("FixHyphensAddTicked", settings.CommonErrors.FixHyphensAddTicked.ToString());
            textWriter.WriteElementString("UppercaseIInsideLowercaseWordTicked", settings.CommonErrors.UppercaseIInsideLowercaseWordTicked.ToString());
            textWriter.WriteElementString("DoubleApostropheToQuoteTicked", settings.CommonErrors.DoubleApostropheToQuoteTicked.ToString());
            textWriter.WriteElementString("AddPeriodAfterParagraphTicked", settings.CommonErrors.AddPeriodAfterParagraphTicked.ToString());
            textWriter.WriteElementString("StartWithUppercaseLetterAfterParagraphTicked", settings.CommonErrors.StartWithUppercaseLetterAfterParagraphTicked.ToString());
            textWriter.WriteElementString("StartWithUppercaseLetterAfterPeriodInsideParagraphTicked", settings.CommonErrors.StartWithUppercaseLetterAfterPeriodInsideParagraphTicked.ToString());
            textWriter.WriteElementString("StartWithUppercaseLetterAfterColonTicked", settings.CommonErrors.StartWithUppercaseLetterAfterColonTicked.ToString());
            textWriter.WriteElementString("AloneLowercaseIToUppercaseIEnglishTicked", settings.CommonErrors.AloneLowercaseIToUppercaseIEnglishTicked.ToString());
            textWriter.WriteElementString("FixOcrErrorsViaReplaceListTicked", settings.CommonErrors.FixOcrErrorsViaReplaceListTicked.ToString());
            textWriter.WriteElementString("RemoveSpaceBetweenNumberTicked", settings.CommonErrors.RemoveSpaceBetweenNumberTicked.ToString());
            textWriter.WriteElementString("FixDialogsOnOneLineTicked", settings.CommonErrors.FixDialogsOnOneLineTicked.ToString());
            textWriter.WriteElementString("TurkishAnsiTicked", settings.CommonErrors.TurkishAnsiTicked.ToString());
            textWriter.WriteElementString("DanishLetterITicked", settings.CommonErrors.DanishLetterITicked.ToString());
            textWriter.WriteElementString("SpanishInvertedQuestionAndExclamationMarksTicked", settings.CommonErrors.SpanishInvertedQuestionAndExclamationMarksTicked.ToString());
            textWriter.WriteElementString("FixDoubleDashTicked", settings.CommonErrors.FixDoubleDashTicked.ToString());
            textWriter.WriteElementString("FixDoubleGreaterThanTicked", settings.CommonErrors.FixDoubleGreaterThanTicked.ToString());
            textWriter.WriteElementString("FixEllipsesStartTicked", settings.CommonErrors.FixEllipsesStartTicked.ToString());
            textWriter.WriteElementString("FixMissingOpenBracketTicked", settings.CommonErrors.FixMissingOpenBracketTicked.ToString());
            textWriter.WriteElementString("FixMusicNotationTicked", settings.CommonErrors.FixMusicNotationTicked.ToString());
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("VideoControls", "");
            textWriter.WriteElementString("CustomSearchText1", settings.VideoControls.CustomSearchText1);
            textWriter.WriteElementString("CustomSearchText2", settings.VideoControls.CustomSearchText2);
            textWriter.WriteElementString("CustomSearchText3", settings.VideoControls.CustomSearchText3);
            textWriter.WriteElementString("CustomSearchText4", settings.VideoControls.CustomSearchText4);
            textWriter.WriteElementString("CustomSearchText5", settings.VideoControls.CustomSearchText5);
            textWriter.WriteElementString("CustomSearchText6", settings.VideoControls.CustomSearchText6);
            textWriter.WriteElementString("CustomSearchUrl1", settings.VideoControls.CustomSearchUrl1);
            textWriter.WriteElementString("CustomSearchUrl2", settings.VideoControls.CustomSearchUrl2);
            textWriter.WriteElementString("CustomSearchUrl3", settings.VideoControls.CustomSearchUrl3);
            textWriter.WriteElementString("CustomSearchUrl4", settings.VideoControls.CustomSearchUrl4);
            textWriter.WriteElementString("CustomSearchUrl5", settings.VideoControls.CustomSearchUrl5);
            textWriter.WriteElementString("CustomSearchUrl6", settings.VideoControls.CustomSearchUrl6);
            textWriter.WriteElementString("LastActiveTab", settings.VideoControls.LastActiveTab);
            textWriter.WriteElementString("WaveFormDrawGrid", settings.VideoControls.WaveFormDrawGrid.ToString());
            textWriter.WriteElementString("WaveFormAllowOverlap", settings.VideoControls.WaveFormAllowOverlap.ToString());
            textWriter.WriteElementString("WaveFormFocusOnMouseEnter", settings.VideoControls.WaveFormFocusOnMouseEnter.ToString());
            textWriter.WriteElementString("WaveFormListViewFocusOnMouseEnter", settings.VideoControls.WaveFormListViewFocusOnMouseEnter.ToString());
            textWriter.WriteElementString("WaveformBorderHitMs", settings.VideoControls.WaveformBorderHitMs.ToString());
            textWriter.WriteElementString("WaveFormGridColor", settings.VideoControls.WaveFormGridColor.ToArgb().ToString());
            textWriter.WriteElementString("WaveFormColor", settings.VideoControls.WaveFormColor.ToArgb().ToString());
            textWriter.WriteElementString("WaveFormSelectedColor", settings.VideoControls.WaveFormSelectedColor.ToArgb().ToString());
            textWriter.WriteElementString("WaveFormBackgroundColor", settings.VideoControls.WaveFormBackgroundColor.ToArgb().ToString());
            textWriter.WriteElementString("WaveFormTextColor", settings.VideoControls.WaveFormTextColor.ToArgb().ToString());
            textWriter.WriteElementString("WaveFormDoubleClickOnNonParagraphAction", settings.VideoControls.WaveFormDoubleClickOnNonParagraphAction);
            textWriter.WriteElementString("WaveFormRightClickOnNonParagraphAction", settings.VideoControls.WaveFormRightClickOnNonParagraphAction);
            textWriter.WriteElementString("WaveFormMouseWheelScrollUpIsForward", settings.VideoControls.WaveFormMouseWheelScrollUpIsForward.ToString());
            textWriter.WriteElementString("GenerateSpectrogram", settings.VideoControls.GenerateSpectrogram.ToString());
            textWriter.WriteElementString("SpectrogramAppearance", settings.VideoControls.SpectrogramAppearance);
            textWriter.WriteElementString("WaveFormMininumSampleRate", settings.VideoControls.WaveFormMininumSampleRate.ToString());
            textWriter.WriteElementString("WaveformSeeksSilenceDurationSeconds", settings.VideoControls.WaveformSeeksSilenceDurationSeconds.ToString(System.Globalization.CultureInfo.InvariantCulture));
            textWriter.WriteElementString("WaveformSeeksSilenceMaxVolume", settings.VideoControls.WaveformSeeksSilenceMaxVolume.ToString());
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("NetworkSettings", "");
            textWriter.WriteElementString("SessionKey", settings.NetworkSettings.SessionKey);
            textWriter.WriteElementString("UserName", settings.NetworkSettings.UserName);
            textWriter.WriteElementString("WebServiceUrl", settings.NetworkSettings.WebServiceUrl);
            textWriter.WriteElementString("PollIntervalSeconds", settings.NetworkSettings.PollIntervalSeconds.ToString());
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("VobSubOcr", "");
            textWriter.WriteElementString("XOrMorePixelsMakesSpace", settings.VobSubOcr.XOrMorePixelsMakesSpace.ToString());
            textWriter.WriteElementString("AllowDifferenceInPercent", settings.VobSubOcr.AllowDifferenceInPercent.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("BlurayAllowDifferenceInPercent", settings.VobSubOcr.BlurayAllowDifferenceInPercent.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("LastImageCompareFolder", settings.VobSubOcr.LastImageCompareFolder);
            textWriter.WriteElementString("LastModiLanguageId", settings.VobSubOcr.LastModiLanguageId.ToString());
            textWriter.WriteElementString("LastOcrMethod", settings.VobSubOcr.LastOcrMethod);
            textWriter.WriteElementString("TesseractLastLanguage", settings.VobSubOcr.TesseractLastLanguage);
            textWriter.WriteElementString("UseModiInTesseractForUnknownWords", settings.VobSubOcr.UseModiInTesseractForUnknownWords.ToString());
            textWriter.WriteElementString("UseItalicsInTesseract", settings.VobSubOcr.UseItalicsInTesseract.ToString());
            textWriter.WriteElementString("UseMusicSymbolsInTesseract", settings.VobSubOcr.UseMusicSymbolsInTesseract.ToString());
            textWriter.WriteElementString("RightToLeft", settings.VobSubOcr.RightToLeft.ToString());
            textWriter.WriteElementString("TopToBottom", settings.VobSubOcr.TopToBottom.ToString());
            textWriter.WriteElementString("DefaultMillisecondsForUnknownDurations", settings.VobSubOcr.DefaultMillisecondsForUnknownDurations.ToString());
            textWriter.WriteElementString("PromptForUnknownWords", settings.VobSubOcr.PromptForUnknownWords.ToString());
            textWriter.WriteElementString("GuessUnknownWords", settings.VobSubOcr.GuessUnknownWords.ToString());
            textWriter.WriteElementString("AutoBreakSubtitleIfMoreThanTwoLines", settings.VobSubOcr.AutoBreakSubtitleIfMoreThanTwoLines.ToString());
            textWriter.WriteElementString("ItalicFactor", settings.VobSubOcr.ItalicFactor.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("LineOcrDraw", settings.VobSubOcr.LineOcrDraw.ToString());
            textWriter.WriteElementString("LineOcrAdvancedItalic", settings.VobSubOcr.LineOcrAdvancedItalic.ToString());
            textWriter.WriteElementString("LineOcrLastLanguages", settings.VobSubOcr.LineOcrLastLanguages);
            textWriter.WriteElementString("LineOcrLastSpellcheck", settings.VobSubOcr.LineOcrLastSpellcheck);
            textWriter.WriteElementString("LineOcrXOrMorePixelsMakesSpace", settings.VobSubOcr.LineOcrXOrMorePixelsMakesSpace.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("LineOcrMinLineHeight", settings.VobSubOcr.LineOcrMinLineHeight.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteElementString("LineOcrMaxLineHeight", settings.VobSubOcr.LineOcrMaxLineHeight.ToString(CultureInfo.InvariantCulture));
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("MultipleSearchAndReplaceList", "");
            foreach (var item in settings.MultipleSearchAndReplaceList)
            {
                textWriter.WriteStartElement("MultipleSearchAndReplaceItem", "");
                textWriter.WriteElementString("Enabled", item.Enabled.ToString());
                textWriter.WriteElementString("FindWhat", item.FindWhat);
                textWriter.WriteElementString("ReplaceWith", item.ReplaceWith);
                textWriter.WriteElementString("SearchType", item.SearchType);
                textWriter.WriteEndElement();
            }
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("Shortcuts", "");
            textWriter.WriteElementString("GeneralGoToFirstSelectedLine", settings.Shortcuts.GeneralGoToFirstSelectedLine);
            textWriter.WriteElementString("GeneralMergeSelectedLines", settings.Shortcuts.GeneralMergeSelectedLines);
            textWriter.WriteElementString("GeneralToggleTranslationMode", settings.Shortcuts.GeneralToggleTranslationMode);
            textWriter.WriteElementString("GeneralSwitchOriginalAndTranslation", settings.Shortcuts.GeneralSwitchOriginalAndTranslation);
            textWriter.WriteElementString("GeneralMergeOriginalAndTranslation", settings.Shortcuts.GeneralMergeOriginalAndTranslation);
            textWriter.WriteElementString("GeneralGoToNextSubtitle", settings.Shortcuts.GeneralGoToNextSubtitle);
            textWriter.WriteElementString("GeneralGoToPrevSubtitle", settings.Shortcuts.GeneralGoToPrevSubtitle);
            textWriter.WriteElementString("GeneralGoToEndOfCurrentSubtitle", settings.Shortcuts.GeneralGoToEndOfCurrentSubtitle);
            textWriter.WriteElementString("GeneralGoToStartOfCurrentSubtitle", settings.Shortcuts.GeneralGoToStartOfCurrentSubtitle);
            textWriter.WriteElementString("MainFileNew", settings.Shortcuts.MainFileNew);
            textWriter.WriteElementString("MainFileOpen", settings.Shortcuts.MainFileOpen);
            textWriter.WriteElementString("MainFileOpenKeepVideo", settings.Shortcuts.MainFileOpenKeepVideo);
            textWriter.WriteElementString("MainFileSave", settings.Shortcuts.MainFileSave);
            textWriter.WriteElementString("MainFileSaveAs", settings.Shortcuts.MainFileSaveAs);
            textWriter.WriteElementString("MainFileExportEbu", settings.Shortcuts.MainFileSaveAs);
            textWriter.WriteElementString("MainEditUndo", settings.Shortcuts.MainEditUndo);
            textWriter.WriteElementString("MainEditRedo", settings.Shortcuts.MainEditRedo);
            textWriter.WriteElementString("MainEditFind", settings.Shortcuts.MainEditFind);
            textWriter.WriteElementString("MainEditFindNext", settings.Shortcuts.MainEditFindNext);
            textWriter.WriteElementString("MainEditReplace", settings.Shortcuts.MainEditReplace);
            textWriter.WriteElementString("MainEditMultipleReplace", settings.Shortcuts.MainEditMultipleReplace);
            textWriter.WriteElementString("MainEditGoToLineNumber", settings.Shortcuts.MainEditGoToLineNumber);
            textWriter.WriteElementString("MainEditRightToLeft", settings.Shortcuts.MainEditRightToLeft);
            textWriter.WriteElementString("MainToolsFixCommonErrors", settings.Shortcuts.MainToolsFixCommonErrors);
            textWriter.WriteElementString("MainToolsFixCommonErrorsPreview", settings.Shortcuts.MainToolsFixCommonErrorsPreview);
            textWriter.WriteElementString("MainToolsSplitLongLines", settings.Shortcuts.MainToolsSplitLongLines);
            textWriter.WriteElementString("MainToolsRenumber", settings.Shortcuts.MainToolsRenumber);
            textWriter.WriteElementString("MainToolsRemoveTextForHI", settings.Shortcuts.MainToolsRemoveTextForHI);
            textWriter.WriteElementString("MainToolsChangeCasing", settings.Shortcuts.MainToolsChangeCasing);
            textWriter.WriteElementString("MainToolsAutoDuration", settings.Shortcuts.MainToolsAutoDuration);
            textWriter.WriteElementString("MainToolsBatchConvert", settings.Shortcuts.MainToolsBatchConvert);
            textWriter.WriteElementString("MainToolsBeamer", settings.Shortcuts.MainToolsBeamer);
            textWriter.WriteElementString("MainToolsToggleTranslationOriginalInPreviews", settings.Shortcuts.MainEditToggleTranslationOriginalInPreviews);
            textWriter.WriteElementString("MainEditInverseSelection", settings.Shortcuts.MainEditInverseSelection);
            textWriter.WriteElementString("MainEditModifySelection", settings.Shortcuts.MainEditModifySelection);
            textWriter.WriteElementString("MainVideoPause", settings.Shortcuts.MainVideoPause);
            textWriter.WriteElementString("MainVideoPlayPauseToggle", settings.Shortcuts.MainVideoPlayPauseToggle);
            textWriter.WriteElementString("MainVideoShowHideVideo", settings.Shortcuts.MainVideoShowHideVideo);
            textWriter.WriteElementString("MainVideoToggleVideoControls", settings.Shortcuts.MainVideoToggleVideoControls);
            textWriter.WriteElementString("MainVideo1FrameLeft", settings.Shortcuts.MainVideo1FrameLeft);
            textWriter.WriteElementString("MainVideo1FrameRight", settings.Shortcuts.MainVideo1FrameRight);
            textWriter.WriteElementString("MainVideo100MsLeft", settings.Shortcuts.MainVideo100MsLeft);
            textWriter.WriteElementString("MainVideo100MsRight", settings.Shortcuts.MainVideo100MsRight);
            textWriter.WriteElementString("MainVideo500MsLeft", settings.Shortcuts.MainVideo500MsLeft);
            textWriter.WriteElementString("MainVideo500MsRight", settings.Shortcuts.MainVideo500MsRight);
            textWriter.WriteElementString("MainVideo1000MsLeft", settings.Shortcuts.MainVideo1000MsLeft);
            textWriter.WriteElementString("MainVideo1000MsRight", settings.Shortcuts.MainVideo1000MsRight);
            textWriter.WriteElementString("MainVideoFullscreen", settings.Shortcuts.MainVideoFullscreen);
            textWriter.WriteElementString("MainSpellCheck", settings.Shortcuts.MainSpellCheck);
            textWriter.WriteElementString("MainSpellCheckFindDoubleWords", settings.Shortcuts.MainSpellCheckFindDoubleWords);
            textWriter.WriteElementString("MainSpellCheckAddWordToNames", settings.Shortcuts.MainSpellCheckAddWordToNames);
            textWriter.WriteElementString("MainSynchronizationAdjustTimes", settings.Shortcuts.MainSynchronizationAdjustTimes);
            textWriter.WriteElementString("MainSynchronizationVisualSync", settings.Shortcuts.MainSynchronizationVisualSync);
            textWriter.WriteElementString("MainSynchronizationPointSync", settings.Shortcuts.MainSynchronizationPointSync);
            textWriter.WriteElementString("MainSynchronizationChangeFrameRate", settings.Shortcuts.MainSynchronizationChangeFrameRate);
            textWriter.WriteElementString("MainListViewItalic", settings.Shortcuts.MainListViewItalic);
            textWriter.WriteElementString("MainListViewToggleDashes", settings.Shortcuts.MainListViewToggleDashes);
            textWriter.WriteElementString("MainListViewAlignment", settings.Shortcuts.MainListViewAlignment);
            textWriter.WriteElementString("MainListViewCopyText", settings.Shortcuts.MainListViewCopyText);
            textWriter.WriteElementString("MainListViewAutoDuration", settings.Shortcuts.MainListViewAutoDuration);
            textWriter.WriteElementString("MainListViewColumnDeleteText", settings.Shortcuts.MainListViewColumnDeleteText);
            textWriter.WriteElementString("MainListViewColumnInsertText", settings.Shortcuts.MainListViewColumnInsertText);
            textWriter.WriteElementString("MainListViewColumnPaste", settings.Shortcuts.MainListViewColumnPaste);
            textWriter.WriteElementString("MainListViewFocusWaveform", settings.Shortcuts.MainListViewFocusWaveform);
            textWriter.WriteElementString("MainEditReverseStartAndEndingForRTL", settings.Shortcuts.MainEditReverseStartAndEndingForRTL);
            textWriter.WriteElementString("MainTextBoxItalic", settings.Shortcuts.MainTextBoxItalic);
            textWriter.WriteElementString("MainTextBoxSplitAtCursor", settings.Shortcuts.MainTextBoxSplitAtCursor);
            textWriter.WriteElementString("MainTextBoxMoveLastWordDown", settings.Shortcuts.MainTextBoxMoveLastWordDown);
            textWriter.WriteElementString("MainTextBoxMoveFirstWordFromNextUp", settings.Shortcuts.MainTextBoxMoveFirstWordFromNextUp);
            textWriter.WriteElementString("MainCreateInsertSubAtVideoPos", settings.Shortcuts.MainCreateInsertSubAtVideoPos);
            textWriter.WriteElementString("MainCreatePlayFromJustBefore", settings.Shortcuts.MainCreatePlayFromJustBefore);
            textWriter.WriteElementString("MainCreateSetStart", settings.Shortcuts.MainCreateSetStart);
            textWriter.WriteElementString("MainCreateSetEnd", settings.Shortcuts.MainCreateSetEnd);
            textWriter.WriteElementString("MainCreateSetEndAddNewAndGoToNew", settings.Shortcuts.MainCreateSetEndAddNewAndGoToNew);
            textWriter.WriteElementString("MainCreateStartDownEndUp", settings.Shortcuts.MainCreateStartDownEndUp);
            textWriter.WriteElementString("MainAdjustSetStartAndOffsetTheRest", settings.Shortcuts.MainAdjustSetStartAndOffsetTheRest);
            textWriter.WriteElementString("MainAdjustSetEndAndOffsetTheRest", settings.Shortcuts.MainAdjustSetEndAndOffsetTheRest);
            textWriter.WriteElementString("MainAdjustSetEndAndOffsetTheRestAndGoToNext", settings.Shortcuts.MainAdjustSetEndAndOffsetTheRestAndGoToNext);
            textWriter.WriteElementString("MainAdjustSetEndAndGotoNext", settings.Shortcuts.MainAdjustSetEndAndGotoNext);
            textWriter.WriteElementString("MainAdjustViaEndAutoStartAndGoToNext", settings.Shortcuts.MainAdjustViaEndAutoStartAndGoToNext);
            textWriter.WriteElementString("MainAdjustSetStartAutoDurationAndGoToNext", settings.Shortcuts.MainAdjustSetStartAutoDurationAndGoToNext);
            textWriter.WriteElementString("MainAdjustSetEndNextStartAndGoToNext", settings.Shortcuts.MainAdjustSetEndNextStartAndGoToNext);
            textWriter.WriteElementString("MainAdjustStartDownEndUpAndGoToNext", settings.Shortcuts.MainAdjustStartDownEndUpAndGoToNext);
            textWriter.WriteElementString("MainAdjustSetStart", settings.Shortcuts.MainAdjustSetStart);
            textWriter.WriteElementString("MainAdjustSetStartKeepDuration", settings.Shortcuts.MainAdjustSetStartKeepDuration);
            textWriter.WriteElementString("MainAdjustSetEnd", settings.Shortcuts.MainAdjustSetEnd);
            textWriter.WriteElementString("MainAdjustSelected100MsForward", settings.Shortcuts.MainAdjustSelected100MsForward);
            textWriter.WriteElementString("MainAdjustSelected100MsBack", settings.Shortcuts.MainAdjustSelected100MsBack);
            textWriter.WriteElementString("MainInsertAfter", settings.Shortcuts.MainInsertAfter);
            textWriter.WriteElementString("MainTextBoxInsertAfter", settings.Shortcuts.MainTextBoxInsertAfter);
            textWriter.WriteElementString("MainTextBoxAutoBreak", settings.Shortcuts.MainTextBoxAutoBreak);
            textWriter.WriteElementString("MainTextBoxUnbreak", settings.Shortcuts.MainTextBoxUnbreak);
            textWriter.WriteElementString("MainWaveformInsertAtCurrentPosition", settings.Shortcuts.MainWaveformInsertAtCurrentPosition);
            textWriter.WriteElementString("MainInsertBefore", settings.Shortcuts.MainInsertBefore);
            textWriter.WriteElementString("MainMergeDialogue", settings.Shortcuts.MainMergeDialogue);
            textWriter.WriteElementString("MainToogleFocus", settings.Shortcuts.MainToogleFocus);
            textWriter.WriteElementString("WaveformVerticalZoom", settings.Shortcuts.WaveformVerticalZoom);
            textWriter.WriteElementString("WaveformVerticalZoomOut", settings.Shortcuts.WaveformVerticalZoomOut);
            textWriter.WriteElementString("WaveformZoomIn", settings.Shortcuts.WaveformZoomIn);
            textWriter.WriteElementString("WaveformZoomOut", settings.Shortcuts.WaveformZoomOut);
            textWriter.WriteElementString("WaveformPlaySelection", settings.Shortcuts.WaveformPlaySelection);
            textWriter.WriteElementString("WaveformPlayFirstSelected", settings.Shortcuts.WaveformPlayFirstSelected);
            textWriter.WriteElementString("WaveformSearchSilenceForward", settings.Shortcuts.WaveformSearchSilenceForward);
            textWriter.WriteElementString("WaveformSearchSilenceBack", settings.Shortcuts.WaveformSearchSilenceBack);
            textWriter.WriteElementString("WaveformAddTextHere", settings.Shortcuts.WaveformAddTextHere);
            textWriter.WriteElementString("WaveformFocusListView", settings.Shortcuts.WaveformFocusListView);
            textWriter.WriteElementString("MainTranslateCustomSearch1", settings.Shortcuts.MainTranslateCustomSearch1);
            textWriter.WriteElementString("MainTranslateCustomSearch2", settings.Shortcuts.MainTranslateCustomSearch2);
            textWriter.WriteElementString("MainTranslateCustomSearch3", settings.Shortcuts.MainTranslateCustomSearch3);
            textWriter.WriteElementString("MainTranslateCustomSearch4", settings.Shortcuts.MainTranslateCustomSearch4);
            textWriter.WriteElementString("MainTranslateCustomSearch5", settings.Shortcuts.MainTranslateCustomSearch5);
            textWriter.WriteElementString("MainTranslateCustomSearch6", settings.Shortcuts.MainTranslateCustomSearch6);
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("RemoveTextForHearingImpaired", "");
            textWriter.WriteElementString("RemoveTextBetweenBrackets", settings.RemoveTextForHearingImpaired.RemoveTextBetweenBrackets.ToString());
            textWriter.WriteElementString("RemoveTextBetweenParentheses", settings.RemoveTextForHearingImpaired.RemoveTextBetweenParentheses.ToString());
            textWriter.WriteElementString("RemoveTextBetweenCurlyBrackets", settings.RemoveTextForHearingImpaired.RemoveTextBetweenCurlyBrackets.ToString());
            textWriter.WriteElementString("RemoveTextBetweenQuestionMarks", settings.RemoveTextForHearingImpaired.RemoveTextBetweenQuestionMarks.ToString());
            textWriter.WriteElementString("RemoveTextBetweenCustom", settings.RemoveTextForHearingImpaired.RemoveTextBetweenCustom.ToString());
            textWriter.WriteElementString("RemoveTextBetweenCustomBefore", settings.RemoveTextForHearingImpaired.RemoveTextBetweenCustomBefore);
            textWriter.WriteElementString("RemoveTextBetweenCustomAfter", settings.RemoveTextForHearingImpaired.RemoveTextBetweenCustomAfter);
            textWriter.WriteElementString("RemoveTextBetweenOnlySeperateLines", settings.RemoveTextForHearingImpaired.RemoveTextBetweenOnlySeperateLines.ToString());
            textWriter.WriteElementString("RemoveTextBeforeColon", settings.RemoveTextForHearingImpaired.RemoveTextBeforeColon.ToString());
            textWriter.WriteElementString("RemoveTextBeforeColonOnlyIfUppercase", settings.RemoveTextForHearingImpaired.RemoveTextBeforeColonOnlyIfUppercase.ToString());
            textWriter.WriteElementString("RemoveTextBeforeColonOnlyOnSeparateLine", settings.RemoveTextForHearingImpaired.RemoveTextBeforeColonOnlyOnSeparateLine.ToString());
            textWriter.WriteElementString("RemoveInterjections", settings.RemoveTextForHearingImpaired.RemoveInterjections.ToString());
            textWriter.WriteElementString("RemoveIfAllUppercase", settings.RemoveTextForHearingImpaired.RemoveIfAllUppercase.ToString());
            textWriter.WriteElementString("RemoveIfContains", settings.RemoveTextForHearingImpaired.RemoveIfContains.ToString());
            textWriter.WriteElementString("RemoveIfContainsText", settings.RemoveTextForHearingImpaired.RemoveIfContainsText);
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("SubtitleBeaming", "");
            textWriter.WriteElementString("FontName", settings.SubtitleBeaming.FontName);
            textWriter.WriteElementString("FontColor", settings.SubtitleBeaming.FontColor.ToArgb().ToString());
            textWriter.WriteElementString("FontSize", settings.SubtitleBeaming.FontSize.ToString());
            textWriter.WriteElementString("BorderColor", settings.SubtitleBeaming.BorderColor.ToArgb().ToString());
            textWriter.WriteElementString("BorderWidth", settings.SubtitleBeaming.BorderWidth.ToString());
            textWriter.WriteEndElement();

            textWriter.WriteEndElement();

            textWriter.WriteEndDocument();
            textWriter.Close();
        }
예제 #3
0
        //private static Settings Deserialize(string fileName)
        //{
        //    var r = new StreamReader(fileName);
        //    var s = new XmlSerializer(typeof(Settings));
        //    var settings = (Settings)s.Deserialize(r);
        //    r.Close();
        //    if (settings.RecentFiles == null)
        //        settings.RecentFiles = new RecentFilesSettings();
        //    if (settings.General == null)
        //        settings.General = new GeneralSettings();
        //    if (settings.SsaStyle == null)
        //        settings.SsaStyle = new SsaStyleSettings();
        //    if (settings.CommonErrors == null)
        //        settings.CommonErrors = new FixCommonErrorsSettings();
        //    if (settings.VideoControls == null)
        //        settings.VideoControls = new VideoControlsSettings();
        //    if (settings.VobSubOcr == null)
        //        settings.VobSubOcr = new VobSubOcrSettings();
        //    if (settings.MultipleSearchAndReplaceList == null)
        //        settings.MultipleSearchAndReplaceList = new List<MultipleSearchAndReplaceSetting>();
        //    if (settings.NetworkSettings == null)
        //        settings.NetworkSettings = new NetworkSettings();
        //    if (settings.Shortcuts == null)
        //        settings.Shortcuts = new Shortcuts();
        //    return settings;
        //}
        /// <summary>
        /// A faster serializer than xml serializer... which is insanely slow (first time)!!!!
        /// This method is auto-generated with XmlSerializerGenerator
        /// </summary>
        /// <param name="fileName">File name of xml settings file to load</param>
        /// <returns>Newly loaded settings</returns>
        private static Settings CustomDeserialize(string fileName)
        {
            var doc = new XmlDocument();
            doc.PreserveWhitespace = true;
            doc.Load(fileName);

            Settings settings = new Settings();

            settings.RecentFiles = new Nikse.SubtitleEdit.Logic.RecentFilesSettings();
            XmlNode node = doc.DocumentElement.SelectSingleNode("RecentFiles");
            foreach (XmlNode listNode in node.SelectNodes("FileNames/FileName"))
            {
                string firstVisibleIndex = "-1";
                if (listNode.Attributes["FirstVisibleIndex"] != null)
                    firstVisibleIndex = listNode.Attributes["FirstVisibleIndex"].Value;

                string firstSelectedIndex = "-1";
                if (listNode.Attributes["FirstSelectedIndex"] != null)
                    firstSelectedIndex = listNode.Attributes["FirstSelectedIndex"].Value;

                string videoFileName = null;
                if (listNode.Attributes["VideoFileName"] != null)
                    videoFileName = listNode.Attributes["VideoFileName"].Value;

                string originalFileName = null;
                if (listNode.Attributes["OriginalFileName"] != null)
                    originalFileName = listNode.Attributes["OriginalFileName"].Value;

                settings.RecentFiles.Files.Add(new RecentFileEntry() { FileName = listNode.InnerText, FirstVisibleIndex = int.Parse(firstVisibleIndex), FirstSelectedIndex = int.Parse(firstSelectedIndex), VideoFileName = videoFileName, OriginalFileName = originalFileName });
            }

            settings.General = new GeneralSettings();
            node = doc.DocumentElement.SelectSingleNode("General");
            XmlNode subNode = node.SelectSingleNode("ShowToolbarNew");
            if (subNode != null)
                settings.General.ShowToolbarNew = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarOpen");
            if (subNode != null)
                settings.General.ShowToolbarOpen = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarSave");
            if (subNode != null)
                settings.General.ShowToolbarSave = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarSaveAs");
            if (subNode != null)
                settings.General.ShowToolbarSaveAs = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarFind");
            if (subNode != null)
                settings.General.ShowToolbarFind = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarReplace");
            if (subNode != null)
                settings.General.ShowToolbarReplace = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarFixCommonErrors");
            if (subNode != null)
                settings.General.ShowToolbarFixCommonErrors = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarVisualSync");
            if (subNode != null)
                settings.General.ShowToolbarVisualSync = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarSpellCheck");
            if (subNode != null)
                settings.General.ShowToolbarSpellCheck = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarSettings");
            if (subNode != null)
                settings.General.ShowToolbarSettings = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowToolbarHelp");
            if (subNode != null)
                settings.General.ShowToolbarHelp = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowFrameRate");
            if (subNode != null)
                settings.General.ShowFrameRate = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowVideoPlayer");
            if (subNode != null)
                settings.General.ShowVideoPlayer = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowAudioVisualizer");
            if (subNode != null)
                settings.General.ShowAudioVisualizer = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowWaveform");
            if (subNode != null)
                settings.General.ShowWaveform = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowSpectrogram");
            if (subNode != null)
                settings.General.ShowSpectrogram = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("DefaultFrameRate");
            if (subNode != null)
            {
                settings.General.DefaultFrameRate = Convert.ToDouble(subNode.InnerText, CultureInfo.InvariantCulture);
                if (settings.General.DefaultFrameRate > 23975)
                    settings.General.DefaultFrameRate = 23.976;
                settings.General.CurrentFrameRate = settings.General.DefaultFrameRate;
            }
            subNode = node.SelectSingleNode("DefaultSubtitleFormat");
            if (subNode != null)
                settings.General.DefaultSubtitleFormat = subNode.InnerText;
            subNode = node.SelectSingleNode("DefaultEncoding");
            if (subNode != null)
                settings.General.DefaultEncoding = subNode.InnerText;
            subNode = node.SelectSingleNode("AutoConvertToUtf8");
            if (subNode != null)
                settings.General.AutoConvertToUtf8 = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("AutoGuessAnsiEncoding");
            if (subNode != null)
                settings.General.AutoGuessAnsiEncoding = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("_subtitleFontName");
            if (subNode != null)
                settings.General.SubtitleFontName = subNode.InnerText;
            subNode = node.SelectSingleNode("SubtitleFontSize");
            if (subNode != null)
                settings.General.SubtitleFontSize = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("SubtitleFontBold");
            if (subNode != null)
                settings.General.SubtitleFontBold = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("SubtitleFontColor");
            if (subNode != null)
                settings.General.SubtitleFontColor = Color.FromArgb(Convert.ToInt32(subNode.InnerText));
            subNode = node.SelectSingleNode("SubtitleBackgroundColor");
            if (subNode != null)
                settings.General.SubtitleBackgroundColor = Color.FromArgb(Convert.ToInt32(subNode.InnerText));
            subNode = node.SelectSingleNode("CenterSubtitleInTextBox");
            if (subNode != null)
                settings.General.CenterSubtitleInTextBox = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ShowRecentFiles");
            if (subNode != null)
                settings.General.ShowRecentFiles = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("RememberSelectedLine");
            if (subNode != null)
                settings.General.RememberSelectedLine = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("StartLoadLastFile");
            if (subNode != null)
                settings.General.StartLoadLastFile = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("StartRememberPositionAndSize");
            if (subNode != null)
                settings.General.StartRememberPositionAndSize = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("StartPosition");
            if (subNode != null)
                settings.General.StartPosition = subNode.InnerText;
            subNode = node.SelectSingleNode("StartSize");
            if (subNode != null)
                settings.General.StartSize = subNode.InnerText;
            subNode = node.SelectSingleNode("SplitContainerMainSplitterDistance");
            if (subNode != null)
                settings.General.SplitContainerMainSplitterDistance = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("SplitContainer1SplitterDistance");
            if (subNode != null)
                settings.General.SplitContainer1SplitterDistance = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("SplitContainerListViewAndTextSplitterDistance");
            if (subNode != null)
                settings.General.SplitContainerListViewAndTextSplitterDistance = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("StartInSourceView");
            if (subNode != null)
                settings.General.StartInSourceView = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("RemoveBlankLinesWhenOpening");
            if (subNode != null)
                settings.General.RemoveBlankLinesWhenOpening = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("SubtitleLineMaximumLength");
            if (subNode != null)
                settings.General.SubtitleLineMaximumLength = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("SubtitleMinimumDisplayMilliseconds");
            if (subNode != null)
                settings.General.SubtitleMinimumDisplayMilliseconds = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("SubtitleMaximumDisplayMilliseconds");
            if (subNode != null)
                settings.General.SubtitleMaximumDisplayMilliseconds = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("MininumMillisecondsBetweenLines");
            if (subNode != null)
                settings.General.MininumMillisecondsBetweenLines = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("SetStartEndHumanDelay");
            if (subNode != null)
                settings.General.SetStartEndHumanDelay = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("AutoWrapLineWhileTyping");
            if (subNode != null)
                settings.General.AutoWrapLineWhileTyping = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("SubtitleMaximumCharactersPerSeconds");
            if (subNode != null)
                settings.General.SubtitleMaximumCharactersPerSeconds = Convert.ToDouble(subNode.InnerText, System.Globalization.CultureInfo.InvariantCulture);
            subNode = node.SelectSingleNode("SubtitleOptimalCharactersPerSeconds");
            if (subNode != null)
                settings.General.SubtitleOptimalCharactersPerSeconds = Convert.ToDouble(subNode.InnerText, System.Globalization.CultureInfo.InvariantCulture);
            subNode = node.SelectSingleNode("SpellCheckLanguage");
            if (subNode != null)
                settings.General.SpellCheckLanguage = subNode.InnerText;
            subNode = node.SelectSingleNode("VideoPlayer");
            if (subNode != null)
                settings.General.VideoPlayer = subNode.InnerText;
            subNode = node.SelectSingleNode("VideoPlayerDefaultVolume");
            if (subNode != null)
                settings.General.VideoPlayerDefaultVolume = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("VideoPlayerPreviewFontSize");
            if (subNode != null)
                settings.General.VideoPlayerPreviewFontSize = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("VideoPlayerShowStopButton");
            if (subNode != null)
                settings.General.VideoPlayerShowStopButton = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("VideoPlayerShowMuteButton");
            if (subNode != null)
                settings.General.VideoPlayerShowMuteButton = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("VideoPlayerShowFullscreenButton");
            if (subNode != null)
                settings.General.VideoPlayerShowFullscreenButton = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("Language");
            if (subNode != null)
                settings.General.Language = subNode.InnerText;
            subNode = node.SelectSingleNode("ListViewLineSeparatorString");
            if (subNode != null)
                settings.General.ListViewLineSeparatorString = subNode.InnerText;
            subNode = node.SelectSingleNode("ListViewDoubleClickAction");
            if (subNode != null)
                settings.General.ListViewDoubleClickAction = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("UppercaseLetters");
            if (subNode != null)
                settings.General.UppercaseLetters = subNode.InnerText;
            subNode = node.SelectSingleNode("DefaultAdjustMilliseconds");
            if (subNode != null)
                settings.General.DefaultAdjustMilliseconds = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("AutoRepeatOn");
            if (subNode != null)
                settings.General.AutoRepeatOn = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("AutoRepeatCount");
            if (subNode != null)
                settings.General.AutoRepeatCount = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("SyncListViewWithVideoWhilePlaying");
            if (subNode != null)
                settings.General.SyncListViewWithVideoWhilePlaying = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("AutoContinueOn");
            if (subNode != null)
                settings.General.AutoContinueOn = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("AutoBackupSeconds");
            if (subNode != null)
                settings.General.AutoBackupSeconds = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("SpellChecker");
            if (subNode != null)
                settings.General.SpellChecker = subNode.InnerText;
            subNode = node.SelectSingleNode("AllowEditOfOriginalSubtitle");
            if (subNode != null)
                settings.General.AllowEditOfOriginalSubtitle = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("PromptDeleteLines");
            if (subNode != null)
                settings.General.PromptDeleteLines = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("Undocked");
            if (subNode != null)
                settings.General.Undocked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("UndockedVideoPosition");
            if (subNode != null)
                settings.General.UndockedVideoPosition = subNode.InnerText;
            subNode = node.SelectSingleNode("UndockedWaveformPosition");
            if (subNode != null)
                settings.General.UndockedWaveformPosition = subNode.InnerText;
            subNode = node.SelectSingleNode("UndockedVideoControlsPosition");
            if (subNode != null)
                settings.General.UndockedVideoControlsPosition = subNode.InnerText;
            subNode = node.SelectSingleNode("WaveFormCenter");
            if (subNode != null)
                settings.General.WaveFormCenter = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("SmallDelayMilliseconds");
            if (subNode != null)
                settings.General.SmallDelayMilliseconds = Convert.ToInt32((subNode.InnerText));
            subNode = node.SelectSingleNode("LargeDelayMilliseconds");
            if (subNode != null)
                settings.General.LargeDelayMilliseconds = Convert.ToInt32((subNode.InnerText));
            subNode = node.SelectSingleNode("ShowOriginalAsPreviewIfAvailable");
            if (subNode != null)
                settings.General.ShowOriginalAsPreviewIfAvailable = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("LastPacCodePage");
            if (subNode != null)
                settings.General.LastPacCodePage = Convert.ToInt32((subNode.InnerText));
            subNode = node.SelectSingleNode("OpenSubtitleExtraExtensions");
            if (subNode != null)
                settings.General.OpenSubtitleExtraExtensions = subNode.InnerText.Trim();
            subNode = node.SelectSingleNode("ListViewColumsRememberSize");
            if (subNode != null)
                settings.General.ListViewColumsRememberSize = Convert.ToBoolean(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("ListViewNumberWidth");
            if (subNode != null)
                settings.General.ListViewNumberWidth = Convert.ToInt32(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("ListViewStartWidth");
            if (subNode != null)
                settings.General.ListViewStartWidth = Convert.ToInt32(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("ListViewEndWidth");
            if (subNode != null)
                settings.General.ListViewEndWidth = Convert.ToInt32(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("ListViewDurationWidth");
            if (subNode != null)
                settings.General.ListViewDurationWidth = Convert.ToInt32(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("ListViewTextWidth");
            if (subNode != null)
                settings.General.ListViewTextWidth = Convert.ToInt32(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("VlcWaveTranscodeSettings");
            if (subNode != null)
                settings.General.VlcWaveTranscodeSettings = subNode.InnerText.Trim();
            subNode = node.SelectSingleNode("VlcLocation");
            if (subNode != null)
                settings.General.VlcLocation = subNode.InnerText.Trim();
            subNode = node.SelectSingleNode("UseFFMPEGForWaveExtraction");
            if (subNode != null)
                settings.General.UseFFMPEGForWaveExtraction = Convert.ToBoolean(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("FFMPEGLocation");
            if (subNode != null)
                settings.General.FFMPEGLocation = subNode.InnerText.Trim();
            subNode = node.SelectSingleNode("UseTimeFormatHHMMSSFF");
            if (subNode != null)
                settings.General.UseTimeFormatHHMMSSFF = Convert.ToBoolean(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("ClearStatusBarAfterSeconds");
            if (subNode != null)
                settings.General.ClearStatusBarAfterSeconds = Convert.ToInt32(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("Company");
            if (subNode != null)
                settings.General.Company = subNode.InnerText;
            subNode = node.SelectSingleNode("DisableVideoAutoLoading");
            if (subNode != null)
                settings.General.DisableVideoAutoLoading = Convert.ToBoolean(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("RightToLeftMode");
            if (subNode != null)
                settings.General.RightToLeftMode = Convert.ToBoolean(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("LastSaveAsFormat");
            if (subNode != null)
                settings.General.LastSaveAsFormat = subNode.InnerText.Trim();
            subNode = node.SelectSingleNode("ShowBetaStuff");
            if (subNode != null)
                settings.General.ShowBetaStuff = Convert.ToBoolean(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("NewEmptyDefaultMs");
            if (subNode != null)
                settings.General.NewEmptyDefaultMs = Convert.ToInt32(subNode.InnerText.Trim());
            subNode = node.SelectSingleNode("MoveVideo100Or500MsPlaySmallSample");
            if (subNode != null)
                settings.General.MoveVideo100Or500MsPlaySmallSample = Convert.ToBoolean(subNode.InnerText.Trim());

            settings.Tools = new ToolsSettings();
            node = doc.DocumentElement.SelectSingleNode("Tools");
            subNode = node.SelectSingleNode("StartSceneIndex");
            if (subNode != null)
                settings.Tools.StartSceneIndex = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("EndSceneIndex");
            if (subNode != null)
                settings.Tools.EndSceneIndex = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("VerifyPlaySeconds");
            if (subNode != null)
                settings.Tools.VerifyPlaySeconds = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("MergeLinesShorterThan");
            if (subNode != null)
                settings.Tools.MergeLinesShorterThan = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("FixShortDisplayTimesAllowMoveStartTime");
            if (subNode != null)
                settings.Tools.FixShortDisplayTimesAllowMoveStartTime = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("MusicSymbol");
            if (subNode != null)
                settings.Tools.MusicSymbol = subNode.InnerText;
            subNode = node.SelectSingleNode("MusicSymbolToReplace");
            if (subNode != null)
                settings.Tools.MusicSymbolToReplace = subNode.InnerText;
            subNode = node.SelectSingleNode("UnicodeSymbolsToInsert");
            if (subNode != null)
                settings.Tools.UnicodeSymbolsToInsert = subNode.InnerText;
            subNode = node.SelectSingleNode("SpellCheckAutoChangeNames");
            if (subNode != null)
                settings.Tools.SpellCheckAutoChangeNames = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("SpellCheckOneLetterWords");
            if (subNode != null)
                settings.Tools.SpellCheckOneLetterWords = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("SpellCheckEnglishAllowInQuoteAsIng");
            if (subNode != null)
                settings.Tools.SpellCheckEnglishAllowInQuoteAsIng = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("OcrFixUseHardcodedRules");
            if (subNode != null)
                settings.Tools.OcrFixUseHardcodedRules = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("Interjections");
            if (subNode != null)
                settings.Tools.Interjections = subNode.InnerText;
            subNode = node.SelectSingleNode("MicrosoftBingApiId");
            if (subNode != null)
                settings.Tools.MicrosoftBingApiId = subNode.InnerText;
            subNode = node.SelectSingleNode("GoogleApiKey");
            if (subNode != null)
                settings.Tools.GoogleApiKey = subNode.InnerText;
            subNode = node.SelectSingleNode("UseGooleApiPaidService");
            if (subNode != null)
                settings.Tools.UseGooleApiPaidService = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("GoogleTranslateLastTargetLanguage");
            if (subNode != null)
                settings.Tools.GoogleTranslateLastTargetLanguage = subNode.InnerText;
            subNode = node.SelectSingleNode("ListViewSyntaxColorDurationSmall");
            if (subNode != null)
                settings.Tools.ListViewSyntaxColorDurationSmall = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ListViewSyntaxColorDurationBig");
            if (subNode != null)
                settings.Tools.ListViewSyntaxColorDurationBig = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ListViewSyntaxColorLongLines");
            if (subNode != null)
                settings.Tools.ListViewSyntaxColorLongLines = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ListViewSyntaxMoreThanXLines");
            if (subNode != null)
                settings.Tools.ListViewSyntaxMoreThanXLines = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ListViewSyntaxMoreThanXLinesX");
            if (subNode != null)
                settings.Tools.ListViewSyntaxMoreThanXLinesX = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("ListViewSyntaxColorOverlap");
            if (subNode != null)
                settings.Tools.ListViewSyntaxColorOverlap = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ListViewSyntaxErrorColor");
            if (subNode != null)
                settings.Tools.ListViewSyntaxErrorColor = Color.FromArgb(int.Parse(subNode.InnerText));
            subNode = node.SelectSingleNode("ListViewUnfocusedSelectedColor");
            if (subNode != null)
                settings.Tools.ListViewUnfocusedSelectedColor = Color.FromArgb(int.Parse(subNode.InnerText));
            subNode = node.SelectSingleNode("SplitAdvanced");
            if (subNode != null)
                settings.Tools.SplitAdvanced = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("SplitOutputFolder");
            if (subNode != null)
                settings.Tools.SplitOutputFolder = subNode.InnerText;
            subNode = node.SelectSingleNode("SplitNumberOfParts");
            if (subNode != null)
                settings.Tools.SplitNumberOfParts = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("SplitVia");
            if (subNode != null)
                settings.Tools.SplitVia = subNode.InnerText;
            subNode = node.SelectSingleNode("NewEmptyTranslationText");
            if (subNode != null)
                settings.Tools.NewEmptyTranslationText = subNode.InnerText;
            subNode = node.SelectSingleNode("BatchConvertOutputFolder");
            if (subNode != null)
                settings.Tools.BatchConvertOutputFolder = subNode.InnerText;
            subNode = node.SelectSingleNode("BatchConvertOverwrite");
            if (subNode != null)
                settings.Tools.BatchConvertOverwrite = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BatchConvertRemoveFormatting");
            if (subNode != null)
                settings.Tools.BatchConvertRemoveFormatting = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BatchConvertFixCasing");
            if (subNode != null)
                settings.Tools.BatchConvertFixCasing = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BatchConvertRemoveTextForHI");
            if (subNode != null)
                settings.Tools.BatchConvertRemoveTextForHI = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BatchConvertFixCommonErrors");
            if (subNode != null)
                settings.Tools.BatchConvertFixCommonErrors = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BatchConvertMultipleReplace");
            if (subNode != null)
                settings.Tools.BatchConvertMultipleReplace = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BatchConvertAutoBalance");
            if (subNode != null)
                settings.Tools.BatchConvertAutoBalance = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BatchConvertSplitLongLines");
            if (subNode != null)
                settings.Tools.BatchConvertSplitLongLines = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BatchConvertSetMinDisplayTimeBetweenSubtitles");
            if (subNode != null)
                settings.Tools.BatchConvertSetMinDisplayTimeBetweenSubtitles = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BatchConvertLanguage");
            if (subNode != null)
                settings.Tools.BatchConvertLanguage = subNode.InnerText;
            subNode = node.SelectSingleNode("ModifySelectionRule");
            if (subNode != null)
                settings.Tools.ModifySelectionRule = subNode.InnerText;
            subNode = node.SelectSingleNode("ModifySelectionText");
            if (subNode != null)
                settings.Tools.ModifySelectionText = subNode.InnerText;
            subNode = node.SelectSingleNode("ModifySelectionCaseSensitive");
            if (subNode != null)
                settings.Tools.ModifySelectionCaseSensitive = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportVobSubFontName");
            if (subNode != null)
                settings.Tools.ExportVobSubFontName = subNode.InnerText;
            subNode = node.SelectSingleNode("ExportVobSubFontSize");
            if (subNode != null)
                settings.Tools.ExportVobSubFontSize = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportVobSubVideoResolution");
            if (subNode != null)
                settings.Tools.ExportVobSubVideoResolution = subNode.InnerText;
            subNode = node.SelectSingleNode("ExportVobSubSimpleRendering");
            if (subNode != null)
                settings.Tools.ExportVobSubSimpleRendering = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportVobSubLanguage");
            if (subNode != null)
                settings.Tools.ExportVobSubLanguage = subNode.InnerText;
            subNode = node.SelectSingleNode("ExportBluRayFontName");
            if (subNode != null)
                settings.Tools.ExportBluRayFontName = subNode.InnerText;
            subNode = node.SelectSingleNode("ExportBluRayFontSize");
            if (subNode != null)
                settings.Tools.ExportBluRayFontSize = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportFcpFontName");
            if (subNode != null)
                settings.Tools.ExportFcpFontName = subNode.InnerText;
            subNode = node.SelectSingleNode("ExportFcpFontSize");
            if (subNode != null)
                settings.Tools.ExportFcpFontSize = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportFcpImageType");
            if (subNode != null)
                settings.Tools.ExportFcpImageType = subNode.InnerText;
            subNode = node.SelectSingleNode("ExportLastFontSize");
            if (subNode != null)
                settings.Tools.ExportLastFontSize = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportLastLineHeight");
            if (subNode != null)
                settings.Tools.ExportLastLineHeight = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportLastBorderWidth");
            if (subNode != null)
                settings.Tools.ExportLastBorderWidth = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportLastFontBold");
            if (subNode != null)
                settings.Tools.ExportLastFontBold = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportBluRayVideoResolution");
            if (subNode != null)
                settings.Tools.ExportBluRayVideoResolution = subNode.InnerText;
            subNode = node.SelectSingleNode("ExportFontColor");
            if (subNode != null)
                settings.Tools.ExportFontColor = Color.FromArgb(int.Parse(subNode.InnerText));
            subNode = node.SelectSingleNode("ExportBorderColor");
            if (subNode != null)
                settings.Tools.ExportBorderColor = Color.FromArgb(int.Parse(subNode.InnerText));
            subNode = node.SelectSingleNode("ExportBottomMargin");
            if (subNode != null)
                settings.Tools.ExportBottomMargin = int.Parse(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportHorizontalAlignment");
            if (subNode != null)
                settings.Tools.ExportHorizontalAlignment = int.Parse(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportBluRayBottomMargin");
            if (subNode != null)
                settings.Tools.ExportBluRayBottomMargin = int.Parse(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportBluRayShadow");
            if (subNode != null)
                settings.Tools.ExportBluRayShadow = int.Parse(subNode.InnerText);
            subNode = node.SelectSingleNode("Export3DType");
            if (subNode != null)
                settings.Tools.Export3DType = int.Parse(subNode.InnerText);
            subNode = node.SelectSingleNode("Export3DDepth");
            if (subNode != null)
                settings.Tools.Export3DDepth = int.Parse(subNode.InnerText);
            subNode = node.SelectSingleNode("FixCommonErrorsFixOverlapAllowEqualEndStart");
            if (subNode != null)
                settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ImportTextSplitting");
            if (subNode != null)
                settings.Tools.ImportTextSplitting = subNode.InnerText;
            subNode = node.SelectSingleNode("ImportTextMergeShortLines");
            if (subNode != null)
                settings.Tools.ImportTextMergeShortLines = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("GenerateTimeCodePatterns");
            if (subNode != null)
                settings.Tools.GenerateTimeCodePatterns = subNode.InnerText;
            subNode = node.SelectSingleNode("MusicSymbolStyle");
            if (subNode != null)
                settings.Tools.MusicSymbolStyle = subNode.InnerText;
            subNode = node.SelectSingleNode("BridgeGapMilliseconds");
            if (subNode != null)
                settings.Tools.BridgeGapMilliseconds = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("ExportCustomTemplates");
            if (subNode != null)
                settings.Tools.ExportCustomTemplates = subNode.InnerText;
            subNode = node.SelectSingleNode("ChangeCasingChoice");
            if (subNode != null)
                settings.Tools.ChangeCasingChoice = subNode.InnerText;

            settings.SubtitleSettings = new Nikse.SubtitleEdit.Logic.SubtitleSettings();
            node = doc.DocumentElement.SelectSingleNode("SubtitleSettings");
            if (node != null)
            {
                subNode = node.SelectSingleNode("SsaFontName");
                if (subNode != null)
                    settings.SubtitleSettings.SsaFontName = subNode.InnerText;
                subNode = node.SelectSingleNode("SsaFontSize");
                if (subNode != null)
                    settings.SubtitleSettings.SsaFontSize = Convert.ToDouble(subNode.InnerText, CultureInfo.InvariantCulture);
                subNode = node.SelectSingleNode("SsaFontColorArgb");
                if (subNode != null)
                    settings.SubtitleSettings.SsaFontColorArgb = Convert.ToInt32(subNode.InnerText);
                subNode = node.SelectSingleNode("SsaOutline");
                if (subNode != null)
                    settings.SubtitleSettings.SsaOutline = Convert.ToInt32(subNode.InnerText);
                subNode = node.SelectSingleNode("SsaShadow");
                if (subNode != null)
                    settings.SubtitleSettings.SsaShadow = Convert.ToInt32(subNode.InnerText);
                subNode = node.SelectSingleNode("SsaOpaqueBox");
                if (subNode != null)
                    settings.SubtitleSettings.SsaOpaqueBox = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("DCinemaFontFile");
                if (subNode != null)
                    settings.SubtitleSettings.DCinemaFontFile = subNode.InnerText;
                subNode = node.SelectSingleNode("DCinemaFontSize");
                if (subNode != null)
                    settings.SubtitleSettings.DCinemaFontSize = Convert.ToInt32(subNode.InnerText);
                subNode = node.SelectSingleNode("DCinemaBottomMargin");
                if (subNode != null)
                    settings.SubtitleSettings.DCinemaBottomMargin = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
                subNode = node.SelectSingleNode("DCinemaZPosition");
                if (subNode != null)
                    settings.SubtitleSettings.DCinemaZPosition = Convert.ToDouble(subNode.InnerText);
                subNode = node.SelectSingleNode("DCinemaFadeUpDownTime");
                if (subNode != null)
                    settings.SubtitleSettings.DCinemaFadeUpDownTime = Convert.ToInt32(subNode.InnerText);
                subNode = node.SelectSingleNode("SamiDisplayTwoClassesAsTwoSubtitles");
                if (subNode != null)
                    settings.SubtitleSettings.SamiDisplayTwoClassesAsTwoSubtitles = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("SamiFullHtmlEncode");
                if (subNode != null)
                    settings.SubtitleSettings.SamiFullHtmlEncode = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("SamiFullHtmlEncodeNumeric");
                if (subNode != null)
                    settings.SubtitleSettings.SamiFullHtmlEncodeNumeric = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("TimedText10TimeCodeFormat");
                if (subNode != null)
                    settings.SubtitleSettings.TimedText10TimeCodeFormat = subNode.InnerText;
                subNode = node.SelectSingleNode("FcpFontSize");
                if (subNode != null)
                    settings.SubtitleSettings.FcpFontSize = Convert.ToInt32(subNode.InnerText);
                subNode = node.SelectSingleNode("FcpFontName");
                if (subNode != null)
                    settings.SubtitleSettings.FcpFontName = subNode.InnerText;
                subNode = node.SelectSingleNode("NuendoCharacterListFile");
                if (subNode != null)
                    settings.SubtitleSettings.NuendoCharacterListFile = subNode.InnerText;
            }

            settings.Proxy = new Nikse.SubtitleEdit.Logic.ProxySettings();
            node = doc.DocumentElement.SelectSingleNode("Proxy");
            subNode = node.SelectSingleNode("ProxyAddress");
            if (subNode != null)
                settings.Proxy.ProxyAddress = subNode.InnerText;
            subNode = node.SelectSingleNode("UserName");
            if (subNode != null)
                settings.Proxy.UserName = subNode.InnerText;
            subNode = node.SelectSingleNode("Password");
            if (subNode != null)
                settings.Proxy.Password = subNode.InnerText;
            subNode = node.SelectSingleNode("Domain");
            if (subNode != null)
                settings.Proxy.Domain = subNode.InnerText;

            settings.WordLists = new Nikse.SubtitleEdit.Logic.WordListSettings();
            node = doc.DocumentElement.SelectSingleNode("WordLists");
            subNode = node.SelectSingleNode("LastLanguage");
            if (subNode != null)
                settings.WordLists.LastLanguage = subNode.InnerText;
            subNode = node.SelectSingleNode("NamesEtcUrl");
            if (subNode != null)
                settings.WordLists.NamesEtcUrl = subNode.InnerText;
            subNode = node.SelectSingleNode("UseOnlineNamesEtc");
            if (subNode != null)
                settings.WordLists.UseOnlineNamesEtc = Convert.ToBoolean(subNode.InnerText);

            settings.CommonErrors = new Nikse.SubtitleEdit.Logic.FixCommonErrorsSettings();
            node = doc.DocumentElement.SelectSingleNode("CommonErrors");
            subNode = node.SelectSingleNode("StartPosition");
            if (subNode != null)
                settings.CommonErrors.StartPosition = subNode.InnerText;
            subNode = node.SelectSingleNode("StartSize");
            if (subNode != null)
                settings.CommonErrors.StartSize = subNode.InnerText;
            subNode = node.SelectSingleNode("EmptyLinesTicked");
            if (subNode != null)
                settings.CommonErrors.EmptyLinesTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("OverlappingDisplayTimeTicked");
            if (subNode != null)
                settings.CommonErrors.OverlappingDisplayTimeTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("TooShortDisplayTimeTicked");
            if (subNode != null)
                settings.CommonErrors.TooShortDisplayTimeTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("TooLongDisplayTimeTicked");
            if (subNode != null)
                settings.CommonErrors.TooLongDisplayTimeTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("InvalidItalicTagsTicked");
            if (subNode != null)
                settings.CommonErrors.InvalidItalicTagsTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("BreakLongLinesTicked");
            if (subNode != null)
                settings.CommonErrors.BreakLongLinesTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("MergeShortLinesTicked");
            if (subNode != null)
                settings.CommonErrors.MergeShortLinesTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("MergeShortLinesAllTicked");
            if (subNode != null)
                settings.CommonErrors.MergeShortLinesAllTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("UnneededSpacesTicked");
            if (subNode != null)
                settings.CommonErrors.UnneededSpacesTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("UnneededPeriodsTicked");
            if (subNode != null)
                settings.CommonErrors.UnneededPeriodsTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("MissingSpacesTicked");
            if (subNode != null)
                settings.CommonErrors.MissingSpacesTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("AddMissingQuotesTicked");
            if (subNode != null)
                settings.CommonErrors.AddMissingQuotesTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("Fix3PlusLinesTicked");
            if (subNode != null)
                settings.CommonErrors.Fix3PlusLinesTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("FixHyphensTicked");
            if (subNode != null)
                settings.CommonErrors.FixHyphensTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("FixHyphensAddTicked");
            if (subNode != null)
                settings.CommonErrors.FixHyphensAddTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("UppercaseIInsideLowercaseWordTicked");
            if (subNode != null)
                settings.CommonErrors.UppercaseIInsideLowercaseWordTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("DoubleApostropheToQuoteTicked");
            if (subNode != null)
                settings.CommonErrors.DoubleApostropheToQuoteTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("AddPeriodAfterParagraphTicked");
            if (subNode != null)
                settings.CommonErrors.AddPeriodAfterParagraphTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("StartWithUppercaseLetterAfterParagraphTicked");
            if (subNode != null)
                settings.CommonErrors.StartWithUppercaseLetterAfterParagraphTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("StartWithUppercaseLetterAfterPeriodInsideParagraphTicked");
            if (subNode != null)
                settings.CommonErrors.StartWithUppercaseLetterAfterPeriodInsideParagraphTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("StartWithUppercaseLetterAfterColonTicked");
            if (subNode != null)
                settings.CommonErrors.StartWithUppercaseLetterAfterColonTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("AloneLowercaseIToUppercaseIEnglishTicked");
            if (subNode != null)
                settings.CommonErrors.AloneLowercaseIToUppercaseIEnglishTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("FixOcrErrorsViaReplaceListTicked");
            if (subNode != null)
                settings.CommonErrors.FixOcrErrorsViaReplaceListTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("RemoveSpaceBetweenNumberTicked");
            if (subNode != null)
                settings.CommonErrors.RemoveSpaceBetweenNumberTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("FixDialogsOnOneLineTicked");
            if (subNode != null)
                settings.CommonErrors.FixDialogsOnOneLineTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("TurkishAnsiTicked");
            if (subNode != null)
                settings.CommonErrors.TurkishAnsiTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("DanishLetterITicked");
            if (subNode != null)
                settings.CommonErrors.DanishLetterITicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("SpanishInvertedQuestionAndExclamationMarksTicked");
            if (subNode != null)
                settings.CommonErrors.SpanishInvertedQuestionAndExclamationMarksTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("FixDoubleDashTicked");
            if (subNode != null)
                settings.CommonErrors.FixDoubleDashTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("FixDoubleGreaterThanTicked");
            if (subNode != null)
                settings.CommonErrors.FixDoubleGreaterThanTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("FixEllipsesStartTicked");
            if (subNode != null)
                settings.CommonErrors.FixEllipsesStartTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("FixMissingOpenBracketTicked");
            if (subNode != null)
                settings.CommonErrors.FixMissingOpenBracketTicked = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("FixMusicNotationTicked");
            if (subNode != null)
                settings.CommonErrors.FixMusicNotationTicked = Convert.ToBoolean(subNode.InnerText);

            settings.VideoControls = new VideoControlsSettings();
            node = doc.DocumentElement.SelectSingleNode("VideoControls");
            subNode = node.SelectSingleNode("CustomSearchText1");
            if (subNode != null)
                settings.VideoControls.CustomSearchText1 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchText2");
            if (subNode != null)
                settings.VideoControls.CustomSearchText2 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchText3");
            if (subNode != null)
                settings.VideoControls.CustomSearchText3 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchText4");
            if (subNode != null)
                settings.VideoControls.CustomSearchText4 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchText5");
            if (subNode != null)
                settings.VideoControls.CustomSearchText5 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchText6");
            if (subNode != null)
                settings.VideoControls.CustomSearchText6 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchUrl1");
            if (subNode != null)
                settings.VideoControls.CustomSearchUrl1 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchUrl1");
            if (subNode != null)
                settings.VideoControls.CustomSearchUrl1 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchUrl2");
            if (subNode != null)
                settings.VideoControls.CustomSearchUrl2 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchUrl3");
            if (subNode != null)
                settings.VideoControls.CustomSearchUrl3 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchUrl4");
            if (subNode != null)
                settings.VideoControls.CustomSearchUrl4 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchUrl5");
            if (subNode != null)
                settings.VideoControls.CustomSearchUrl5 = subNode.InnerText;
            subNode = node.SelectSingleNode("CustomSearchUrl6");
            if (subNode != null)
                settings.VideoControls.CustomSearchUrl6 = subNode.InnerText;
            subNode = node.SelectSingleNode("LastActiveTab");
            if (subNode != null)
                settings.VideoControls.LastActiveTab = subNode.InnerText;
            subNode = node.SelectSingleNode("WaveFormDrawGrid");
            if (subNode != null)
                settings.VideoControls.WaveFormDrawGrid = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("WaveFormAllowOverlap");
            if (subNode != null)
                settings.VideoControls.WaveFormAllowOverlap = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("WaveFormFocusOnMouseEnter");
            if (subNode != null)
                settings.VideoControls.WaveFormFocusOnMouseEnter = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("WaveFormListViewFocusOnMouseEnter");
            if (subNode != null)
                settings.VideoControls.WaveFormListViewFocusOnMouseEnter = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("WaveformBorderHitMs");
            if (subNode != null)
                settings.VideoControls.WaveformBorderHitMs = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("WaveFormGridColor");
            if (subNode != null)
                settings.VideoControls.WaveFormGridColor = Color.FromArgb(int.Parse(subNode.InnerText));
            subNode = node.SelectSingleNode("WaveFormColor");
            if (subNode != null)
                settings.VideoControls.WaveFormColor = Color.FromArgb(int.Parse(subNode.InnerText));
            subNode = node.SelectSingleNode("WaveFormSelectedColor");
            if (subNode != null)
                settings.VideoControls.WaveFormSelectedColor = Color.FromArgb(int.Parse(subNode.InnerText));
            subNode = node.SelectSingleNode("WaveFormBackgroundColor");
            if (subNode != null)
                settings.VideoControls.WaveFormBackgroundColor = Color.FromArgb(int.Parse(subNode.InnerText));
            subNode = node.SelectSingleNode("WaveFormTextColor");
            if (subNode != null)
                settings.VideoControls.WaveFormTextColor = Color.FromArgb(int.Parse(subNode.InnerText));
            subNode = node.SelectSingleNode("WaveFormDoubleClickOnNonParagraphAction");
            if (subNode != null)
                settings.VideoControls.WaveFormDoubleClickOnNonParagraphAction = subNode.InnerText;
            subNode = node.SelectSingleNode("WaveFormRightClickOnNonParagraphAction");
            if (subNode != null)
                settings.VideoControls.WaveFormRightClickOnNonParagraphAction = subNode.InnerText;
            subNode = node.SelectSingleNode("WaveFormMouseWheelScrollUpIsForward");
            if (subNode != null)
                settings.VideoControls.WaveFormMouseWheelScrollUpIsForward = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("GenerateSpectrogram");
            if (subNode != null)
                settings.VideoControls.GenerateSpectrogram = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("SpectrogramAppearance");
            if (subNode != null)
                settings.VideoControls.SpectrogramAppearance = subNode.InnerText;
            subNode = node.SelectSingleNode("WaveFormMininumSampleRate");
            if (subNode != null)
                settings.VideoControls.WaveFormMininumSampleRate = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("WaveformSeeksSilenceDurationSeconds");
            if (subNode != null)
                settings.VideoControls.WaveformSeeksSilenceDurationSeconds = Convert.ToDouble(subNode.InnerText, System.Globalization.CultureInfo.InvariantCulture);
            subNode = node.SelectSingleNode("WaveformSeeksSilenceMaxVolume");
            if (subNode != null)
                settings.VideoControls.WaveformSeeksSilenceMaxVolume = Convert.ToInt32(subNode.InnerText);

            settings.NetworkSettings = new NetworkSettings();
            node = doc.DocumentElement.SelectSingleNode("NetworkSettings");
            if (node != null)
            {
                subNode = node.SelectSingleNode("SessionKey");
                if (subNode != null)
                    settings.NetworkSettings.SessionKey = subNode.InnerText;
                subNode = node.SelectSingleNode("UserName");
                if (subNode != null)
                    settings.NetworkSettings.UserName = subNode.InnerText;
                subNode = node.SelectSingleNode("WebServiceUrl");
                if (subNode != null)
                    settings.NetworkSettings.WebServiceUrl = subNode.InnerText;
                subNode = node.SelectSingleNode("PollIntervalSeconds");
                if (subNode != null)
                    settings.NetworkSettings.PollIntervalSeconds = Convert.ToInt32(subNode.InnerText);
            }

            settings.VobSubOcr = new Nikse.SubtitleEdit.Logic.VobSubOcrSettings();
            node = doc.DocumentElement.SelectSingleNode("VobSubOcr");
            subNode = node.SelectSingleNode("XOrMorePixelsMakesSpace");
            if (subNode != null)
                settings.VobSubOcr.XOrMorePixelsMakesSpace = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("AllowDifferenceInPercent");
            if (subNode != null)
                settings.VobSubOcr.AllowDifferenceInPercent = Convert.ToDouble(subNode.InnerText, CultureInfo.InvariantCulture);
            subNode = node.SelectSingleNode("BlurayAllowDifferenceInPercent");
            if (subNode != null)
                settings.VobSubOcr.BlurayAllowDifferenceInPercent = Convert.ToDouble(subNode.InnerText, CultureInfo.InvariantCulture);
            subNode = node.SelectSingleNode("LastImageCompareFolder");
            if (subNode != null)
                settings.VobSubOcr.LastImageCompareFolder = subNode.InnerText;
            subNode = node.SelectSingleNode("LastModiLanguageId");
            if (subNode != null)
                settings.VobSubOcr.LastModiLanguageId = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("LastOcrMethod");
            if (subNode != null)
                settings.VobSubOcr.LastOcrMethod = subNode.InnerText;
            subNode = node.SelectSingleNode("TesseractLastLanguage");
            if (subNode != null)
                settings.VobSubOcr.TesseractLastLanguage = subNode.InnerText;
            subNode = node.SelectSingleNode("UseModiInTesseractForUnknownWords");
            if (subNode != null)
                settings.VobSubOcr.UseModiInTesseractForUnknownWords = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("UseItalicsInTesseract");
            if (subNode != null)
                settings.VobSubOcr.UseItalicsInTesseract = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("UseMusicSymbolsInTesseract");
            if (subNode != null)
                settings.VobSubOcr.UseMusicSymbolsInTesseract = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("RightToLeft");
            if (subNode != null)
                settings.VobSubOcr.RightToLeft = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("TopToBottom");
            if (subNode != null)
                settings.VobSubOcr.TopToBottom = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("DefaultMillisecondsForUnknownDurations");
            if (subNode != null)
                settings.VobSubOcr.DefaultMillisecondsForUnknownDurations = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("PromptForUnknownWords");
            if (subNode != null)
                settings.VobSubOcr.PromptForUnknownWords = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("GuessUnknownWords");
            if (subNode != null)
                settings.VobSubOcr.GuessUnknownWords = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("AutoBreakSubtitleIfMoreThanTwoLines");
            if (subNode != null)
                settings.VobSubOcr.AutoBreakSubtitleIfMoreThanTwoLines = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("ItalicFactor");
            if (subNode != null)
                settings.VobSubOcr.ItalicFactor = Convert.ToDouble(subNode.InnerText, CultureInfo.InvariantCulture);
            subNode = node.SelectSingleNode("LineOcrDraw");
            if (subNode != null)
                settings.VobSubOcr.LineOcrDraw = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("LineOcrAdvancedItalic");
            if (subNode != null)
                settings.VobSubOcr.LineOcrAdvancedItalic = Convert.ToBoolean(subNode.InnerText);
            subNode = node.SelectSingleNode("LineOcrLastLanguages");
            if (subNode != null)
                settings.VobSubOcr.LineOcrLastLanguages = subNode.InnerText;
            subNode = node.SelectSingleNode("LineOcrLastSpellcheck");
            if (subNode != null)
                settings.VobSubOcr.LineOcrLastSpellcheck = subNode.InnerText;
            subNode = node.SelectSingleNode("LineOcrXOrMorePixelsMakesSpace");
            if (subNode != null)
                settings.VobSubOcr.LineOcrXOrMorePixelsMakesSpace = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("LineOcrMinLineHeight");
            if (subNode != null)
                settings.VobSubOcr.LineOcrMinLineHeight = Convert.ToInt32(subNode.InnerText);
            subNode = node.SelectSingleNode("LineOcrMaxLineHeight");
            if (subNode != null)
                settings.VobSubOcr.LineOcrMaxLineHeight = Convert.ToInt32(subNode.InnerText);

            foreach (XmlNode listNode in doc.DocumentElement.SelectNodes("MultipleSearchAndReplaceList/MultipleSearchAndReplaceItem"))
            {
                MultipleSearchAndReplaceSetting item = new MultipleSearchAndReplaceSetting();
                subNode = listNode.SelectSingleNode("Enabled");
                if (subNode != null)
                    item.Enabled = Convert.ToBoolean(subNode.InnerText);
                subNode = listNode.SelectSingleNode("FindWhat");
                if (subNode != null)
                    item.FindWhat = subNode.InnerText;
                subNode = listNode.SelectSingleNode("ReplaceWith");
                if (subNode != null)
                    item.ReplaceWith = subNode.InnerText;
                subNode = listNode.SelectSingleNode("SearchType");
                if (subNode != null)
                    item.SearchType = subNode.InnerText;
                settings.MultipleSearchAndReplaceList.Add(item);
            }

            settings.Shortcuts = new Shortcuts();
            node = doc.DocumentElement.SelectSingleNode("Shortcuts");
            if (node != null)
            {
                subNode = node.SelectSingleNode("GeneralGoToFirstSelectedLine");
                if (subNode != null)
                    settings.Shortcuts.GeneralGoToFirstSelectedLine = subNode.InnerText;
                subNode = node.SelectSingleNode("GeneralMergeSelectedLines");
                if (subNode != null)
                    settings.Shortcuts.GeneralMergeSelectedLines = subNode.InnerText;
                subNode = node.SelectSingleNode("GeneralToggleTranslationMode");
                if (subNode != null)
                    settings.Shortcuts.GeneralToggleTranslationMode = subNode.InnerText;
                subNode = node.SelectSingleNode("GeneralSwitchOriginalAndTranslation");
                if (subNode != null)
                    settings.Shortcuts.GeneralSwitchOriginalAndTranslation = subNode.InnerText;
                subNode = node.SelectSingleNode("GeneralMergeOriginalAndTranslation");
                if (subNode != null)
                    settings.Shortcuts.GeneralMergeOriginalAndTranslation = subNode.InnerText;
                subNode = node.SelectSingleNode("GeneralGoToNextSubtitle");
                if (subNode != null)
                    settings.Shortcuts.GeneralGoToNextSubtitle = subNode.InnerText;
                subNode = node.SelectSingleNode("GeneralGoToPrevSubtitle");
                if (subNode != null)
                    settings.Shortcuts.GeneralGoToPrevSubtitle = subNode.InnerText;
                subNode = node.SelectSingleNode("GeneralGoToEndOfCurrentSubtitle");
                if (subNode != null)
                    settings.Shortcuts.GeneralGoToEndOfCurrentSubtitle = subNode.InnerText;
                subNode = node.SelectSingleNode("GeneralGoToStartOfCurrentSubtitle");
                if (subNode != null)
                    settings.Shortcuts.GeneralGoToStartOfCurrentSubtitle = subNode.InnerText;
                subNode = node.SelectSingleNode("MainFileNew");
                if (subNode != null)
                    settings.Shortcuts.MainFileNew = subNode.InnerText;
                subNode = node.SelectSingleNode("MainFileOpen");
                if (subNode != null)
                    settings.Shortcuts.MainFileOpen = subNode.InnerText;
                subNode = node.SelectSingleNode("MainFileOpenKeepVideo");
                if (subNode != null)
                    settings.Shortcuts.MainFileOpenKeepVideo = subNode.InnerText;
                subNode = node.SelectSingleNode("MainFileSave");
                if (subNode != null)
                    settings.Shortcuts.MainFileSave = subNode.InnerText;
                subNode = node.SelectSingleNode("MainFileSaveAs");
                if (subNode != null)
                    settings.Shortcuts.MainFileSaveAs = subNode.InnerText;
                subNode = node.SelectSingleNode("MainFileExportEbu");
                if (subNode != null)
                    settings.Shortcuts.MainFileExportEbu = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditUndo");
                if (subNode != null)
                    settings.Shortcuts.MainEditUndo = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditRedo");
                if (subNode != null)
                    settings.Shortcuts.MainEditRedo = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditFind");
                if (subNode != null)
                    settings.Shortcuts.MainEditFind = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditFindNext");
                if (subNode != null)
                    settings.Shortcuts.MainEditFindNext = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditReplace");
                if (subNode != null)
                    settings.Shortcuts.MainEditReplace = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditMultipleReplace");
                if (subNode != null)
                    settings.Shortcuts.MainEditMultipleReplace = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditGoToLineNumber");
                if (subNode != null)
                    settings.Shortcuts.MainEditGoToLineNumber = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditRightToLeft");
                if (subNode != null)
                    settings.Shortcuts.MainEditRightToLeft = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsFixCommonErrors");
                if (subNode != null)
                    settings.Shortcuts.MainToolsFixCommonErrors = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsFixCommonErrorsPreview");
                if (subNode != null)
                    settings.Shortcuts.MainToolsFixCommonErrorsPreview = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsSplitLongLines");
                if (subNode != null)
                    settings.Shortcuts.MainToolsSplitLongLines= subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsRenumber");
                if (subNode != null)
                    settings.Shortcuts.MainToolsRenumber = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsRemoveTextForHI");
                if (subNode != null)
                    settings.Shortcuts.MainToolsRemoveTextForHI = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsChangeCasing");
                if (subNode != null)
                    settings.Shortcuts.MainToolsChangeCasing = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsAutoDuration");
                if (subNode != null)
                    settings.Shortcuts.MainToolsAutoDuration = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsBatchConvert");
                if (subNode != null)
                    settings.Shortcuts.MainToolsBatchConvert = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsBeamer");
                if (subNode != null)
                    settings.Shortcuts.MainToolsBeamer = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToolsToggleTranslationOriginalInPreviews");
                if (subNode != null)
                    settings.Shortcuts.MainEditToggleTranslationOriginalInPreviews = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditInverseSelection");
                if (subNode != null)
                    settings.Shortcuts.MainEditInverseSelection = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditModifySelection");
                if (subNode != null)
                    settings.Shortcuts.MainEditModifySelection = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideoPause");
                if (subNode != null)
                    settings.Shortcuts.MainVideoPause = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideoPlayPauseToggle");
                if (subNode != null)
                    settings.Shortcuts.MainVideoPlayPauseToggle = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideoShowHideVideo");
                if (subNode != null)
                    settings.Shortcuts.MainVideoShowHideVideo = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideoToggleVideoControls");
                if (subNode != null)
                    settings.Shortcuts.MainVideoToggleVideoControls = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideo1FrameLeft");
                if (subNode != null)
                    settings.Shortcuts.MainVideo1FrameLeft = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideo1FrameRight");
                if (subNode != null)
                    settings.Shortcuts.MainVideo1FrameRight = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideo100MsLeft");
                if (subNode != null)
                    settings.Shortcuts.MainVideo100MsLeft = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideo100MsRight");
                if (subNode != null)
                    settings.Shortcuts.MainVideo100MsRight = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideo500MsLeft");
                if (subNode != null)
                    settings.Shortcuts.MainVideo500MsLeft = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideo500MsRight");
                if (subNode != null)
                    settings.Shortcuts.MainVideo500MsRight = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideo1000MsLeft");
                if (subNode != null)
                    settings.Shortcuts.MainVideo1000MsLeft = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideo1000MsRight");
                if (subNode != null)
                    settings.Shortcuts.MainVideo1000MsRight = subNode.InnerText;
                subNode = node.SelectSingleNode("MainVideoFullscreen");
                if (subNode != null)
                    settings.Shortcuts.MainVideoFullscreen = subNode.InnerText;
                subNode = node.SelectSingleNode("MainSpellCheck");
                if (subNode != null)
                    settings.Shortcuts.MainSpellCheck = subNode.InnerText;
                subNode = node.SelectSingleNode("MainSpellCheckFindDoubleWords");
                if (subNode != null)
                    settings.Shortcuts.MainSpellCheckFindDoubleWords = subNode.InnerText;
                subNode = node.SelectSingleNode("MainSpellCheckAddWordToNames");
                if (subNode != null)
                    settings.Shortcuts.MainSpellCheckAddWordToNames = subNode.InnerText;
                subNode = node.SelectSingleNode("MainSynchronizationAdjustTimes");
                if (subNode != null)
                    settings.Shortcuts.MainSynchronizationAdjustTimes = subNode.InnerText;
                subNode = node.SelectSingleNode("MainSynchronizationVisualSync");
                if (subNode != null)
                    settings.Shortcuts.MainSynchronizationVisualSync = subNode.InnerText;
                subNode = node.SelectSingleNode("MainSynchronizationPointSync");
                if (subNode != null)
                    settings.Shortcuts.MainSynchronizationPointSync = subNode.InnerText;
                subNode = node.SelectSingleNode("MainSynchronizationChangeFrameRate");
                if (subNode != null)
                    settings.Shortcuts.MainSynchronizationChangeFrameRate = subNode.InnerText;
                subNode = node.SelectSingleNode("MainListViewItalic");
                if (subNode != null)
                    settings.Shortcuts.MainListViewItalic = subNode.InnerText;
                subNode = node.SelectSingleNode("MainListViewToggleDashes");
                if (subNode != null)
                    settings.Shortcuts.MainListViewToggleDashes = subNode.InnerText;
                subNode = node.SelectSingleNode("MainListViewAlignment");
                if (subNode != null)
                    settings.Shortcuts.MainListViewAlignment = subNode.InnerText;
                subNode = node.SelectSingleNode("MainListViewCopyText");
                if (subNode != null)
                    settings.Shortcuts.MainListViewCopyText = subNode.InnerText;
                subNode = node.SelectSingleNode("MainListViewAutoDuration");
                if (subNode != null)
                    settings.Shortcuts.MainListViewAutoDuration = subNode.InnerText;
                subNode = node.SelectSingleNode("MainListViewColumnDeleteText");
                if (subNode != null)
                    settings.Shortcuts.MainListViewColumnDeleteText = subNode.InnerText;
                subNode = node.SelectSingleNode("MainListViewColumnInsertText");
                if (subNode != null)
                    settings.Shortcuts.MainListViewColumnInsertText = subNode.InnerText;
                subNode = node.SelectSingleNode("MainListViewColumnPaste");
                if (subNode != null)
                    settings.Shortcuts.MainListViewColumnPaste = subNode.InnerText;
                subNode = node.SelectSingleNode("MainListViewFocusWaveform");
                if (subNode != null)
                    settings.Shortcuts.MainListViewFocusWaveform = subNode.InnerText;
                subNode = node.SelectSingleNode("MainEditReverseStartAndEndingForRTL");
                if (subNode != null)
                    settings.Shortcuts.MainEditReverseStartAndEndingForRTL = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTextBoxItalic");
                if (subNode != null)
                    settings.Shortcuts.MainTextBoxItalic = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTextBoxSplitAtCursor");
                if (subNode != null)
                    settings.Shortcuts.MainTextBoxSplitAtCursor = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTextBoxMoveLastWordDown");
                if (subNode != null)
                    settings.Shortcuts.MainTextBoxMoveLastWordDown = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTextBoxMoveFirstWordFromNextUp");
                if (subNode != null)
                    settings.Shortcuts.MainTextBoxMoveFirstWordFromNextUp = subNode.InnerText;
                subNode = node.SelectSingleNode("MainCreateInsertSubAtVideoPos");
                if (subNode != null)
                    settings.Shortcuts.MainCreateInsertSubAtVideoPos = subNode.InnerText;
                subNode = node.SelectSingleNode("MainCreatePlayFromJustBefore");
                if (subNode != null)
                    settings.Shortcuts.MainCreatePlayFromJustBefore = subNode.InnerText;
                subNode = node.SelectSingleNode("MainCreateSetStart");
                if (subNode != null)
                    settings.Shortcuts.MainCreateSetStart = subNode.InnerText;
                subNode = node.SelectSingleNode("MainCreateSetEnd");
                if (subNode != null)
                    settings.Shortcuts.MainCreateSetEnd = subNode.InnerText;
                subNode = node.SelectSingleNode("MainCreateSetEndAddNewAndGoToNew");
                if (subNode != null)
                    settings.Shortcuts.MainCreateSetEndAddNewAndGoToNew = subNode.InnerText;
                subNode = node.SelectSingleNode("MainCreateStartDownEndUp");
                if (subNode != null)
                    settings.Shortcuts.MainCreateStartDownEndUp = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSetStartAndOffsetTheRest");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSetStartAndOffsetTheRest = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSetEndAndOffsetTheRest");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSetEndAndOffsetTheRest = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSetEndAndOffsetTheRestAndGoToNext");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSetEndAndOffsetTheRestAndGoToNext = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSetEndAndGotoNext");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSetEndAndGotoNext = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustViaEndAutoStartAndGoToNext");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustViaEndAutoStartAndGoToNext = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSetStartAutoDurationAndGoToNext");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSetStartAutoDurationAndGoToNext = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSetEndNextStartAndGoToNext");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSetEndNextStartAndGoToNext = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustStartDownEndUpAndGoToNext");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustStartDownEndUpAndGoToNext = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSetStart");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSetStart = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSetStartKeepDuration");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSetStartKeepDuration = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSetEnd");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSetEnd = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSelected100MsForward");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSelected100MsForward = subNode.InnerText;
                subNode = node.SelectSingleNode("MainAdjustSelected100MsBack");
                if (subNode != null)
                    settings.Shortcuts.MainAdjustSelected100MsBack = subNode.InnerText;
                subNode = node.SelectSingleNode("MainInsertAfter");
                if (subNode != null)
                    settings.Shortcuts.MainInsertAfter = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTextBoxInsertAfter");
                if (subNode != null)
                    settings.Shortcuts.MainTextBoxInsertAfter = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTextBoxAutoBreak");
                if (subNode != null)
                    settings.Shortcuts.MainTextBoxAutoBreak = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTextBoxUnbreak");
                if (subNode != null)
                    settings.Shortcuts.MainTextBoxUnbreak = subNode.InnerText;
                subNode = node.SelectSingleNode("MainWaveformInsertAtCurrentPosition");
                if (subNode != null)
                    settings.Shortcuts.MainWaveformInsertAtCurrentPosition = subNode.InnerText;
                subNode = node.SelectSingleNode("MainInsertBefore");
                if (subNode != null)
                    settings.Shortcuts.MainInsertBefore = subNode.InnerText;
                subNode = node.SelectSingleNode("MainMergeDialogue");
                if (subNode != null)
                    settings.Shortcuts.MainMergeDialogue = subNode.InnerText;
                subNode = node.SelectSingleNode("MainToogleFocus");
                if (subNode != null)
                    settings.Shortcuts.MainToogleFocus = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformVerticalZoom");
                if (subNode != null)
                    settings.Shortcuts.WaveformVerticalZoom = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformVerticalZoomOut");
                if (subNode != null)
                    settings.Shortcuts.WaveformVerticalZoomOut = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformZoomIn");
                if (subNode != null)
                    settings.Shortcuts.WaveformZoomIn = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformZoomOut");
                if (subNode != null)
                    settings.Shortcuts.WaveformZoomOut = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformPlaySelection");
                if (subNode != null)
                    settings.Shortcuts.WaveformPlaySelection = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformPlayFirstSelected");
                if (subNode != null)
                    settings.Shortcuts.WaveformPlayFirstSelected = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformSearchSilenceForward");
                if (subNode != null)
                    settings.Shortcuts.WaveformSearchSilenceForward = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformSearchSilenceBack");
                if (subNode != null)
                    settings.Shortcuts.WaveformSearchSilenceBack = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformAddTextHere");
                if (subNode != null)
                    settings.Shortcuts.WaveformAddTextHere = subNode.InnerText;
                subNode = node.SelectSingleNode("WaveformFocusListView");
                if (subNode != null)
                    settings.Shortcuts.WaveformFocusListView = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTranslateCustomSearch1");
                if (subNode != null)
                    settings.Shortcuts.MainTranslateCustomSearch1 = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTranslateCustomSearch2");
                if (subNode != null)
                    settings.Shortcuts.MainTranslateCustomSearch2 = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTranslateCustomSearch3");
                if (subNode != null)
                    settings.Shortcuts.MainTranslateCustomSearch3 = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTranslateCustomSearch4");
                if (subNode != null)
                    settings.Shortcuts.MainTranslateCustomSearch4 = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTranslateCustomSearch5");
                if (subNode != null)
                    settings.Shortcuts.MainTranslateCustomSearch5 = subNode.InnerText;
                subNode = node.SelectSingleNode("MainTranslateCustomSearch6");
                if (subNode != null)
                    settings.Shortcuts.MainTranslateCustomSearch6 = subNode.InnerText;
            }

            settings.RemoveTextForHearingImpaired = new RemoveTextForHearingImpairedSettings();
            node = doc.DocumentElement.SelectSingleNode("RemoveTextForHearingImpaired");
            if (node != null)
            {
                subNode = node.SelectSingleNode("RemoveTextBetweenBrackets");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBetweenBrackets = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveTextBetweenParentheses");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBetweenParentheses = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveTextBetweenCurlyBrackets");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBetweenCurlyBrackets = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveTextBetweenQuestionMarks");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBetweenQuestionMarks = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveTextBetweenCustom");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBetweenCustom = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveTextBetweenCustomBefore");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBetweenCustomBefore = subNode.InnerText;
                subNode = node.SelectSingleNode("RemoveTextBetweenCustomAfter");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBetweenCustomAfter = subNode.InnerText;
                subNode = node.SelectSingleNode("RemoveTextBetweenOnlySeperateLines");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBetweenOnlySeperateLines = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveTextBeforeColon");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBeforeColon = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveTextBeforeColonOnlyIfUppercase");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBeforeColonOnlyIfUppercase = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveTextBeforeColonOnlyOnSeparateLine");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveTextBeforeColonOnlyOnSeparateLine = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveIfAllUppercase");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveIfAllUppercase = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveInterjections");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveInterjections = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveIfContains");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveIfContains = Convert.ToBoolean(subNode.InnerText);
                subNode = node.SelectSingleNode("RemoveIfContainsText");
                if (subNode != null)
                    settings.RemoveTextForHearingImpaired.RemoveIfContainsText = subNode.InnerText;
            }

            settings.SubtitleBeaming = new SubtitleBeaming();
            node = doc.DocumentElement.SelectSingleNode("SubtitleBeaming");
            if (node != null)
            {
                subNode = node.SelectSingleNode("FontName");
                if (subNode != null)
                    settings.SubtitleBeaming.FontName = subNode.InnerText;
                subNode = node.SelectSingleNode("FontColor");
                if (subNode != null)
                    settings.SubtitleBeaming.FontColor = Color.FromArgb(Convert.ToInt32(subNode.InnerText));
                subNode = node.SelectSingleNode("FontSize");
                if (subNode != null)
                    settings.SubtitleBeaming.FontSize = Convert.ToInt32(subNode.InnerText);
                subNode = node.SelectSingleNode("BorderColor");
                if (subNode != null)
                    settings.SubtitleBeaming.BorderColor = Color.FromArgb(Convert.ToInt32(subNode.InnerText));
                subNode = node.SelectSingleNode("BorderWidth");
                if (subNode != null)
                    settings.SubtitleBeaming.BorderWidth = Convert.ToInt32(subNode.InnerText);
            }

            return settings;
        }
예제 #4
0
        //private static void Serialize(string fileName, Settings settings)
        //{
        //    var s = new XmlSerializer(typeof(Settings));
        //    TextWriter w = new StreamWriter(fileName);
        //    s.Serialize(w, settings);
        //    w.Close();
        //}
        public static Settings GetSettings()
        {
            Settings settings = new Settings();
            string settingsFileName = Configuration.SettingsFileName;
            if (File.Exists(settingsFileName))
            {
             //   try
                {
                    settings = CustomDeserialize(settingsFileName); //  15 msecs

                    if (settings.General.AutoConvertToUtf8)
                        settings.General.DefaultEncoding = Encoding.UTF8.EncodingName;
                    //too slow... :(  - settings = Deserialize(Configuration.BaseDirectory + "Settings.xml"); // 688 msecs
                }
                //catch
                //{
                //    settings = new Settings();
                //}

                if (!string.IsNullOrEmpty(settings.General.ListViewLineSeparatorString))
                    settings.General.ListViewLineSeparatorString = settings.General.ListViewLineSeparatorString.Replace("\n", string.Empty).Replace("\r", string.Empty);

                if (string.IsNullOrEmpty(settings.General.ListViewLineSeparatorString) || settings.General.ListViewLineSeparatorString.Trim().Length == 0)
                    settings.General.ListViewLineSeparatorString = "<br />";
            }

            return settings;
        }
        // private static void Serialize(string fileName, Settings settings)
        // {
        // var s = new XmlSerializer(typeof(Settings));
        // TextWriter w = new StreamWriter(fileName);
        // s.Serialize(w, settings);
        // w.Close();
        // }

        /// <summary>
        /// The get settings.
        /// </summary>
        /// <returns>
        /// The <see cref="Settings"/>.
        /// </returns>
        public static Settings GetSettings()
        {
            var settings = new Settings();
            var settingsFileName = Configuration.SettingsFileName;
            if (File.Exists(settingsFileName))
            {
                try
                {
                    // too slow... :(  - settings = Deserialize(settingsFileName); // 688 msecs
                    settings = CustomDeserialize(settingsFileName); // 15 msecs

                    if (settings.General.AutoConvertToUtf8)
                    {
                        settings.General.DefaultEncoding = Encoding.UTF8.EncodingName;
                    }
                }
                catch
                {
                    settings = new Settings();
                }

                if (!string.IsNullOrEmpty(settings.General.ListViewLineSeparatorString))
                {
                    settings.General.ListViewLineSeparatorString = settings.General.ListViewLineSeparatorString.Replace("\n", string.Empty).Replace("\r", string.Empty);
                }

                if (string.IsNullOrWhiteSpace(settings.General.ListViewLineSeparatorString))
                {
                    settings.General.ListViewLineSeparatorString = "<br />";
                }

                if (settings.Shortcuts.GeneralToggleTranslationMode == "Control+U" && settings.Shortcuts.MainTextBoxSelectionToLower == "Control+U")
                {
                    settings.Shortcuts.GeneralToggleTranslationMode = "Control+Shift+O";
                    settings.Shortcuts.GeneralSwitchOriginalAndTranslation = "Control+Alt+O";
                }
            }

            return settings;
        }
예제 #6
0
 private static void Serialize(string fileName, Settings settings)
 {
     var s = new XmlSerializer(typeof(Settings));
     TextWriter w = new StreamWriter(fileName);
     s.Serialize(w, settings);
     w.Close();
 }