本文整理匯總了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;
}