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); }
public RemoveTextForHI(RemoveTextForHISettings removeTextForHISettings) { Settings = removeTextForHISettings; }
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; }
private static RemoveTextForHI GetRemoveTextForHiLib() { var hiSettings = new RemoveTextForHISettings(); return new RemoveTextForHI(hiSettings); }