LuaFileList - simplify

This commit is contained in:
adelikat 2020-05-31 11:07:20 -05:00
parent f082ef1f4f
commit c057c5793c
2 changed files with 34 additions and 44 deletions

View File

@ -12,8 +12,6 @@ namespace BizHawk.Client.Common
private bool _changes;
public Action ChangedCallback { get; set; }
public Action LoadCallback { get; set; }
public bool Changes
{
get => _changes;
@ -64,19 +62,16 @@ namespace BizHawk.Client.Common
return base.Remove(item);
}
public new int RemoveAll(Predicate<LuaFile> match)
{
return base.RemoveAll(match);
}
public bool LoadLuaSession(string path, bool disableOnLoad)
{
var file = new FileInfo(path);
if (file.Exists)
if (!file.Exists)
{
return false;
}
Clear();
using (var sr = file.OpenText())
{
using var sr = file.OpenText();
string line;
while ((line = sr.ReadLine()) != null)
{
@ -101,15 +96,10 @@ namespace BizHawk.Client.Common
});
}
}
}
_filename = path;
LoadCallback?.Invoke();
return true;
}
return false;
}
public void SaveSession()

View File

@ -128,7 +128,6 @@ namespace BizHawk.Client.EmuHawk
}
LuaImp.ScriptList.ChangedCallback = SessionChangedCallback;
LuaImp.ScriptList.LoadCallback = ClearOutputWindow;
if (Config.RecentLuaSession.AutoLoad && !Config.RecentLuaSession.Empty)
{
@ -525,6 +524,7 @@ namespace BizHawk.Client.EmuHawk
Config.RecentLua.Add(script.Path);
}
ClearOutputWindow();
return result;
}