示例#1
0
 async Task TryLoadVersionInfo() {
     try {
         VersionInfo = await GetToolsInfo(VersionInfoFile).ConfigureAwait(false);
     } catch (KeyNotFoundException) {
         VersionInfo = new VersionInfoDto();
     }
 }
示例#2
0
        public VersionRegistry(Uri uri, IApiLocalObjectCacheManager cacheManager, ISystemInfo systemInfo) {
            _cacheManager = cacheManager;
            _systemInfo = systemInfo;

            _versionInfoUrl = Tools.Transfer.JoinUri(uri, VersionInfoFile);
            LocalVersionInfo = new VersionInfoDto();
            VersionInfo = new VersionInfoDto();
        }
示例#3
0
 async Task TryDownloadVersionInfo() {
     VersionInfoDto versionInfo;
     try {
         var dl = await _cacheManager.Download(_versionInfoUrl, TimeSpan.FromSeconds(30));
         versionInfo = Tools.Serialization.Json.LoadJson<VersionInfoDto>(Encoding.UTF8.GetString(dl));
     } catch (Exception) {
         versionInfo = new VersionInfoDto();
     }
     await Save(VersionInfoFile, versionInfo).ConfigureAwait(false);
     VersionInfo = versionInfo;
 }
示例#4
0
 async Task Save(string file, VersionInfoDto obj) {
     await _cacheManager.SetObject(file, obj.ToJson());
 }