コード例 #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 = Encoding.UTF8.GetString(dl).FromJson<VersionInfoDto>();
     } 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());
 }