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
|
2012-01-10 03:12:01 +00:00
|
|
|
|
{
|
2012-03-23 19:44:47 +00:00
|
|
|
|
public LuaFile(string path)
|
2012-01-10 03:12:01 +00:00
|
|
|
|
{
|
2014-02-03 20:48:01 +00:00
|
|
|
|
Name = string.Empty;
|
2012-01-10 03:12:01 +00:00
|
|
|
|
Path = path;
|
|
|
|
|
Enabled = true;
|
2012-11-29 18:42:13 +00:00
|
|
|
|
Paused = false;
|
2012-03-23 23:03:39 +00:00
|
|
|
|
FrameWaiting = false;
|
2012-01-10 03:12:01 +00:00
|
|
|
|
}
|
2011-05-06 23:08:50 +00:00
|
|
|
|
|
2012-03-23 19:44:47 +00:00
|
|
|
|
public LuaFile(string name, string path)
|
2012-01-10 03:12:01 +00:00
|
|
|
|
{
|
|
|
|
|
Name = name;
|
|
|
|
|
Path = path;
|
|
|
|
|
IsSeparator = false;
|
2012-11-29 18:42:13 +00:00
|
|
|
|
|
2013-12-30 01:58:44 +00:00
|
|
|
|
// 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);
|
2012-01-10 03:12:01 +00:00
|
|
|
|
}
|
2011-05-07 00:07:27 +00:00
|
|
|
|
|
2012-03-23 19:44:47 +00:00
|
|
|
|
public LuaFile(bool isSeparator)
|
2012-01-10 03:12:01 +00:00
|
|
|
|
{
|
|
|
|
|
IsSeparator = isSeparator;
|
2014-02-03 20:48:01 +00:00
|
|
|
|
Name = string.Empty;
|
|
|
|
|
Path = string.Empty;
|
2012-01-10 03:12:01 +00:00
|
|
|
|
Enabled = false;
|
|
|
|
|
}
|
2011-05-06 23:08:50 +00:00
|
|
|
|
|
2013-10-28 13:48:17 +00:00
|
|
|
|
public LuaFile(LuaFile file)
|
2012-01-10 03:12:01 +00:00
|
|
|
|
{
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-03 20:48:01 +00:00
|
|
|
|
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; }
|
|
|
|
|
|
2013-11-25 00:44:18 +00:00
|
|
|
|
public static LuaFile SeparatorInstance
|
|
|
|
|
{
|
|
|
|
|
get { return new LuaFile(true); }
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-28 13:48:17 +00:00
|
|
|
|
public void Stop()
|
|
|
|
|
{
|
|
|
|
|
Enabled = false;
|
|
|
|
|
Thread = null;
|
2012-01-10 03:12:01 +00:00
|
|
|
|
}
|
2011-05-06 23:08:50 +00:00
|
|
|
|
|
2012-01-10 03:12:01 +00:00
|
|
|
|
public void Toggle()
|
|
|
|
|
{
|
|
|
|
|
Enabled ^= true;
|
2012-11-29 18:42:13 +00:00
|
|
|
|
if (Enabled)
|
2013-10-28 13:48:17 +00:00
|
|
|
|
{
|
2012-11-29 18:42:13 +00:00
|
|
|
|
Paused = false;
|
2013-10-28 13:48:17 +00:00
|
|
|
|
}
|
2012-01-10 03:12:01 +00:00
|
|
|
|
}
|
2012-03-24 10:53:26 +00:00
|
|
|
|
|
2012-11-29 18:42:13 +00:00
|
|
|
|
public void TogglePause()
|
|
|
|
|
{
|
|
|
|
|
Paused ^= true;
|
|
|
|
|
}
|
2012-01-10 03:12:01 +00:00
|
|
|
|
}
|
2011-05-06 23:08:50 +00:00
|
|
|
|
}
|