BizHawk/BizHawk.Client.Common/lua/LuaFile.cs

80 lines
1.5 KiB
C#
Raw Normal View History

2013-10-28 13:48:17 +00:00
using System;
using System.IO;
2011-05-06 23:08:50 +00:00
2013-10-28 13:48:17 +00:00
namespace BizHawk.Client.Common
2011-05-06 23:08:50 +00:00
{
2013-10-28 13:48:17 +00:00
public class LuaFile
{
public LuaFile(string path)
{
Name = string.Empty;
Path = path;
Enabled = true;
Paused = false;
FrameWaiting = false;
}
2011-05-06 23:08:50 +00:00
public LuaFile(string name, string path)
{
Name = name;
Path = path;
IsSeparator = false;
// the current directory for the lua task will start off wherever the lua file is located
2014-06-03 02:39:15 +00:00
CurrentDirectory = System.IO.Path.GetDirectoryName(path);
}
2011-05-07 00:07:27 +00:00
public LuaFile(bool isSeparator)
{
IsSeparator = isSeparator;
Name = string.Empty;
Path = string.Empty;
Enabled = false;
}
2011-05-06 23:08:50 +00:00
2013-10-28 13:48:17 +00:00
public LuaFile(LuaFile file)
{
2013-10-28 13:48:17 +00:00
Name = file.Name;
Path = file.Path;
Enabled = file.Enabled;
Paused = file.Paused;
IsSeparator = file.IsSeparator;
CurrentDirectory = file.CurrentDirectory;
}
public string Name { get; set; }
public string Path { get; set; }
public bool Enabled { get; set; }
public bool Paused { get; set; }
public bool IsSeparator { get; set; }
public LuaInterface.Lua Thread { get; set; }
public bool FrameWaiting { get; set; }
public string CurrentDirectory { get; set; }
public static LuaFile SeparatorInstance
{
get { return new LuaFile(true); }
}
2013-10-28 13:48:17 +00:00
public void Stop()
{
Enabled = false;
Thread = null;
}
2011-05-06 23:08:50 +00:00
public void Toggle()
{
Enabled ^= true;
if (Enabled)
2013-10-28 13:48:17 +00:00
{
Paused = false;
2013-10-28 13:48:17 +00:00
}
}
public void TogglePause()
{
Paused ^= true;
}
}
2011-05-06 23:08:50 +00:00
}