tabs to spaces, whitespace commits are the best
This commit is contained in:
parent
369c883ac0
commit
817b9d83aa
|
@ -16,25 +16,23 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
public Func<string> ClientSettingsForSave { get; set; }
|
public Func<string> ClientSettingsForSave { get; set; }
|
||||||
public Action<string> GetClientSettingsOnLoad { get; set; }
|
public Action<string> GetClientSettingsOnLoad { get; set; }
|
||||||
|
|
||||||
private const double PROGRESS_STEP = 100 / 12; // TODO hardcoded for now, there might be a better way of doing this
|
|
||||||
|
|
||||||
private double _totalProgress = 0;
|
private const double PROGRESS_STEP = 100 / 12; // TODO hardcoded for now, there might be a better way of doing this
|
||||||
|
|
||||||
private void ReportProgress(double percent)
|
private double _totalProgress = 0;
|
||||||
{
|
|
||||||
if (_progressReportWorker != null)
|
private void ReportProgress(double percent)
|
||||||
{
|
{
|
||||||
_totalProgress += percent;
|
if (_progressReportWorker != null)
|
||||||
_progressReportWorker.ReportProgress((int)_totalProgress);
|
{
|
||||||
}
|
_totalProgress += percent;
|
||||||
}
|
_progressReportWorker.ReportProgress((int)_totalProgress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Write(string fn)
|
protected override void Write(string fn)
|
||||||
{
|
{
|
||||||
|
_totalProgress = 0;
|
||||||
|
|
||||||
_totalProgress = 0;
|
|
||||||
|
|
||||||
var file = new FileInfo(fn);
|
var file = new FileInfo(fn);
|
||||||
if (!file.Directory.Exists)
|
if (!file.Directory.Exists)
|
||||||
|
@ -45,29 +43,29 @@ namespace BizHawk.Client.Common
|
||||||
using (var bs = new BinaryStateSaver(fn, false))
|
using (var bs = new BinaryStateSaver(fn, false))
|
||||||
{
|
{
|
||||||
bs.PutLump(BinaryStateLump.Movieheader, tw => tw.WriteLine(Header.ToString()));
|
bs.PutLump(BinaryStateLump.Movieheader, tw => tw.WriteLine(Header.ToString()));
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
bs.PutLump(BinaryStateLump.Comments, tw => tw.WriteLine(CommentsString()));
|
bs.PutLump(BinaryStateLump.Comments, tw => tw.WriteLine(CommentsString()));
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
bs.PutLump(BinaryStateLump.Subtitles, tw => tw.WriteLine(Subtitles.ToString()));
|
bs.PutLump(BinaryStateLump.Subtitles, tw => tw.WriteLine(Subtitles.ToString()));
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
bs.PutLump(BinaryStateLump.SyncSettings, tw => tw.WriteLine(SyncSettingsJson));
|
bs.PutLump(BinaryStateLump.SyncSettings, tw => tw.WriteLine(SyncSettingsJson));
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
bs.PutLump(BinaryStateLump.Input, tw => tw.WriteLine(RawInputLog()));
|
bs.PutLump(BinaryStateLump.Input, tw => tw.WriteLine(RawInputLog()));
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
|
|
||||||
// TasProj extras
|
// TasProj extras
|
||||||
bs.PutLump(BinaryStateLump.GreenzoneSettings, tw => tw.WriteLine(StateManager.Settings.ToString()));
|
bs.PutLump(BinaryStateLump.GreenzoneSettings, tw => tw.WriteLine(StateManager.Settings.ToString()));
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
if (StateManager.Settings.SaveGreenzone)
|
if (StateManager.Settings.SaveGreenzone)
|
||||||
{
|
{
|
||||||
bs.PutLump(BinaryStateLump.Greenzone, (BinaryWriter bw) => StateManager.Save(bw));
|
bs.PutLump(BinaryStateLump.Greenzone, (BinaryWriter bw) => StateManager.Save(bw));
|
||||||
}
|
}
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
|
|
||||||
bs.PutLump(BinaryStateLump.LagLog, (BinaryWriter bw) => LagLog.Save(bw));
|
bs.PutLump(BinaryStateLump.LagLog, (BinaryWriter bw) => LagLog.Save(bw));
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
bs.PutLump(BinaryStateLump.Markers, tw => tw.WriteLine(Markers.ToString()));
|
bs.PutLump(BinaryStateLump.Markers, tw => tw.WriteLine(Markers.ToString()));
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
|
|
||||||
if (StartsFromSavestate)
|
if (StartsFromSavestate)
|
||||||
{
|
{
|
||||||
|
@ -79,20 +77,20 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
bs.PutLump(BinaryStateLump.Corestate, (BinaryWriter bw) => bw.Write(BinarySavestate));
|
bs.PutLump(BinaryStateLump.Corestate, (BinaryWriter bw) => bw.Write(BinarySavestate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
if (ClientSettingsForSave != null)
|
if (ClientSettingsForSave != null)
|
||||||
{
|
{
|
||||||
var clientSettingsJson = ClientSettingsForSave();
|
var clientSettingsJson = ClientSettingsForSave();
|
||||||
bs.PutLump(BinaryStateLump.ClientSettings, (TextWriter tw) => tw.Write(clientSettingsJson));
|
bs.PutLump(BinaryStateLump.ClientSettings, (TextWriter tw) => tw.Write(clientSettingsJson));
|
||||||
}
|
}
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
|
|
||||||
if (VerificationLog.Any())
|
if (VerificationLog.Any())
|
||||||
{
|
{
|
||||||
bs.PutLump(BinaryStateLump.VerificationLog, tw => tw.WriteLine(InputLogToString(VerificationLog)));
|
bs.PutLump(BinaryStateLump.VerificationLog, tw => tw.WriteLine(InputLogToString(VerificationLog)));
|
||||||
}
|
}
|
||||||
ReportProgress(PROGRESS_STEP);
|
ReportProgress(PROGRESS_STEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
Changes = false;
|
Changes = false;
|
||||||
|
|
Loading…
Reference in New Issue