Exemplo n.º 1
0
 /// <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]);
     }
 }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
        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();
        }