LuaFileList - simplify
This commit is contained in:
parent
f082ef1f4f
commit
c057c5793c
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue