@@ -20,12 +20,16 @@ public static byte[] translate(byte[] bytes, int shift) {
20
20
return bytes ;
21
21
}
22
22
23
+ [ STAThread ]
23
24
public static void Main ( string [ ] args ) {
24
25
bool gui = true , shell = false ;
26
+ string parsethrough = string . Empty ;
25
27
if ( args . Length > 0 ) {
26
- foreach ( string arg in args )
28
+ foreach ( string arg in args ) {
27
29
if ( arg . Equals ( "nogui" ) ) gui = false ;
28
30
else if ( arg . Equals ( "shell" ) ) shell = true ;
31
+ parsethrough += ' ' + arg ;
32
+ }
29
33
}
30
34
string cwd = Environment . CurrentDirectory ;
31
35
string exe = Process . GetCurrentProcess ( ) . MainModule . FileName ;
@@ -58,19 +62,32 @@ public static void Main(string[] args) {
58
62
stream . Close ( ) ;
59
63
}
60
64
ProcessStartInfo info = new ProcessStartInfo ( ) ;
61
- if ( exe . EndsWith ( ".shell.exe" ) ) {
62
- info . Arguments = "/c title Effyiex Java Packager & java -jar \" " + jar + "\" & pause" ;
65
+ if ( exe . EndsWith ( ".shell.exe" ) ) {
66
+ info . Arguments = "/c title Effyiex Java Packager & java -jar \" " + jar + "\" " + parsethrough + " & pause";
63
67
info . FileName = "cmd.exe" ;
64
- } else info . FileName = jar ;
68
+ } else {
69
+ info . Arguments = parsethrough . Substring ( 1 ) ;
70
+ info . FileName = jar ;
71
+ }
65
72
info . WorkingDirectory = cwd ;
66
73
Process . Start ( info ) . WaitForExit ( ) ;
67
74
File . Delete ( jar ) ;
68
75
} else {
76
+ short jcount = 0 ;
69
77
foreach ( string f in Directory . GetFiles ( cwd ) )
70
78
if ( f . EndsWith ( ".jar" ) ) {
71
79
jar = f ;
72
- break ;
80
+ jcount ++ ;
73
81
}
82
+ if ( jcount > 1 && gui ) {
83
+ OpenFileDialog dialog = new OpenFileDialog ( ) ;
84
+ dialog . Title = "There are multiple Jars to choose from." ;
85
+ dialog . InitialDirectory = cwd ;
86
+ dialog . Filter = "Java Package (*.jar) | *.jar" ;
87
+ dialog . Multiselect = false ;
88
+ if ( dialog . ShowDialog ( ) == DialogResult . OK ) jar = dialog . FileName ;
89
+ else Environment . Exit ( 0 ) ;
90
+ }
74
91
if ( ! File . Exists ( jar ) ) {
75
92
string msg = "There has to be placed a jar-file in the same folder as the packager!" ;
76
93
MessageBox . Show ( msg , "ERROR: jar not found" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
0 commit comments