예제 #1
0
        /// <summary>
        /// 获取全部丢失的文件下载任务
        /// </summary>
        /// <param name="source">下载源</param>
        /// <param name="core">使用的核心</param>
        /// <param name="version">检查的版本</param>
        /// <returns></returns>
        public static List <DownloadTask> GetLostDependDownloadTask(DownloadSource source, LaunchHandler core, Version version)
        {
            var lostLibs              = GetLostLibs(core, version);
            var lostNatives           = GetLostNatives(core, version);
            List <DownloadTask> tasks = new List <DownloadTask>();
            string jarPath            = core.GetJarPath(version);

            if (!File.Exists(jarPath))
            {
                if (version.InheritsVersion != null)
                {
                    Version inner = core.GetVersionByID(version.InheritsVersion);
                    tasks.Add(GetDownloadUrl.GetCoreDownloadTask(source, inner, core));
                }
                else
                {
                    tasks.Add(GetDownloadUrl.GetCoreDownloadTask(source, version, core));
                }
            }
            foreach (var item in lostLibs)
            {
                tasks.Add(GetDownloadUrl.GetLibDownloadTask(source, item.Value, core));
            }
            foreach (var item in lostNatives)
            {
                tasks.Add(GetDownloadUrl.GetNativeDownloadTask(source, item.Value, core));
            }
            return(tasks);
        }