@@ -23,20 +23,19 @@ public static async Task Main(string[] args)
2323 if ( File . Exists ( path + "\\ Among Us.exe" ) ) acceptedpath = true ;
2424 }
2525 Console . WriteLine ( "Downloading town of us" ) ;
26- await Handlezip ( path ) ;
26+ await Handlezip ( path ) ;
2727 Movefiles ( path , Touversion ) ;
28- Console . WriteLine ( "Done!" ) ;
2928 }
30- public static async Task Handlezip ( string path )
29+ public static async Task Handlezip ( string path )
3130 {
3231 try
3332 {
3433 client . DefaultRequestHeaders . Add ( "User-Agent" , "TownOfUs Downloader" ) ;
3534 Json assets = await client . GetFromJsonAsync < Json > ( url ) ;
36- string linktozip = assets . Assets [ 0 ] . Browser_download_url ;
35+ Assets linktozip = assets . Assets . Find ( link => link . Browser_download_url . EndsWith ( "zip" ) ) ;
3736 Touversion = assets . Name ;
38- var connection = await client . GetAsync ( linktozip ) ;
39-
37+ var connection = await client . GetAsync ( linktozip . Browser_download_url ) ;
38+
4039 string zippath = $@ "{ path } " + "\\ tou.zip" ;
4140 var zip = new FileInfo ( zippath ) ;
4241 if ( connection . IsSuccessStatusCode )
@@ -57,12 +56,14 @@ public static async Task Handlezip(string path)
5756 {
5857 Console . WriteLine ( "Error in Handlezip()" ) ;
5958 Console . WriteLine ( e ) ;
59+ Console . ReadLine ( ) ;
60+
6061 }
6162 }
6263 public static void Movefiles ( string path , string version )
6364 {
64- try
65- {
65+ try
66+ {
6667 if ( Directory . Exists ( path + "\\ BepInEx" ) ) Directory . Delete ( path + "\\ BepInEx" , true ) ;
6768 if ( Directory . Exists ( path + "\\ mono" ) ) Directory . Delete ( path + "\\ mono" , true ) ;
6869 string subfolder = $@ "{ path } " + $ "\\ ToU { version } ";
@@ -79,12 +80,13 @@ public static void Movefiles(string path, string version)
7980 }
8081
8182 Directory . Delete ( subfolder ) ;
82- }
83- catch ( Exception e )
84- {
83+ }
84+ catch ( Exception e )
85+ {
8586 Console . WriteLine ( "Error in movefiles()" ) ;
8687 Console . WriteLine ( e ) ;
87- }
88+ Console . ReadLine ( ) ;
89+ }
8890 }
8991 }
9092}
0 commit comments