public static void RemoveFavorite(string Fontname) { favorite f = FavoriteList.SingleOrDefault(x => x.fontname == Fontname); if (!(f == null)) { FavoriteList.Remove(f); UpdateFavorites(); } }
public static void AddFavorite(favorite F) { XmlDocument D = new XmlDocument(); D.Load(Utils.GetFilePath(FileType.Favorite)); XmlElement _F = D.CreateElement("favorite"); XmlElement _d = D.CreateElement("date"); _d.InnerText = F.date; XmlElement _t = D.CreateElement("time"); _t.InnerText = F.time; XmlElement _f = D.CreateElement("fontname"); _f.InnerText = F.fontname; _F.AppendChild(_d); _F.AppendChild(_t); _F.AppendChild(_f); D.DocumentElement.AppendChild(_F); D.Save(Utils.GetFilePath(FileType.Favorite)); }