private static void SaveFile() { var rootA = new XElement("ActionsCaisse"); var root = new XElement("ActionHashBoxes"); foreach (var actionCash in ActionCashBoxes) { rootA.Add(new XElement("item", XElement.Parse(actionCash.Xml))); root.Add(ActionCashBox.ToXElement(actionCash)); } File.WriteAllText(PathA, new XDocument(rootA).ToString()); File.WriteAllText(Path, new XDocument(root).ToString()); }
private static void LoadFile() { if (File.Exists(PathA)) { _documentA = XDocument.Load(PathA); } if (File.Exists(Path)) { var document = XDocument.Load(Path); ActionCashBoxes.Clear(); foreach (var element in document.GetXElementsIfExistElement("ActionHashBoxes", "rec")) { ActionCashBoxes.Add(ActionCashBox.FromXElement(element)); } } }