public void TxtSerialize(ListView lv) { EnsureDirectoryExists("TXTOrders"); Order order = this.CreateOrder(this.CollectDishes(lv).ToArray()); var serealized = TxtSerealizer.Serialize(order); TxtSerealizer.WriteTo(serealized, "TXTOrders/" + FormLogic.filename + order.GetId().ToString() + ".txt"); }
public void JsonSerialize(ListView lv) { EnsureDirectoryExists("JSONOrders"); Order order = this.CreateOrder(this.CollectDishes(lv).ToArray()); var settingsjson = new JsonSerializerSettings() { ContractResolver = new MyContractResolver() }; var json = JsonConvert.SerializeObject(order, Newtonsoft.Json.Formatting.Indented, settingsjson); TxtSerealizer.WriteTo(json, "JSONOrders/" + FormLogic.filename + order.GetId().ToString() + ".json"); }