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

76 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
{
2013-10-28 13:48:17 +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; }
2011-05-06 23:08:50 +00:00
public LuaFile(string path)
{
2013-10-28 13:48:17 +00:00
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
var directory_info = new FileInfo(path).Directory;
if (directory_info != null) CurrentDirectory = directory_info.FullName;
}
2011-05-07 00:07:27 +00:00
public LuaFile(bool isSeparator)
{
IsSeparator = isSeparator;
2013-10-28 13:48:17 +00:00
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 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
}