Example #1
0
        public void DownloadJAR(DownloadingEventHandler eve)
        {
            Dictionary <NeedDownloadFile, string> files = new Dictionary <NeedDownloadFile, string>();

            JARPath = Path.Combine(GameSettings.SelectedGameDirectory.ToString(), "versions", VersionName, VersionName + ".jar");
            files.Add(new NeedDownloadFile()
            {
                FileName = AddrTranslater.TranslateURL(JSON["downloads"]["client"]["url"].ToString()), FileName2 = JSON["downloads"]["client"]["url"].ToString(), Hash = ""
            }, JARPath);
            var v = new DownloadTask(files).Download((float percent) =>
            {
                eve(percent * 0.2f);
            });

            if (v.Count > 0)
            {
                throw v.First().Value;
            }
        }
Example #2
0
        public static MinecraftProfile GetFromVersion(GameVersion version, string activityname)
        {
            NeedDownloadFile dl = new NeedDownloadFile();

            dl.Hash      = "";
            dl.FileName2 = version.JSONURL;
            dl.FileName  = AddrTranslater.TranslateURL(version.JSONURL);
            Dictionary <NeedDownloadFile, string> dic = new Dictionary <NeedDownloadFile, string>();
            string name = "OMCLC\\Plugins\\Data\\EDGW\\Downloader-Temps\\" + Guid.NewGuid().ToString();

            dic.Add(dl, name);
            var v = new DownloadTask(dic).Download((float percent) => { });

            if (v.Count > 0)
            {
                throw v.First().Value;
            }
            JObject data = JObject.Parse(File.ReadAllText(name));

            return(ParseFromJSON(data, version, activityname));
        }
Example #3
0
        public JObject GetAssetIndexJSON()
        {
            string URL     = JSON["assetIndex"]["url"].ToString();
            string urlmain = AddrTranslater.TranslateURL(URL);

            Directory.CreateDirectory("OMCLC\\Plugins\\Data\\EDGW\\Downloader-Temps\\");
            string name = "OMCLC\\Plugins\\Data\\EDGW\\Downloader-Temps\\" + Guid.NewGuid().ToString();
            Dictionary <NeedDownloadFile, string> dic = new Dictionary <NeedDownloadFile, string>();

            dic.Add(new NeedDownloadFile()
            {
                FileName = urlmain, FileName2 = URL, Hash = ""
            }, name);
            var v = new DownloadTask(dic).Download((float percent) => { });

            if (v.Count > 0)
            {
                throw v.First().Value;
            }
            JObject data = JObject.Parse(File.ReadAllText(name));

            return(data);
        }