本文整理汇总了C#中Nikse.SubtitleEdit.Logic.Paragraph.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Paragraph.ToString方法的具体用法?C# Paragraph.ToString怎么用?C# Paragraph.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nikse.SubtitleEdit.Logic.Paragraph
的用法示例。
在下文中一共展示了Paragraph.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestToStringNewParagraph
public void TestToStringNewParagraph()
{
string expectedOutput = "00:00:00,000 --> 00:00:00,000 ";
var paragraph = new Paragraph();
string actualOutput = paragraph.ToString();
Assert.AreEqual(expectedOutput, actualOutput);
}
示例2: IsFixAllowed
private bool IsFixAllowed(Paragraph p)
{
foreach (ListViewItem item in listViewFixes.Items)
{
if (item.Tag.ToString() == p.ToString())
return item.Checked;
}
return false;
}
示例3: MoveStartTime
private int MoveStartTime(string fixAction, int noOfShortDisplayTimes, Paragraph p, Paragraph temp, Paragraph next)
{
if (AllowFix(p, fixAction))
{
string oldCurrent = p.ToString();
if (next != null && next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines > p.EndTime.TotalMilliseconds)
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds;
_totalFixes++;
noOfShortDisplayTimes++;
AddFixToListView(p, fixAction, oldCurrent, p.ToString());
}
return noOfShortDisplayTimes;
}
示例4: FixOverlappingDisplayTimes
public void FixOverlappingDisplayTimes()
{
// negative display time
string fixAction = _language.FixOverlappingDisplayTime;
int noOfOverlappingDisplayTimesFixed = 0;
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
{
Paragraph p = _subtitle.Paragraphs[i];
Paragraph oldP = new Paragraph(p);
if (p.Duration.TotalMilliseconds < 0) // negative display time...
{
bool isFixed = false;
string status = string.Format(_language.StartTimeLaterThanEndTime,
i + 1, p.StartTime, p.EndTime, p.Text, Environment.NewLine);
Paragraph prev = _subtitle.GetParagraphOrDefault(i - 1);
Paragraph next = _subtitle.GetParagraphOrDefault(i + 1);
double wantedDisplayTime = Utilities.GetOptimalDisplayMilliseconds(p.Text) * 0.9;
if (next == null || next.StartTime.TotalMilliseconds > p.StartTime.TotalMilliseconds + wantedDisplayTime)
{
if (AllowFix(p, fixAction))
{
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + wantedDisplayTime;
isFixed = true;
}
}
else if (next.StartTime.TotalMilliseconds > p.StartTime.TotalMilliseconds + 500.0)
{
if (AllowFix(p, fixAction))
{
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + 500.0;
isFixed = true;
}
}
else if (prev == null || next.StartTime.TotalMilliseconds - wantedDisplayTime > prev.EndTime.TotalMilliseconds)
{
if (AllowFix(p, fixAction))
{
p.StartTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - wantedDisplayTime;
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - 1;
isFixed = true;
}
}
else
{
LogStatus(_language.FixOverlappingDisplayTimes, string.Format(_language.UnableToFixStartTimeLaterThanEndTime,
i + 1, p), true);
_totalErrors++;
}
if (isFixed)
{
_totalFixes++;
noOfOverlappingDisplayTimesFixed++;
status = string.Format(_language.XFixedToYZ, status, Environment.NewLine, p);
LogStatus(_language.FixOverlappingDisplayTimes, status);
AddFixToListView(p, fixAction, oldP.ToString(), p.ToString());
}
}
}
// overlapping display time
for (int i = 1; i < _subtitle.Paragraphs.Count; i++)
{
Paragraph p = _subtitle.Paragraphs[i];
Paragraph prev = _subtitle.GetParagraphOrDefault(i - 1);
Paragraph target = p; // subtitle to display when clicking on fix in top list view
if (prev != null)
target = prev;
string oldCurrent = p.ToString();
string oldPrevious = prev.ToString();
double prevWantedDisplayTime = Utilities.GetOptimalDisplayMilliseconds(prev.Text, Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds);
double currentWantedDisplayTime = Utilities.GetOptimalDisplayMilliseconds(p.Text, Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds);
double prevOptimalDisplayTime = Utilities.GetOptimalDisplayMilliseconds(prev.Text);
double currentOptimalDisplayTime = Utilities.GetOptimalDisplayMilliseconds(p.Text);
bool canBeEqual = _format != null && (_format.GetType() == typeof(AdvancedSubStationAlpha) || _format.GetType() == typeof(SubStationAlpha));
if (!canBeEqual)
canBeEqual = Configuration.Settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart;
double diff = prev.EndTime.TotalMilliseconds - p.StartTime.TotalMilliseconds;
if (prev != null && !prev.StartTime.IsMaxTime && !p.StartTime.IsMaxTime && diff >= 0 && !(canBeEqual && diff == 0))
{
int diffHalf = (int)(diff / 2);
if (!Configuration.Settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart && p.StartTime.TotalMilliseconds == prev.EndTime.TotalMilliseconds &&
prev.Duration.TotalMilliseconds > 100)
{
if (AllowFix(target, fixAction))
{
if (!canBeEqual)
{
bool okEqual = true;
if (prev.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds)
prev.EndTime.TotalMilliseconds--;
else if (p.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds)
p.StartTime.TotalMilliseconds++;
else
okEqual = false;
//.........这里部分代码省略.........