Move SwapBackupSavestate() from EmuHawk.Mainform to Client.Common.SaveSlotManager
This commit is contained in:
parent
dd63395f67
commit
e711a6ec6f
|
@ -99,5 +99,32 @@ namespace BizHawk.Client.Common
|
|||
ClearRedoList();
|
||||
Update();
|
||||
}
|
||||
|
||||
public void SwapBackupSavestate(string path)
|
||||
{
|
||||
// Takes the .state and .bak files and swaps them
|
||||
var state = new FileInfo(path);
|
||||
var backup = new FileInfo(path + ".bak");
|
||||
var temp = new FileInfo(path + ".bak.tmp");
|
||||
|
||||
if (!state.Exists || !backup.Exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (temp.Exists)
|
||||
{
|
||||
temp.Delete();
|
||||
}
|
||||
|
||||
backup.CopyTo(path + ".bak.tmp");
|
||||
backup.Delete();
|
||||
state.CopyTo(path + ".bak");
|
||||
state.Delete();
|
||||
temp.CopyTo(path);
|
||||
temp.Delete();
|
||||
|
||||
ToggleRedo(Global.Config.SaveSlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1874,7 +1874,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void UndoSavestateContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SwapBackupSavestate(
|
||||
_stateSlots.SwapBackupSavestate(
|
||||
PathManager.SaveStatePrefix(Global.Game) +
|
||||
".QuickSave" +
|
||||
Global.Config.SaveSlot +
|
||||
|
|
|
@ -3571,33 +3571,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void SwapBackupSavestate(string path) // Move inside Saveslot Manager
|
||||
{
|
||||
// Takes the .state and .bak files and swaps them
|
||||
var state = new FileInfo(path);
|
||||
var backup = new FileInfo(path + ".bak");
|
||||
var temp = new FileInfo(path + ".bak.tmp");
|
||||
|
||||
if (!state.Exists || !backup.Exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (temp.Exists)
|
||||
{
|
||||
temp.Delete();
|
||||
}
|
||||
|
||||
backup.CopyTo(path + ".bak.tmp");
|
||||
backup.Delete();
|
||||
state.CopyTo(path + ".bak");
|
||||
state.Delete();
|
||||
temp.CopyTo(path);
|
||||
temp.Delete();
|
||||
|
||||
_stateSlots.ToggleRedo(Global.Config.SaveSlot);
|
||||
}
|
||||
|
||||
private static void ProcessMovieImport(string fn) // Nothing Winform Specific here, move to Movie import
|
||||
{
|
||||
var d = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null);
|
||||
|
|
Loading…
Reference in New Issue