private static async Task UpdateChannel() { var sha = new SHA256Wrapper(); int counter = 1; while (1 == 1) { Console.WriteLine(counter++); var result = GetChannelToDownloads(); if (result == null) { break; } try { var stringContent = await ReadBlobAsStringAsync(result.Path); var hash = sha.GetHash(stringContent); UpdateSha(result.Id, hash); } catch (Exception e) { UpdateSha(result.Id, "Do it manually"); } } }
private static async Task UpdateNews() { var sha = new SHA256Wrapper(); int counter = 1; while (1 == 1) { Console.WriteLine(counter++); var result = GetNewsToDownload(); if (result == null) { break; } try { var path = $"items/{result.ChannelId.ToString()}/{result.Id.ToString()}.json"; var stringContent = await ReadBlobAsStringAsync(path); var item = JsonConvert.DeserializeObject <ItanFeedItemJson>(stringContent); var hash = sha.GetHash( item.Content?.Trim() + item.Description?.Trim() + item.Title?.Trim() + item.Link?.Trim()); UpdateNewsWithSha(result.Id, hash); } catch (Exception e) { UpdateNewsWithSha(result.Id, "Do it manually"); } } }