static void Main(string[] args) { IndexObjects newIndet = new IndexObjects(@"D:\mc\.minecraft", @"1.12.2", false); Queue <DownloadTask> tasks = new Queue <DownloadTask>(); //for (int i =0;i<newIndet.ObjList.Count;i++) //{ // Debug.WriteLine(newIndet.ObjList[i].sha1); //} foreach (SingleObject element in newIndet.ObjList) { tasks.Enqueue(new DownloadTask(element.url, @".\testAssets\" + element.path, element.sha1, element.size)); //Debug.WriteLine(element.sha1); } MultiDownloader download1 = new MultiDownloader(tasks, 100, false); download1.StartDownload(); }
public static void PackageDownload(Index index) { string url; string localPath; Queue <DownloadTask> tasks = new Queue <DownloadTask>(); if (!Directory.Exists(@".\HikazeLauncher\download")) { Utils.CreateDir(@".\HikazeLauncher\download"); } if (!Directory.Exists(@".\HikazeLauncher\temp")) { Utils.CreateDir(@".\HikazeLauncher\temp"); } foreach (JFiles files in index.files) { url = RESOURCESURL + "/objects/" + files.sha1.Substring(0, 2) + "/" + files.sha1 + ".zip"; localPath = @".\HikazeLauncher\temp\" + files.sha1 + ".zip"; tasks.Enqueue(new DownloadTask(url, localPath, files.sha1, files.size)); sha1List.Add(files.sha1); } MultiDownloader multiDownloader = new MultiDownloader(tasks, 3, false); }