private static XmlElement GetElement(XmlDocument xmlDoc, SaasAir serverFileInfo) { string id = serverFileInfo.Id; string name = serverFileInfo.Name; string remark = serverFileInfo.Remark; string versionName = serverFileInfo.VersionNum; SaasAirType airType = serverFileInfo.AirType; string filePath = serverFileInfo.FilePath; string bundle = serverFileInfo.Bundle; string manifest = serverFileInfo.Manifest; XmlElement record = xmlDoc.CreateElement("record"); record.SetAttribute("id", id.ToString()); record.SetAttribute("name", name); record.SetAttribute("remark", remark); record.SetAttribute("versionName", versionName); record.SetAttribute("filePath", filePath); record.SetAttribute("bundle", bundle); record.SetAttribute("manifest", manifest); XmlElement element = xmlDoc.CreateElement("airType"); element.SetAttribute("id", airType.Id.ToString()); element.SetAttribute("name", airType.Name); record.AppendChild(element); return(record); }
//创建资源版本文件,记录资源版本 private void CreateResInfoConfig(string path, List <SaasAir> data) { XmlDocument xmlDoc = new XmlDocument(); XmlElement root = xmlDoc.CreateElement("root"); xmlDoc.AppendChild(root); var it = data.GetEnumerator(); while (it.MoveNext()) { string id = it.Current.Id; string name = it.Current.Name; string remark = it.Current.Remark; string versionName = it.Current.VersionNum; SaasAirType airType = it.Current.AirType; string filePath = it.Current.FilePath; string bundle = it.Current.Bundle; string manifest = it.Current.Manifest; XmlElement record = xmlDoc.CreateElement("record"); record.SetAttribute("id", id.ToString()); record.SetAttribute("name", name); record.SetAttribute("remark", remark); record.SetAttribute("versionName", versionName); record.SetAttribute("filePath", filePath); record.SetAttribute("bundle", bundle); record.SetAttribute("manifest", manifest); XmlElement element = xmlDoc.CreateElement("airType"); element.SetAttribute("id", airType.Id.ToString()); element.SetAttribute("name", airType.Name); record.AppendChild(element); root.AppendChild(record); } xmlDoc.Save(path); }
public SaasAir(string id, string name, string remark, string version, string filePath, string bundle, string mainfest, SaasAirType type) { this.id = id; this.name = name; this.remark = remark; this.versionNum = version; this.filePath = filePath; this.bundle = bundle; this.manifest = mainfest; this.airType = type; }