From f930622b5e9b02136fd7d7ff4dc346c8484b696f Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 17 Oct 2014 22:39:40 +0000 Subject: [PATCH] Move TasStateManagerSettings to its own file --- .../BizHawk.Client.Common.csproj | 1 + .../movie/tasproj/TasStateManager.cs | 45 +---------------- .../movie/tasproj/TasStateManagerSettings.cs | 48 +++++++++++++++++++ .../tools/TAStudio/GreenzoneSettings.cs | 4 +- 4 files changed, 53 insertions(+), 45 deletions(-) create mode 100644 BizHawk.Client.Common/movie/tasproj/TasStateManagerSettings.cs diff --git a/BizHawk.Client.Common/BizHawk.Client.Common.csproj b/BizHawk.Client.Common/BizHawk.Client.Common.csproj index 605bd10acf..b6f631129d 100644 --- a/BizHawk.Client.Common/BizHawk.Client.Common.csproj +++ b/BizHawk.Client.Common/BizHawk.Client.Common.csproj @@ -177,6 +177,7 @@ + diff --git a/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs b/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs index 0314f13b85..c70ba21a3e 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs @@ -43,7 +43,7 @@ namespace BizHawk.Client.Common public TasStateManager(TasMovie movie) { _movie = movie; - Settings = new ManagerSettings(); + Settings = new TasStateManagerSettings(); var cap = Settings.Cap; @@ -61,7 +61,7 @@ namespace BizHawk.Client.Common States = new SortedList(limit); } - public ManagerSettings Settings { get; set; } + public TasStateManagerSettings Settings { get; set; } /// /// Retrieves the savestate for the given frame, @@ -288,46 +288,5 @@ namespace BizHawk.Client.Common return 0; } } - - public class ManagerSettings - { - public ManagerSettings() - { - SaveGreenzone = true; - Capacitymb = 512; - } - - /// - /// Whether or not to save greenzone information to disk - /// - public bool SaveGreenzone { get; set; } - - /// - /// The total amount of memory to devote to greenzone in megabytes - /// - public int Capacitymb { get; set; } - - public int Cap - { - get { return Capacitymb * 1024 * 1024; } - } - - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - - sb.AppendLine(SaveGreenzone.ToString()); - sb.AppendLine(Capacitymb.ToString()); - - return sb.ToString(); - } - - public void PopulateFromString(string settings) - { - var lines = settings.Split(new [] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); - SaveGreenzone = bool.Parse(lines[0]); - Capacitymb = int.Parse(lines[1]); - } - } } } diff --git a/BizHawk.Client.Common/movie/tasproj/TasStateManagerSettings.cs b/BizHawk.Client.Common/movie/tasproj/TasStateManagerSettings.cs new file mode 100644 index 0000000000..34f5ea129f --- /dev/null +++ b/BizHawk.Client.Common/movie/tasproj/TasStateManagerSettings.cs @@ -0,0 +1,48 @@ +using System; +using System.Text; +using Newtonsoft.Json; + +namespace BizHawk.Client.Common +{ + public class TasStateManagerSettings + { + public TasStateManagerSettings() + { + SaveGreenzone = true; + Capacitymb = 512; + } + + /// + /// Whether or not to save greenzone information to disk + /// + public bool SaveGreenzone { get; set; } + + /// + /// The total amount of memory to devote to greenzone in megabytes + /// + public int Capacitymb { get; set; } + + [JsonIgnore] + public int Cap + { + get { return Capacitymb * 1024 * 1024; } + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + + sb.AppendLine(SaveGreenzone.ToString()); + sb.AppendLine(Capacitymb.ToString()); + + return sb.ToString(); + } + + public void PopulateFromString(string settings) + { + var lines = settings.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + SaveGreenzone = bool.Parse(lines[0]); + Capacitymb = int.Parse(lines[1]); + } + } +} diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs index 256798569a..9ad2f5def3 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs @@ -13,9 +13,9 @@ namespace BizHawk.Client.EmuHawk { public partial class GreenzoneSettingsForm : Form { - private readonly TasStateManager.ManagerSettings Settings; + private readonly TasStateManagerSettings Settings; private decimal _stateSizeMb; - public GreenzoneSettingsForm(TasStateManager.ManagerSettings settings) + public GreenzoneSettingsForm(TasStateManagerSettings settings) { Settings = settings; InitializeComponent();