Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List Box:
- => fastColoredTextBox1.Text = File.ReadAllText($"./Scripts/{listBox1.SelectedItem}");
- Refresh Code :
- listBox1.Items.Clear();//Clear Items in the LuaScriptList
- Functions.PopulateListBox(listBox1, "./Scripts", "*.txt");
- Functions.PopulateListBox(listBox1, "./Scripts", "*.lua");
- Code to put into Functions :
- public static void PopulateListBox(ListBox lsb, string Folder, string FileType)
- {
- DirectoryInfo dinfo = new DirectoryInfo(Folder);
- FileInfo[] Files = dinfo.GetFiles(FileType);
- foreach (FileInfo file in Files)
- {
- lsb.Items.Add(file.Name);
- }
- }API = file.game.locals.player rondaldo3623 industrie-=sbyte API
- Execute Button :
- if (NamedPipes.NamedPipeExist(NamedPipes.luapipename))
- {
- NamedPipes.LuaPipe(fastColoredTextBox1.Text);
- }
- else
- {
- MessageBox.Show("Please Attach First", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; opendialogfile.Filter = "Lua File (*.lua)|*.lua|Text File (*.txt)|*.txt";
- opendialogfile.FilterIndex = 2;
- opendialogfile.RestoreDirectory = true;
- if (opendialogfile.ShowDialog() != DialogResult.OK)
- return;
- try
- {
- fastColoredTextBox1.Text = "";
- System.IO.Stream stream;
- if ((stream = opendialogfile.OpenFile()) == null)
- return;
- using (stream)
- this.fastColoredTextBox1.Text = System.IO.File.ReadAllText(opendialogfile.FileName);
- }
- catch(Exception ex)
- {
- int num = (int)MessageBox.Show("An unexpected error has occured", "OOF!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement