Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ================================================================================================
- Clear Button :
- webBrowser1.Document.InvokeScript("SetText", new object[]
- {
- ""
- });
- ================================================================================================
- Execute Button :
- HtmlDocument document = webBrowser1.Document;
- string scriptName = "GetText";
- object[] args = new string[0];
- object obj = document.InvokeScript(scriptName, args);
- string script = obj.ToString();
- api.SendLimitedLuaScript(script);
- ================================================================================================
- Open File Dialog :
- OpenFileDialog ofd = new OpenFileDialog();
- ofd.Filter = "Txt Files (*.txt)|*.txt|Lua Files (*.lua)|*.lua|All Files (*.*)|*.*";
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- string mofd = File.ReadAllText(ofd.FileName);
- webBrowser1.Document.InvokeScript("SetText", new object[]
- {
- mofd
- });
- }
- ==================================================================================
- Load :
- if (this.listBox1.SelectedIndex != -1)
- {
- this.webBrowser1.Document.InvokeScript("SetText", new object[1]
- {
- (object) System.IO.File.ReadAllText("scripts\\" + this.listBox1.SelectedItem.ToString())
- });
- }
- else
- {
- int num = (int)MessageBox.Show("Please select a script from the list before trying to loading it in tab.", "Name");
- }
- ================================================================================================
- Execute :
- if(this.listBox1.SelectedIndex != -1)
- {
- api.SendLimitedLuaScript(System.IO.File.ReadAllText("scripts\\" + this.listBox1.SelectedItem.ToString()));
- }
- ================================================================================================
- Refresh :
- listBox1.Items.Clear();//Clear Items in the LuaScriptList
- Functions.PopulateListBox(listBox1, "./Scripts", "*.txt");
- Functions.PopulateListBox(listBox1, "./Scripts", "*.lua");
- ================================================================================================
- 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);
- }
- }
- ================================================================================================
- Save File Dialog :
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.Filter = "Txt Files (*.txt)|*.txt|Lua Files (*.lua)|*.lua|All Files (*.*)|*.*";
- if (sfd.ShowDialog() == DialogResult.OK)
- {
- Stream s = sfd.OpenFile();
- StreamWriter sw = new StreamWriter(s);
- sw.Write(webBrowser1.Document.InvokeScript("GetText", new object[0]));
- sw.Close();
- s.Close();
- }
- ================================================================================================
- Main :
- WebClient wc = new WebClient();
- wc.Proxy = null;
- try
- {
- RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
- string friendlyName = AppDomain.CurrentDomain.FriendlyName;
- bool flag2 = registryKey.GetValue(friendlyName) == null;
- if (flag2)
- {
- registryKey.SetValue(friendlyName, 11001, RegistryValueKind.DWord);
- }
- registryKey = null;
- friendlyName = null;
- }
- catch (Exception)
- {
- }
- webBrowser1.Url = new Uri(string.Format("file:///{0}/Bin/Monaco/Monaco.html", Directory.GetCurrentDirectory()));
- ================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement