maybe speed up movie state handling a bit by handlign the more likely case of | first, make multitrack and tastudio resistant to unexpected empty lines in the input log

This commit is contained in:
adelikat 2020-06-06 13:29:26 -05:00
parent 1ffa5bc97a
commit 8063393c04
2 changed files with 25 additions and 30 deletions

View File

@ -50,7 +50,11 @@ namespace BizHawk.Client.Common
string line;
while ((line = reader.ReadLine()) != null)
{
if (line.Contains("Frame "))
if (line.StartsWith("|"))
{
Log.Add(line);
}
else if (line.StartsWith("Frame "))
{
var strs = line.Split(' ');
try
@ -67,10 +71,6 @@ namespace BizHawk.Client.Common
{
LogKey = line.Replace("LogKey:", "");
}
else if (line[0] == '|')
{
Log.Add(line);
}
}
}
else
@ -79,7 +79,12 @@ namespace BizHawk.Client.Common
string line;
while ((line = reader.ReadLine()) != null)
{
if (line.Contains("Frame "))
if (line.StartsWith("|"))
{
SetFrameAt(i, line);
i++;
}
else if (line.StartsWith("Frame "))
{
var strs = line.Split(' ');
try
@ -96,11 +101,6 @@ namespace BizHawk.Client.Common
{
LogKey = line.Replace("LogKey:", "");
}
else if (line.StartsWith("|"))
{
SetFrameAt(i, line);
i++;
}
}
}
@ -145,12 +145,11 @@ namespace BizHawk.Client.Common
string line;
while ((line = reader.ReadLine()) != null)
{
if (line.Trim() == "")
if (line.StartsWith("|"))
{
continue;
newLog.Add(line);
}
if (line.Contains("Frame "))
else if (line.StartsWith("Frame "))
{
var strs = line.Split(' ');
try
@ -163,10 +162,6 @@ namespace BizHawk.Client.Common
return false;
}
}
else if (line[0] == '|')
{
newLog.Add(line);
}
}
if (stateFrame == 0)

View File

@ -194,7 +194,17 @@ namespace BizHawk.Client.Common
string line;
while ((line = reader.ReadLine()) != null)
{
if (line.Contains("Frame "))
if (line.StartsWith("|"))
{
newLog.Add(line);
if (!timelineBranchFrame.HasValue && counter < Log.Count && line != Log[counter])
{
timelineBranchFrame = counter;
}
counter++;
}
else if (line.StartsWith("Frame "))
{
var split = line.Split(' ');
try
@ -211,16 +221,6 @@ namespace BizHawk.Client.Common
{
LogKey = line.Replace("LogKey:", "");
}
else if (line[0] == '|')
{
newLog.Add(line);
if (!timelineBranchFrame.HasValue && counter < Log.Count && line != Log[counter])
{
timelineBranchFrame = counter;
}
counter++;
}
}
Log.Clear();