Esempio n. 1
0
        public void DownloadLatestMonomod(string targetFolder)
        {
            Console.WriteLine("Retrieving MonoMod latest release");
            var releaseInfos = NetworkUtil.GetJson("http://api.github.com/repos/0x0ade/MonoMod/releases/latest");

            var assetInfos = releaseInfos.Element("root").Elements("assets")
                             .First(a => {
                var name = a.Element("name").Value;
                return(name.Contains("net35") && name.EndsWith(".zip"));
            });

            var fileUrl  = assetInfos.Element("browser_download_url").Value;
            var filePath = Path.Combine(targetFolder, "monomod.zip");

            Console.WriteLine("Retrieved MonoMod latest release");

            Console.WriteLine("Download URL: " + fileUrl);
            Console.WriteLine("Downloading MonoMod");
            NetworkUtil.DownloadFile(fileUrl, filePath);
            Console.WriteLine("Downloaded MonoMod");
        }