saving too!

also catch inconsistent tsmSettings exception
This commit is contained in:
feos 2016-06-11 10:12:30 +03:00
parent ef93a50f4d
commit 2a952cebef
1 changed files with 40 additions and 32 deletions

View File

@ -3,7 +3,6 @@ using System.ComponentModel;
using System.Text;
using Newtonsoft.Json;
namespace BizHawk.Client.Common
{
public class TasStateManagerSettings
@ -104,9 +103,9 @@ namespace BizHawk.Client.Common
sb.AppendLine(DiskSaveCapacitymb.ToString());
sb.AppendLine(Capacitymb.ToString());
sb.AppendLine(DiskCapacitymb.ToString());
sb.AppendLine(StateGap.ToString());
sb.AppendLine(BranchStatesInTasproj.ToString());
sb.AppendLine(EraseBranchStatesFirst.ToString());
sb.AppendLine(StateGap.ToString());
return sb.ToString();
}
@ -114,6 +113,8 @@ namespace BizHawk.Client.Common
public void PopulateFromString(string settings)
{
if (!string.IsNullOrWhiteSpace(settings))
{
try
{
string[] lines = settings.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
Capacitymb = int.Parse(lines[1]);
@ -149,6 +150,13 @@ namespace BizHawk.Client.Common
else
StateGap = 4;
}
catch (Exception)
{
// "GreenZoneSettings inconsistent, ignoring"
// if we don't catch it, the project won't load
// but dialog boxes aren't supposed to exist here?
}
}
}
}
}