本文整理汇总了C#中Nikse.SubtitleEdit.Core.Subtitle.RemoveParagraphsByIds方法的典型用法代码示例。如果您正苦于以下问题:C# Subtitle.RemoveParagraphsByIds方法的具体用法?C# Subtitle.RemoveParagraphsByIds怎么用?C# Subtitle.RemoveParagraphsByIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nikse.SubtitleEdit.Core.Subtitle
的用法示例。
在下文中一共展示了Subtitle.RemoveParagraphsByIds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestRemoveParagraphsByIds2
public void TestRemoveParagraphsByIds2()
{
var sub = new Subtitle();
var p1 = new Paragraph("1", 0, 1000);
var p2 = new Paragraph("2", 1000, 2000);
var p3 = new Paragraph("3", 2000, 3000);
sub.Paragraphs.Add(p1);
sub.Paragraphs.Add(p2);
sub.Paragraphs.Add(p3);
int removedCount = sub.RemoveParagraphsByIds(new List<string> { p2.ID, p3.ID });
Assert.AreEqual(removedCount, 2);
Assert.AreEqual(sub.Paragraphs.Count, 1);
Assert.AreEqual(sub.Paragraphs[0], p1);
}
示例2: GetFixedSubtitle
public Subtitle GetFixedSubtitle(Subtitle subtitle)
{
FixCount = 0;
DeleteIDs = new List<string>();
var fixedSubtitle = new Subtitle(subtitle, false);
foreach (var previewItem in _previewItems)
{
if (previewItem.Apply)
{
var p = fixedSubtitle.Paragraphs.First(pa => pa.ID == previewItem.Id);
p.Text = previewItem.After.Replace(Configuration.Settings.General.ListViewLineSeparatorString, Environment.NewLine);
FixCount++;
if (!string.IsNullOrWhiteSpace(p.Text) && (string.IsNullOrWhiteSpace(previewItem.After) || string.IsNullOrWhiteSpace(HtmlUtil.RemoveHtmlTags(previewItem.After, true))))
{
DeleteIDs.Add(p.ID);
}
}
}
fixedSubtitle.RemoveParagraphsByIds(DeleteIDs);
return fixedSubtitle;
}