Lua console - unify Save/SaveAs logic and remove a now unnecessary LuaFileList method
This commit is contained in:
parent
5a44a99118
commit
4be160a71f
|
@ -94,15 +94,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
Filename = path;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public void SaveSession()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(Filename))
|
||||
{
|
||||
SaveSession(Filename);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveSession(string path)
|
||||
|
|
|
@ -690,14 +690,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Sound.StartSound();
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(LuaImp.ScriptList.Filename))
|
||||
{
|
||||
LuaImp.ScriptList.SaveSession();
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveSessionAs();
|
||||
}
|
||||
SaveOrSaveAs();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -725,6 +718,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void SaveOrSaveAs()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(LuaImp.ScriptList.Filename))
|
||||
{
|
||||
LuaImp.ScriptList.SaveSession(LuaImp.ScriptList.Filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveSessionAs();
|
||||
}
|
||||
}
|
||||
|
||||
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
SaveSessionMenuItem.Enabled = LuaImp.ScriptList.Changes;
|
||||
|
@ -780,15 +785,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (LuaImp.ScriptList.Changes)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(LuaImp.ScriptList.Filename))
|
||||
{
|
||||
LuaImp.ScriptList.SaveSession();
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveSessionAs();
|
||||
}
|
||||
|
||||
SaveOrSaveAs();
|
||||
OutputMessages.Text = $"{Path.GetFileName(LuaImp.ScriptList.Filename)} saved.";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue