Esempio n. 1
0
        public static DownloadTask GetCoreDownloadTask(DownloadSource downloadSource, Modules.Version version, LaunchHandler core)
        {
            string from = GetCoreDownloadURL(downloadSource, version);
            string to   = core.GetJarPath(version);

            return(new DownloadTask("游戏版本核心", from, to));
        }
Esempio n. 2
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);
        }
 public static bool IsLostJarCore(LaunchHandler core, Version version)
 {
     if (version.InheritsVersion == null)
     {
         string jarPath = core.GetJarPath(version);
         return(!File.Exists(jarPath));
     }
     else
     {
         return(false);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 返回全部丢失的文件路径
        /// </summary>
        /// <param name="core">所使用的核心</param>
        /// <param name="version">要检查的版本</param>
        /// <returns>丢失文件的路径列表</returns>
        public static List <string> GetAllLostDepend(LaunchHandler core, Modules.Version version)
        {
            List <string> lost    = new List <string>();
            string        jarPath = core.GetJarPath(version);

            if (!File.Exists(jarPath))
            {
                lost.Add(jarPath);
            }
            lost.AddRange(GetLostLibs(core, version).Keys);
            lost.AddRange(GetLostNatives(core, version).Keys);
            return(lost);
        }
Esempio n. 5
0
        public static DownloadTask GetCoreJarDownloadTask(DownloadSource downloadSource, Modules.Version version, LaunchHandler core)
        {
            string       to           = core.GetJarPath(version);
            string       from         = GetCoreJarDownloadURL(downloadSource, version);
            DownloadTask downloadTask = new DownloadTask("游戏版本核心Jar文件", from, to);

            if (!string.IsNullOrWhiteSpace(version.Downloads?.Client?.SHA1))
            {
                downloadTask.Checker = new SHA1Checker()
                {
                    CheckSum = version.Downloads.Client.SHA1, FilePath = to
                };
            }
            return(downloadTask);
        }
Esempio n. 6
0
        public static bool IsLostJarCore(LaunchHandler core, Version version)
        {
            string jarPath = core.GetJarPath(version);

            return(!File.Exists(jarPath));
        }