public void setConfig(CashierModel cashier) { if (!Directory.Exists(path))//不存在path文件夹 { Directory.CreateDirectory(path);//新建文件夹 } XmlSerializer xmlSerializer = new XmlSerializer(typeof(CashierModel)); Stream stream = new FileStream(path + fname, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); xmlSerializer.Serialize(stream, cashier); stream.Close(); }
public CashierModel getConfig() { CashierModel cashier = new CashierModel(); if (File.Exists(path + fname)) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(CashierModel)); Stream stream = new FileStream(path + fname, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); cashier = (CashierModel)xmlSerializer.Deserialize(stream); } return cashier; }
public void setConfig(CashierModel cashier) { cd.setConfig(cashier); }