Lua Cosnole - output message at bottom of dialog to show if changes have occured and saved messages (same as other tool dialogs such as ram watch). Better minimize size parameters of dialog.
This commit is contained in:
parent
cba68551d0
commit
602ee06ffc
|
@ -82,6 +82,7 @@
|
||||||
this.clearToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
this.clearToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
this.NumberOfScripts = new System.Windows.Forms.Label();
|
this.NumberOfScripts = new System.Windows.Forms.Label();
|
||||||
|
this.OutputMessages = new System.Windows.Forms.Label();
|
||||||
this.toolStrip1 = new ToolStripEx();
|
this.toolStrip1 = new ToolStripEx();
|
||||||
this.openToolStripButton = new System.Windows.Forms.ToolStripButton();
|
this.openToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||||
this.copyToolStripButton = new System.Windows.Forms.ToolStripButton();
|
this.copyToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||||
|
@ -506,7 +507,7 @@
|
||||||
this.OutputBox.Location = new System.Drawing.Point(6, 17);
|
this.OutputBox.Location = new System.Drawing.Point(6, 17);
|
||||||
this.OutputBox.Name = "OutputBox";
|
this.OutputBox.Name = "OutputBox";
|
||||||
this.OutputBox.ReadOnly = true;
|
this.OutputBox.ReadOnly = true;
|
||||||
this.OutputBox.Size = new System.Drawing.Size(246, 259);
|
this.OutputBox.Size = new System.Drawing.Size(246, 283);
|
||||||
this.OutputBox.TabIndex = 2;
|
this.OutputBox.TabIndex = 2;
|
||||||
this.OutputBox.Text = "";
|
this.OutputBox.Text = "";
|
||||||
//
|
//
|
||||||
|
@ -531,7 +532,7 @@
|
||||||
this.groupBox1.Controls.Add(this.OutputBox);
|
this.groupBox1.Controls.Add(this.OutputBox);
|
||||||
this.groupBox1.Location = new System.Drawing.Point(310, 71);
|
this.groupBox1.Location = new System.Drawing.Point(310, 71);
|
||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.Size = new System.Drawing.Size(258, 280);
|
this.groupBox1.Size = new System.Drawing.Size(258, 304);
|
||||||
this.groupBox1.TabIndex = 3;
|
this.groupBox1.TabIndex = 3;
|
||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
this.groupBox1.Text = "Output";
|
this.groupBox1.Text = "Output";
|
||||||
|
@ -545,6 +546,16 @@
|
||||||
this.NumberOfScripts.TabIndex = 4;
|
this.NumberOfScripts.TabIndex = 4;
|
||||||
this.NumberOfScripts.Text = "0 script ";
|
this.NumberOfScripts.Text = "0 script ";
|
||||||
//
|
//
|
||||||
|
// OutputMessages
|
||||||
|
//
|
||||||
|
this.OutputMessages.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.OutputMessages.AutoSize = true;
|
||||||
|
this.OutputMessages.Location = new System.Drawing.Point(13, 384);
|
||||||
|
this.OutputMessages.Name = "OutputMessages";
|
||||||
|
this.OutputMessages.Size = new System.Drawing.Size(106, 13);
|
||||||
|
this.OutputMessages.TabIndex = 6;
|
||||||
|
this.OutputMessages.Text = " ";
|
||||||
|
//
|
||||||
// toolStrip1
|
// toolStrip1
|
||||||
//
|
//
|
||||||
this.toolStrip1.ClickThrough = true;
|
this.toolStrip1.ClickThrough = true;
|
||||||
|
@ -666,7 +677,7 @@
|
||||||
this.LuaListView.Location = new System.Drawing.Point(13, 71);
|
this.LuaListView.Location = new System.Drawing.Point(13, 71);
|
||||||
this.LuaListView.Name = "LuaListView";
|
this.LuaListView.Name = "LuaListView";
|
||||||
this.LuaListView.selectedItem = -1;
|
this.LuaListView.selectedItem = -1;
|
||||||
this.LuaListView.Size = new System.Drawing.Size(291, 280);
|
this.LuaListView.Size = new System.Drawing.Size(291, 304);
|
||||||
this.LuaListView.TabIndex = 0;
|
this.LuaListView.TabIndex = 0;
|
||||||
this.LuaListView.UseCompatibleStateImageBehavior = false;
|
this.LuaListView.UseCompatibleStateImageBehavior = false;
|
||||||
this.LuaListView.View = System.Windows.Forms.View.Details;
|
this.LuaListView.View = System.Windows.Forms.View.Details;
|
||||||
|
@ -688,7 +699,8 @@
|
||||||
this.AllowDrop = true;
|
this.AllowDrop = true;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(584, 366);
|
this.ClientSize = new System.Drawing.Size(584, 402);
|
||||||
|
this.Controls.Add(this.OutputMessages);
|
||||||
this.Controls.Add(this.toolStrip1);
|
this.Controls.Add(this.toolStrip1);
|
||||||
this.Controls.Add(this.groupBox1);
|
this.Controls.Add(this.groupBox1);
|
||||||
this.Controls.Add(this.NumberOfScripts);
|
this.Controls.Add(this.NumberOfScripts);
|
||||||
|
@ -696,7 +708,7 @@
|
||||||
this.Controls.Add(this.LuaListView);
|
this.Controls.Add(this.LuaListView);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
this.MainMenuStrip = this.menuStrip1;
|
||||||
this.MinimumSize = new System.Drawing.Size(356, 132);
|
this.MinimumSize = new System.Drawing.Size(400, 180);
|
||||||
this.Name = "LuaConsole";
|
this.Name = "LuaConsole";
|
||||||
this.Text = "Lua Console";
|
this.Text = "Lua Console";
|
||||||
this.Load += new System.EventHandler(this.LuaConsole_Load);
|
this.Load += new System.EventHandler(this.LuaConsole_Load);
|
||||||
|
@ -781,5 +793,6 @@
|
||||||
private System.Windows.Forms.ToolStripButton resumePauseButton1;
|
private System.Windows.Forms.ToolStripButton resumePauseButton1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem resumePauseToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem resumePauseToolStripMenuItem;
|
||||||
public System.Windows.Forms.RichTextBox OutputBox;
|
public System.Windows.Forms.RichTextBox OutputBox;
|
||||||
|
private System.Windows.Forms.Label OutputMessages;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@ namespace BizHawk.MultiClient
|
||||||
//options - autoload session
|
//options - autoload session
|
||||||
//TODO: remember column widths
|
//TODO: remember column widths
|
||||||
//TODO: restore column width on restore default settings
|
//TODO: restore column width on restore default settings
|
||||||
|
//TODO: don't call asksave without looking at the surpress asksave config item
|
||||||
|
|
||||||
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
||||||
int defaultHeight;
|
int defaultHeight;
|
||||||
|
@ -54,16 +55,30 @@ namespace BizHawk.MultiClient
|
||||||
LuaListView.VirtualMode = true;
|
LuaListView.VirtualMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Changes(bool changesOccured)
|
||||||
|
{
|
||||||
|
if (changesOccured)
|
||||||
|
{
|
||||||
|
changes = true;
|
||||||
|
OutputMessages.Text = "* " + Path.GetFileName(currentSessionFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
changes = false;
|
||||||
|
OutputMessages.Text = Path.GetFileName(currentSessionFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void LuaListView_QueryItemBkColor(int index, int column, ref Color color)
|
private void LuaListView_QueryItemBkColor(int index, int column, ref Color color)
|
||||||
{
|
{
|
||||||
if (column == 0)
|
if (column == 0)
|
||||||
{
|
{
|
||||||
if (luaList[index].IsSeparator)
|
if (luaList[index].IsSeparator)
|
||||||
color = this.BackColor;
|
color = this.BackColor;
|
||||||
else if (luaList[index].Enabled && !luaList[index].Paused)
|
else if (luaList[index].Enabled && !luaList[index].Paused)
|
||||||
color = Color.LightCyan;
|
color = Color.LightCyan;
|
||||||
else if (luaList[index].Enabled && luaList[index].Paused)
|
else if (luaList[index].Enabled && luaList[index].Paused)
|
||||||
color = Color.IndianRed;
|
color = Color.IndianRed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,25 +102,20 @@ namespace BizHawk.MultiClient
|
||||||
private void StopScript(int x)
|
private void StopScript(int x)
|
||||||
{
|
{
|
||||||
luaList[x].Stop();
|
luaList[x].Stop();
|
||||||
//LuaImp.Close();
|
Changes(true);
|
||||||
//LuaImp = new LuaImplementation(this);
|
|
||||||
changes = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StopAllScripts()
|
private void StopAllScripts()
|
||||||
{
|
{
|
||||||
for (int x = 0; x < luaList.Count; x++)
|
for (int x = 0; x < luaList.Count; x++)
|
||||||
luaList[x].Enabled = false;
|
luaList[x].Enabled = false;
|
||||||
//LuaImp.Close();
|
Changes(true);
|
||||||
//LuaImp = new LuaImplementation(this);
|
|
||||||
changes = true;
|
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
StopAllScripts();
|
StopAllScripts();
|
||||||
//LuaImp = new LuaImplementation(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveConfigSettings()
|
private void SaveConfigSettings()
|
||||||
|
@ -167,32 +177,32 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (LuaAlreadyInSession(path) == false)
|
if (LuaAlreadyInSession(path) == false)
|
||||||
{
|
{
|
||||||
LuaFile l = new LuaFile("", path);
|
LuaFile l = new LuaFile("", path);
|
||||||
luaList.Add(l);
|
luaList.Add(l);
|
||||||
LuaListView.ItemCount = luaList.Count;
|
LuaListView.ItemCount = luaList.Count;
|
||||||
LuaListView.Refresh();
|
LuaListView.Refresh();
|
||||||
Global.Config.RecentLua.Add(path);
|
Global.Config.RecentLua.Add(path);
|
||||||
|
|
||||||
if (!Global.Config.DisableLuaScriptsOnLoad)
|
if (!Global.Config.DisableLuaScriptsOnLoad)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
l.Thread = LuaImp.SpawnCoroutine(path);
|
l.Thread = LuaImp.SpawnCoroutine(path);
|
||||||
l.Enabled = true;
|
l.Enabled = true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (e.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
if (e.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
||||||
{
|
{
|
||||||
l.Enabled = false;
|
l.Enabled = false;
|
||||||
AddText(e.Message);
|
AddText(e.Message);
|
||||||
}
|
}
|
||||||
else MessageBox.Show(e.ToString());
|
else MessageBox.Show(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else l.Enabled = false;
|
else l.Enabled = false;
|
||||||
l.Paused = false;
|
l.Paused = false;
|
||||||
changes = true;
|
Changes(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -202,8 +212,8 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
luaList[i].Toggle();
|
luaList[i].Toggle();
|
||||||
RunLuaScripts();
|
RunLuaScripts();
|
||||||
LuaListView.Refresh();
|
LuaListView.Refresh();
|
||||||
changes = true;
|
Changes(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,58 +262,58 @@ namespace BizHawk.MultiClient
|
||||||
for (int x = 0; x < indexes.Count; x++)
|
for (int x = 0; x < indexes.Count; x++)
|
||||||
{
|
{
|
||||||
var item = luaList[indexes[x]];
|
var item = luaList[indexes[x]];
|
||||||
if (!item.IsSeparator)
|
if (!item.IsSeparator)
|
||||||
{
|
{
|
||||||
item.Toggle();
|
item.Toggle();
|
||||||
}
|
}
|
||||||
if (item.Enabled && item.Thread == null)
|
if (item.Enabled && item.Thread == null)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
item.Thread = LuaImp.SpawnCoroutine(item.Path);
|
item.Thread = LuaImp.SpawnCoroutine(item.Path);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (e.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
if (e.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
||||||
{
|
{
|
||||||
item.Enabled = false;
|
item.Enabled = false;
|
||||||
AddText(e.Message);
|
AddText(e.Message);
|
||||||
}
|
}
|
||||||
else MessageBox.Show(e.ToString());
|
else MessageBox.Show(e.ToString());
|
||||||
}
|
}
|
||||||
else if (!item.Enabled && item.Thread != null)
|
else if (!item.Enabled && item.Thread != null)
|
||||||
item.Stop();
|
item.Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LuaListView.Refresh();
|
LuaListView.Refresh();
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
changes = true;
|
Changes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunLuaScripts()
|
public void RunLuaScripts()
|
||||||
{
|
{
|
||||||
for (int x = 0; x < luaList.Count; x++)
|
for (int x = 0; x < luaList.Count; x++)
|
||||||
{
|
{
|
||||||
if (luaList[x].Enabled && luaList[x].Thread == null)
|
if (luaList[x].Enabled && luaList[x].Thread == null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
luaList[x].Thread = LuaImp.SpawnCoroutine(luaList[x].Path);
|
luaList[x].Thread = LuaImp.SpawnCoroutine(luaList[x].Path);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (e.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
if (e.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
||||||
{
|
{
|
||||||
luaList[x].Enabled = false;
|
luaList[x].Enabled = false;
|
||||||
AddText(e.Message);
|
AddText(e.Message);
|
||||||
}
|
}
|
||||||
else MessageBox.Show(e.ToString());
|
else MessageBox.Show(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StopScript(x);
|
StopScript(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateNumberOfScripts()
|
private void UpdateNumberOfScripts()
|
||||||
|
@ -312,19 +322,19 @@ namespace BizHawk.MultiClient
|
||||||
int active = 0, paused = 0, separators = 0;
|
int active = 0, paused = 0, separators = 0;
|
||||||
for (int x = 0; x < luaList.Count; x++)
|
for (int x = 0; x < luaList.Count; x++)
|
||||||
{
|
{
|
||||||
if (!luaList[x].IsSeparator)
|
if (!luaList[x].IsSeparator)
|
||||||
{
|
{
|
||||||
if (luaList[x].Enabled)
|
if (luaList[x].Enabled)
|
||||||
{
|
{
|
||||||
active++;
|
active++;
|
||||||
if (luaList[x].Paused)
|
if (luaList[x].Paused)
|
||||||
paused++;
|
paused++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
separators++;
|
separators++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int L = luaList.Count - separators;
|
int L = luaList.Count - separators;
|
||||||
|
@ -355,7 +365,8 @@ namespace BizHawk.MultiClient
|
||||||
if (changes)
|
if (changes)
|
||||||
{
|
{
|
||||||
SaveSession(currentSessionFile);
|
SaveSession(currentSessionFile);
|
||||||
AddText('\n' + Path.GetFileName(currentSessionFile) + " saved.");
|
Changes(false);
|
||||||
|
OutputMessages.Text = Path.GetFileName(currentSessionFile) + " saved.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,12 +387,12 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
if (result == true || suppressAsk)
|
if (result == true || suppressAsk)
|
||||||
{
|
{
|
||||||
ClearOutput();
|
ClearOutput();
|
||||||
StopAllScripts();
|
StopAllScripts();
|
||||||
luaList.Clear();
|
luaList.Clear();
|
||||||
DisplayLuaList();
|
DisplayLuaList();
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
changes = false;
|
Changes(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,17 +419,17 @@ namespace BizHawk.MultiClient
|
||||||
private void RemoveScript()
|
private void RemoveScript()
|
||||||
{
|
{
|
||||||
if (luaList.Count == 0) return;
|
if (luaList.Count == 0) return;
|
||||||
changes = true;
|
Changes(true);
|
||||||
ListView.SelectedIndexCollection indexes = LuaListView.SelectedIndices;
|
ListView.SelectedIndexCollection indexes = LuaListView.SelectedIndices;
|
||||||
if (indexes.Count > 0)
|
if (indexes.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (int index in indexes)
|
foreach (int index in indexes)
|
||||||
{
|
{
|
||||||
luaList.Remove(luaList[indexes[0]]); //index[0] used since each iteration will make this the correct list index
|
luaList.Remove(luaList[indexes[0]]); //index[0] used since each iteration will make this the correct list index
|
||||||
}
|
}
|
||||||
indexes.Clear();
|
indexes.Clear();
|
||||||
DisplayLuaList();
|
DisplayLuaList();
|
||||||
}
|
}
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +460,7 @@ namespace BizHawk.MultiClient
|
||||||
luaList.Add(f);
|
luaList.Add(f);
|
||||||
DisplayLuaList();
|
DisplayLuaList();
|
||||||
LuaListView.Refresh();
|
LuaListView.Refresh();
|
||||||
changes = true;
|
Changes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertSeperatorToolStripMenuItem1_Click(object sender, EventArgs e)
|
private void insertSeperatorToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||||
|
@ -470,7 +481,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
//Note: here it will get flagged many times redundantly potentially,
|
//Note: here it will get flagged many times redundantly potentially,
|
||||||
//but this avoids it being flagged falsely when the user did not select an index
|
//but this avoids it being flagged falsely when the user did not select an index
|
||||||
changes = true;
|
Changes(true);
|
||||||
}
|
}
|
||||||
List<int> i = new List<int>();
|
List<int> i = new List<int>();
|
||||||
for (int z = 0; z < indexes.Count; z++)
|
for (int z = 0; z < indexes.Count; z++)
|
||||||
|
@ -502,7 +513,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
//Note: here it will get flagged many times redundantly potnetially,
|
//Note: here it will get flagged many times redundantly potnetially,
|
||||||
//but this avoids it being flagged falsely when the user did not select an index
|
//but this avoids it being flagged falsely when the user did not select an index
|
||||||
changes = true;
|
Changes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<int> i = new List<int>();
|
List<int> i = new List<int>();
|
||||||
|
@ -574,34 +585,34 @@ namespace BizHawk.MultiClient
|
||||||
return Validated;
|
return Validated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LuaConsole_DragDrop(object sender, DragEventArgs e)
|
private void LuaConsole_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Path.GetExtension(filePaths[0]) == (".lua") || Path.GetExtension(filePaths[0]) == (".txt"))
|
if (Path.GetExtension(filePaths[0]) == (".lua") || Path.GetExtension(filePaths[0]) == (".txt"))
|
||||||
{
|
{
|
||||||
LoadLuaFile(filePaths[0]);
|
LoadLuaFile(filePaths[0]);
|
||||||
DisplayLuaList();
|
DisplayLuaList();
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
}
|
}
|
||||||
else if (Path.GetExtension(filePaths[0]) == (".luases"))
|
else if (Path.GetExtension(filePaths[0]) == (".luases"))
|
||||||
{
|
{
|
||||||
LoadLuaSession(filePaths[0]);
|
LoadLuaSession(filePaths[0]);
|
||||||
RunLuaScripts();
|
RunLuaScripts();
|
||||||
DisplayLuaList();
|
DisplayLuaList();
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (ex.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
if (ex.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
||||||
{
|
{
|
||||||
AddText(ex.Message);
|
AddText(ex.Message);
|
||||||
}
|
}
|
||||||
else MessageBox.Show(ex.Message);
|
else MessageBox.Show(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LuaConsole_DragEnter(object sender, DragEventArgs e)
|
private void LuaConsole_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -635,16 +646,16 @@ namespace BizHawk.MultiClient
|
||||||
ListView.SelectedIndexCollection indexes = LuaListView.SelectedIndices;
|
ListView.SelectedIndexCollection indexes = LuaListView.SelectedIndices;
|
||||||
if (indexes.Count == 0)
|
if (indexes.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (indexes.Count > 0)
|
if (indexes.Count > 0)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < indexes.Count; x++)
|
for (int x = 0; x < indexes.Count; x++)
|
||||||
{
|
{
|
||||||
var item = luaList[indexes[x]];
|
var item = luaList[indexes[x]];
|
||||||
if (!item.IsSeparator)
|
if (!item.IsSeparator)
|
||||||
System.Diagnostics.Process.Start(luaList[indexes[x]].Path);
|
System.Diagnostics.Process.Start(luaList[indexes[x]].Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleScriptToolStripMenuItem_Click(object sender, EventArgs e)
|
private void toggleScriptToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
@ -736,7 +747,7 @@ namespace BizHawk.MultiClient
|
||||||
var file = new FileInfo(path);
|
var file = new FileInfo(path);
|
||||||
if (file.Exists == false) return false;
|
if (file.Exists == false) return false;
|
||||||
|
|
||||||
ClearOutput();
|
ClearOutput();
|
||||||
StopAllScripts();
|
StopAllScripts();
|
||||||
luaList = new List<LuaFile>();
|
luaList = new List<LuaFile>();
|
||||||
|
|
||||||
|
@ -777,8 +788,8 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Global.Config.RecentLuaSession.Add(path);
|
Global.Config.RecentLuaSession.Add(path);
|
||||||
currentSessionFile = path;
|
currentSessionFile = path;
|
||||||
changes = false;
|
Changes(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,7 +809,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
OpenLuaSession();
|
OpenLuaSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// resumes suspended coroutines
|
/// resumes suspended coroutines
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -807,23 +818,23 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
foreach (var s in luaList)
|
foreach (var s in luaList)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (s.Enabled && s.Thread != null && !s.Paused)
|
if (s.Enabled && s.Thread != null && !s.Paused)
|
||||||
{
|
{
|
||||||
bool prohibit = false;
|
bool prohibit = false;
|
||||||
if (s.FrameWaiting && !includeFrameWaiters)
|
if (s.FrameWaiting && !includeFrameWaiters)
|
||||||
prohibit = true;
|
prohibit = true;
|
||||||
|
|
||||||
if (prohibit) continue;
|
if (prohibit) continue;
|
||||||
var result = LuaImp.ResumeScript(s.Thread);
|
var result = LuaImp.ResumeScript(s.Thread);
|
||||||
s.FrameWaiting = result.WaitForFrame;
|
s.FrameWaiting = result.WaitForFrame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
MessageBox.Show("");
|
MessageBox.Show("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,7 +910,7 @@ namespace BizHawk.MultiClient
|
||||||
currentSessionFile = file.FullName;
|
currentSessionFile = file.FullName;
|
||||||
AddText('\n' + Path.GetFileName(currentSessionFile) + " saved.");
|
AddText('\n' + Path.GetFileName(currentSessionFile) + " saved.");
|
||||||
Global.Config.RecentLuaSession.Add(file.FullName);
|
Global.Config.RecentLuaSession.Add(file.FullName);
|
||||||
changes = false;
|
Changes(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,7 +936,7 @@ namespace BizHawk.MultiClient
|
||||||
sw.WriteLine(str);
|
sw.WriteLine(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
changes = false;
|
Changes(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -992,8 +1003,8 @@ namespace BizHawk.MultiClient
|
||||||
DisplayLuaList();
|
DisplayLuaList();
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
//ClearOutput();
|
//ClearOutput();
|
||||||
currentSessionFile = file;
|
currentSessionFile = file;
|
||||||
changes = false;
|
Changes(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1045,9 +1056,9 @@ namespace BizHawk.MultiClient
|
||||||
if (indexes.Count > 0)
|
if (indexes.Count > 0)
|
||||||
{
|
{
|
||||||
scriptToolStripMenuItem.DropDownItems[1].Enabled = true;
|
scriptToolStripMenuItem.DropDownItems[1].Enabled = true;
|
||||||
scriptToolStripMenuItem.DropDownItems[2].Enabled = true;
|
scriptToolStripMenuItem.DropDownItems[2].Enabled = true;
|
||||||
scriptToolStripMenuItem.DropDownItems[3].Enabled = true;
|
scriptToolStripMenuItem.DropDownItems[3].Enabled = true;
|
||||||
scriptToolStripMenuItem.DropDownItems[4].Enabled = true;
|
scriptToolStripMenuItem.DropDownItems[4].Enabled = true;
|
||||||
scriptToolStripMenuItem.DropDownItems[7].Enabled = true;
|
scriptToolStripMenuItem.DropDownItems[7].Enabled = true;
|
||||||
scriptToolStripMenuItem.DropDownItems[8].Enabled = true;
|
scriptToolStripMenuItem.DropDownItems[8].Enabled = true;
|
||||||
|
|
||||||
|
@ -1064,12 +1075,12 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scriptToolStripMenuItem.DropDownItems[1].Enabled = false;
|
scriptToolStripMenuItem.DropDownItems[1].Enabled = false;
|
||||||
scriptToolStripMenuItem.DropDownItems[2].Enabled = false;
|
scriptToolStripMenuItem.DropDownItems[2].Enabled = false;
|
||||||
scriptToolStripMenuItem.DropDownItems[3].Enabled = false;
|
scriptToolStripMenuItem.DropDownItems[3].Enabled = false;
|
||||||
scriptToolStripMenuItem.DropDownItems[4].Enabled = false;
|
scriptToolStripMenuItem.DropDownItems[4].Enabled = false;
|
||||||
scriptToolStripMenuItem.DropDownItems[7].Enabled = false;
|
scriptToolStripMenuItem.DropDownItems[7].Enabled = false;
|
||||||
scriptToolStripMenuItem.DropDownItems[8].Enabled = false;
|
scriptToolStripMenuItem.DropDownItems[8].Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (luaList.Count > 0)
|
if (luaList.Count > 0)
|
||||||
|
@ -1098,7 +1109,7 @@ namespace BizHawk.MultiClient
|
||||||
contextMenuStrip1.Items[0].Enabled = true;
|
contextMenuStrip1.Items[0].Enabled = true;
|
||||||
contextMenuStrip1.Items[1].Enabled = true;
|
contextMenuStrip1.Items[1].Enabled = true;
|
||||||
contextMenuStrip1.Items[2].Enabled = true;
|
contextMenuStrip1.Items[2].Enabled = true;
|
||||||
contextMenuStrip1.Items[3].Enabled = true;
|
contextMenuStrip1.Items[3].Enabled = true;
|
||||||
|
|
||||||
bool allSeparators = true;
|
bool allSeparators = true;
|
||||||
for (int i = 0; i < indexes.Count; i++)
|
for (int i = 0; i < indexes.Count; i++)
|
||||||
|
@ -1116,7 +1127,7 @@ namespace BizHawk.MultiClient
|
||||||
contextMenuStrip1.Items[0].Enabled = false;
|
contextMenuStrip1.Items[0].Enabled = false;
|
||||||
contextMenuStrip1.Items[1].Enabled = false;
|
contextMenuStrip1.Items[1].Enabled = false;
|
||||||
contextMenuStrip1.Items[2].Enabled = false;
|
contextMenuStrip1.Items[2].Enabled = false;
|
||||||
contextMenuStrip1.Items[3].Enabled = true;
|
contextMenuStrip1.Items[3].Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (luaRunning)
|
if (luaRunning)
|
||||||
|
@ -1141,40 +1152,40 @@ namespace BizHawk.MultiClient
|
||||||
Global.Config.AutoLoadLuaSession ^= true;
|
Global.Config.AutoLoadLuaSession ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripButton1_Click(object sender, EventArgs e)
|
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TogglePause();
|
TogglePause();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TogglePause()
|
private void TogglePause()
|
||||||
{
|
{
|
||||||
ListView.SelectedIndexCollection indexes = LuaListView.SelectedIndices;
|
ListView.SelectedIndexCollection indexes = LuaListView.SelectedIndices;
|
||||||
if (indexes.Count > 0)
|
if (indexes.Count > 0)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < indexes.Count; x++)
|
for (int x = 0; x < indexes.Count; x++)
|
||||||
{
|
{
|
||||||
var item = luaList[indexes[x]];
|
var item = luaList[indexes[x]];
|
||||||
if(!item.IsSeparator)
|
if (!item.IsSeparator)
|
||||||
item.TogglePause();
|
item.TogglePause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LuaListView.Refresh();
|
LuaListView.Refresh();
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pauseResumeToolStripMenuItem_Click(object sender, EventArgs e)
|
private void pauseResumeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TogglePause();
|
TogglePause();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripButton1_Click_1(object sender, EventArgs e)
|
private void toolStripButton1_Click_1(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TogglePause();
|
TogglePause();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resumePauseToolStripMenuItem_Click(object sender, EventArgs e)
|
private void resumePauseToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TogglePause();
|
TogglePause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue