@@ -2,8 +2,6 @@ module provision.adi;
2
2
3
3
import provision.android.id;
4
4
import provision.androidlibrary;
5
- import plist;
6
- import plist.types;
7
5
import std.base64 ;
8
6
import std.conv ;
9
7
import std.digest.sha ;
@@ -13,6 +11,8 @@ import std.net.curl;
13
11
import std.stdio ;
14
12
import std.string ;
15
13
14
+ import provision.plist;
15
+
16
16
@nogc :
17
17
18
18
alias ADILoadLibraryWithPath_t = extern (C ) int function (immutable char * );
@@ -178,14 +178,15 @@ alias ADIGetIDMSRouting_t = extern(C) int function(ulong*, ulong);
178
178
}
179
179
180
180
private void populateUrlBag (HTTP client) {
181
- auto content = std.net.curl.get (" https://gsa.apple.com/grandslam/GsService2/lookup" , client);
182
-
183
- Plist plist = new Plist();
184
- plist.read(cast (string ) content);
185
- auto response = (cast (PlistElementDict) (cast (PlistElementDict) (plist[0 ]))[" urls" ]);
186
-
187
- foreach (key; response.keys ()) {
188
- urlBag[key] = (cast (PlistElementString) response[key]).value;
181
+ auto content = cast (string ) std.net.curl.get (" https://gsa.apple.com/grandslam/GsService2/lookup" , client);
182
+
183
+ PlistDict plist = cast (PlistDict) Plist.fromXml(content);
184
+ auto response = cast (PlistDict) plist[" urls" ];
185
+ auto responseIter = response.iter();
186
+ Plist val;
187
+ string key;
188
+ while (responseIter.next(val, key)) {
189
+ urlBag[key] = cast (string ) cast (PlistString) val;
189
190
}
190
191
}
191
192
@@ -209,10 +210,9 @@ alias ADIGetIDMSRouting_t = extern(C) int function(ulong*, ulong);
209
210
</plist>
210
211
" , client);
211
212
212
- Plist spimPlist = new Plist();
213
- spimPlist.read(content);
214
- PlistElementDict spimResponse = cast (PlistElementDict) (cast (PlistElementDict) (spimPlist[0 ]))[" Response" ];
215
- string spimStr = (cast (PlistElementString) spimResponse[" spim" ]).value;
213
+ auto spimPlist = cast (PlistDict) Plist.fromXml(content);
214
+ auto spimResponse = cast (PlistDict) spimPlist[" Response" ];
215
+ string spimStr = cast (string ) cast (PlistString) spimResponse[" spim" ];
216
216
217
217
return Base64.decode(spimStr);
218
218
}
@@ -242,9 +242,8 @@ alias ADIGetIDMSRouting_t = extern(C) int function(ulong*, ulong);
242
242
string content = cast (string ) post(urlBag[" midFinishProvisioning" ],
243
243
body_, client);
244
244
245
- Plist plist = new Plist();
246
- plist.read(content);
247
- PlistElementDict spimResponse = cast (PlistElementDict) (cast (PlistElementDict) (plist[0 ]))[" Response" ];
245
+ PlistDict plist = cast (PlistDict) Plist.fromXml(content);
246
+ PlistDict spimResponse = cast (PlistDict) plist[" Response" ];
248
247
249
248
struct SecondStepAnswers {
250
249
string rinfo;
@@ -253,9 +252,9 @@ alias ADIGetIDMSRouting_t = extern(C) int function(ulong*, ulong);
253
252
}
254
253
255
254
SecondStepAnswers secondStepAnswers = SecondStepAnswers();
256
- secondStepAnswers.rinfo = ( cast (PlistElementString ) spimResponse[" X-Apple-I-MD-RINFO" ]).value ;
257
- secondStepAnswers.tk = Base64.decode(( cast (PlistElementString ) spimResponse[" tk" ]).value );
258
- secondStepAnswers.ptm = Base64.decode(( cast (PlistElementString ) spimResponse[" ptm" ]).value );
255
+ secondStepAnswers.rinfo = cast ( string ) cast (PlistString ) spimResponse[" X-Apple-I-MD-RINFO" ];
256
+ secondStepAnswers.tk = Base64.decode(cast ( string ) cast (PlistString ) spimResponse[" tk" ]);
257
+ secondStepAnswers.ptm = Base64.decode(cast ( string ) cast (PlistString ) spimResponse[" ptm" ]);
259
258
260
259
return secondStepAnswers;
261
260
}
0 commit comments