Exemplo n.º 1
0
        public void SetUserConfig(UserConfig userConfig)
        {
            try
            {
                this.NumericUpDownMaxSpeakingCharacterCount.Value = userConfig.MaxSpeakingCharacterCount;
            }
            catch //(Exception ex)
            {
            }
            try
            {
                this.numericUpDownTurboThreshold.Value = userConfig.TurboThreshold;
            }
            catch //(Exception ex)
            {
            }
            try
            {
                this.NumericUpDownAutoGettingWebInverval.Value = userConfig.AutoGettingWebInvervalMillsec;
            }
            catch //(Exception ex)
            {
            }

            try
            {
                this.numericUpDownAAModeTextLength.Value = userConfig.AAModeTextLength;
            }
            catch //(Exception ex)
            {
            }

            try
            {
                this.numericUpDownAAModeInvervalMillsec.Value = userConfig.AAModeInvervalMillsec;
            }
            catch //(Exception ex)
            {
            }

            foreach (string NewResponseSoundFilePath in userConfig.NewResponseSoundFilePathes)
            {
                this.listBoxNewResponseSoundFilePathes.Items.Add(NewResponseSoundFilePath);
            }
            this.NumericUpDownSpeakingInvervalMillsec.Value           = userConfig.SpeakingInvervalMillsec;
            this.NumericUpDownTurboSpeakingInvervalMillsec.Value      = userConfig.TurboSpeakingInvervalMillsec;
            this.numericUpDownDefaultCaptinoDispInvervalMillsec.Value = userConfig.DefaultCaptinoDispInvervalMillsec;
            this.TrackBarSpeakingRate.Value             = userConfig.SpeakingRate;
            this.TrackBarTurboSpeakingRate.Value        = userConfig.TurboSpeakingRate;
            this.trackBarAutoScrollSpeed.Value          = userConfig.AutoScrollSpeed;
            this.labelAutoScrollSpeed.Text              = userConfig.AutoScrollSpeed.ToString();
            this.labelTurboSpeakingRate.Text            = userConfig.TurboSpeakingRate.ToString();
            this.TextBoxNGWords.Text                    = StringsToText(userConfig.NGWords);
            this.TextBoxPronounciations.Text            = StringsToText(userConfig.Pronounciations);
            this.textBoxAAModeConditions.Text           = StringsToText(userConfig.AAModeConditions);
            this.checkBoxSpeaksResNumber.Checked        = userConfig.SpeaksResNumber;
            this.checkBoxGZipCompression.Checked        = userConfig.GZipCompressionEnabled;
            this.checkBoxUseProxy.Checked               = userConfig.UseDefaultProxy;
            this.checkBoxShowCaptionImmediately.Checked = userConfig.ShowCaptionImmediately;
            this.CaptionFont   = userConfig.CaptionFont;
            this.AACaptionFont = userConfig.AACaptionFont;
            this.checkBoxReduceFontSizeByWindowWidth.Checked  = userConfig.ReduceFontSizeByWindowWidth;
            this.checkBoxReduceFontSizeByWindowHeight.Checked = userConfig.ReduceFontSizeByWindowHeight;
            this.checkBoxSpeakTextBetweenBraces.Checked       = userConfig.SpeakTextBetweenBracesEvenIfAAMode;
            this.checkBoxPlaySoundNewResponse.Checked         = userConfig.PlaySoundNewResponse;
            this.checkBoxPlaySoundSync.Checked = userConfig.PlaySoundNewResponseSync;
            //this.textBoxSoundFilePath.Text = userConfig.NewResponseSoundFilePathes;
            this.textBoxEditorFilePath.Text = userConfig.EditorFilePath;
            this.checkBoxSpeaksResNumberWhenAAMode.Checked = userConfig.SpeaksResNumberWhenAAMode;
            this.textBoxSpeakingTextWhenAAMode.Text        = userConfig.SpeakingTextWhenAAMode;
            this.checkBoxHideCaptionTitle.Checked          = userConfig.HideCaptionTitle;
            this.VoiceVolme            = userConfig.SpeakingVolume;
            this.checkBoxDebug.Checked = userConfig.OutputDebugLog;
            this.checkBoxAutoReloadAlertCaption.Checked        = userConfig.AutoReloadAlertCaption;
            this.checkBoxAutoReloadAlertVoice.Checked          = userConfig.AutoReloadAlertVoice;
            this.numericUpDownAutoReloadAlertTime.Value        = userConfig.AutoReloadAlertInvervalMinutes;
            this.textBoxAutoReloadAlertMessage.Text            = userConfig.AutoReloadAlertMessage;
            this.checkBoxEnableMoveBottomFromBookmarks.Checked = userConfig.enableMoveBottomFromBookmarks;
            this.numericUpDownEndThreadWarningResCount.Value   = userConfig.endThreadWarningResCount;
            this.textBoxOutputLogPath.Text            = userConfig.OutputLogPath;
            this.textBoxOutputLogFormat.Text          = userConfig.OutputLogFormat.Replace("\r\n", "\n").Replace("\n", "\r\n");
            this.checkOutputLog.Checked               = userConfig.OutputLog;
            this.checkCopyLog.Checked                 = userConfig.CopyLog;
            this.comboBoxOutputEncode.SelectedIndex   = userConfig.LogEncode;
            this.comboBoxLogReturnCode.SelectedIndex  = userConfig.LogReturnCode;
            this.comboBoxSpiltMethod.SelectedIndex    = userConfig.SpiltMethod;
            this.numericUpDownResLength.Value         = userConfig.ResLength;
            this.numericUpDownLogOutputInterval.Value = userConfig.LogOutputInterval;
            this.textBoxCommandLineTargetPath.Text    = userConfig.CommandLineTargetPath;
            this.textBoxCommandLineParam.Text         = userConfig.CommandLineParam;

            if (userConfig.LogAppendMode)
            {
                this.comboBoxLogAppendMode.SelectedIndex = 1;
            }
            else
            {
                this.comboBoxLogAppendMode.SelectedIndex = 0;
            }

            numericUpDownViewerYoutubePlayerHeight.Value = userConfig.ViewerYoutubePlayerHeight;
            numericUpDownViewerYoutubePlayerWidth.Value  = userConfig.ViewerYoutubePlayerWidth;
            UpdateUI();
        }
Exemplo n.º 2
0
        public void GetUserConfig(UserConfig userConfig)
        {
            userConfig.SpeakingInvervalMillsec           = System.Convert.ToInt32(this.NumericUpDownSpeakingInvervalMillsec.Value);
            userConfig.TurboSpeakingInvervalMillsec      = System.Convert.ToInt32(this.NumericUpDownTurboSpeakingInvervalMillsec.Value);
            userConfig.DefaultCaptinoDispInvervalMillsec = System.Convert.ToInt32(this.numericUpDownDefaultCaptinoDispInvervalMillsec.Value);
            userConfig.SpeakingRate              = this.TrackBarSpeakingRate.Value;
            userConfig.TurboSpeakingRate         = this.TrackBarTurboSpeakingRate.Value;
            userConfig.AutoScrollSpeed           = this.trackBarAutoScrollSpeed.Value;
            userConfig.TurboThreshold            = System.Convert.ToInt32(this.numericUpDownTurboThreshold.Value);
            userConfig.MaxSpeakingCharacterCount = System.Convert.ToInt32(this.NumericUpDownMaxSpeakingCharacterCount.Value);
            userConfig.CaptionFont   = this.CaptionFont;
            userConfig.AACaptionFont = this.AACaptionFont;
            userConfig.AutoGettingWebInvervalMillsec = System.Convert.ToInt32(this.NumericUpDownAutoGettingWebInverval.Value);
            userConfig.AAModeTextLength = System.Convert.ToInt32(this.numericUpDownAAModeTextLength.Value);
            userConfig.SpeaksResNumber  = this.checkBoxSpeaksResNumber.Checked;
            userConfig.NGWords.Clear();
            foreach (string ngword in this.TextBoxNGWords.Lines)
            {
                if (!regexAllSpaces.IsMatch(ngword))
                {
                    userConfig.NGWords.Add(ngword);
                }
            }
            userConfig.Pronounciations.Clear();
            foreach (string pron in this.TextBoxPronounciations.Lines)
            {
                if (!regexAllSpaces.IsMatch(pron))
                {
                    userConfig.Pronounciations.Add(pron);
                }
            }
            userConfig.AAModeConditions.Clear();
            foreach (string cond in this.textBoxAAModeConditions.Lines)
            {
                if (!regexAllSpaces.IsMatch(cond))
                {
                    userConfig.AAModeConditions.Add(cond);
                }
            }
            userConfig.NewResponseSoundFilePathes.Clear();
            foreach (string NewResponseSoundFilePath in listBoxNewResponseSoundFilePathes.Items)
            {
                if (!regexAllSpaces.IsMatch(NewResponseSoundFilePath))
                {
                    userConfig.NewResponseSoundFilePathes.Add(NewResponseSoundFilePath);
                }
            }

            userConfig.UpdatePronounciations();
            userConfig.GZipCompressionEnabled = checkBoxGZipCompression.Checked;
            userConfig.UseDefaultProxy        = checkBoxUseProxy.Checked;
            userConfig.ShowCaptionImmediately = checkBoxShowCaptionImmediately.Checked;
            FormMain.Instance.toolStripButtonShowCaptionImmediately.Checked = checkBoxShowCaptionImmediately.Checked;
            userConfig.ReduceFontSizeByWindowWidth        = checkBoxReduceFontSizeByWindowWidth.Checked;
            userConfig.ReduceFontSizeByWindowHeight       = checkBoxReduceFontSizeByWindowHeight.Checked;
            userConfig.SpeakTextBetweenBracesEvenIfAAMode = checkBoxSpeakTextBetweenBraces.Checked;
            userConfig.AAModeInvervalMillsec = System.Convert.ToInt32(this.numericUpDownAAModeInvervalMillsec.Value);
            userConfig.PlaySoundNewResponse  = this.checkBoxPlaySoundNewResponse.Checked;
            FormMain.Instance.toolStripButtonPlaySoundNewResponse.Checked = checkBoxPlaySoundNewResponse.Checked;
            userConfig.PlaySoundNewResponseSync = this.checkBoxPlaySoundSync.Checked;
            //userConfig.NewResponseSoundFilePath = this.textBoxSoundFilePath.Text;
            userConfig.EditorFilePath                 = this.textBoxEditorFilePath.Text;
            userConfig.SpeaksResNumberWhenAAMode      = this.checkBoxSpeaksResNumberWhenAAMode.Checked;
            userConfig.SpeakingTextWhenAAMode         = this.textBoxSpeakingTextWhenAAMode.Text;
            userConfig.AACaptionFont.Colors           = this.aAFontColors;
            userConfig.HideCaptionTitle               = this.checkBoxHideCaptionTitle.Checked;
            userConfig.OutputDebugLog                 = this.checkBoxDebug.Checked;
            userConfig.ViewerYoutubePlayerHeight      = (int)numericUpDownViewerYoutubePlayerHeight.Value;
            userConfig.ViewerYoutubePlayerWidth       = (int)numericUpDownViewerYoutubePlayerWidth.Value;
            userConfig.AutoReloadAlertCaption         = this.checkBoxAutoReloadAlertCaption.Checked;
            userConfig.AutoReloadAlertVoice           = this.checkBoxAutoReloadAlertVoice.Checked;
            userConfig.AutoReloadAlertInvervalMinutes = (int)this.numericUpDownAutoReloadAlertTime.Value;
            userConfig.AutoReloadAlertMessage         = this.textBoxAutoReloadAlertMessage.Text;
            userConfig.endThreadWarningResCount       = (int)this.numericUpDownEndThreadWarningResCount.Value;
            userConfig.enableMoveBottomFromBookmarks  = this.checkBoxEnableMoveBottomFromBookmarks.Checked;
            userConfig.OutputLogPath   = this.textBoxOutputLogPath.Text;
            userConfig.OutputLogFormat = this.textBoxOutputLogFormat.Text.Replace("\r\n", "\n").Replace("\n", "\r\n");
            userConfig.OutputLog       = this.checkOutputLog.Checked;
            userConfig.CopyLog         = this.checkCopyLog.Checked;

            userConfig.LogEncode     = this.comboBoxOutputEncode.SelectedIndex;
            userConfig.LogReturnCode = this.comboBoxLogReturnCode.SelectedIndex;

            userConfig.SpiltMethod = this.comboBoxSpiltMethod.SelectedIndex;
            userConfig.ResLength   = (int)this.numericUpDownResLength.Value;

            userConfig.LogOutputInterval = (int)this.numericUpDownLogOutputInterval.Value;

            userConfig.CommandLineTargetPath = this.textBoxCommandLineTargetPath.Text;
            userConfig.CommandLineParam      = this.textBoxCommandLineParam.Text;


            if (this.comboBoxLogAppendMode.SelectedIndex == 1)
            {
                userConfig.LogAppendMode = true;
            }
            else
            {
                userConfig.LogAppendMode = false;
            }
        }