Пример #1
0
        public Dictionary <NeedDownloadFile, string> GetNeedToInstallFiles()
        {
            Dictionary <NeedDownloadFile, string> result = new Dictionary <NeedDownloadFile, string>();

            foreach (var lib in this)
            {
                NeedDownloadFile f = new NeedDownloadFile();
                f.Hash      = lib.Hash;
                f.FileName  = AddrTranslater.TranslateURL(lib.UnTranslatedDownloadAddress);
                f.FileName2 = lib.UnTranslatedDownloadAddress;
                string path = lib.GetLocalAbsolutePath();
                result.Add(f, path);
            }
            return(result);
        }
Пример #2
0
        public Dictionary <NeedDownloadFile, string> GetNeedToInstallFiles()
        {
            Dictionary <NeedDownloadFile, string> result = new Dictionary <NeedDownloadFile, string>();

            foreach (var lib in this)
            {
                foreach (var dl in lib.Downloads)
                {
                    NeedDownloadFile f = new NeedDownloadFile();
                    f.Hash      = dl.Hash;
                    f.FileName  = dl.GetTranslatedDownloadSite();
                    f.FileName2 = dl.GetUnTranslatedDownloadSite();
                    string path = dl.GetLocalAbsolutePath();
                    result.Add(f, path);
                }
            }
            return(result);
        }
Пример #3
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));
        }