private void mainOpen_Click(object sender, EventArgs e) { var file = new OpenFileDialog(); file.CheckFileExists = true; var result = file.ShowDialog(this); if (result != DialogResult.OK) { return; } main.Clear(); using (var mainFile = File.OpenRead(file.FileName)) { var reader = new StreamReader(mainFile); do { main.Add(TodoTxt.Parse(reader.ReadLine())); } while (!reader.EndOfStream); } itemList.Items.Clear(); foreach (var item in main) { itemList.Items.Add(item.Body); } mainFileData = new FileInfo(file.FileName); }
public void FromLine(string line) { var t = TodoTxt.Parse(line); Body = t.Body; Completed = t.Completed; Completion = t.Completion; Context = t.Context; Creation = t.Creation; Meta = t.Meta; Priority = t.Priority; Project = t.Project; }
public List <TodoItem> ParsingTest() { var reader = new StreamReader("todo.txt"); var todoList = new List <TodoItem>(); do { var line = reader.ReadLine(); var result = TodoTxt.Parse(line); Console.WriteLine(result.Body); todoList.Add(result); } while (!reader.EndOfStream); return(todoList); }