Exemplo n.º 1
0
        public RemoveTextForHISettings GetSettings()
        {
            var settings = new RemoveTextForHISettings
            {
                OnlyIfInSeparateLine  = checkBoxOnlyIfInSeparateLine.Checked,
                RemoveIfAllUppercase  = checkBoxRemoveIfAllUppercase.Checked,
                RemoveTextBeforeColon = checkBoxRemoveTextBeforeColon.Checked,
                RemoveTextBeforeColonOnlyUppercase = checkBoxRemoveTextBeforeColonOnlyUppercase.Checked,
                ColonSeparateLine              = checkBoxColonSeparateLine.Checked,
                RemoveWhereContains            = checkBoxRemoveWhereContains.Checked,
                RemoveIfTextContains           = new List <string>(),
                RemoveTextBetweenCustomTags    = checkBoxRemoveTextBetweenCustomTags.Checked,
                RemoveInterjections            = checkBoxRemoveInterjections.Checked,
                RemoveTextBetweenSquares       = checkBoxRemoveTextBetweenSquares.Checked,
                RemoveTextBetweenBrackets      = checkBoxRemoveTextBetweenBrackets.Checked,
                RemoveTextBetweenQuestionMarks = checkBoxRemoveTextBetweenQuestionMarks.Checked,
                RemoveTextBetweenParentheses   = checkBoxRemoveTextBetweenParentheses.Checked,
                CustomStart = comboBoxCustomStart.Text,
                CustomEnd   = comboBoxCustomEnd.Text
            };

            foreach (string item in comboBoxRemoveIfTextContains.Text.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries))
            {
                settings.RemoveIfTextContains.Add(item.Trim());
            }
            return(settings);
        }
        public void GeneratePreview(RemoveTextForHISettings settings)
        {
            if (_subtitle == null)
            {
                return;
            }

            _removeTextForHiLib          = new RemoveTextForHI(settings);
            _removeTextForHiLib.Warnings = new List <int>();
            int count = 0;

            _fixes = new Dictionary <Paragraph, string>();
            var previewItems = new List <PreviewItem>();

            for (int index = 0; index < _subtitle.Paragraphs.Count; index++)
            {
                Paragraph p = _subtitle.Paragraphs[index];
                _removeTextForHiLib.WarningIndex = index - 1;
                string newText = _removeTextForHiLib.RemoveTextFromHearImpaired(p.Text);
                if (p.Text.Replace(" ", string.Empty) != newText.Replace(" ", string.Empty))
                {
                    count++;
                    previewItems.Add(new PreviewItem(p.ID, true, p.Number.ToString(CultureInfo.InvariantCulture), p.Text, newText));
                    _fixes.Add(p, newText);
                }
            }
            Window.ShowFixes(previewItems);
            //groupBoxLinesFound.Text = string.Format(_language.LinesFoundX, count);
        }
Exemplo n.º 3
0
        public RemoveTextForHISettings GetSettings()
        {
            var settings = new RemoveTextForHISettings();

            settings.OnlyIfInSeparateLine  = checkBoxOnlyIfInSeparateLine.Checked;
            settings.RemoveIfAllUppercase  = checkBoxRemoveIfAllUppercase.Checked;
            settings.RemoveTextBeforeColon = checkBoxRemoveTextBeforeColon.Checked;
            settings.RemoveTextBeforeColonOnlyUppercase = checkBoxRemoveTextBeforeColonOnlyUppercase.Checked;
            settings.ColonSeparateLine              = checkBoxColonSeparateLine.Checked;
            settings.RemoveWhereContains            = checkBoxRemoveWhereContains.Checked;
            settings.RemoveIfTextContains           = comboBoxRemoveIfTextContains.Text;
            settings.RemoveTextBetweenCustomTags    = checkBoxRemoveTextBetweenCustomTags.Checked;
            settings.RemoveInterjections            = checkBoxRemoveInterjections.Checked;
            settings.RemoveTextBetweenSquares       = checkBoxRemoveTextBetweenSquares.Checked;
            settings.RemoveTextBetweenBrackets      = checkBoxRemoveTextBetweenBrackets.Checked;
            settings.RemoveTextBetweenQuestionMarks = checkBoxRemoveTextBetweenQuestionMarks.Checked;
            settings.RemoveTextBetweenParentheses   = checkBoxRemoveTextBetweenParentheses.Checked;
            settings.CustomStart = comboBoxCustomStart.Text;
            settings.CustomEnd   = comboBoxCustomEnd.Text;
            return(settings);
        }
        private static RemoveTextForHI GetRemoveTextForHiLib()
        {
            var hiSettings = new RemoveTextForHISettings();

            return(new RemoveTextForHI(hiSettings));
        }