Advertisement
Charliezkie

C# Monaco Code

Jul 29th, 2019
3,827
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.39 KB | None | 0 0
  1. ================================================================================================
  2. Clear Button :
  3. webBrowser1.Document.InvokeScript("SetText", new object[]
  4.             {
  5.                 ""
  6.             });
  7. ================================================================================================
  8. Execute Button :
  9. HtmlDocument document = webBrowser1.Document;
  10.                 string scriptName = "GetText";
  11.                 object[] args = new string[0];
  12.                 object obj = document.InvokeScript(scriptName, args);
  13.                 string script = obj.ToString();
  14.                 api.SendLimitedLuaScript(script);
  15. ================================================================================================
  16. Open File Dialog :
  17. OpenFileDialog ofd = new OpenFileDialog();
  18.             ofd.Filter = "Txt Files (*.txt)|*.txt|Lua Files (*.lua)|*.lua|All Files (*.*)|*.*";
  19.            
  20.             if (ofd.ShowDialog() == DialogResult.OK)
  21.             {
  22.                 string mofd = File.ReadAllText(ofd.FileName);
  23.                 webBrowser1.Document.InvokeScript("SetText", new object[]
  24.                 {
  25.                     mofd
  26.                 });
  27.             }
  28. ==================================================================================
  29. Load :
  30. if (this.listBox1.SelectedIndex != -1)
  31.             {
  32.                 this.webBrowser1.Document.InvokeScript("SetText", new object[1]
  33.                 {
  34.           (object) System.IO.File.ReadAllText("scripts\\" + this.listBox1.SelectedItem.ToString())
  35.                 });
  36.             }
  37.             else
  38.             {
  39.                 int num = (int)MessageBox.Show("Please select a script from the list before trying to loading it in tab.", "Name");
  40.             }
  41. ================================================================================================
  42. Execute :
  43. if(this.listBox1.SelectedIndex != -1)
  44.             {
  45.                 api.SendLimitedLuaScript(System.IO.File.ReadAllText("scripts\\" + this.listBox1.SelectedItem.ToString()));
  46.             }
  47. ================================================================================================
  48. Refresh :
  49. listBox1.Items.Clear();//Clear Items in the LuaScriptList
  50.             Functions.PopulateListBox(listBox1, "./Scripts", "*.txt");
  51.             Functions.PopulateListBox(listBox1, "./Scripts", "*.lua");
  52. ================================================================================================
  53. Functions :
  54. public static void PopulateListBox(ListBox lsb, string Folder, string FileType)
  55.         {
  56.             DirectoryInfo dinfo = new DirectoryInfo(Folder);
  57.             FileInfo[] Files = dinfo.GetFiles(FileType);
  58.             foreach (FileInfo file in Files)
  59.             {
  60.                 lsb.Items.Add(file.Name);
  61.             }
  62.         }
  63. ================================================================================================
  64. Save File Dialog :
  65. SaveFileDialog sfd = new SaveFileDialog();
  66.             sfd.Filter = "Txt Files (*.txt)|*.txt|Lua Files (*.lua)|*.lua|All Files (*.*)|*.*";
  67.  
  68.             if (sfd.ShowDialog() == DialogResult.OK)
  69.             {
  70.                 Stream s = sfd.OpenFile();
  71.                 StreamWriter sw = new StreamWriter(s);
  72.                 sw.Write(webBrowser1.Document.InvokeScript("GetText", new object[0]));
  73.                 sw.Close();
  74.                 s.Close();
  75.             }
  76. ================================================================================================
  77. Main :
  78. WebClient wc = new WebClient();
  79.             wc.Proxy = null;
  80.             try
  81.             {
  82.                 RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
  83.                 string friendlyName = AppDomain.CurrentDomain.FriendlyName;
  84.                 bool flag2 = registryKey.GetValue(friendlyName) == null;
  85.                 if (flag2)
  86.                 {
  87.                     registryKey.SetValue(friendlyName, 11001, RegistryValueKind.DWord);
  88.                 }
  89.                 registryKey = null;
  90.                 friendlyName = null;
  91.             }
  92.             catch (Exception)
  93.             {
  94.             }
  95.             webBrowser1.Url = new Uri(string.Format("file:///{0}/Bin/Monaco/Monaco.html", Directory.GetCurrentDirectory()));
  96. ================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement