コード例 #1
0
 private bool CheckDownloadRequireLibrary(MLibrary lib)
 {
     return(lib.IsRequire &&
            lib.Path != "" &&
            lib.Url != "" &&
            !CheckFileValidation(lib.Path, lib.Hash));
 }
コード例 #2
0
ファイル: MLibrary.cs プロジェクト: aleffeh/CmlLib.Core
            private static MLibrary createMLibrary(string libraryPath, string name, string nativeId, JObject job)
            {
                var path = job["path"]?.ToString();

                if (path == null || path == "")
                {
                    path = NameToPath(name, nativeId);
                }

                var url = job["url"]?.ToString();

                if (url == null)
                {
                    url = MojangServer.Library + path;
                }
                else if (url.Split('/').Last() == "")
                {
                    url += path;
                }

                var hash = job["sha1"] ?? job["checksums"]?[0];

                var library = new MLibrary();

                library.Hash     = hash?.ToString() ?? "";
                library.IsNative = (nativeId != "");
                library.Name     = name;
                library.Path     = System.IO.Path.Combine(libraryPath, path);
                library.Url      = url;

                return(library);
            }