private static void ProcessCommand(ConsoleCommand command) { switch (command.Current) { case "label": ProcessLabelCommand(command.Advance()); return; case "message": ProcessMessageCommand(command.Advance()); return; default: ConsoleWriter.WriteInYellow($"Unknown command '{command}'"); return; } }
private static void DownloadWithMessageId(ConsoleCommand command) { string messageId = command.Current; string dir = command.Advance().Current; Directory.CreateDirectory(dir); ConsoleWriter.WriteInGreen($"Downloading message {messageId} to {dir}.."); Message message = _messageProvider.GetMessage(TraceId.New(), messageId); SaveMessage(message, dir); }
private static void ProcessMessageCommand(ConsoleCommand command) { switch (command.Current) { case "-list-with-label": PrintMessages(command.Advance()); return; case "-dl-with-label": DownloadWithLabel(command.Advance()); return; case "-dl": DownloadWithMessageId(command.Advance()); return; case "-read": ReadMessage(command.Advance()); return; case "-upload": UploadReceipts(command.Advance()); return; case "-send-test": SendTestMessage(command.Advance()); return; default: ConsoleWriter.WriteInYellow($"Unknown message command '{command}'"); return; } }
private static void DownloadWithLabel(ConsoleCommand command) { string labelId = command.Current; string dir = command.Advance().Current; Directory.CreateDirectory(dir); ConsoleWriter.WriteInGreen($"Downloading messages with label {labelId} to {dir}.."); var messages = _messageProvider.GetMessagesWithLabel(TraceId.New(), labelId); if (!messages.Any()) { ConsoleWriter.WriteInGreen($"No messages found for label {labelId}"); return; } foreach (var message in messages) { SaveMessage(message, dir); } }