public void AddToHistory(VideoInfos vi) { if (HistoryList.Find(x => x.Title == vi.Title) == null && HistoryList.Find(x => x.URL == vi.URL) == null) { HistoryList.Add(vi); File.AppendAllText(path, CreateLine(vi)); } Logger.WriteSuccess($"{vi.Title} | ({vi.URL})"); }
public void RemoveFromHistory(VideoInfos vi) { HistoryList.Remove(HistoryList.Find(x => x.Title == vi.Title && x.URL == vi.URL)); string history = string.Empty; foreach (VideoInfos vis in HistoryList) { history += CreateLine(vis); } File.WriteAllText(path, string.Empty); File.AppendAllText(path, history); }
private string CreateLine(VideoInfos vi) { return(string.Concat(string.Format("{0}|||{1}", vi.Title, vi.URL), Environment.NewLine)); }