simplify Bk2Movie and TasMovie constructors

This commit is contained in:
adelikat 2020-04-14 14:55:25 -05:00
parent d2e19c9ba5
commit e29b02a472
4 changed files with 8 additions and 24 deletions

View File

@ -10,8 +10,8 @@ namespace BizHawk.Client.Common
public IDictionary<string, string> HeaderEntries => Header;
public SubtitleList Subtitles { get; }
public IList<string> Comments { get; }
public SubtitleList Subtitles { get; } = new SubtitleList();
public IList<string> Comments { get; } = new List<string>();
public string SyncSettingsJson
{

View File

@ -8,7 +8,7 @@ namespace BizHawk.Client.Common
{
public partial class Bk2Movie
{
protected IStringLog Log { get; set; }
protected IStringLog Log { get; set; } = StringLogUtil.MakeStringLog();
protected string LogKey { get; set; } = "";
public void WriteInputLog(TextWriter writer)

View File

@ -12,21 +12,11 @@ namespace BizHawk.Client.Common
public Bk2Movie(string filename = null)
{
Subtitles = new SubtitleList();
Comments = new List<string>();
Filename = filename ?? string.Empty;
IsCountingRerecords = true;
if (filename != null) Rerecords = 0;
Mode = MovieMode.Inactive;
MakeBackup = true;
Header[HeaderKeys.MovieVersion] = "BizHawk v2.0.0";
Log = StringLogUtil.MakeStringLog();
}
protected bool MakeBackup { get; set; }
protected bool MakeBackup { get; set; } = true;
private string _filename;
@ -48,7 +38,7 @@ namespace BizHawk.Client.Common
public const string Extension = "bk2";
public virtual bool Changes { get; protected set; }
public bool IsCountingRerecords { get; set; }
public bool IsCountingRerecords { get; set; } = true;
public ILogEntryGenerator LogGeneratorInstance()
{

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.Common
public IStringLog VerificationLog { get; } = StringLogUtil.MakeStringLog(); // For movies that do not begin with power-on, this is the input required to get into the initial state
public TasBranchCollection Branches { get; } = new TasBranchCollection();
public TasSession Session { get; private set; }
public TasSession Session { get; private set; } = new TasSession();
public new const string Extension = "tasproj";
public const string DefaultProjectName = "default";
@ -24,7 +24,7 @@ namespace BizHawk.Client.Common
public bool LastPositionStable { get; set; } = true;
public TasMovieMarkerList Markers { get; private set; }
public bool BindMarkersToInput { get; set; }
public int CurrentBranch { get; set; }
public int CurrentBranch { get; set; } = -1;
public TasLagLog TasLagLog { get; } = new TasLagLog();
@ -32,10 +32,7 @@ namespace BizHawk.Client.Common
public override string PreferredExtension => Extension;
public IStateManager TasStateManager { get; }
public IStringLog CloneInput()
{
return Log.Clone();
}
public IStringLog CloneInput() => Log.Clone();
public TasMovieRecord this[int index] => new TasMovieRecord
{
@ -55,13 +52,10 @@ namespace BizHawk.Client.Common
ChangeLog = new TasMovieChangeLog(this);
TasStateManager = new TasStateManager(this, Global.Config.DefaultTasStateManagerSettings);
Session = new TasSession();
Header[HeaderKeys.MovieVersion] = "BizHawk v2.0 Tasproj v1.0";
Markers = new TasMovieMarkerList(this);
Markers.CollectionChanged += Markers_CollectionChanged;
Markers.Add(0, startsFromSavestate ? "Savestate" : "Power on");
BindMarkersToInput = false;
CurrentBranch = -1;
}
// TODO: use LogGenerators rather than string comparisons