-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
102 lines (90 loc) · 3.5 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
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
using System;
namespace JniGen
{
class Program
{
static void Main(string[] args)
{
if (args.Length <= 0)
{
Console.WriteLine("JniGen - generate .java and JNI_*.cpp bindings with ease!");
Console.WriteLine("Usage:");
Console.WriteLine("JniGen -domain [com] -company [whatever] -product [yourlibrary] -classname [AutogenClassNative] -file <path to .h>");
Console.WriteLine();
Console.WriteLine("Press any key to continue . . . ");
Console.ReadKey(true);
}
else
{
string domain = "com";
string company = "whatever";
string product = "yourlibrary";
string classname = "AutogenClassNative";
string[] includes = null;
string[] libraries = null;
string[] imports = null;
string file = null;
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "-domain":
{
domain = args[++i];
break;
}
case "-company":
{
company = args[++i];
break;
}
case "-product":
{
product = args[++i];
break;
}
case "-classname":
{
classname = args[++i];
break;
}
case "-file":
{
file = args[++i];
break;
}
case "-includes":
{
string itoParse = args[++i];
includes = itoParse.Split(';');
break;
}
case "-libraries":
{
string ltoParse = args[++i];
libraries = ltoParse.Split(';');
break;
}
case "-imports":
{
string imtoParse = args[++i];
imports = imtoParse.Split(';');
break;
}
default:
{
throw new Exception($"Invalid argument '{args[i]}'");
}
}
}
if (file is null)
{
throw new Exception("Filename is not set.");
}
Console.WriteLine($"Running JniGen on file {file}");
new JniGen().SetProperties(domain, company, product, classname, includes, libraries, imports).Generate(file);
Console.WriteLine($"{classname}.java and JNI_{classname}.cpp generated, have fun.");
}
}
}
}