public void OpenRandomEntry() { var entries = _markdownFiles.FindAll(); if (entries.Count == 0) { throw new InvalidOperationException("I couldn't find any journal entries. Did you pass in the right root directory?"); } var index = new Random().Next(0, entries.Count - 1); _systemProcess.Start(entries[index]); }
public void CreateNewEntry(LocalDate entryDate, string[] tags, string readme) { var journalWriter = _readerWriterFactory.CreateWriter(); var entryFilePath = journalWriter.GetJournalEntryFilePath(entryDate); if (journalWriter.EntryExists(entryFilePath)) { throw new JournalEntryAlreadyExistsException(entryFilePath); } var readmeExpression = new ReadmeParser(readme).ToExpression(entryDate); var frontMatter = new JournalFrontMatter(tags, readmeExpression); var header = $"# {entryDate}"; journalWriter.Create(entryFilePath, frontMatter, header); _systemProcess.Start(entryFilePath); }
public void Login(Action <User> applyUser) { _applyUser = applyUser; _oAuthManager.Authenticated += OAuthManagerAuthenticated; _process.Start(new ProcessStartInfo { FileName = _oAuthManager.BeginAuthorization() }); }