Move TasStateManagerSettings to its own file

This commit is contained in:
adelikat 2014-10-17 22:39:40 +00:00
parent e0525ebbe4
commit f930622b5e
4 changed files with 53 additions and 45 deletions

View File

@ -177,6 +177,7 @@
<Compile Include="movie\tasproj\TasMovieMarker.cs" />
<Compile Include="movie\tasproj\TasStateManager.cs" />
<Compile Include="movie\tasproj\TasMovieRecord.cs" />
<Compile Include="movie\tasproj\TasStateManagerSettings.cs" />
<Compile Include="NESGameGenieEncoderDecoder.cs" />
<Compile Include="PathManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -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<int, byte[]>(limit);
}
public ManagerSettings Settings { get; set; }
public TasStateManagerSettings Settings { get; set; }
/// <summary>
/// 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;
}
/// <summary>
/// Whether or not to save greenzone information to disk
/// </summary>
public bool SaveGreenzone { get; set; }
/// <summary>
/// The total amount of memory to devote to greenzone in megabytes
/// </summary>
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]);
}
}
}
}

View File

@ -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;
}
/// <summary>
/// Whether or not to save greenzone information to disk
/// </summary>
public bool SaveGreenzone { get; set; }
/// <summary>
/// The total amount of memory to devote to greenzone in megabytes
/// </summary>
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]);
}
}
}

View File

@ -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();