protected override async Task <string> ImplementExecute() { var filePath = _twitterRepository .GetMaxIdFilePath(); if (!File.Exists(filePath)) { using (var stream = File.Create(filePath)) { //do nothing }; } var maxObject = new MaxFileId { Id = _fileId }; var stringToWrite = JsonConvert.SerializeObject( maxObject, Formatting.Indented); await File.WriteAllTextAsync( filePath, stringToWrite); return(_fileId); }
protected override async Task <string> ImplementExecute() { var filePath = _twitterRepository .GetMaxIdFilePath(); if (!File.Exists(filePath)) { return(string.Empty); } var maxFileId = new MaxFileId(); var stringToDeserialize = await File.ReadAllTextAsync(filePath); var dynamicMaxFile = JsonConvert .DeserializeAnonymousType(stringToDeserialize, maxFileId); return(dynamicMaxFile.Id); }