Advertisement
PareX

Advanced Code

May 29th, 2019
19,887
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1.  
  2. List Box:
  3. => fastColoredTextBox1.Text = File.ReadAllText($"./Scripts/{listBox1.SelectedItem}");
  4.  
  5. Refresh Code :
  6.  
  7. listBox1.Items.Clear();//Clear Items in the LuaScriptList
  8.             Functions.PopulateListBox(listBox1, "./Scripts", "*.txt");
  9.             Functions.PopulateListBox(listBox1, "./Scripts", "*.lua");
  10.  
  11.  
  12. Code to put into Functions :
  13.  
  14. public static void PopulateListBox(ListBox lsb, string Folder, string FileType)
  15.         {
  16.             DirectoryInfo dinfo = new DirectoryInfo(Folder);
  17.             FileInfo[] Files = dinfo.GetFiles(FileType);
  18.             foreach (FileInfo file in Files)
  19.             {
  20.                 lsb.Items.Add(file.Name);
  21.             }
  22.         }
  23.  
  24.  
  25. Execute Button :
  26.  
  27.   if (NamedPipes.NamedPipeExist(NamedPipes.luapipename))
  28.             {
  29.                 NamedPipes.LuaPipe(fastColoredTextBox1.Text);
  30.             }
  31.             else
  32.             {
  33.                 MessageBox.Show("Please Attach First", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
  34.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement