forked from neophoenix236/INVedit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
57 lines (52 loc) · 1.48 KB
/
Program.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
using System;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Diagnostics;
using System.Reflection;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace INVedit
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
List<string> files = new List<string>();
foreach (string arg in args)
if (arg.Length > 0 && arg[0] == '-') {
switch (args[0]) {
case "-update":
if (File.Exists("_NBT.dll")) {
while (true) {
try { File.Delete("NBT.dll"); break; } catch { }
Thread.Sleep(500);
} File.Copy("_NBT.dll", "NBT.dll");
}
if (File.Exists("_INVedit.exe")) {
while (true) {
try { File.Delete("INVedit.exe"); break; } catch { }
Thread.Sleep(500);
} File.Copy("_INVedit.exe", "INVedit.exe");
Process.Start("INVedit.exe", "-finish");
return;
} break;
case "-finish":
while (true) {
try { File.Delete("_INVedit.exe"); break; } catch { }
Thread.Sleep(500);
} break;
}
} else { files.Add(arg); }
try { Assembly.Load("NBT"); }
catch { MessageBox.Show("Couldn't load NBT.dll.", "Error"); return; }
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm(files.ToArray()));
}
}
}