-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProgram.cs
50 lines (46 loc) · 1.88 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
using System;
using System.IO;
using System.Text.RegularExpressions;
namespace GK
{
class Program
{
static int Main(string[] args)
{
var ilStrip = new ILStrip();
ilStrip.LogLine = (format, arg) => { Console.WriteLine(format, arg); };
foreach (var arg in args)
{
var match = Regex.Match(arg, @"^(?:/|-)(\w+)(?::?)(.*)$");
if (match.Success)
{
var paramName = match.Groups[1].Value.ToLower();
if (paramName == "out")
ilStrip.OutputFileName = match.Groups[2].Value;
else if (paramName == "keeptypes")
ilStrip.KeepTypes = match.Groups[2].Value;
else if (paramName == "keepresources")
ilStrip.KeepResources = match.Groups[2].Value;
else if (paramName == "removeresources")
ilStrip.RemoveResources = match.Groups[2].Value;
else if (paramName == "renameresources")
ilStrip.RenameResources = match.Groups[2].Value;
else if (paramName == "v")
ilStrip.Verbose++;
}
else
{
ilStrip.InputFileName = arg;
}
}
if (string.IsNullOrEmpty(ilStrip.InputFileName))
{
Console.Error.WriteLine(ilStrip.CopyrightNotice);
Console.Error.WriteLine("Usage: ilstrip inputfilename [/out:outputfilename] /keeptypes:regex[,regex] /keepresources:regex[,regex] /removeresources:regex[,regex] /renameresources:regex[,regex]");
return 666;
}
ilStrip.Execute();
return 0;
}
}
}