private void UpdateDialog() { LuaListView.RowCount = LuaImp.ScriptList.Count; LuaListView.Refresh(); UpdateNumberOfScripts(); UpdateRegisteredFunctionsDialog(); }
public void UpdateDialog() { LuaListView.ItemCount = _luaList.Count; LuaListView.Refresh(); UpdateNumberOfScripts(); UpdateRegisteredFunctionsDialog(); }
private void ToggleScriptMenuItem_Click(object sender, EventArgs e) { var files = !SelectedFiles.Any() && Global.Config.ToggleAllIfNoneSelected ? _luaList : SelectedFiles; foreach (var item in files) { item.Toggle(); if (item.Enabled && item.Thread == null) { try { LuaSandbox.Sandbox(() => { item.Thread = LuaImp.SpawnCoroutine(item.Path); }, () => { item.State = LuaFile.RunState.Disabled; }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else if (!item.Enabled && item.Thread != null) { LuaImp.CallExitEvent(item.Thread); var items = SelectedItems.ToList(); foreach (var sitem in items) { var temp = sitem; var functions = LuaImp.RegisteredFunctions.Where(x => x.Lua == temp.Thread).ToList(); foreach (var function in functions) { LuaImp.RegisteredFunctions.Remove(function); } UpdateRegisteredFunctionsDialog(); } LuaImp.CallExitEvent(item.Thread); item.Stop(); if (Global.Config.RemoveRegisteredFunctionsOnToggle) { GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.ClearAll(); } } } UpdateDialog(); UpdateNumberOfScripts(); LuaListView.Refresh(); }
private void ToggleScriptMenuItem_Click(object sender, EventArgs e) { var files = !SelectedFiles.Any() && Global.Config.ToggleAllIfNoneSelected ? LuaImp.ScriptList : SelectedFiles; foreach (var file in files) { file.Toggle(); if (file.Enabled && file.Thread == null) { EnableLuaFile(file); } else if (!file.Enabled && file.Thread != null) { LuaImp.CallExitEvent(file); var items = SelectedItems.ToList(); foreach (var sitem in items) { var temp = sitem; var functions = LuaImp.GetRegisteredFunctions().Where(lf => lf.Lua == temp.Thread).ToList(); foreach (var function in functions) { LuaImp.GetRegisteredFunctions().Remove(function); } UpdateRegisteredFunctionsDialog(); } LuaImp.CallExitEvent(file); file.Stop(); if (Global.Config.RemoveRegisteredFunctionsOnToggle) { LuaImp.GetRegisteredFunctions().ClearAll(); } } } UpdateDialog(); UpdateNumberOfScripts(); LuaListView.Refresh(); }
private void ToggleScriptMenuItem_Click(object sender, EventArgs e) { var files = !SelectedFiles.Any() && Global.Config.ToggleAllIfNoneSelected ? _luaList : SelectedFiles; foreach (var item in files) { item.Toggle(); if (item.Enabled && item.Thread == null) { try { LuaSandbox.Sandbox(null, () => { string pathToLoad = Path.IsPathRooted(item.Path) ? item.Path : PathManager.MakeProgramRelativePath(item.Path); //JUNIPIER SQUATCHBOX COMPLEX item.Thread = LuaImp.SpawnCoroutine(pathToLoad); LuaSandbox.CreateSandbox(item.Thread, Path.GetDirectoryName(pathToLoad)); }, () => { item.State = LuaFile.RunState.Disabled; }); } catch (IOException) { ConsoleLog("Unable to access file " + item.Path); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else if (!item.Enabled && item.Thread != null) { LuaImp.CallExitEvent(item.Thread); var items = SelectedItems.ToList(); foreach (var sitem in items) { var temp = sitem; var functions = LuaImp.RegisteredFunctions.Where(x => x.Lua == temp.Thread).ToList(); foreach (var function in functions) { LuaImp.RegisteredFunctions.Remove(function); } UpdateRegisteredFunctionsDialog(); } LuaImp.CallExitEvent(item.Thread); item.Stop(); if (Global.Config.RemoveRegisteredFunctionsOnToggle) { GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.ClearAll(); } } } UpdateDialog(); UpdateNumberOfScripts(); LuaListView.Refresh(); }
private void ToggleScriptMenuItem_Click(object sender, EventArgs e) { var files = !SelectedFiles.Any() && Global.Config.ToggleAllIfNoneSelected ? LuaImp.ScriptList : SelectedFiles; foreach (var item in files) { item.Toggle(); if (item.Enabled && item.Thread == null) { try { LuaSandbox.Sandbox(null, () => { string pathToLoad = Path.IsPathRooted(item.Path) ? item.Path : PathManager.MakeProgramRelativePath(item.Path); item.Thread = LuaImp.SpawnCoroutine(pathToLoad); LuaSandbox.CreateSandbox(item.Thread, Path.GetDirectoryName(pathToLoad)); }, () => { item.State = LuaFile.RunState.Disabled; }); // Shenanigans // We want any gui.text messages from a script to immediately update even when paused GlobalWin.OSD.ClearGUIText(); GlobalWin.Tools.UpdateToolsAfter(); LuaImp.EndLuaDrawing(); LuaImp.StartLuaDrawing(); } catch (IOException) { ConsoleLog("Unable to access file " + item.Path); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else if (!item.Enabled && item.Thread != null) { LuaImp.CallExitEvent(item.Thread); var items = SelectedItems.ToList(); foreach (var sitem in items) { var temp = sitem; var functions = LuaImp.RegisteredFunctions.Where(lf => lf.Lua == temp.Thread).ToList(); foreach (var function in functions) { LuaImp.RegisteredFunctions.Remove(function); } UpdateRegisteredFunctionsDialog(); } LuaImp.CallExitEvent(item.Thread); item.Stop(); if (Global.Config.RemoveRegisteredFunctionsOnToggle) { LuaImp.RegisteredFunctions.ClearAll(); } } } UpdateDialog(); UpdateNumberOfScripts(); LuaListView.Refresh(); }