-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cs
825 lines (758 loc) · 32.9 KB
/
Main.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
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
using System;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using CliWrap;
using SteamAppIdIdentifier;
using Clipboard = System.Windows.Forms.Clipboard;
using DataFormats = System.Windows.DataFormats;
using DragDropEffects = System.Windows.Forms.DragDropEffects;
using Timer = System.Windows.Forms.Timer;
namespace APPID
{
public partial class SteamAppId : Form
{
protected DataTableGeneration dataTableGeneration;
public static int CurrentCell = 0;
public static string APPDATA = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
public SteamAppId()
{
dataTableGeneration = new DataTableGeneration();
Task.Run(async () => await dataTableGeneration.GetDataTableAsync(dataTableGeneration)).Wait();
InitializeComponent();
}
public static void Tit(string Message)
{
Program.form.Text = Message;
}
public static void Tat(string Message)
{
Program.form.currDIrText.Text = $"Path: {Message}";
}
public static bool VRLExists = false;
public static string RemoveSpecialCharacters(string str)
{
return Regex.Replace(str, "[^a-zA-Z0-9._0-]+", " ", RegexOptions.Compiled);
}
public async void SteamAppId_Load(object sender, EventArgs e)
{
OpenOnFinish.Checked = Properties.Settings.Default.OpenDir;
if (Properties.Settings.Default.Pinned)
{
this.TopMost = true;
unPin.BringToFront();
}
if (Properties.Settings.Default.Goldy)
{
dllSelect.SelectedIndex = 0;
}
else
{
dllSelect.SelectedIndex = 1;
}
Tit("Checking for Internet... ");
bool check = Updater.CheckForNet();
if (check)
{
Tit("Checking for Steamless update...");
await Updater.CheckGitHubNewerVersion("atom0s", "Steamless", "https://api.github.com/repos");
Tit("Checking for Goldberg update...");
Updater.UpdateGoldBerg();
Tit("Select directory...");
}
t1 = new Timer();
t1.Tick += new EventHandler(t1_Tick);
t1.Interval = 1000;
if (Directory.Exists($"{APPDATA}\\VRL"))
{
VRLExists = true;
}
this.TopMost = true;
string args3;
dataGridView1.DataSource = dataTableGeneration.DataTableToGenerate;
dataGridView1.MultiSelect = false;
string args2 = "";
dataGridView1.Columns[0].Width = 540;
if (args2 != null)
{
foreach (string args1 in Program.args2)
{
args3 = RemoveSpecialCharacters(args1);
args2 += args3 + " ";
}
try
{
string Search = RemoveSpecialCharacters(args2.ToLower());
((DataTable)dataGridView1.DataSource).DefaultView.RowFilter = String.Format("Name like '%" + Search.Replace(" ", "%' AND Name LIKE '%").Replace(" and ", " ").Replace(" the ", " ").Replace(":", "") + "%'"); if (dataGridView1.Rows[0].Cells[1].Value.ToString() != null)
if (!String.IsNullOrEmpty(dataGridView1.Rows[0].Cells[1].Value.ToString()))
Clipboard.SetText($"{dataGridView1.Rows[0].Cells[1].Value.ToString()}");
if (String.IsNullOrWhiteSpace(dataGridView1.Rows[0].Cells[1].Value.ToString()))
{
dataTableGeneration = new DataTableGeneration();
Task.Run(async () => await dataTableGeneration.GetDataTableAsync(dataTableGeneration)).Wait();
dataGridView1.DataSource = dataTableGeneration.DataTableToGenerate;
}
}
catch { }
searchTextBox.Text = "";
}
dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
dataGridView1.ClearSelection();
dataGridView1.DefaultCellStyle.SelectionBackColor = dataGridView1.DefaultCellStyle.BackColor;
dataGridView1.DefaultCellStyle.SelectionForeColor = dataGridView1.DefaultCellStyle.ForeColor;
}
private void btnSearch_Click(object sender, EventArgs e)
{
searchTextBox.Clear();
searchTextBox.Focus();
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
try
{
if (dataGridView1[1, e.RowIndex].Value == null)
{
return;
}
if (dataGridView1.SelectedCells.Count > 0)
{
CurrentCell = e.RowIndex;
}
}
catch { }
}
public static String APPID;
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1[1, e.RowIndex].Value == null)
{
return;
}
try
{
if (VRLExists)
{
string PropName = RemoveSpecialCharacters(dataGridView1[0, e.RowIndex].Value.ToString());
File.WriteAllText($"{APPDATA}\\VRL\\ProperName.txt", PropName);
}
APPID = dataGridView1[1, e.RowIndex].Value.ToString();
searchTextBox.Clear();
mainPanel.Visible = true;
startCrackPic.Visible = true;
resinstruccZip.Visible = false;
}
catch { }
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
try
{
if (VRLExists)
{
string PropName = RemoveSpecialCharacters(dataGridView1[0, e.RowIndex].Value.ToString());
File.WriteAllText($"{APPDATA}\\VRL\\ProperName.txt", PropName);
}
Clipboard.SetText(dataGridView1[1, e.RowIndex].Value.ToString());
}
catch
{
}
}
private void label2_Click(object sender, EventArgs e)
{
Process.Start("https://discord.gg/QvYwqvdgxc");
Process.Start("https://t.me/FFAMain");
}
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
try
{
if (e.KeyCode == Keys.Up)
{
if (dataGridView1.Rows.Count > 0)
{
if (dataGridView1.Rows[0].Selected)
{
searchTextBox.Focus();
}
}
}
if (e.KeyCode == Keys.Escape)
{
searchTextBox.Clear();
searchTextBox.Focus();
}
else if (e.KeyCode == Keys.Enter)
{
if (dataGridView1[1, CurrentCell].Value == null)
{
return;
}
if (VRLExists)
{
string PropName = RemoveSpecialCharacters(dataGridView1[0, CurrentCell].Value.ToString());
File.WriteAllText($"{APPDATA}\\VRL\\ProperName.txt", PropName);
}
APPID = dataGridView1[1, CurrentCell].Value.ToString();
searchTextBox.Clear();
mainPanel.Visible = true;
startCrackPic.Visible = true;
}
else if (e.KeyCode == Keys.Back)
{
string s = searchTextBox.Text;
if (s.Length > 1)
{
s = s.Substring(0, s.Length - 1);
}
else
{
s = "0";
}
searchTextBox.Text = s;
searchTextBox.Focus();
dataGridView1.ClearSelection();
searchTextBox.SelectionStart = searchTextBox.Text.Length;
}
else if (e.KeyCode != Keys.Up && e.KeyCode != Keys.Down && char.IsLetterOrDigit((char)e.KeyCode) && e.KeyCode.ToString().Length == 1 || e.KeyCode == Keys.Space)
{
bool isShiftKeyPressed = (e.Modifiers == Keys.Shift);
bool isCapsLockOn = System.Windows.Forms.Control
.IsKeyLocked(System.Windows.Forms.Keys.CapsLock);
if (e.KeyCode == Keys.Space)
{
searchTextBox.Focus();
searchTextBox.Text += " ";
dataGridView1.ClearSelection();
searchTextBox.SelectionStart = searchTextBox.Text.Length;
}
else if (!isShiftKeyPressed && !isCapsLockOn)
{
searchTextBox.Focus();
searchTextBox.Text += e.KeyData.ToString().ToLower();
searchTextBox.SelectionStart = searchTextBox.Text.Length;
}
else
{
searchTextBox.Focus();
searchTextBox.Text += e.KeyData.ToString().Replace(", Shift", "").Replace("Oem", "").Replace("numpad", "");
searchTextBox.SelectionStart = searchTextBox.Text.Length;
}
}
}
catch { }
}
private void searchTextBox_KeyDown(object sender, KeyEventArgs e)
{
try
{
if (e.Modifiers == Keys.LShiftKey && e.KeyCode == Keys.Oem4)
{
searchTextBox.Text = $"${searchTextBox.Text}";
searchTextBox.SelectionStart = searchTextBox.Text.Length + 1;
}
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.A)
{
searchTextBox.SelectAll();
e.SuppressKeyPress = true;
}
if (dataGridView1.Rows.Count == 0)
{
return;
}
if (e.KeyCode == Keys.Down)
{
dataGridView1.Focus();
dataGridView1.Rows[0].Selected = true;
dataGridView1.SelectedCells[0].Selected = true;
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.Tab)
{
dataGridView1.Focus();
dataGridView1.Rows[0].Selected = true;
dataGridView1.SelectedCells[0].Selected = true;
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.Enter)
{
dataGridView1.Focus();
dataGridView1.Rows[0].Selected = true;
dataGridView1.SelectedCells[0].Selected = true;
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.Escape)
{
searchTextBox.Clear();
searchTextBox.Focus();
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.Back)
{
BackPressed = true;
}
else
{
BackPressed = false;
SearchPause = false;
t1.Stop();
}
}
catch { }
}
public static bool SearchPause = false;
public static bool BackPressed = false;
public static void t1_Tick(object sender, EventArgs e)
{
BackPressed = false;
SearchPause = false;
t1.Stop();
}
public static Timer t1;
private void searchTextBox_TextChanged(object sender, EventArgs e)
{
if (SearchPause && searchTextBox.Text.Length > 0)
{
return;
}
try
{
var fore = dataGridView1.DefaultCellStyle.BackColor;
string Search = searchTextBox.Text.ToLower();
if (Search.StartsWith("$"))
{
((DataTable)dataGridView1.DataSource).DefaultView.RowFilter = String.Format("Name like '" + Search.Replace("$", "").Replace("&", "and").Replace(":", " -") + "'");
}
else
{
Search = RemoveSpecialCharacters(searchTextBox.Text.ToLower());
((DataTable)dataGridView1.DataSource).DefaultView.RowFilter = String.Format("Name like '%" + Search.Replace(" ", "%' AND Name LIKE '%").Replace(" and ", "").Replace(" & ", "").Replace(":", "") + "%'");
}
dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
if (BackPressed)
{
SearchPause = true;
t1.Start();
}
dataGridView1.ClearSelection();
dataGridView1.DefaultCellStyle.SelectionBackColor = dataGridView1.DefaultCellStyle.BackColor;
dataGridView1.DefaultCellStyle.SelectionForeColor = dataGridView1.DefaultCellStyle.ForeColor;
}
catch { }
}
private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (VRLExists)
{
string PropName = RemoveSpecialCharacters(dataGridView1[0, e.RowIndex].Value.ToString());
File.WriteAllText($"{APPDATA}\\VRL\\ProperName.txt", PropName);
}
APPID = dataGridView1[1, CurrentCell].Value.ToString();
searchTextBox.Clear();
mainPanel.Visible = true;
startCrackPic.Visible = true;
}
private void pictureBox1_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/harryeffinpotter/SteamAPPIDFinder");
}
private void searchTextBox_Enter(object sender, EventArgs e)
{
}
public void Crack()
{
int execount = -20;
int steam64count = -1;
int steamcount = -1;
string parentdir = "";
bool cracked = false;
try
{
var files = Directory.GetFiles(gameDir, "*.*", SearchOption.AllDirectories);
foreach (string file in files)
{
if (file.EndsWith("steam_api64.dll"))
{
steam64count++;
parentdir = Directory.GetParent(file).FullName;
string steam = $"{parentdir}\\steam_settings";
if (Directory.Exists(steam))
{
var filesz = Directory.GetFiles(steam, "*.*", SearchOption.AllDirectories);
foreach (var filee in filesz)
{
File.Delete(filee);
}
Directory.Delete(steam, true);
}
if (File.Exists($"{file}.bak"))
{
File.Delete(file);
File.Move($"{file}.bak", file);
}
Tit("Replacing steam_api64.dll.");
cracked = true;
File.Move(file, $"{file}.bak");
if (goldy)
{
Directory.CreateDirectory(steam);
File.Copy($"{Environment.CurrentDirectory}\\_bin\\Goldberg\\steam_api64.dll", file);
}
else
{
File.Copy($"{Environment.CurrentDirectory}\\_bin\\ALI213\\steam_api64.dll", file);
if (File.Exists(parentdir + "\\SteamConfig.ini"))
{
File.Delete(parentdir + "\\SteamConfig.ini");
}
IniFileEdit($"{Environment.CurrentDirectory}\\_bin\\ALI213\\SteamConfig.ini [Settings] \"AppID = {APPID}\"");
File.Copy($"{Environment.CurrentDirectory}\\_bin\\ALI213\\SteamConfig.ini", $"{parentdir}\\SteamConfig.ini");
}
}
if (file.EndsWith("steam_api.dll"))
{
steamcount++;
parentdir = Directory.GetParent(file).FullName;
string steam = $"{parentdir}\\steam_settings";
if (Directory.Exists(steam))
{
var filesz = Directory.GetFiles(steam, "*.*", SearchOption.AllDirectories);
foreach (var filee in filesz)
{
File.Delete(filee);
}
Directory.Delete(steam, true);
}
if (File.Exists($"{file}.bak"))
{
File.Delete(file);
File.Move($"{file}.bak", file);
}
Tit("Replacing steam_api.dll.");
parentdir = Directory.GetParent(file).FullName;
cracked = true;
File.Move(file, $"{file}.bak");
if (goldy)
{
Directory.CreateDirectory(steam);
File.Copy($"{Environment.CurrentDirectory}\\_bin\\Goldberg\\steam_api.dll", file);
}
else
{
File.Copy($"{Environment.CurrentDirectory}\\_bin\\ALI213\\steam_api.dll", file);
if (File.Exists(parentdir + "\\SteamConfig.ini"))
{
File.Delete(parentdir + "\\SteamConfig.ini");
}
IniFileEdit($"\".\\_bin\\ALI213\\SteamConfig.ini\" [Settings] \"AppID = {APPID}\"");
File.Copy("_bin\\ALI213\\SteamConfig.ini", $"{parentdir}\\SteamConfig.ini");
}
}
if (Path.GetExtension(file) == ".exe")
{
if (File.Exists($"{file}.bak"))
{
File.Delete(file);
File.Move($"{file}.bak", file);
}
string exeparent = Directory.GetParent(file).FullName;
Process x2 = new Process();
ProcessStartInfo pro = new ProcessStartInfo();
pro.WindowStyle = ProcessWindowStyle.Hidden;
pro.UseShellExecute = false;
pro.CreateNoWindow = true;
pro.RedirectStandardError = true;
pro.RedirectStandardOutput = true;
pro.WorkingDirectory = parentdir;
pro.FileName = @"C:\Windows\System32\cmd.exe";
pro.Arguments = $"/c start /B \"\" \"{Environment.CurrentDirectory}\\_bin\\Steamless\\Steamless.CLI.exe\" \"{file}\"";
x2.StartInfo = pro;
x2.Start();
string Output = x2.StandardError.ReadToEnd() + x2.StandardOutput.ReadToEnd();
x2.WaitForExit();
if (File.Exists($"{file}.unpacked.exe"))
{
Tit($"Unpacked {file} successfully!");
File.Move(file, file + ".bak");
File.Move($"{file}.unpacked.exe", file);
}
}
if (steamcount > 1 || execount > 1 || steam64count > 1)
{
DialogResult Diagg = MessageBox.Show(
"This is the 2nd steam_api64.dll on this run - something is broken. " +
"The APPID has to match the ini/txt files or the cracks will not work.\n\n" +
"This usually happens when SACGUI determines the wrong parent dir " +
"from EXE or when user selects incorrect folder. Please select " +
"the GAME DIRECTORY, for example:\n\n" +
"-CORRECT-\nD:\\SteamLibrary\\Common\\SomeGameName\n\n" +
"-INCORRECT-\nD:\\SteamLibrary\\Common\n\n" +
"If you think this message is wrong, verify the path on bottom left and hit YES to continue..",
"Somethings wrong..., continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (Diagg == DialogResult.Yes)
{
execount = -600;
steam64count = -600;
steamcount = -600;
}
else
{
break;
}
}
}
if (cracked)
{
if (goldy)
{
if (Directory.Exists($"{parentdir}\\steam_settings"))
{
Directory.Delete($"{parentdir}\\steam_settings");
}
Directory.CreateDirectory($"{parentdir}\\steam_settings");
Tit("Generating achievements and DLC info...");
var infos = Cli.Wrap($"{Environment.CurrentDirectory}\\_bin\\generate_game_infos.exe").WithValidation(CommandResultValidation.None).WithArguments($"{APPID} -s 92CD46192F62DE1A769F79A667CE5631 -o\"{parentdir}\\steam_settings\"").WithWorkingDirectory(parentdir).ExecuteAsync().GetAwaiter().GetResult();
}
}
}
catch (Exception ex){ File.WriteAllText("_CRASHlog.txt", ex.StackTrace + "\n" + ex.Message); }
}
public void IniFileEdit(string args)
{
Process IniProcess = new Process();
IniProcess.StartInfo.CreateNoWindow = true;
IniProcess.StartInfo.UseShellExecute = false;
IniProcess.StartInfo.FileName = $"{Environment.CurrentDirectory}\\_bin\\ALI213\\inifile.exe";
IniProcess.StartInfo.Arguments = args;
IniProcess.Start();
IniProcess.WaitForExit();
}
private string parentOfSelection;
private string gameDir;
private string gameDirName;
private void pictureBox2_Click(object sender, EventArgs e)
{
FolderSelectDialog folderSelectDialog = new FolderSelectDialog();
folderSelectDialog.Title = "Select the game's main folder.";
if (Properties.Settings.Default.lastDir.Length > 0)
folderSelectDialog.InitialDirectory = Properties.Settings.Default.lastDir;
if (folderSelectDialog.Show(Handle))
{
if (folderSelectDialog.FileName.Contains("Program Files"))
{
MessageBox.Show("It looks like you selected a Program Files directory, " +
"this will often cause the autocrack to fail.");
}
gameDir = folderSelectDialog.FileName;
Tat(gameDir);
parentOfSelection = Directory.GetParent(gameDir).FullName;
gameDirName = Path.GetFileName(gameDir);
mainPanel.Visible = false;
startCrackPic.Visible = true;
searchTextBox.Text = gameDirName;
Properties.Settings.Default.lastDir = parentOfSelection;
Properties.Settings.Default.Save();
}
else
{
MessageBox.Show("You must select a folder to continue...");
}
}
public bool cracking;
private async void startCrackPic_Click(object sender, EventArgs e)
{
if (!cracking)
{
cracking = true;
Crack();
cracking = false;
Tit("Crack complete!");
donePic.Visible = true;
await Task.Delay(3000);
startCrackPic.Visible = false;
donePic.Visible = false;
Tit("Select directory...");
Tat("");
if (OpenOnFinish.Checked)
{
Process.Start(gameDir);
}
}
}
public bool goldy = false;
private void dllSelect_SelectedIndexChanged(object sender, EventArgs e)
{
if (dllSelect.SelectedIndex == 0)
{
goldy = true;
Properties.Settings.Default.Goldy = true;
}
else if (dllSelect.SelectedIndex == 1)
{
goldy = false;
Properties.Settings.Default.Goldy = false;
}
Properties.Settings.Default.Save();
}
private void selectDir_MouseEnter(object sender, EventArgs e)
{
selectDir.Image = Image.FromFile("_bin\\hoveradd.png");
}
private void selectDir_MouseHover(object sender, EventArgs e)
{
selectDir.Image = Image.FromFile("_bin\\hoveradd.png");
}
private void selectDir_MouseDown(object sender, MouseEventArgs e)
{
selectDir.Image = Image.FromFile("_bin\\clickadd.png");
}
private void startCrackPic_MouseDown(object sender, MouseEventArgs e)
{
startCrackPic.Image = Image.FromFile("_bin\\clickr2c.png");
}
private void startCrackPic_MouseEnter(object sender, EventArgs e)
{
startCrackPic.Image = Image.FromFile("_bin\\hoverr2c.png");
}
private void startCrackPic_MouseHover(object sender, EventArgs e)
{
startCrackPic.Image = Image.FromFile("_bin\\hoverr2c.png");
}
private void selectDir_MouseLeave(object sender, EventArgs e)
{
selectDir.Image = Image.FromFile("_bin\\add.png");
}
private void startCrackPic_MouseLeave(object sender, EventArgs e)
{
startCrackPic.Image = Image.FromFile("_bin\\r2c.png");
}
private void mainPanel_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
drgdropText.BringToFront();
drgdropText.Visible = true;
e.Effect = DragDropEffects.Copy;
}
private void mainPanel_DragLeave(object sender, EventArgs e)
{
drgdropText.SendToBack();
drgdropText.Visible = false;
}
private void mainPanel_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
string[] drops = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string d in drops)
{
FileAttributes attr = File.GetAttributes(d);
string parent = Directory.GetParent(d).FullName;
//detect whether its a directory or file
if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
{
//DIR
Tat(d);
gameDir = d;
parentOfSelection = Directory.GetParent(gameDir).FullName;
gameDirName = Path.GetFileName(gameDir);
mainPanel.Visible = false;
startCrackPic.Visible = true;
searchTextBox.Text = gameDirName;
Properties.Settings.Default.lastDir = parentOfSelection;
Properties.Settings.Default.Save();
}
else
{
//FILE
if (Path.GetExtension(d) != ".exe")
{
return;
}
bool parentfound = false;
string[] dirs = Directory.GetDirectories(parent);
foreach (string dir in dirs)
{
if (dir.ToLower().EndsWith("_data") || dir.ToLower().EndsWith("\\engine"))
{
parentfound = true;
gameDir = Directory.GetParent(dir).FullName;
Tat(gameDir);
parentOfSelection = Directory.GetParent(gameDir).FullName;
gameDirName = Path.GetFileName(gameDir);
mainPanel.Visible = false;
startCrackPic.Visible = true;
searchTextBox.Text = gameDirName;
Properties.Settings.Default.lastDir = parentOfSelection;
Properties.Settings.Default.Save();
}
}
if (!parentfound)
{
try
{
parent = Directory.GetParent(parent).FullName;
parent = Directory.GetParent(parent).FullName;
parent = Directory.GetParent(parent).FullName;
string[] topdirs = Directory.GetDirectories(parent);
foreach (string topdir in topdirs)
{
if (topdir.ToLower().EndsWith("engine"))
{
parentfound = true;
gameDir = parent;
Tat(gameDir);
parentOfSelection = Directory.GetParent(gameDir).FullName;
gameDirName = Path.GetFileName(gameDir);
mainPanel.Visible = false;
startCrackPic.Visible = true;
searchTextBox.Text = gameDirName;
Properties.Settings.Default.lastDir = parentOfSelection;
Properties.Settings.Default.Save();
}
}
}
catch(Exception Ex)
{
if (!Ex.Message.ToLower().Contains("object"))
{
MessageBox.Show(Ex.Message);
}
}
}
if (!parentfound)
{
MessageBox.Show("No recognizable game folder found!" +
"\nTry the top directory of the game you're trying to crack instead!");
}
}
}
drgdropText.SendToBack();
drgdropText.Visible = false;
}
private void unPin_Click(object sender, EventArgs e)
{
this.TopMost = false;
pin.BringToFront();
Properties.Settings.Default.Pinned = false;
Properties.Settings.Default.Save();
}
private void pin_Click(object sender, EventArgs e)
{
this.TopMost = true;
unPin.BringToFront();
Properties.Settings.Default.Pinned = true;
Properties.Settings.Default.Save();
}
private void OpenOnFinish_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.OpenDir = OpenOnFinish.Checked;
Properties.Settings.Default.Save();
}
}
}