More progress on the movie class, basic movie file writing. Survives round trip testing
This commit is contained in:
parent
a5dc7e90b3
commit
c59b9ff6ce
|
@ -128,6 +128,7 @@ namespace BizHawk.MultiClient
|
|||
//p.ShowDialog();
|
||||
|
||||
//Hacky testing
|
||||
InputLog.LoadMovie();
|
||||
InputLog.WriteMovie();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,39 +62,65 @@ namespace BizHawk.MultiClient
|
|||
|
||||
}
|
||||
|
||||
private string ParseHeader(string line, string headerName)
|
||||
{
|
||||
string str;
|
||||
int x = line.LastIndexOf(headerName) + headerName.Length;
|
||||
str = line.Substring(x + 1, line.Length - x - 1);
|
||||
return str;
|
||||
}
|
||||
|
||||
private bool LoadText()
|
||||
{
|
||||
var file = new FileInfo(Filename);
|
||||
|
||||
if (file.Exists == false)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
Header.Clear();
|
||||
Log.Clear();
|
||||
}
|
||||
|
||||
using (StreamReader sr = file.OpenText())
|
||||
{
|
||||
string str = "";
|
||||
|
||||
while ((str = sr.ReadLine()) != null)
|
||||
{
|
||||
if (str.Contains(MovieHeader.EMULATIONVERSION))
|
||||
if (str == "")
|
||||
{
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (str.Contains(MovieHeader.EMULATIONVERSION))
|
||||
{
|
||||
str = ParseHeader(str, MovieHeader.EMULATIONVERSION);
|
||||
Header.AddHeaderLine(MovieHeader.EMULATIONVERSION, str);
|
||||
}
|
||||
else if (str.Contains(MovieHeader.MOVIEVERSION))
|
||||
{
|
||||
|
||||
str = ParseHeader(str, MovieHeader.MOVIEVERSION);
|
||||
Header.AddHeaderLine(MovieHeader.MOVIEVERSION, str);
|
||||
}
|
||||
else if (str.Contains(MovieHeader.PLATFORM))
|
||||
{
|
||||
|
||||
str = ParseHeader(str, MovieHeader.PLATFORM);
|
||||
Header.AddHeaderLine(MovieHeader.PLATFORM, str);
|
||||
}
|
||||
else if (str.Contains(MovieHeader.GAMENAME))
|
||||
{
|
||||
|
||||
str = ParseHeader(str, MovieHeader.GAMENAME);
|
||||
Header.AddHeaderLine(MovieHeader.GAMENAME, str);
|
||||
}
|
||||
else if (str[0] == '|')
|
||||
{
|
||||
|
||||
Log.AddFrame(str); //TODO: validate proper formatting
|
||||
}
|
||||
else
|
||||
{
|
||||
//Something has gone wrong here!
|
||||
//TODO: Something has gone wrong here!
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,9 @@ namespace BizHawk.MultiClient
|
|||
/// <param name="value"></param>
|
||||
public void AddHeaderLine(string key, string value) //TODO: check for redundancy and return bool?
|
||||
{
|
||||
if (!HeaderParams.TryGetValue(key, out value)) //TODO: does a failed attempt mess with value?
|
||||
string temp = value;
|
||||
|
||||
if (!HeaderParams.TryGetValue(key, out temp)) //TODO: does a failed attempt mess with value?
|
||||
HeaderParams.Add(key, value);
|
||||
}
|
||||
|
||||
|
@ -53,6 +55,11 @@ namespace BizHawk.MultiClient
|
|||
return HeaderParams.Remove(key);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
HeaderParams.Clear();
|
||||
}
|
||||
|
||||
public string GetHeaderLine(string key)
|
||||
{
|
||||
string value = "";
|
||||
|
|
|
@ -17,6 +17,11 @@ namespace BizHawk.MultiClient
|
|||
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
MovieRecords.Clear();
|
||||
}
|
||||
|
||||
public int GetMovieLength()
|
||||
{
|
||||
return MovieRecords.Count;
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
EmulationVersion v1.0.0
|
||||
MovieVersion v1.0.0
|
||||
Platform PCE
|
||||
GameName Bonk.pce
|
||||
|........|0|
|
||||
|
Loading…
Reference in New Issue