예제 #1
0
        async Task <ApiHashes> GetHashes()
        {
            // TODO: Without ExHandling?
            // TODO: Don't save the JSON representation but our own? But then if we have a bug in the client we can have wrong data in the cache so..

            try {
                var data = await _cacheManager.GetObject <string>(RepoHelper.GetFullApiPath(HashesJson));

                return(JsonConvert.DeserializeObject <ApiHashes>(data, ContentRestApi.JsonSettings));
            } catch (KeyNotFoundException) {
                return(new ApiHashes());
            }
        }
예제 #2
0
        async Task <List <T> > LoadFromDisk()
        {
            // TODO: Without ExHandling?
            // TODO: Don't save the JSON representation but our own? But then if we have a bug in the client we can have wrong data in the cache so..
            // the other way around is that we can have bad json data in the cache...
            try {
                var data = await _cacheManager.GetObject <string>(_fullApiPath);

                Hash = RepoHelper.GetShortHash(data);
                return(JsonConvert.DeserializeObject <List <T> >(data, ContentRestApi.JsonSettings));
            } catch (KeyNotFoundException) {
                return(null);
            }
        }
예제 #3
0
        async Task <VersionInfoDto> GetToolsInfo(string versionInfoFile)
        {
            var json = await _cacheManager.GetObject <string>(versionInfoFile);

            return(json.FromJson <VersionInfoDto>());
        }