2011-02-24 22:25:53 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.MultiClient
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents the controller key presses of a movie
|
|
|
|
|
/// </summary>
|
|
|
|
|
class MovieLog
|
|
|
|
|
{
|
2011-05-08 01:00:13 +00:00
|
|
|
|
//TODO: Insert(int frame) not useful for convenctional tasing but TAStudio will want it
|
|
|
|
|
|
2011-02-24 22:25:53 +00:00
|
|
|
|
List<string> MovieRecords = new List<string>();
|
|
|
|
|
|
|
|
|
|
public MovieLog()
|
|
|
|
|
{
|
2011-05-16 03:55:17 +00:00
|
|
|
|
//Should this class initialize with an empty string to MovieRecords so that first frame is index 1?
|
|
|
|
|
//MovieRecords.Add("");
|
2011-02-24 22:25:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-05-08 12:51:39 +00:00
|
|
|
|
public int Length()
|
|
|
|
|
{
|
|
|
|
|
return MovieRecords.Count;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-25 22:26:13 +00:00
|
|
|
|
public void Clear()
|
|
|
|
|
{
|
|
|
|
|
MovieRecords.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-24 22:25:53 +00:00
|
|
|
|
public int GetMovieLength()
|
|
|
|
|
{
|
|
|
|
|
return MovieRecords.Count;
|
|
|
|
|
}
|
2011-02-25 19:49:29 +00:00
|
|
|
|
|
|
|
|
|
public void AddFrame(string frame)
|
|
|
|
|
{
|
2011-05-08 01:00:13 +00:00
|
|
|
|
MovieRecords.Add(frame);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-16 03:55:17 +00:00
|
|
|
|
public void AddFrameAt(string frame, int frameNum)
|
|
|
|
|
{
|
|
|
|
|
MovieRecords.Insert(frameNum, frame);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-08 01:00:13 +00:00
|
|
|
|
public void Truncate(int frame)
|
|
|
|
|
{
|
2011-05-16 03:55:17 +00:00
|
|
|
|
if (frame >= 0 && frame < Length())
|
|
|
|
|
{ MovieRecords.RemoveRange(frame,Length() - frame); }
|
2011-02-25 19:49:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetFrame(int frameCount) //Frame count is 0 based here, should it be?
|
|
|
|
|
{
|
|
|
|
|
if (frameCount >= 0)
|
2011-05-08 01:00:13 +00:00
|
|
|
|
{
|
|
|
|
|
if (frameCount < MovieRecords.Count)
|
|
|
|
|
return MovieRecords[frameCount];
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
2011-02-25 19:49:29 +00:00
|
|
|
|
else
|
|
|
|
|
return ""; //TODO: throw an exception?
|
|
|
|
|
}
|
2011-02-24 22:25:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|