mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Swift text formats - last number if frames... (not ms / 10) - thx Sabrina :)
This commit is contained in:
parent
80fd62ec3f
commit
0e177db4c8
@ -57,10 +57,10 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
var sb = new StringBuilder();
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
string startTime = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds / 10);
|
||||
string duration = string.Format("{0:00}:{1:00}", p.Duration.Seconds, p.Duration.Milliseconds / 10);
|
||||
string timeOut = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds / 10);
|
||||
sb.AppendLine(string.Format(paragraphWriteFormat, startTime, duration, timeOut, p.Text));
|
||||
string startTime = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, MillisecondsToFramesMaxFrameRate(p.StartTime.Milliseconds));
|
||||
string timeOut = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, MillisecondsToFramesMaxFrameRate(p.EndTime.Milliseconds));
|
||||
string timeDuration = string.Format("{0:00}:{1:00}", p.Duration.Seconds, MillisecondsToFramesMaxFrameRate(p.Duration.Milliseconds));
|
||||
sb.AppendLine(string.Format(paragraphWriteFormat, startTime, timeDuration, timeOut, p.Text));
|
||||
}
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
@ -137,14 +137,14 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
int startHours = int.Parse(parts[0]);
|
||||
int startMinutes = int.Parse(parts[1]);
|
||||
int startSeconds = int.Parse(parts[2]);
|
||||
int startMilliseconds = int.Parse(parts[3]) * 10;
|
||||
int startMilliseconds = FramesToMillisecondsMax999(int.Parse(parts[3]));
|
||||
|
||||
int durationSeconds = 0;
|
||||
if (parts[4] != "-")
|
||||
durationSeconds = int.Parse(parts[4]);
|
||||
int durationMilliseconds = 0;
|
||||
if (parts[5] != "--")
|
||||
durationMilliseconds = int.Parse(parts[5]) * 10;
|
||||
durationMilliseconds = FramesToMillisecondsMax999(int.Parse(parts[5]));
|
||||
|
||||
int endHours = 0;
|
||||
if (parts[6] != "--")
|
||||
@ -157,7 +157,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
endSeconds = int.Parse(parts[8]);
|
||||
int endMilliseconds = 0;
|
||||
if (parts[9] != "--")
|
||||
endMilliseconds = int.Parse(parts[9]) * 10;
|
||||
endMilliseconds = FramesToMillisecondsMax999(int.Parse(parts[9]));
|
||||
|
||||
paragraph.StartTime = new TimeCode(startHours, startMinutes, startSeconds, startMilliseconds);
|
||||
|
||||
|
@ -63,9 +63,9 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
int count = 1;
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
string startTime = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds / 10);
|
||||
string timeOut = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds / 10);
|
||||
string timeDuration = string.Format("{0:00}:{1:00}", p.Duration.Seconds, p.Duration.Milliseconds / 10);
|
||||
string startTime = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, MillisecondsToFramesMaxFrameRate(p.StartTime.Milliseconds));
|
||||
string timeOut = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, MillisecondsToFramesMaxFrameRate(p.EndTime.Milliseconds));
|
||||
string timeDuration = string.Format("{0:00}:{1:00}", p.Duration.Seconds, MillisecondsToFramesMaxFrameRate(p.Duration.Milliseconds));
|
||||
sb.AppendLine(string.Format(paragraphWriteFormat, startTime, count, timeOut, p.Text, timeDuration));
|
||||
count++;
|
||||
}
|
||||
@ -144,7 +144,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
int startHours = int.Parse(parts[1]);
|
||||
int startMinutes = int.Parse(parts[2]);
|
||||
int startSeconds = int.Parse(parts[3]);
|
||||
int startMilliseconds = int.Parse(parts[4]) * 10;
|
||||
int startMilliseconds = FramesToMillisecondsMax999(int.Parse(parts[4]));
|
||||
|
||||
int endHours = 0;
|
||||
if (parts[5+2] != "--")
|
||||
@ -157,7 +157,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
endSeconds = int.Parse(parts[7 + 2]);
|
||||
int endMilliseconds = 0;
|
||||
if (parts[8 + 2] != "--")
|
||||
endMilliseconds = int.Parse(parts[8 + 2]) * 10;
|
||||
endMilliseconds = FramesToMillisecondsMax999(int.Parse(parts[8 + 2]));
|
||||
|
||||
paragraph.StartTime = new TimeCode(startHours, startMinutes, startSeconds, startMilliseconds);
|
||||
paragraph.EndTime = new TimeCode(endHours, endMinutes, endSeconds, endMilliseconds);
|
||||
|
@ -63,8 +63,8 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
int count = 1;
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
string startTime = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds / 10);
|
||||
string timeOut = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds / 10);
|
||||
string startTime = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, MillisecondsToFramesMaxFrameRate(p.StartTime.Milliseconds));
|
||||
string timeOut = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, MillisecondsToFramesMaxFrameRate(p.EndTime.Milliseconds));
|
||||
sb.AppendLine(string.Format(paragraphWriteFormat, startTime, count, timeOut, p.Text));
|
||||
count++;
|
||||
}
|
||||
@ -143,7 +143,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
int startHours = int.Parse(parts[1]);
|
||||
int startMinutes = int.Parse(parts[2]);
|
||||
int startSeconds = int.Parse(parts[3]);
|
||||
int startMilliseconds = int.Parse(parts[4]) * 10;
|
||||
int startMilliseconds = FramesToMillisecondsMax999(int.Parse(parts[4]));
|
||||
|
||||
int endHours = 0;
|
||||
if (parts[5] != "--")
|
||||
@ -156,7 +156,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
endSeconds = int.Parse(parts[7]);
|
||||
int endMilliseconds = 0;
|
||||
if (parts[8] != "--")
|
||||
endMilliseconds = int.Parse(parts[8]) * 10;
|
||||
endMilliseconds = FramesToMillisecondsMax999(int.Parse(parts[8]));
|
||||
|
||||
paragraph.StartTime = new TimeCode(startHours, startMinutes, startSeconds, startMilliseconds);
|
||||
paragraph.EndTime = new TimeCode(endHours, endMinutes, endSeconds, endMilliseconds);
|
||||
|
Loading…
Reference in New Issue
Block a user