Exemplo n.º 1
0
        private void checkLibraries(JArray jarr)
        {
            if (jarr == null || jarr.Count == 0)
            {
                return;
            }

            var libs = new List <MLibrary>();

            foreach (var item in jarr)
            {
                var parsedLib = MLibraryParser.ParseJsonObject((JObject)item);
                libs.AddRange(parsedLib);
            }

            var downloader = new MDownloader(Minecraft);

            downloader.ChangeFile += (e) => FileChanged?.Invoke(e);
            downloader.DownloadLibraries(libs.ToArray());
        }
Exemplo n.º 2
0
        private void checkLibraries(JArray jarr)
        {
            if (jarr == null || jarr.Count == 0)
            {
                return;
            }

            var libs   = new List <MLibrary>();
            var parser = new MLibraryParser();

            foreach (var item in jarr)
            {
                var parsedLib = parser.ParseJsonObject((JObject)item);
                libs.AddRange(parsedLib);
            }

            var fileProgress = new Progress <DownloadFileChangedEventArgs>(
                e => FileChanged?.Invoke(e));

            var libraryChecker = new LibraryChecker();
            var lostLibrary    = libraryChecker.CheckFiles(Minecraft, libs.ToArray(), fileProgress);

            Downloader.DownloadFiles(lostLibrary, fileProgress, null);
        }