tabs to spaces, whitespace commits are the best

This commit is contained in:
adelikat 2015-02-24 20:15:43 +00:00
parent 369c883ac0
commit 817b9d83aa
1 changed files with 35 additions and 37 deletions

View File

@ -16,25 +16,23 @@ namespace BizHawk.Client.Common
{
public Func<string> ClientSettingsForSave { 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)
{
if (_progressReportWorker != null)
{
_totalProgress += percent;
_progressReportWorker.ReportProgress((int)_totalProgress);
}
}
private double _totalProgress = 0;
private void ReportProgress(double percent)
{
if (_progressReportWorker != null)
{
_totalProgress += percent;
_progressReportWorker.ReportProgress((int)_totalProgress);
}
}
protected override void Write(string fn)
{
_totalProgress = 0;
_totalProgress = 0;
var file = new FileInfo(fn);
if (!file.Directory.Exists)
@ -45,29 +43,29 @@ namespace BizHawk.Client.Common
using (var bs = new BinaryStateSaver(fn, false))
{
bs.PutLump(BinaryStateLump.Movieheader, tw => tw.WriteLine(Header.ToString()));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.Comments, tw => tw.WriteLine(CommentsString()));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.Subtitles, tw => tw.WriteLine(Subtitles.ToString()));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.SyncSettings, tw => tw.WriteLine(SyncSettingsJson));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.Input, tw => tw.WriteLine(RawInputLog()));
ReportProgress(PROGRESS_STEP);
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.Comments, tw => tw.WriteLine(CommentsString()));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.Subtitles, tw => tw.WriteLine(Subtitles.ToString()));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.SyncSettings, tw => tw.WriteLine(SyncSettingsJson));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.Input, tw => tw.WriteLine(RawInputLog()));
ReportProgress(PROGRESS_STEP);
// TasProj extras
bs.PutLump(BinaryStateLump.GreenzoneSettings, tw => tw.WriteLine(StateManager.Settings.ToString()));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.GreenzoneSettings, tw => tw.WriteLine(StateManager.Settings.ToString()));
ReportProgress(PROGRESS_STEP);
if (StateManager.Settings.SaveGreenzone)
{
bs.PutLump(BinaryStateLump.Greenzone, (BinaryWriter bw) => StateManager.Save(bw));
}
ReportProgress(PROGRESS_STEP);
}
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.LagLog, (BinaryWriter bw) => LagLog.Save(bw));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.Markers, tw => tw.WriteLine(Markers.ToString()));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.LagLog, (BinaryWriter bw) => LagLog.Save(bw));
ReportProgress(PROGRESS_STEP);
bs.PutLump(BinaryStateLump.Markers, tw => tw.WriteLine(Markers.ToString()));
ReportProgress(PROGRESS_STEP);
if (StartsFromSavestate)
{
@ -79,20 +77,20 @@ namespace BizHawk.Client.Common
{
bs.PutLump(BinaryStateLump.Corestate, (BinaryWriter bw) => bw.Write(BinarySavestate));
}
}
ReportProgress(PROGRESS_STEP);
}
ReportProgress(PROGRESS_STEP);
if (ClientSettingsForSave != null)
{
var clientSettingsJson = ClientSettingsForSave();
bs.PutLump(BinaryStateLump.ClientSettings, (TextWriter tw) => tw.Write(clientSettingsJson));
}
ReportProgress(PROGRESS_STEP);
}
ReportProgress(PROGRESS_STEP);
if (VerificationLog.Any())
{
bs.PutLump(BinaryStateLump.VerificationLog, tw => tw.WriteLine(InputLogToString(VerificationLog)));
}
ReportProgress(PROGRESS_STEP);
}
ReportProgress(PROGRESS_STEP);
}
Changes = false;