Merge ctors using default params, resolves a TODO

This commit is contained in:
YoshiRulz 2020-01-02 22:10:42 +10:00
parent 060255471b
commit 9ef32cf8f5
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 5 additions and 32 deletions

View File

@ -9,20 +9,14 @@ namespace BizHawk.Client.Common
{
private Bk2ControllerAdapter _adapter;
public Bk2Movie(string filename)
: this()
{
Rerecords = 0;
Filename = filename;
}
public Bk2Movie()
public Bk2Movie(string filename = null)
{
Subtitles = new SubtitleList();
Comments = new List<string>();
Filename = "";
Filename = filename ?? string.Empty;
IsCountingRerecords = true;
if (filename != null) Rerecords = 0;
Mode = MovieMode.Inactive;
MakeBackup = true;

View File

@ -47,28 +47,7 @@ namespace BizHawk.Client.Common
};
/// <exception cref="InvalidOperationException">loaded core does not implement <see cref="IStatable"/></exception>
public TasMovie(string path, bool startsFromSavestate = false)
: base(path)
{
// TODO: how to call the default constructor AND the base(path) constructor? And is base(path) calling base() ?
if (!Global.Emulator.HasSavestates())
{
throw new InvalidOperationException($"Cannot create a {nameof(TasMovie)} against a core that does not implement {nameof(IStatable)}");
}
ChangeLog = new TasMovieChangeLog(this);
TasStateManager = new TasStateManager(this);
Session = new TasSession(this);
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;
}
/// <exception cref="InvalidOperationException">loaded core does not implement <see cref="IStatable"/></exception>
public TasMovie(bool startsFromSavestate = false)
public TasMovie(string path = null, bool startsFromSavestate = false) : base(path)
{
if (!Global.Emulator.HasSavestates())
{

View File

@ -555,7 +555,7 @@ namespace BizHawk.Client.EmuHawk
return false;
}
TasMovie newMovie = new TasMovie(startsFromSavestate);
TasMovie newMovie = new TasMovie(startsFromSavestate: startsFromSavestate);
newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated;
newMovie.Filename = file.FullName;