private async Task EnqueueInternalAsync(Message message) { var messageList = await ReadMessagesAsync(); var memento = message.GetMemento(); messageList.Add(memento); await WriteMessagesAsync(messageList); }
private async Task SaveInternalAsync(Message message) { string fileName = String.Format("obj_{0}.json", message.ObjectId.ToCanonicalString()); var inputStream = await FileImplementation.OpenForRead( _folderName, fileName); var messages = ReadMessages(inputStream); if (!messages.Any(m => m.Hash == message.Hash.ToString())) { messages.Add(message.GetMemento()); var outputStream = await FileImplementation.OpenForWrite( _folderName, fileName); WriteMessages(outputStream, messages); } }