public static Tuple <string, string>[] GetLinksForDevice(DeviceInformation device)
        {
            string verStr = GetSoftwareVersion(device);

            // Populate URLs for developer images from Github
            if (VersionToImageUrlLegacy.Count == 0)
            {
                string treeList = "795fc91f28cb3884edc45b876482911c797de85c";
                try {
                    WebClient.Headers["Accept-Encoding"]  = "gzip, deflate";
                    WebClient.Headers["X-Requested-With"] = "XMLHttpRequest";
                    var resp = WebClient.DownloadString(
                        "https://github.com/xushuduo/Xcode-iOS-Developer-Disk-Image/find/master?_pjax=%23js-repo-pjax-container");
                    var tl  = "/tree-list/";
                    var idx = resp.IndexOf(tl, StringComparison.InvariantCultureIgnoreCase);
                    if (idx != -1)
                    {
                        treeList = resp.Substring(idx + tl.Length, resp.IndexOf('\"', idx) - (idx + tl.Length));
                    }
                }
                catch {
                }

                try {
                    WebClient.Headers["Accept"]           = "application/json";
                    WebClient.Headers["Accept-Encoding"]  = "gzip, deflate";
                    WebClient.Headers["X-Requested-With"] = "XMLHttpRequest";
                    var response =
                        WebClient.DownloadString("https://github.com/xushuduo/Xcode-iOS-Developer-Disk-Image/tree-list/" +
                                                 treeList);
                    var paths = response.Split('"')
                                .Where(s => s.EndsWith(".dmg", StringComparison.InvariantCultureIgnoreCase)).ToArray();
                    foreach (var path in paths)
                    {
                        VersionToImageUrlLegacy[path.Split('/')[1].Split(' ')[0]] =
                            "https://github.com/xushuduo/Xcode-iOS-Developer-Disk-Image/raw/master/" + path;
                    }
                } catch {
                }
            }

            if (VersionToImageUrlZip.Count == 0)
            {
                string treeList = "89cdf804bd416d0d6ba3f958b5c6d086cb914fa1";
                try {
                    WebClient.Headers["Accept-Encoding"]  = "gzip, deflate";
                    WebClient.Headers["X-Requested-With"] = "XMLHttpRequest";
                    var resp = WebClient.DownloadString(
                        "https://github.com/haikieu/xcode-developer-disk-image-all-platforms/find/master?_pjax=%23js-repo-pjax-container");
                    var tl  = "/tree-list/";
                    var idx = resp.IndexOf(tl, StringComparison.InvariantCultureIgnoreCase);
                    if (idx != -1)
                    {
                        treeList = resp.Substring(idx + tl.Length, resp.IndexOf('\"', idx) - (idx + tl.Length));
                    }
                }
                catch {
                }

                try {
                    WebClient.Headers["Accept"]           = "application/json";
                    WebClient.Headers["Accept-Encoding"]  = "gzip, deflate";
                    WebClient.Headers["X-Requested-With"] = "XMLHttpRequest";
                    var response =
                        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) &&
                                       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;
                    }
                } catch {
                }
            }

            // Use special override source that is under control of author and can be updated without
            // issuing a client update.
            // "<iOS version>": [".zip URL source containing developer image and signature"]
            // or
            // "<iOS version>": [".dmg URL source"] (.dmg.signature must also exist at the same path)

            if (VersionToImageUrlOverride.Count == 0)
            {
                try {
                    WebClient.Headers["Accept-Encoding"] = "gzip, deflate";
                    var response =
                        JObject.Parse(WebClient.DownloadString("https://raw.githubusercontent.com/master131/iFakeLocation/master/updates.json"));
                    foreach (var kvp in response.SelectToken("images").ToObject <Dictionary <string, string> >())
                    {
                        VersionToImageUrlOverride.Add(kvp.Key, kvp.Value);
                    }
                } catch {
                }
            }

            if (VersionToImageUrlOverride.TryGetValue(verStr, out var ss) ||
                VersionToImageUrlZip.TryGetValue(verStr, out ss) ||
                VersionToImageUrlLegacy.TryGetValue(verStr, out ss))
            {
                if (ss.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
                {
                    return(new[] {
                        new Tuple <string, string>(ss, Path.Combine(ImagePath, verStr, verStr + ".zip"))
                    });
                }
                else
                {
                    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"))
                    });
                }
            }

            return(null);
        }
 public static bool HasImageForDevice(DeviceInformation device)
 {
     string[] p;
     return(HasImageForDevice(device, out p));
 }