From cbdcea13413c0721ef3312c45b91fb4f2c8412fe Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Thu, 24 Feb 2011 22:25:53 +0000 Subject: [PATCH] Get started on a Movie class --- .../BizHawk.MultiClient.csproj | 5 +- BizHawk.MultiClient/movie/Movie.cs | 33 ++++++++++ BizHawk.MultiClient/movie/MovieHeader.cs | 63 +++++++++++++++++++ BizHawk.MultiClient/movie/MovieLog.cs | 25 ++++++++ 4 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 BizHawk.MultiClient/movie/Movie.cs create mode 100644 BizHawk.MultiClient/movie/MovieHeader.cs create mode 100644 BizHawk.MultiClient/movie/MovieLog.cs diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index 1a3dbafc15..750fec93ac 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 9.0.21022 + 9.0.30729 2.0 {DD448B37-BA3F-4544-9754-5406E8094723} Exe @@ -111,6 +111,9 @@ MainForm.cs Form + + + Form diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs new file mode 100644 index 0000000000..77fe402b58 --- /dev/null +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BizHawk.MultiClient +{ + class Movie + { + private MovieHeader Header = new MovieHeader(); + private MovieLog Log = new MovieLog(); + + public Movie() + { + + } + + public void AddMovieRecord() + { + + } + + public void WriteMovie() + { + + } + + public int GetMovieLength() + { + return Log.GetMovieLength(); + } + } +} diff --git a/BizHawk.MultiClient/movie/MovieHeader.cs b/BizHawk.MultiClient/movie/MovieHeader.cs new file mode 100644 index 0000000000..cea8f5f593 --- /dev/null +++ b/BizHawk.MultiClient/movie/MovieHeader.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BizHawk.MultiClient +{ + class MovieHeader + { + //Required Header Params + //Emulation - Core version, will be 1.0.0 until there is a versioning system + //Movie - Versioning for the Movie code itself, or perhaps this could be changed client version? + //Platform - Must know what platform we are making a movie on! + //GameName - Which game + //TODO: GUID, checksum of game, other stuff + + Dictionary HeaderParams = new Dictionary(); //Platform specific options go here + + public MovieHeader() //All required fields will be set to default values + { + HeaderParams.Add("EmulationVersion", "v1.0.0"); + HeaderParams.Add("MovieVersion", "v1.0.0"); + HeaderParams.Add("Platform", ""); + HeaderParams.Add("GameName", ""); + } + + public MovieHeader(string EmulatorVersion, string MovieVersion, string Platform, string GameName) + { + HeaderParams.Add("EmulationVersion", EmulatorVersion); + HeaderParams.Add("MovieVersion", MovieVersion); + HeaderParams.Add("Platform", Platform); + HeaderParams.Add("GameName", GameName); + } + + /// + /// Adds the key value pair to header params. If key already exists, value will be updated + /// + /// + /// + 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? + HeaderParams.Add(key, value); + } + + public bool RemoveHeaderLine(string key) + { + return HeaderParams.Remove(key); + } + + public string GetHeaderLine(string key) + { + string value = ""; + HeaderParams.TryGetValue(key, out value); + return value; + } + + public Dictionary GetHeaderInfo() + { + return HeaderParams; + } + } +} diff --git a/BizHawk.MultiClient/movie/MovieLog.cs b/BizHawk.MultiClient/movie/MovieLog.cs new file mode 100644 index 0000000000..c343fa2add --- /dev/null +++ b/BizHawk.MultiClient/movie/MovieLog.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BizHawk.MultiClient +{ + /// + /// Represents the controller key presses of a movie + /// + class MovieLog + { + List MovieRecords = new List(); + + public MovieLog() + { + + } + + public int GetMovieLength() + { + return MovieRecords.Count; + } + } +}