-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
440 lines (396 loc) · 15.1 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
// *****************************************************************************
//
// © Component Factory Pty Ltd 2012. All rights reserved.
// The software and associated documentation supplied hereunder are the
// proprietary information of Component Factory Pty Ltd, PO Box 1504,
// Glen Waverley, Vic 3150, Australia and are supplied subject to licence terms.
//
// Version 4.6.0.0 www.ComponentFactory.com
// *****************************************************************************
using System;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using ComponentFactory.Krypton.Toolkit;
using Microsoft.Win32;
using System.IO;
namespace KryptonFormExamples
{
public partial class Form1 : KryptonForm
{
public Form1()
{
InitializeComponent();
Home.BringToFront();
try
{
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
string friendlyName = AppDomain.CurrentDomain.FriendlyName;
if (registryKey.GetValue(friendlyName) == null)
{
registryKey.SetValue(friendlyName, 11001, RegistryValueKind.DWord);
}
this.webBrowser1.Url = new Uri(string.Format("file:///{0}/bin/Monaco.html", Application.StartupPath));
}
catch (Exception ex)
{
MessageBox.Show("Error loading Monaco Editor! Error: " + ex.Message + "\nThis error has been copied. Please send to Zesty.", "", MessageBoxButtons.OK);
Clipboard.SetText(ex.Message);
Application.ExitThread();
}
this.scriptBoxLoad();
}
private void scriptBoxLoad()
{
this.listBox1.Items.Clear();
DirectoryInfo directoryInfo = new DirectoryInfo(Application.StartupPath + "/scripts");
FileInfo[] files = directoryInfo.GetFiles("*.txt");
FileInfo[] files2 = directoryInfo.GetFiles("*.lua");
foreach (FileInfo fileInfo in files)
{
this.listBox1.Items.Add(fileInfo.Name);
}
foreach (FileInfo fileInfo2 in files2)
{
this.listBox1.Items.Add(fileInfo2.Name);
}
}
private void kryptonCheckSetPalettes_CheckedButtonChanged(object sender, EventArgs e)
{
// Recalc the non client size to reflect new border style
RecalcNonClient();
switch (kryptonCheckSetPalettes.CheckedIndex)
{
case 0:
kryptonManager.GlobalPaletteMode = PaletteModeManager.ProfessionalSystem;
break;
case 1:
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2007Black;
break;
case 2:
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2007Silver;
break;
case 3:
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2007Blue;
break;
case 4:
kryptonManager.GlobalPaletteMode = PaletteModeManager.ProfessionalOffice2003;
break;
case 5:
kryptonManager.GlobalPaletteMode = PaletteModeManager.SparkleBlue;
break;
case 6:
kryptonManager.GlobalPaletteMode = PaletteModeManager.SparkleOrange;
break;
case 7:
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2010Black;
break;
case 8:
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2010Silver;
break;
case 9:
kryptonManager.GlobalPaletteMode = PaletteModeManager.Office2010Blue;
break;
}
}
private void kryptonCheckSetStyles_CheckedButtonChanged(object sender, EventArgs e)
{
switch (kryptonCheckSetStyles.CheckedIndex)
{
case 0:
FormBorderStyle = FormBorderStyle.Sizable;
break;
case 1:
FormBorderStyle = FormBorderStyle.FixedToolWindow;
break;
case 2:
FormBorderStyle = FormBorderStyle.SizableToolWindow;
break;
case 3:
FormBorderStyle = FormBorderStyle.FixedDialog;
break;
case 4:
FormBorderStyle = FormBorderStyle.Fixed3D;
break;
case 5:
FormBorderStyle = FormBorderStyle.FixedSingle;
break;
case 6:
FormBorderStyle = FormBorderStyle.None;
break;
}
// Recalc the non client size to reflect new border style
RecalcNonClient();
}
private void Form1_Load(object sender, EventArgs e)
{
// Set correct initial checked button
if (KryptonManager.CurrentGlobalPalette == KryptonManager.PaletteOffice2007Black)
kryptonCheckSetPalettes.CheckedIndex = 1;
//// Setup the property grid to edit this form
//propertyGrid.SelectedObject = new KryptonFormProxy(this);
}
private void kryptonOffice2007Blue_Click(object sender, EventArgs e)
{
}
private void sixToolStripMenuItem_Click(object sender, EventArgs e)
{
Setting.BringToFront();
}
private void kryptonHeaderGroup1_Paint(object sender, PaintEventArgs e)
{
}
private void kryptonHeaderGroup1_Panel_Paint(object sender, PaintEventArgs e)
{
}
private void kryptonCheckButton5_Click(object sender, EventArgs e)
{
Home.BringToFront();
}
private void newToolStripButton_Click(object sender, EventArgs e)
{
//Execute ur shit
HtmlDocument document = this.webBrowser1.Document;
string scriptName = "GetText";
object[] array = new string[0];
object[] args = array;
string script = document.InvokeScript(scriptName, args).ToString();
new WeAreDevs_API.ExploitAPI().SendLuaScript(script);
}
private void printToolStripButton_Click(object sender, EventArgs e)
{
this.webBrowser1.Document.InvokeScript("SetText", new object[]
{
""
});
}
private void saveToolStripButton_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Lua File (*.lua)|*.lua|Text File (*.txt)|*.txt";
saveFileDialog.Title = "Save Script";
if (saveFileDialog.ShowDialog() != DialogResult.OK)
{
return;
}
try
{
HtmlDocument document = this.webBrowser1.Document;
string scriptName = "GetText";
object[] array = new string[0];
object[] args = array;
string value = document.InvokeScript(scriptName, args).ToString();
StreamWriter streamWriter = new StreamWriter(File.Create(saveFileDialog.FileName));
streamWriter.Write(value);
streamWriter.Dispose();
}
catch
{
MessageBox.Show("An unexpected error occured!", "Oof");
}
}
private OpenFileDialog open = new OpenFileDialog
{
Filter = "Lua Script (*.txt)|*.txt|Lua Script (*.lua)|*.lua",
FilterIndex = 1,
Title = "Open Script"
};
private void openToolStripButton_Click(object sender, EventArgs e)
{
if (this.open.ShowDialog() == DialogResult.OK)
{
string text = File.ReadAllText(this.open.FileName);
HtmlDocument document = this.webBrowser1.Document;
string scriptName = "SetText";
object[] array = new string[]
{
text
};
object[] args = array;
document.InvokeScript(scriptName, args);
}
}
private void cutToolStripButton_Click(object sender, EventArgs e)
{
HtmlDocument document = this.webBrowser1.Document;
string scriptName = "GetText";
object[] array = new string[0];
object[] args = array;
string script = document.InvokeScript(scriptName, args).ToString();
Clipboard.SetText(script);
this.webBrowser1.Document.InvokeScript("SetText", new object[]
{
""
});
}
private void copyToolStripButton_Click(object sender, EventArgs e)
{
HtmlDocument document = this.webBrowser1.Document;
string scriptName = "GetText";
object[] array = new string[0];
object[] args = array;
string script = document.InvokeScript(scriptName, args).ToString();
Clipboard.SetText(script);
}
private void pasteToolStripButton_Click(object sender, EventArgs e)
{
string text = Clipboard.GetText();
HtmlDocument document = this.webBrowser1.Document;
string scriptName = "SetText";
object[] array = new string[]
{
text
};
object[] args = array;
document.InvokeScript(scriptName, args);
}
private void listBox1_DoubleClick(object sender, EventArgs e)
{
object selectedItem = this.listBox1.SelectedItem;
if (selectedItem != null)
{
if (File.Exists(Application.StartupPath + "\\scripts\\" + selectedItem.ToString()))
{
string text = File.ReadAllText(Application.StartupPath + "\\scripts\\" + selectedItem.ToString());
HtmlDocument document = this.webBrowser1.Document;
string scriptName = "SetText";
object[] array = new string[]
{
text
};
object[] args = array;
document.InvokeScript(scriptName, args);
return;
}
this.listBox1.Items.Remove(this.listBox1.SelectedItem);
}
}
}
public class KryptonFormProxy
{
private KryptonForm _form;
public KryptonFormProxy(KryptonForm form)
{
_form = form;
}
[Category("Appearance")]
[Description("The text associated with the control.")]
[DefaultValue("")]
public string Text
{
get { return _form.Text; }
set { _form.Text = value; }
}
[Category("Appearance")]
[Description("The extra text associated with the control.")]
[DefaultValue("")]
public string TextExtra
{
get { return _form.TextExtra; }
set { _form.TextExtra = value; }
}
[Category("Appearance")]
[Description("The icon associated with the control.")]
[DefaultValue("")]
public Icon Icon
{
get { return _form.Icon; }
set { _form.Icon = value; }
}
[Category("Visuals")]
[Description("Should custom chrome be allowed for this KryptonForm instance.")]
[DefaultValue(true)]
public bool AllowFormChrome
{
get { return _form.AllowFormChrome; }
set { _form.AllowFormChrome = value; }
}
[Category("Visuals")]
[Description("Should the form status strip be considered for merging into chrome.")]
[DefaultValue(true)]
public bool AllowStatusStripMerge
{
get { return _form.AllowStatusStripMerge; }
set { _form.AllowStatusStripMerge = value; }
}
[Category("Visuals")]
[Description("Header style for a main form.")]
[DefaultValue(typeof(HeaderStyle), "Form")]
public HeaderStyle HeaderStyle
{
get { return _form.HeaderStyle; }
set { _form.HeaderStyle = value; }
}
[Category("Visuals")]
[Description("Chrome group border style.")]
[DefaultValue(typeof(PaletteBorderStyle), "FormMain")]
public PaletteBorderStyle GroupBorderStyle
{
get { return _form.GroupBorderStyle; }
set { _form.GroupBorderStyle = value; }
}
[Category("Visuals")]
[Description("Chrome group background style.")]
[DefaultValue(typeof(PaletteBackStyle), "FormMain")]
public PaletteBackStyle GroupBackStyle
{
get { return _form.GroupBackStyle; }
set { _form.GroupBackStyle = value; }
}
[Category("Visuals")]
[Description("Overrides for defining common form appearance that other states can override.")]
public PaletteFormRedirect StateCommon
{
get { return _form.StateCommon; }
}
[Category("Visuals")]
[Description("Overrides for defining inactive form appearance.")]
public PaletteForm StateInactive
{
get { return _form.StateInactive; }
}
[Category("Visuals")]
[Description("Overrides for defining active form appearance.")]
public PaletteForm StateActive
{
get { return _form.StateActive; }
}
[Category("Visuals")]
[Description("Collection of button specifications.")]
public KryptonForm.FormButtonSpecCollection ButtonSpecs
{
get { return _form.ButtonSpecs; }
}
[Category("Window Style")]
[DefaultValue(true)]
public bool ControlBox
{
get { return _form.ControlBox; }
set { _form.ControlBox = value; }
}
[Category("Window Style")]
[DefaultValue(true)]
public bool MaximizeBox
{
get { return _form.MaximizeBox; }
set { _form.MaximizeBox = value; }
}
[Category("Window Style")]
[DefaultValue(true)]
public bool MinimizeBox
{
get { return _form.MinimizeBox; }
set { _form.MinimizeBox = value; }
}
[Category("Window Style")]
[DefaultValue(true)]
public bool ShowIcon
{
get { return _form.ShowIcon; }
set { _form.ShowIcon = value; }
}
}
}