@@ -10,7 +10,7 @@ public class ConsolePatchAccessor : PatchAccessor, IDisposable
10
10
private readonly FtpClient _client ;
11
11
private const string BasePath = "/dev_hdd0/" ;
12
12
13
- public Lazy < byte [ ] > IdpsFile ;
13
+ public readonly Lazy < byte [ ] ? > IdpsFile ;
14
14
15
15
public ConsolePatchAccessor ( string remoteIp )
16
16
{
@@ -21,18 +21,37 @@ public ConsolePatchAccessor(string remoteIp)
21
21
FtpProfile ? profile = this . _client . AutoConnect ( ) ;
22
22
if ( profile == null ) throw new FTPConnectionFailureException ( ) ;
23
23
24
- this . IdpsFile = new Lazy < byte [ ] > ( ( ) =>
24
+ this . IdpsFile = new Lazy < byte [ ] ? > ( ( ) =>
25
25
{
26
+ Program . Log ( "Getting IDPS..." , "IDPS" ) ;
26
27
UriBuilder idpsPs3 = new ( "http" , remoteIp , 80 , "idps.ps3" ) ;
27
28
UriBuilder idpsHex = new ( "http" , remoteIp , 80 , "dev_hdd0/idps.hex" ) ;
28
29
29
30
HttpClient httpClient = new ( ) ;
30
31
31
- //Get the /idps.ps3 path, this creates the idps.hex file we can grab.
32
- _ = httpClient . GetAsync ( idpsPs3 . Uri ) . Result ;
32
+ // Get the /idps.ps3 path, this creates the idps.hex file we can grab.
33
+ Program . Log ( " Triggering generation of IDPS file" , "IDPS" ) ;
34
+ HttpResponseMessage response = httpClient . GetAsync ( idpsPs3 . Uri ) . Result ;
35
+ Program . Log ( $ " { response . StatusCode } { ( int ) response . StatusCode } (success: { response . IsSuccessStatusCode } )", "IDPS" ) ;
36
+ if ( ! response . IsSuccessStatusCode )
37
+ {
38
+ Program . Log ( "Couldn't fetch the IDPS from the PS3 because of a bad status code." , "IDPS" , BreadcrumbLevel . Error ) ;
39
+ Program . Log ( response . Content . ReadAsStringAsync ( ) . Result , "IDPS" , BreadcrumbLevel . Debug ) ;
40
+ return null ;
41
+ }
42
+
43
+ Program . Log ( " Downloading IDPS hex" , "IDPS" ) ;
44
+ response = httpClient . GetAsync ( idpsHex . Uri ) . Result ;
45
+ Program . Log ( $ " { response . StatusCode } { ( int ) response . StatusCode } (success: { response . IsSuccessStatusCode } )", "IDPS" ) ;
46
+ if ( ! response . IsSuccessStatusCode )
47
+ {
48
+ Program . Log ( "Couldn't fetch the IDPS from the PS3 because of a bad status code." , "IDPS" , BreadcrumbLevel . Error ) ;
49
+ Program . Log ( response . Content . ReadAsStringAsync ( ) . Result , "IDPS" , BreadcrumbLevel . Debug ) ;
50
+ return null ;
51
+ }
33
52
34
53
//Return the IDPS key
35
- return httpClient . GetAsync ( idpsHex . Uri ) . Result . Content . ReadAsByteArrayAsync ( ) . Result ;
54
+ return response . Content . ReadAsByteArrayAsync ( ) . Result ;
36
55
} ) ;
37
56
}
38
57
0 commit comments