Skip to content

Commit

Permalink
Prefer ZIP source instead of legacy source
Browse files Browse the repository at this point in the history
  • Loading branch information
master131 committed Sep 27, 2020
1 parent 24a1c3b commit 1d96f1a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions iFakeLocation/DeveloperImageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,24 @@ public static Tuple<string, string>[] GetLinksForDevice(DeviceInformation device
WebClient.DownloadString("https://github.com/haikieu/xcode-developer-disk-image-all-platforms/tree-list/" +
treeList);
var paths = response.Split('"')
.Where(s => s.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase)).ToArray();
.Where(s => s.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase) &&
s.IndexOf("iPhoneOS", StringComparison.InvariantCulture) >= 0).ToArray();
foreach (var path in paths)
VersionToImageUrlZip[Path.GetFileNameWithoutExtension(path.Split('/').Last())] =
"https://github.com/haikieu/xcode-developer-disk-image-all-platforms/raw/master/" + path;
}

if (VersionToImageUrlLegacy.TryGetValue(verStr, out var ss)) {
if (VersionToImageUrlZip.TryGetValue(verStr, out var ss)) {
return new[] {
new Tuple<string, string>(ss, Path.Combine(ImagePath, verStr, "DeveloperDiskImage.dmg")),
new Tuple<string, string>(ss + ".signature",
Path.Combine(ImagePath, verStr, "DeveloperDiskImage.dmg.signature"))
new Tuple<string, string>(ss, Path.Combine(ImagePath, verStr, verStr + ".zip"))
};
}

if (VersionToImageUrlZip.TryGetValue(verStr, out ss)) {
if (VersionToImageUrlLegacy.TryGetValue(verStr, out ss)) {
return new[] {
new Tuple<string, string>(ss, Path.Combine(ImagePath, verStr, verStr + ".zip"))
new Tuple<string, string>(ss, Path.Combine(ImagePath, verStr, "DeveloperDiskImage.dmg")),
new Tuple<string, string>(ss + ".signature",
Path.Combine(ImagePath, verStr, "DeveloperDiskImage.dmg.signature"))
};
}

Expand Down

0 comments on commit 1d96f1a

Please sign in to comment.