private async Task PrintNoteText(string noteName, bool isPrivateNote) { NoteResource noteResource = await NotesProvider.GetNoteResource(mHttpClient, noteName, isPrivateNote, mLogger) .ConfigureAwait(false); if (noteResource == null) { mLogger.LogError($"Could not find note {noteName}"); return; } if (noteResource.IsMoreThanOneNoteFound()) { mConsolePrinter.Print(noteResource.PossibleNotes, "Found the next possible notes"); return; } mConsolePrinter.Print(noteResource.Text, $"NotePath: {Environment.NewLine}{noteResource.NotePath}{Environment.NewLine}"); }
private async Task <int> OpenNote(string noteName, bool isPrivateNote) { if (string.IsNullOrWhiteSpace(noteName)) { mLogger.LogError($"{nameof(noteName)} is null or whitespace. Invalid note name."); return(1); } NoteResource noteResource = await NotesProvider.GetNoteResource( mHttpClient, noteName, isPrivateNote, mLogger).ConfigureAwait(false); if (noteResource == null) { mLogger.LogError($"Could not find note {noteName}"); return(1); } if (noteResource.IsMoreThanOneNoteFound()) { StringBuilder stringBuilder = new StringBuilder(); noteResource.PossibleNotes.ToList().ForEach(note => stringBuilder.AppendLine(note)); mLogger.LogInformation($"Found the next possible notes: {stringBuilder}"); return(0); } bool isOpenSuccess = Open(noteResource); if (!isOpenSuccess) { mLogger.LogError($"Could not open note {noteResource.NotePath}"); } mLogger.LogInformation($"Note {noteResource.NotePath} opened"); return(0); }