That optimization for movie length calculation in the PlayMovie dialog now accounts for files with new line characters of all sizes.

This commit is contained in:
brandman211 2012-07-25 08:01:02 +00:00
parent bb05876f84
commit 1bedd81666
1 changed files with 9 additions and 14 deletions

View File

@ -381,27 +381,22 @@ namespace BizHawk.MultiClient
using (StreamReader sr = file.OpenText())
{
string str = "";
int length = 0;
while ((str = sr.ReadLine()) != null)
{
length += str.Length + 1;
if (str == "")
{
if (str == "" || Header.AddHeaderFromLine(str))
continue;
}
else if (Header.AddHeaderFromLine(str))
continue;
if (str.StartsWith("subtitle") || str.StartsWith("sub"))
{
Subtitles.AddSubtitle(str);
}
else if (str[0] == '|')
{
int line = str.Length + 1;
length -= line;
int lines = (int)file.Length - length;
this.Frames = lines / line;
string frames = sr.ReadToEnd();
int length = str.Length;
// Account for line breaks of either size.
if (frames.IndexOf("\r\n") != -1)
length++;
length++;
// Count the remaining frames and the current one.
this.Frames = (frames.Length / length) + 1;
break;
}
else