Lua Console Now Saves And Loads Sessions With Separators
This commit is contained in:
parent
9ff5f10a70
commit
5337fb2213
|
@ -759,34 +759,42 @@ namespace BizHawk.MultiClient
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
string s = "";
|
string s = "";
|
||||||
string temp = "";
|
string temp = "";
|
||||||
|
LuaFile l;
|
||||||
|
|
||||||
while ((s = sr.ReadLine()) != null)
|
while ((s = sr.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
//.luases
|
//.luases
|
||||||
if (s.Length < 3) continue;
|
if (s.Length < 3) continue;
|
||||||
|
if (s.Substring(0, 3) == "---")
|
||||||
|
{
|
||||||
|
l = new LuaFile(true);
|
||||||
|
l.IsSeparator = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp = s.Substring(0, 1); //Get enabled flag
|
||||||
|
|
||||||
temp = s.Substring(0, 1); //Get enabled flag
|
try
|
||||||
|
{
|
||||||
|
if (int.Parse(temp) == 0)
|
||||||
|
enabled = false;
|
||||||
|
else
|
||||||
|
enabled = true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false; //TODO: report an error?
|
||||||
|
}
|
||||||
|
|
||||||
try
|
s = s.Substring(2, s.Length - 2); //Get path
|
||||||
{
|
|
||||||
if (int.Parse(temp) == 0)
|
|
||||||
enabled = false;
|
|
||||||
else
|
|
||||||
enabled = true;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false; //TODO: report an error?
|
|
||||||
}
|
|
||||||
|
|
||||||
s = s.Substring(2, s.Length - 2); //Get path
|
l = new LuaFile(s);
|
||||||
|
|
||||||
LuaFile l = new LuaFile(s);
|
if (!Global.Config.DisableLuaScriptsOnLoad)
|
||||||
|
l.Enabled = enabled;
|
||||||
if (!Global.Config.DisableLuaScriptsOnLoad)
|
else
|
||||||
l.Enabled = enabled;
|
l.Enabled = false;
|
||||||
else
|
}
|
||||||
l.Enabled = false;
|
|
||||||
luaList.Add(l);
|
luaList.Add(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -932,17 +940,21 @@ namespace BizHawk.MultiClient
|
||||||
string str = "";
|
string str = "";
|
||||||
for (int i = 0; i < luaList.Count; i++)
|
for (int i = 0; i < luaList.Count; i++)
|
||||||
{
|
{
|
||||||
if (!luaList[i].IsSeparator)
|
if (!luaList[i].IsSeparator)
|
||||||
{
|
{
|
||||||
if (luaList[i].Enabled)
|
if (luaList[i].Enabled)
|
||||||
str += "1 ";
|
str += "1 ";
|
||||||
else
|
else
|
||||||
str += "0 ";
|
str += "0 ";
|
||||||
|
|
||||||
str += luaList[i].Path + "\n";
|
str += luaList[i].Path + "\n";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str += "---\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sw.WriteLine(str);
|
sw.Write(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
Changes(false);
|
Changes(false);
|
||||||
|
|
Loading…
Reference in New Issue