protected void CreateLocalCores(IEnumerable <OnlineCore> onlineCores) { _cores = new List <LocalCore>(); foreach (CustomCore customCore in _customCores) { LocalCore core = new LocalCore() { Url = customCore.CoreUrl, CoreName = customCore.CoreName, ArchiveName = customCore.CoreName, Info = LoadCoreInfo(customCore.CoreName, _infoDirectory) }; _cores.Add(core); } foreach (OnlineCore onlineCore in onlineCores) { Uri uri; if (!TryCreateAbsoluteUrl(_baseUrl, _latestUrl + onlineCore.Name, out uri)) { continue; } string coreName = Path.GetFileNameWithoutExtension(onlineCore.Name); LocalCore core = new LocalCore() { Url = uri.AbsoluteUri, ArchiveName = onlineCore.Name, CoreName = coreName, Supported = !_unsupportedCores.Contains(coreName), Info = LoadCoreInfo(coreName, _infoDirectory) }; _cores.Add(core); } }
public bool DownloadCore(LocalCore core) { if (string.IsNullOrEmpty(core.Url)) { return(false); } if (!TryCreateDirectory(_coresDirectory)) { return(false); } string path = Path.Combine(_coresDirectory, core.ArchiveName); return(_downloader.DownloadFileAsync(core.Url, path, true).Result&& ExtractCore(path)); }