public static SeatBgColorSetup ImportObj(string szFile) { if (szFile.Trim().Length <= 0) { return(null); } if (!File.Exists(szFile)) { return(null); } byte[] arrFile = ReadFile(szFile); if (arrFile == null) { return(null); } try { string szXml = Encoding.UTF8.GetString(arrFile); SeatBgColorSetup sysSetup = ImpportData(szXml); return(sysSetup); } catch (Exception ex) { throw ex; } }
public string ExportData(SeatBgColorSetup sysSetUp) { try { StringBuilder sbXML = new StringBuilder(); System.IO.StringWriter strw = new System.IO.StringWriter(sbXML); System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(sysSetUp.GetType()); reader.Serialize(strw, sysSetUp); return(strw.ToString()); } catch (Exception ex) { throw (ex); } }
public static SeatBgColorSetup ImpportData(string szSysSetUp) { try { StringReader sr = new StringReader(szSysSetUp); SeatBgColorSetup sysSetUp = new SeatBgColorSetup(); System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(sysSetUp.GetType()); sysSetUp = (SeatBgColorSetup)reader.Deserialize(sr); return(sysSetUp); } catch (Exception ex) { throw (ex); } }