From 35f42b94f3985e11a75a11cf8ac6de734e462f33 Mon Sep 17 00:00:00 2001 From: rolanmen1 Date: Sun, 25 Mar 2012 14:51:35 +0000 Subject: [PATCH] Dragging A Lua Session Now Works. Script Errors From Dragging Sessions Now Appears In The Output Box. --- BizHawk.MultiClient/tools/LuaConsole.cs | 45 +++++++++++++++---------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/BizHawk.MultiClient/tools/LuaConsole.cs b/BizHawk.MultiClient/tools/LuaConsole.cs index 7237458dc7..4e34335114 100644 --- a/BizHawk.MultiClient/tools/LuaConsole.cs +++ b/BizHawk.MultiClient/tools/LuaConsole.cs @@ -548,23 +548,34 @@ namespace BizHawk.MultiClient return Validated; } - private void LuaConsole_DragDrop(object sender, DragEventArgs e) - { - string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); - if (Path.GetExtension(filePaths[0]) == (".lua") || Path.GetExtension(filePaths[0]) == (".txt")) - { - LoadLuaFile(filePaths[0]); - DisplayLuaList(); - UpdateNumberOfScripts(); - } - else if (Path.GetExtension(filePaths[0]) == (".luases")) - { - LoadLuaSession(filePaths[0]); - DisplayLuaList(); - UpdateNumberOfScripts(); - //ClearOutput(); - } - } + private void LuaConsole_DragDrop(object sender, DragEventArgs e) + { + string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); + try + { + if (Path.GetExtension(filePaths[0]) == (".lua") || Path.GetExtension(filePaths[0]) == (".txt")) + { + LoadLuaFile(filePaths[0]); + DisplayLuaList(); + UpdateNumberOfScripts(); + } + else if (Path.GetExtension(filePaths[0]) == (".luases")) + { + LoadLuaSession(filePaths[0]); + RunLuaScripts(); + DisplayLuaList(); + UpdateNumberOfScripts(); + } + } + catch (Exception ex) + { + if (ex.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:") + { + AddText(ex.Message); + } + else MessageBox.Show(ex.Message); + } + } private void LuaConsole_DragEnter(object sender, DragEventArgs e) {