Advertisement
ZEREF_PLAYZ

4 u big nipple man

Dec 14th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. List Box:
  2. => fastColoredTextBox1.Text = File.ReadAllText($"./Scripts/{listBox1.SelectedItem}");
  3.  
  4. Refresh Code :
  5.  
  6. listBox1.Items.Clear();//Clear Items in the LuaScriptList
  7. Functions.PopulateListBox(listBox1, "./Scripts", "*.txt");
  8. Functions.PopulateListBox(listBox1, "./Scripts", "*.lua");
  9.  
  10.  
  11. Code to put into Functions :
  12.  
  13. public static void PopulateListBox(ListBox lsb, string Folder, string FileType)
  14. {
  15. DirectoryInfo dinfo = new DirectoryInfo(Folder);
  16. FileInfo[] Files = dinfo.GetFiles(FileType);
  17. foreach (FileInfo file in Files)
  18. {
  19. lsb.Items.Add(file.Name);
  20. }
  21. }API = file.game.locals.player rondaldo3623 industrie-=sbyte API
  22.  
  23.  
  24. Execute Button :
  25.  
  26. if (NamedPipes.NamedPipeExist(NamedPipes.luapipename))
  27. {
  28. NamedPipes.LuaPipe(fastColoredTextBox1.Text);
  29. }
  30. else
  31. {
  32. MessageBox.Show("Please Attach First", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; opendialogfile.Filter = "Lua File (*.lua)|*.lua|Text File (*.txt)|*.txt";
  33. opendialogfile.FilterIndex = 2;
  34. opendialogfile.RestoreDirectory = true;
  35. if (opendialogfile.ShowDialog() != DialogResult.OK)
  36. return;
  37. try
  38. {
  39. fastColoredTextBox1.Text = "";
  40. System.IO.Stream stream;
  41. if ((stream = opendialogfile.OpenFile()) == null)
  42. return;
  43. using (stream)
  44. this.fastColoredTextBox1.Text = System.IO.File.ReadAllText(opendialogfile.FileName);
  45. }
  46. catch(Exception ex)
  47. {
  48. int num = (int)MessageBox.Show("An unexpected error has occured", "OOF!", MessageBoxButtons.OK, MessageBoxIcon.Information);
  49.  
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement