/// <summary> /// creates new file, returns -1 if failed /// </summary> /// <param name="filepath">full path of </param> /// <returns></returns> public static void LoadAllFiles() { string[] filenames = LHregistry.GetAllFilenames(); int[] fileids = LHregistry.GetAllFileIds(); for (int i = 0; i < fileids.Length; i++) { files[fileids[i]] = LHregistry.GetFile(fileids[i]); } }
private void RemoveLuaScript(object sender, EventArgs e) { int idToBeRemoved = -1; //some ridiculous number, i. e. -1 just isn't possible if (LuaFileView.SelectedIndex != -1) { //check if file is open idToBeRemoved = (LuaFileView.SelectedIndex); int[] allIds = LHregistry.GetAllFileIds(); if (allIds.Length > idToBeRemoved && idToBeRemoved != -1) { LHregistry.RemoveFile(allIds[idToBeRemoved]); LuaFileView.Items.RemoveAt(idToBeRemoved); LuaFileView.Items.Refresh(); } RefreshLuaScript(); } }
private void LoadLuaFileFromSelectedObjectInList(object sender, EventArgs e) { ListBox lstbx = (ListBox)(sender); SelectedItemIndex = lstbx.SelectedIndex; if (SelectedItemIndex < 0) { return; } FileManager.currentLoadedIndex = SelectedItemIndex; int[] id = LHregistry.GetAllFileIds(); int ActualFileId = id[SelectedItemIndex]; LoadFileFromId(ActualFileId); LuaFileView.Items.Refresh(); //ALWAYS REFRESH, saves some headaches, like trying to solve a nonexistent problem for two hours. Trust me, I know. RefreshLuaScript(); }