simplify LuaFileList more

This commit is contained in:
adelikat 2020-05-31 11:18:02 -05:00
parent 4be160a71f
commit 4b696e64fa
1 changed files with 15 additions and 17 deletions

View File

@ -98,28 +98,26 @@ namespace BizHawk.Client.Common
public void SaveSession(string path)
{
using (var sw = new StreamWriter(path))
using var sw = new StreamWriter(path);
var sb = new StringBuilder();
foreach (var file in this)
{
var sb = new StringBuilder();
foreach (var file in this)
if (file.IsSeparator)
{
if (file.IsSeparator)
{
sb.AppendLine("---");
}
else
{
sb
.Append(file.Enabled ? "1" : "0")
.Append(' ')
.Append(Global.Config.PathEntries.AbsolutePathFor(file.Path, "").MakeRelativeTo(Path.GetDirectoryName(path)))
.AppendLine();
}
sb.AppendLine("---");
}
else
{
sb
.Append(file.Enabled ? "1" : "0")
.Append(' ')
.Append(Global.Config.PathEntries.AbsolutePathFor(file.Path, "").MakeRelativeTo(Path.GetDirectoryName(path)))
.AppendLine();
}
sw.Write(sb.ToString());
}
sw.Write(sb.ToString());
Filename = path;
Global.Config.RecentLuaSession.Add(path);
Changes = false;