public XElement Format(Scenario scenario, int id) { var header = new XElement( this.xmlns + "div", new XAttribute("class", "scenario-heading"), new XElement(this.xmlns + "h2", scenario.Name)); var tags = RetrieveTags(scenario); if (tags.Length > 0) { var paragraph = new XElement(this.xmlns + "p", CreateTagElements(tags.OrderBy(t => t).ToArray(), this.xmlns)); paragraph.Add(new XAttribute("class", "tags")); header.Add(paragraph); } header.Add(this.htmlDescriptionFormatter.Format(scenario.Description)); return new XElement( this.xmlns + "li", new XAttribute("class", "scenario"), this.htmlImageResultFormatter.Format(scenario), header, new XElement( this.xmlns + "div", new XAttribute("class", "steps"), new XElement( this.xmlns + "ul", scenario.Steps.Select(step => this.htmlStepFormatter.Format(step))))); }
public void CreateFolders(Project currentProject, string schedule, string projectName, string relativePath) { //Create a File under Properties Folder which will contain information about all WebJobs //https://github.com/ligershark/webjobsvs/issues/6 // Check if the WebApp is C# or VB string dir = GetProjectDirectory(currentProject); var propertiesFolderName = "Properties"; if (currentProject.CodeModel.Language == CodeModelLanguageConstants.vsCMLanguageVB) { propertiesFolderName = "My Project"; } DirectoryInfo info = new DirectoryInfo(Path.Combine(dir, propertiesFolderName)); string readmeFile = Path.Combine(info.FullName, "WebJobs.xml"); // Copy File if it does not exit if (!File.Exists(readmeFile)) AddReadMe(readmeFile); //Add a WebJob info to it XDocument doc = XDocument.Load(readmeFile); XElement root = new XElement("WebJob"); root.Add(new XAttribute("Project", projectName)); root.Add(new XAttribute("RelativePath", relativePath)); root.Add(new XAttribute("Schedule", schedule)); doc.Element("WebJobs").Add(root); doc.Save(readmeFile); currentProject.ProjectItems.AddFromFile(readmeFile); }
public static string Build() { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { using (PlayerBussiness db = new PlayerBussiness()) { BestEquipInfo[] infos = db.GetCelebByDayBestEquip(); foreach (BestEquipInfo info in infos) { result.Add(FlashUtils.CreateBestEquipInfo(info)); } value = true; message = "Success!"; } } catch (Exception ex) { log.Error("Load CelebByDayBestEquip is fail!", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); return csFunction.CreateCompressXml(result, "CelebForBestEquip", false); }
/// <summary> /// Injects Calibre's metadata into XHTML element (for metadata part) /// </summary> /// <param name="metadata"></param> public void InjectData(XElement metadata) { if (!string.IsNullOrEmpty(SeriesName)) { XElement serie = new XElement(MetaName); serie.Add(new XAttribute("name", "calibre:series")); serie.Add(new XAttribute("content", SeriesName)); metadata.Add(serie); } if (SeriesIndex != 0) { XElement serieIndex = new XElement(MetaName); serieIndex.Add(new XAttribute("name", "calibre:series_index")); serieIndex.Add(new XAttribute("content", SeriesIndex)); metadata.Add(serieIndex); } if (!string.IsNullOrEmpty(TitleForSort)) { XElement title4Sort = new XElement(MetaName); title4Sort.Add(new XAttribute("name", "calibre:title_sort")); title4Sort.Add(new XAttribute("content", TitleForSort)); metadata.Add(title4Sort); } XElement date = new XElement(MetaName); date.Add(new XAttribute("name", "calibre:timestamp")); date.Add(new XAttribute("content", DateTime.UtcNow.ToString("O"))); metadata.Add(date); }
public void AddNextObxElement(string value, XElement document, string observationResultStatus) { XElement obxElement = new XElement("OBX"); XElement obx01Element = new XElement("OBX.1"); XElement obx0101Element = new XElement("OBX.1.1", this.m_ObxCount.ToString()); obx01Element.Add(obx0101Element); obxElement.Add(obx01Element); XElement obx02Element = new XElement("OBX.2"); XElement obx0201Element = new XElement("OBX.2.1", "TX"); obx02Element.Add(obx0201Element); obxElement.Add(obx02Element); XElement obx03Element = new XElement("OBX.3"); XElement obx0301Element = new XElement("OBX.3.1", "&GDT"); obx03Element.Add(obx0301Element); obxElement.Add(obx03Element); XElement obx05Element = new XElement("OBX.5"); XElement obx0501Element = new XElement("OBX.5.1", value); obx05Element.Add(obx0501Element); obxElement.Add(obx05Element); XElement obx11Element = new XElement("OBX.11"); XElement obx1101Element = new XElement("OBX.11.1", observationResultStatus); obx11Element.Add(obx1101Element); obxElement.Add(obx11Element); this.m_ObxCount++; document.Add(obxElement); }
public static XElement ToXml(ConvolutionFilter filter) { var res = new XElement(TAG_NAME, new XAttribute("divisor", CommonFormatter.Format(filter.Divisor)), new XAttribute("bias", CommonFormatter.Format(filter.Bias)) ); var xMatrix = new XElement("matrix"); for (var y = 0; y < filter.MatrixY; y++) { var xRow = new XElement("r"); for (var x = 0; x < filter.MatrixX; x++) { var xCol = new XElement("c") { Value = CommonFormatter.Format(filter.Matrix[y, x]) }; xRow.Add(xCol); } xMatrix.Add(xRow); } res.Add(xMatrix); res.Add(new XElement("color", XColorRGBA.ToXml(filter.DefaultColor))); if (filter.Reserved != 0) { res.Add(new XAttribute("reserved", filter.Reserved)); } res.Add(new XAttribute("clamp", CommonFormatter.Format(filter.Clamp))); res.Add(new XAttribute("preserveAlpha", CommonFormatter.Format(filter.PreserveAlpha))); return res; }
public System.Xml.Linq.XElement ToPhysical(System.Xml.Linq.XElement udsService) { string name = udsService.Attribute("Name").Value; XElement x = new XElement("Service", new XAttribute("Name", name)); XElement prop = new XElement("Property", new XAttribute("Name", "Definition")); x.Add(prop); XElement serv = new XElement("Service"); prop.Add(serv); XElement sd = new XElement("ServiceDescription"); serv.Add(sd); XElement handler = new XElement("Handler", new XAttribute("ExecType", "RemoteComponent")); sd.Add(handler); XElement udsDefinition = udsService.Element("Definition"); foreach (XElement e in udsDefinition.Elements()) sd.Add(e); XElement usage = new XElement("Usage"); sd.Add(usage); XElement sh = new XElement("ServiceHelp"); sh.Add(new XElement("Description")); sh.Add(new XElement("RequestSDDL")); sh.Add(new XElement("ResponseSDDL")); sh.Add(new XElement("Errors")); sh.Add(new XElement("RelatedDocumentServices")); sh.Add(new XElement("Samples")); serv.Add(sh); return x; }
public override XElement Serialize() { XElement thisElement = new XElement(GetType().Name); thisElement.Add(insideEquation.Serialize()); thisElement.Add(outerEquation.Serialize()); return thisElement; }
private static XDocument CreateXmlDocument(List<PhotographExportModel> photographs) { var root = new XElement("photographs"); XDocument photographsDoc = new XDocument(root); foreach (var photo in photographs) { var photograph = new XElement("photograph", new XAttribute("title", photo.Title), new XElement("category", photo.CategoryName), new XElement("link", photo.Link)); var equipment = new XElement("equipment"); equipment.Add( new XElement("camera", photo.CameraModel, new XAttribute("megapixels", photo.CameraMegaPixels))); var lens = new XElement("lens", photo.LensModel); if (photo.LensPrice != null) { lens.Add(new XAttribute("price", Math.Round(photo.LensPrice.Value, 2))); } equipment.Add(lens); photograph.Add(equipment); photographsDoc.Root.Add(photograph); } return photographsDoc; }
public SXL.XDocument CreateDocument() { var doc = new SXL.XDocument(); var root = new SXL.XElement("methodCall"); doc.Add(root); var method = new SXL.XElement("methodName"); root.Add(method); method.Add(this.Name); var params_el = new SXL.XElement("params"); root.Add(params_el); foreach (var p in this.Parameters) { var param_el = new SXL.XElement("param"); params_el.Add(param_el); p.AddXmlElement(param_el); } return(doc); }
public static void Main() { var context = new GeographyEntities(); var countries = context.Countries; var countriesQuery = countries .Where(c => c.Monasteries.Any()) .OrderBy(c => c.CountryName) .Select(c => new { c.CountryName, Monasteries = c.Monasteries .OrderBy(m => m.Name) .Select(m => m.Name) }); // Build the output XML var xmlMonasteries = new XElement("monasteries"); foreach (var country in countriesQuery) { var xmlCountry = new XElement("country"); xmlCountry.Add(new XAttribute("name", country.CountryName)); foreach (var monastery in country.Monasteries) { xmlCountry.Add(new XElement("monastery", monastery)); } xmlMonasteries.Add(xmlCountry); } Console.WriteLine(xmlMonasteries); var xmlDoc = new XDocument(xmlMonasteries); xmlDoc.Save(@"..\..\monasteries.xml"); }
static void Main() { var context = new GeographyEntities(); var xmlDocInput = XDocument.Load("../../rivers-query.xml"); var queryResults = new XElement("results"); foreach (var queryElement in xmlDocInput.XPathSelectElements("/queries/query")) { var riversQuery = BuildRiversQuery(context, queryElement); var riversElement = new XElement("rivers"); riversElement.Add(new XAttribute("total-count", riversQuery.Count().ToString())); var maxResultsAttribute = queryElement.Attribute("max-results"); if (maxResultsAttribute != null) { int maxResults = int.Parse(maxResultsAttribute.Value); riversQuery = riversQuery.Take(maxResults); } var riverNames = riversQuery.Select(r => r.RiverName).ToList(); foreach (var riverName in riverNames) { riversElement.Add(new XElement("river", riverName)); } riversElement.Add(new XAttribute("listed-count", riversQuery.Count().ToString())); queryResults.Add(riversElement); } Console.WriteLine(queryResults); }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { int userid = int.Parse(context.Request.Params["ID"]); using (PlayerBussiness db = new PlayerBussiness()) { ItemInfo[] items = db.GetUserItem(userid); foreach (ItemInfo item in items) { result.Add(Road.Flash.FlashUtils.CreateGoodsInfo(item)); } } value = true; message = "Success!"; } catch (Exception ex) { log.Error("LoadUserItems", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; context.Response.Write(result.ToString(false)); }
// public System.Xml.Linq.XElement GetXElement() { //new XElement( "ds", // new XAttribute( "nm", "Patrick Hines" ), // new XAttribute( "csNm", "144" ), // new XAttribute( "lddo", true ), // LoadDefaultDatabaseOnly // new XAttribute( "lso", true ), // LoadSystemObjects // new XAttribute( "wf", true ), // WithFields // new XElement( "stgDir", // stage path dir // new XCData( "./../.." ) ) //); if (this.Name == null) { return(null); } System.Xml.Linq.XElement e = new System.Xml.Linq.XElement("ds", new System.Xml.Linq.XAttribute("nm", this.Name) ); if (this.ConnectionStringName != null) { e.Add(new System.Xml.Linq.XAttribute("csNm", this.ConnectionStringName)); } e.Add(new System.Xml.Linq.XAttribute("lddo", this.LoadDefaultDatabaseOnly)); e.Add(new System.Xml.Linq.XAttribute("lso", this.LoadSystemObjects)); e.Add(new System.Xml.Linq.XAttribute("wf", this.WithFields)); if (this.StagePathDir != null) { e.Add(new System.Xml.Linq.XElement("stgDir", new System.Xml.Linq.XCData(this.StagePathDir)) ); } return(e); }
public XNode ToXML() { XElement xPoem = new XElement(Fb2Const.fb2DefaultNamespace + Fb2PoemElementName); if (!string.IsNullOrEmpty(ID)) { xPoem.Add(new XAttribute("id", ID)); } if (!string.IsNullOrEmpty(Lang)) { xPoem.Add(new XAttribute(XNamespace.Xml + "lang", Lang)); } if (Title != null) { xPoem.Add(Title.ToXML()); } foreach (EpigraphItem PoemEpigraph in Epigraphs) { xPoem.Add(PoemEpigraph.ToXML()); } foreach (IFb2TextItem PoemStanza in content) { xPoem.Add(PoemStanza.ToXML()); } foreach (TextAuthorItem TextAuthor in authors) { xPoem.Add(TextAuthor.ToXML()); } if (Date != null) { xPoem.Add(Date.ToXML()); } return xPoem; }
/// <summary> /// 将配置信息保存到XML /// </summary> /// <param name="CurrentNode">当前XML节点</param> public void SerializeConfigToXmlNode(System.Xml.Linq.XElement CurrentNode) { //参数检查 if (this.Menus == null) { return; } //处理菜单项 XElement xMenus = new XElement("Menus"); foreach (DictionaryEntry item in Menus) { xMenus.Add(new XElement("MenuItem", new XElement("Text", item.Key), new XElement("NodeId", item.Value) )); } //成功之后附加到节点 CurrentNode.Add(xMenus); //处理状态成员(只关注xeReady) XElement xeReady, xeSuccess, xeFail; this.SerializeStatusMember(out xeReady, out xeSuccess, out xeFail); if (xeReady != null) { CurrentNode.Add(xeReady); } }
private XElement GetParameterValue(object value) { if (value is int) { return new XElement("value", new XElement("int", value)); } if (value is string) { return new XElement("value", new XElement("string", value)); } if (value is IEnumerable) { return new XElement("value", ToArrayElement(value)); } var commentHash = value as XmlCommentHash; if (commentHash != null) { var hash = new XElement("hash"); hash.Add(new XElement("body", new XElement("string", commentHash.Body))); hash.Add(new XElement("is_private", new XElement("boolean", commentHash.IsPrivate))); return hash; } return null; }
public static string Bulid(HttpContext context) { bool value = false; string message = "Fail"; XElement result = new XElement("Result"); try { using (ProduceBussiness db = new ProduceBussiness()) { StrengthenInfo[] infos = db.GetAllStrengthen(); foreach (StrengthenInfo info in infos) { result.Add(Road.Flash.FlashUtils.CreateStrengthenInfo(info)); } } value = true; message = "Success!"; } catch (Exception ex) { log.Error("ItemStrengthenList", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); //return result.ToString(false); return csFunction.CreateCompressXml(context, result, "ItemStrengthenList", true); }
public XDocument Format(IDirectoryTreeNode featureNode, GeneralTree<IDirectoryTreeNode> features, DirectoryInfo rootFolder) { var xmlns = HtmlNamespace.Xhtml; var featureNodeOutputPath = Path.Combine(this.configuration.OutputFolder.FullName, featureNode.RelativePathFromRoot); var featureNodeOutputUri = new Uri(featureNodeOutputPath); var container = new XElement(xmlns + "div", new XAttribute("id", "container")); container.Add(this.htmlHeaderFormatter.Format()); container.Add(this.htmlTableOfContentsFormatter.Format(featureNode.OriginalLocationUrl, features, rootFolder)); container.Add(this.htmlContentFormatter.Format(featureNode, features)); container.Add(this.htmlFooterFormatter.Format()); var body = new XElement(xmlns + "body"); body.Add(container); var head = new XElement(xmlns + "head"); head.Add(new XElement(xmlns + "title", string.Format("{0}", featureNode.Name))); head.Add(new XElement(xmlns + "link", new XAttribute("rel", "stylesheet"), new XAttribute("href", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.MasterStylesheet)), new XAttribute("type", "text/css"))); head.Add(new XElement(xmlns + "link", new XAttribute("rel", "stylesheet"), new XAttribute("href", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.PrintStylesheet)), new XAttribute("type", "text/css"), new XAttribute("media", "print"))); head.Add(new XElement(xmlns + "script", new XAttribute("src", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.jQueryScript)), new XAttribute("type", "text/javascript"), new XText(string.Empty))); head.Add(new XElement(xmlns + "script", new XAttribute("src", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.jQueryDataTablesScript)), new XAttribute("type", "text/javascript"), new XText(string.Empty))); head.Add(new XElement(xmlns + "script", new XAttribute("src", featureNodeOutputUri.MakeRelativeUri(this.htmlResources.AdditionalScripts)), new XAttribute("type", "text/javascript"), new XText(string.Empty))); head.Add(new XElement(xmlns + "script", new XAttribute("type", "text/javascript"), documentReady)); var html = new XElement(xmlns + "html", new XAttribute(XNamespace.Xml + "lang", "en"), head, body); var document = new XDocument( new XDeclaration("1.0", "UTF-8", null), new XDocumentType("html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd", string.Empty), html); return document; }
public void AddCollectionToElement(XElement metadata,int collectionCounter) { string collectionID = string.Format("collect_{0}", ++collectionCounter); var metaBelongsTo = new XElement(EPubNamespaces.FakeOpf + "meta", CollectionName); metaBelongsTo.Add(new XAttribute("property", "belongs-to-collection")); metaBelongsTo.Add(new XAttribute("id", collectionID)); metadata.Add(metaBelongsTo); var metaCollectionType = new XElement(EPubNamespaces.FakeOpf + "meta", ToStringType(Type)); metaCollectionType.Add(new XAttribute("property", "collection-type")); metaCollectionType.Add(new XAttribute("refines", "#" + collectionID)); metadata.Add(metaCollectionType); if (CollectionPosition.HasValue) { var metaPosition = new XElement(EPubNamespaces.FakeOpf + "meta", CollectionPosition.Value); metaPosition.Add(new XAttribute("property", "group-position")); metaPosition.Add(new XAttribute("refines", "#" + collectionID)); metadata.Add(metaPosition); } if (!string.IsNullOrEmpty(CollectionUID)) { var metaUID = new XElement(EPubNamespaces.FakeOpf + "meta", CollectionUID); metaUID.Add(new XAttribute("property", "dcterms:identifier")); metaUID.Add(new XAttribute("refines", "#" + collectionID)); metadata.Add(metaUID); } }
private IEnumerable<XElement> Group (IEnumerable<XElement> receipts){ IEnumerable<string> storerkeys = receipts.Select(x => x.Element("STORERKEY").Value).Distinct(); foreach (string key in storerkeys) { string duns = getStorerDuns(key); XElement storerGroup = new XElement("VendorReceiptReport"); storerGroup.Add(new XAttribute("VendorCode", key)); storerGroup.Add(new XAttribute("VendorDuns", duns)); XElement fromrole = ConfigHelper.GetRoleElement(_configpath, _fromRole, "fromRole"); XElement tostxrole = ConfigHelper.GetRoleElement(_configpath, _toSTXRole, "toRole"); XElement toe2openrole = ConfigHelper.GetRoleElement(_configpath, _toe2openRole, "toRole"); //XElement hub = ConfigHelper.GetRoleElement(_warehous, "hub"); XElement config = new XElement("config"); config.Add(new XElement("fromRole", fromrole.Elements())); config.Add(new XElement("tostxRole", tostxrole.Elements())); config.Add(new XElement("toe2openRole", toe2openrole.Elements())); //config.Add(new XElement("hub", hub.Elements())); storerGroup.Add(config); IEnumerable<XElement> vendorreport = receipts.Where(x => x.Element("STORERKEY").Value == key).ToArray(); storerGroup.Add(vendorreport); yield return storerGroup; } }
public static void ExportXml(string path, IEnumerable<SniffedPacket> packets) { if (packets == null) { throw new ArgumentNullException("packets"); } XDocument xDoc = new XDocument( new XDeclaration("1.0", Encoding.UTF8.HeaderName, String.Empty)); XElement xPackets = new XElement( "Packets", new XAttribute("Version", XmlVersion)); foreach (SniffedPacket packet in packets) { XElement xPacket = new XElement("Packet"); xPacket.Add(new XAttribute("Elapsed", packet.ElapsedTime.TotalMilliseconds)); foreach (SniffedValue value in packet.Values) { xPacket.Add(new XElement(value.Name, value.Value)); } xPackets.Add(xPacket); } xDoc.Add(xPackets); xDoc.Save(path); }
/// <summary> /// Writes out the assertion as an XElement. /// </summary> /// <param name="assertion">The assertion to create xml for.</param> /// <returns>XElement</returns> public static XElement ToXElement(this Saml2Assertion assertion) { if(assertion == null) { throw new ArgumentNullException(nameof(assertion)); } var xml = new XElement(Saml2Namespaces.Saml2 + "Assertion", new XAttribute(XNamespace.Xmlns + "saml2", Saml2Namespaces.Saml2Name), new XAttribute("Version", assertion.Version), new XAttribute("ID", assertion.Id.Value), new XAttribute("IssueInstant", assertion.IssueInstant.ToSaml2DateTimeString()), new XElement(Saml2Namespaces.Saml2 + "Issuer", assertion.Issuer.Value)); if (assertion.Subject != null) { xml.Add(assertion.Subject.ToXElement()); } if(assertion.Conditions != null) { xml.Add(assertion.Conditions.ToXElement()); } if (assertion.Statements != null) { foreach (var statement in assertion.Statements) { xml.Add(statement.ToXElement()); }; } return xml; }
public XElement GenerateXmlElement() { var binding = new XElement("binding", new XAttribute("template", this.TileTemplate.ToString())); if (!string.IsNullOrEmpty(Language)) binding.Add(new XAttribute("lang", XmlEncode(Language))); if (Branding.HasValue) binding.Add(new XAttribute("branding", XmlEncode(Branding.Value.ToString().ToLowerInvariant()))); if (!string.IsNullOrEmpty(BaseUri)) binding.Add(new XAttribute("baseUri", XmlEncode(BaseUri))); if (AddImageQuery.HasValue) binding.Add(new XAttribute("addImageQuery", AddImageQuery.Value.ToString().ToLowerInvariant())); int idOn = 1; if (Images != null) { foreach (var img in Images) binding.Add(img.GenerateXmlElement(idOn++)); } idOn = 1; if (Texts != null) { foreach (var text in Texts) binding.Add(text.GenerateXmlElement(idOn++)); } return binding; }
static void Main(string[] args) { var db = new GeographyEntities(); var countries = db.Countries .OrderBy(c => c.CountryName) .Select(c => new { coutryName = c.CountryName, monasteries = c.Monasteries.OrderBy(m => m.Name).Select(m => m.Name) }).ToList(); XElement root = new XElement("monasteries"); foreach (var country in countries) { if (country.monasteries.Count() != 0) { var xmlCountry = new XElement("country"); xmlCountry.Add(new XAttribute("name", country.coutryName)); foreach (var xmlMonasteries in country.monasteries) { xmlCountry.Add(new XElement("monastery", xmlMonasteries)); } root.Add(xmlCountry); } } var xmlDoc = new XDocument(root); xmlDoc.Save("../../monasteries.xml"); }
private void WriteNodes(XElement nodes) { foreach (NodeInfo nodeInfo in _snapshot.Nodes) { var labelComponents = new[] {nodeInfo.NodeType.ToString(), nodeInfo.Details} .Union(nodeInfo.Conditions) .Union(nodeInfo.Expressions) .Where(x => !string.IsNullOrEmpty(x)); string label = string.Join("\n", labelComponents); var node = new XElement(Name("Node"), new XAttribute("Id", Id(nodeInfo)), new XAttribute("Category", nodeInfo.NodeType), new XAttribute("Label", label)); if (nodeInfo.Items.Length > 0) { node.Add(new XAttribute("Group", "Collapsed")); } nodes.Add(node); for (int i = 0; i < nodeInfo.Items.Length; i++) { var itemNode = new XElement(Name("Node"), new XAttribute("Id", SubNodeId(nodeInfo, i)), new XAttribute("Label", nodeInfo.Items[i]), new XAttribute("Style", "Plain")); nodes.Add(itemNode); } } }
/// <summary> /// Đăng nhập vào hệ thống /// </summary> /// <param name="tenDangNhap"></param> /// <param name="matKhau"></param> /// <returns></returns> public static async Task<bool> login(string tenDangNhap, string matKhau, bool isRemember) { try { matKhau = Utilities.EncryptMD5(matKhau); var result = await SystemInfo.DatabaseModel.login(tenDangNhap, matKhau); if (!result) { SystemInfo.IsDangNhap = false; SystemInfo.MaNguoiDung = -1; SystemInfo.TenDangNhap = null; SystemInfo.MatKhauDangNhap = null; } else { SystemInfo.IsDangNhap = true; NguoiDung nguoiDung = await SystemInfo.DatabaseModel.getNguoiDungTenDangNhap(tenDangNhap); SystemInfo.MaNguoiDung = nguoiDung.MaNguoiDung; SystemInfo.TenDangNhap = tenDangNhap; SystemInfo.MatKhauDangNhap = matKhau; if (!(await SystemInfo.DatabaseModel.insertNguoiDungLocal(nguoiDung.MaNguoiDung, nguoiDung.HoTen, nguoiDung.NgaySinh, nguoiDung.Email, nguoiDung.SoDienThoai))) { await SystemInfo.DatabaseModel.updateNguoiDung(nguoiDung.MaNguoiDung, nguoiDung.HoTen, nguoiDung.NgaySinh, nguoiDung.SoDienThoai); } if (isRemember) { StorageFile file = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync("AppConfig.qltcconfig"); using (IRandomAccessStream writeStream = await file.OpenAsync(FileAccessMode.ReadWrite)) { System.IO.Stream s = writeStream.AsStreamForWrite(); System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings(); settings.Async = true; settings.Indent = true; settings.CheckCharacters = false; using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(s, settings)) { XDocument xdoc = new XDocument(); XElement element = new XElement("ThongTinDangNhap"); element.Add(new XElement("MaNguoiDung", nguoiDung.MaNguoiDung + "")); element.Add(new XElement("TenDangNhap", tenDangNhap)); xdoc.Add(element); writer.Flush(); xdoc.Save(writer); } } } } return result; } catch (Exception ex) { throw ex; } }
private static void Main(string[] args) { IEnumerable<Process> processlist = Process.GetProcesses().AsEnumerable(); XElement xElement = new XElement("ProcessList"); foreach (var process in Process.GetProcesses().AsEnumerable()) { xElement.Add(new XElement("Process", process.ProcessName)); var StartInfo = new XElement("StartInfo"); StartInfo.Add(new XElement("FileName", process.StartInfo.FileName)); StartInfo.Add(new XElement("Arguments", process.StartInfo.Arguments)); StartInfo.Add(new XElement("CreateNoWindow", process.StartInfo.CreateNoWindow)); StartInfo.Add(new XElement("Domain", process.StartInfo.Domain)); StartInfo.Add(new XElement("EnvironmentVariables", process.StartInfo.EnvironmentVariables)); StartInfo.Add(new XElement("ErrorDialog", process.StartInfo.ErrorDialog)); StartInfo.Add(new XElement("ErrorDialogParentHandle", process.StartInfo.ErrorDialogParentHandle)); StartInfo.Add(new XElement("LoadUserProfile", process.StartInfo.LoadUserProfile)); StartInfo.Add(new XElement("Password", process.StartInfo.Password)); StartInfo.Add(new XElement("RedirectStandardError", process.StartInfo.RedirectStandardError)); StartInfo.Add(new XElement("Arguments", process.StartInfo.WorkingDirectory)); StartInfo.Add(new XElement("IsFixedSize", process.StartInfo.Verbs.IsFixedSize)); StartInfo.Add(new XElement("FileName", process.StartInfo.FileName)); StartInfo.Add(new XElement("FileName", process.StartInfo.FileName)); StartInfo.Add(new XElement("FileName", process.StartInfo.FileName)); StartInfo.Add(new XElement("FileName", process.StartInfo.FileName)); StartInfo.Add(new XElement("FileName", process.StartInfo.FileName)); StartInfo.Add(new XElement("FileName", process.StartInfo.FileName)); StartInfo.Add(new XElement("FileName", process.StartInfo.FileName)); xElement.Add(StartInfo); } xElement.Save(string.Format(@"D:\temp\Process{0}.xml", DateTime.Now.ToString("yyyyMMddHHmmss"))); }
private XDocument CreatePayload(String roleName, String packageUrl, String pathToConfigurationFile, String label) { String configurationFile = File.ReadAllText(pathToConfigurationFile); String base64ConfigurationFile = ConvertToBase64String(configurationFile); String base64Label = ConvertToBase64String(label); XElement xMode = new XElement(wa + "Mode", "auto"); XElement xPackageUrl = new XElement(wa + "PackageUrl", packageUrl); XElement xConfiguration = new XElement(wa + "Configuration", base64ConfigurationFile); XElement xLabel = new XElement(wa + "Label", base64Label); XElement xRoleToUpgrade = new XElement(wa + "RoleToUpgrade", roleName); XElement upgradeDeployment = new XElement(wa + "UpgradeDeployment"); upgradeDeployment.Add(xMode); upgradeDeployment.Add(xPackageUrl); upgradeDeployment.Add(xConfiguration); upgradeDeployment.Add(xLabel); upgradeDeployment.Add(xRoleToUpgrade); XDocument payload = new XDocument(); payload.Add(upgradeDeployment); payload.Declaration = new XDeclaration("1.0", "UTF-8", "no"); return payload; }
public IEnumerable<XElement> GetElements(int tenant, string[] configs, IDataWriteOperator writer) { var xml = new List<XElement>(); var connectionKeys = new Dictionary<string, string>(); foreach (ConnectionStringSettings connectionString in GetConnectionStrings(configs)) { //do not save the base, having the same provider and connection string is not to duplicate //data, but also expose the ref attribute of repetitive bases for the correct recovery var node = new XElement(connectionString.Name); xml.Add(node); var connectionKey = connectionString.ProviderName + connectionString.ConnectionString; if (connectionKeys.ContainsKey(connectionKey)) { node.Add(new XAttribute("ref", connectionKeys[connectionKey])); } else { connectionKeys.Add(connectionKey, connectionString.Name); OnProgressChanged("Saving database " + connectionString.Name, -1); node.Add(BackupDatabase(tenant, connectionString, writer)); OnProgressChanged("OK", 100); } } return xml; }
internal static void Save(QuoteList inQuoteList) { XDocument document = new XDocument(); document.Add(XElement.Parse(@"<QuoteList xmlns='http://kiander.com'></QuoteList>")); document.Root.Add(new XAttribute("QuoteListId", inQuoteList.Id)); foreach (IQuote quote in inQuoteList.Quotes) { XElement quoteRecord = new XElement("QuoteRecord"); quoteRecord.Add(new XElement("QuoteID", quote.Id)); quoteRecord.Add(new XElement("Quote", quote.Text)); quoteRecord.Add(new XElement("Author", quote.Author)); XElement categories = new XElement("Categories"); if (quote.Categories != null) { foreach (string category in quote.Categories) { categories.Add(new XElement("Category", category)); } } if (quote.Categories == null || quote.Categories.Count < 1) { categories.Add(new XElement("Category", string.Empty)); } quoteRecord.Add(categories); document.Root.Add(quoteRecord); } if (File.Exists(DataFileHelper.FullPath(inQuoteList.Id))) File.Delete(DataFileHelper.FullPath(inQuoteList.Id)); document.Save(DataFileHelper.FullPath(inQuoteList.Id)); }
public static string Bulid(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { using (ProduceBussiness db = new ProduceBussiness()) { NpcInfo[] infos = db.GetAllNPCInfo(); foreach (NpcInfo info in infos) { result.Add(FlashUtils.CreatNPCInfo(info)); } value = true; message = "Success!"; } } catch (Exception ex) { log.Error("Load NPCInfoList is fail!", ex); } result.Add(new XAttribute("vaule", value)); result.Add(new XAttribute("message", message)); return csFunction.CreateCompressXml(context, result, "NPCInfoList", true); }
/// <summary> /// Unparses the <see cref="Script"/> into an XML document. /// </summary> /// <returns>The XML representation of the <see cref="Script"/>.</returns> public XElement Unparse() { XElement xelScript = new XElement("config", new XAttribute(XName.Get("noNamespaceSchemaLocation", "http://www.w3.org/2001/XMLSchema-instance"), String.Format("XmlScript{0}.xsd", Script.Version))); List<XElement> lstHeaderInfo = UnparseHeaderInfo(); foreach (XElement xelHeaderInfo in lstHeaderInfo) xelScript.Add(xelHeaderInfo); XElement xelPrerequisites = UnparseModPrerequisites(); if (xelPrerequisites != null) xelScript.Add(xelPrerequisites); XElement xelRequiredInstallFiles = UnparseRequiredInstallFiles(); if (xelRequiredInstallFiles != null) xelScript.Add(xelRequiredInstallFiles); XElement xelInstallSteps = UnparseInstallSteps(); if (xelInstallSteps != null) xelScript.Add(xelInstallSteps); XElement xelConditionallyInstalledFileSets = UnparseConditionallyInstalledFileSets(); if (xelConditionallyInstalledFileSets != null) xelScript.Add(xelConditionallyInstalledFileSets); return xelScript; }
private void buttonOK_Click(object sender, EventArgs e) { Xml.XDocument xDocument = new Xml.XDocument(new Xml.XDeclaration("1.0", "utf-8", "Yes")); Xml.XElement xSettings = new Xml.XElement("schLauncherSettings"); xSettings.Add(new Xml.XElement("KiCadPath", textBoxKiCad.Text)); xSettings.Add(new Xml.XElement("EaglePath", textBoxEagle.Text)); xDocument.Add(xSettings); xDocument.Save("settings.xml"); this.Close(); }
public void SerializeToElement(string objectToSerialize, System.Xml.Linq.XElement elemToFill) { if (objectToSerialize != null) { elemToFill.Add(new XCData(objectToSerialize)); } else { elemToFill.Add(""); } }
protected override void AddToTypeEl(SXL.XElement parent) { if (this.Boolean) { parent.Add("1"); } else { parent.Add("0"); } }
protected override void SaveTo(System.Xml.Linq.XElement element) { element.Add(new XAttribute("type", "User")); if (this.DefaultValue != null && !string.IsNullOrEmpty(this.DefaultValue.ToString())) { element.Add(new XAttribute(DEFAULT, this.DefaultValue.ToString())); } if (DisplayStyle != UserDisplayStyles.PhotoOnly) { element.Add(new XAttribute("dispAs", this.DisplayStyle.ToString())); } this.ThumbnailWidth = element.IntAttr("thumbWidth"); this.ThumbnailHeight = element.IntAttr("thumbHeight"); }
public void AddToElement(SXL.XElement parent) { var connect_el = XMLUtil.CreateVisioSchema2003Element("Connect"); connect_el.SetAttributeValue("FromSheet", this.FromSheet); if (this.FromCell != null) { connect_el.SetAttributeValue("FromCell", this.FromCell); } if (this.FromPart.HasValue) { connect_el.SetAttributeValue("FromPart", this.FromPart.Value); } connect_el.SetAttributeValue("ToSheet", this.ToSheet); if (this.ToCell != null) { connect_el.SetAttributeValue("ToCell", this.ToCell); } if (this.ToPart.HasValue) { connect_el.SetAttributeValue("ToPart", this.ToPart.Value); } parent.Add(connect_el); }
public void AddToElement(SXL.XElement parent) { var el = XMLUtil.CreateVisioSchema2003Element("PageLayout"); el.Add(this.ResizePage.ToXml("ResizePage")); el.Add(this.EnableGrid.ToXml("EnableGrid")); el.Add(this.DynamicsOff.ToXml("DynamicsOff")); el.Add(this.PlaceStyle.ToXml("PlaceStyle")); el.Add(this.RouteStyle.ToXml("RouteStyle")); el.Add(this.PlaceDepth.ToXml("PlaceDepth")); el.Add(this.PlowCode.ToXml("PlowCode")); el.Add(this.LineJumpCode.ToXml("LineJumpCode")); el.Add(this.LineJumpStyle.ToXml("LineJumpStyle")); el.Add(this.PageLineJumpDirX.ToXml("PageLineJumpDirX")); el.Add(this.PageLineJumpDirY.ToXml("PageLineJumpDirY")); el.Add(this.LineToNodeX.ToXml("LineToNodeX")); el.Add(this.LineToNodeY.ToXml("LineToNodeY")); el.Add(this.BlockSizeX.ToXml("BlockSizeX")); el.Add(this.BlockSizeY.ToXml("BlockSizeY")); el.Add(this.AvenueSizeX.ToXml("AvenueSizeX")); el.Add(this.AvenueSizeY.ToXml("AvenueSizeY")); el.Add(this.LineToLineX.ToXml("LineToLineX")); el.Add(this.LineToLineY.ToXml("LineToLineY")); el.Add(this.LineJumpFactorX.ToXml("LineJumpFactorX")); el.Add(this.LineJumpFactorY.ToXml("LineJumpFactorY")); el.Add(this.LineAdjustFrom.ToXml("LineAdjustFrom")); el.Add(this.LineAdjustTo.ToXml("LineAdjustTo")); el.Add(this.PlaceFlip.ToXml("PlaceFlip")); el.Add(this.LineRouteExt.ToXml("LineRouteExt")); el.Add(this.PageShapeSplit.ToXml("PageShapeSplit")); parent.Add(el); }
/// <summary> /// 将配置信息保存到XML /// </summary> /// <param name="CurrentNode">当前XML节点</param> public void SerializeConfigToXmlNode(System.Xml.Linq.XElement CurrentNode) { //参数检查 if (this.ArticleList == null) { throw new Exception("ArticleList参数未赋值"); } //定义节点 XElement xeArticles = new XElement("Articles"); //解析每一个文章列表 foreach (ArticleCan article in this.ArticleList) { List <string> ret = new List <string>(); ret.Add(article.Title); ret.Add(article.Description); ret.Add(article.PicUrl); ret.Add(article.Url); xeArticles.Add(new XElement("Article", ConfigHelper.SerializeToString(ret))); } //成功之后附加到节点 CurrentNode.Add(xeArticles); }
public void AddToElement(SXL.XElement parent) { var el = XMLUtil.CreateVisioSchema2003Element("Misc"); el.Add(this.NoObjHandles.ToXml("NoObjHandles")); el.Add(this.NonPrinting.ToXml("NonPrinting")); el.Add(this.NoCtlHandles.ToXml("NoCtlHandles")); el.Add(this.NoAlignBox.ToXml("NoAlignBox")); el.Add(this.UpdateAlignBox.ToXml("UpdateAlignBox")); el.Add(this.HideText.ToXml("HideText")); el.Add(this.DynFeedback.ToXml("DynFeedback")); el.Add(this.GlueType.ToXml("GlueType")); el.Add(this.WalkPreference.ToXml("WalkPreference")); el.Add(this.BegTrigger.ToXml("BegTrigger")); el.Add(this.EndTrigger.ToXml("EndTrigger")); el.Add(this.ObjType.ToXml("ObjType")); el.Add(this.Comment.ToXml("Comment")); el.Add(this.IsDropSource.ToXml("IsDropSource")); el.Add(this.NoLiveDynamics.ToXml("NoLiveDynamics")); el.Add(this.LocalizeMerge.ToXml("LocalizeMerge")); el.Add(this.Calendar.ToXml("Calendar")); el.Add(this.LangID.ToXml("LangID")); el.Add(this.ShapeKeywords.ToXml("ShapeKeywords")); el.Add(this.DropOnPageScale.ToXml("DropOnPageScale")); parent.Add(el); }
public void AddToElement(SXL.XElement parent) { var el = XMLUtil.CreateVisioSchema2006Element("Event"); el.Add(this.EventMultiDrop.ToXml2006("EventMultiDrop")); parent.Add(el); }
public void AddToElement(SXL.XElement parent) { var el1 = XMLUtil.CreateVisioSchema2003Element("Event"); el1.Add(this.TheData.ToXml("TheData")); el1.Add(this.TheText.ToXml("TheText")); el1.Add(this.EventDblClick.ToXml("EventDblClick")); el1.Add(this.EventXFMod.ToXml("EventXFMod")); el1.Add(this.EventDrop.ToXml("EventDrop")); parent.Add(el1); var el2 = XMLUtil.CreateVisioSchema2006Element("Event"); el2.Add(this.EventMultiDrop.ToXml2006("EventMultiDrop")); parent.Add(el2); }
internal static void LogError(Guid errorId, Exception ex, Dictionary <string, string> dataObject) { try { using (Models.ApplicationDbContext ctx = new ApplicationDbContext()) { ErrorLog errorLogInfo = new ErrorLog(); errorLogInfo.ErrorId = errorId; errorLogInfo.Message = ex.ToString(); XElement objectData = new System.Xml.Linq.XElement("ObjectData"); foreach (var singleItem in dataObject) { XElement propertyInfoElement = new XElement("PropertyInfo"); propertyInfoElement.SetAttributeValue("Name", singleItem.Key); propertyInfoElement.SetAttributeValue("Value", singleItem.Value); objectData.Add(propertyInfoElement); } errorLogInfo.Data = objectData.ToString(); ctx.ErrorLogs.Add(errorLogInfo); ctx.SaveChanges(); } } catch (Exception) { //do nothing } }
public void AddToElement(SXL.XElement parent) { var prop_el = Internal.XMLUtil.CreateVisioSchema2003Element("Prop"); if (this.Name != null) { prop_el.SetElementValue("Name", this.Name); } prop_el.SetAttributeValue("NameU", this.NameU); prop_el.SetAttributeValue("ID", this.ID); prop_el.SetElementValueConditional("Del", this._del); if (this.Value != null) { var val_el = new SXL.XElement(Internal.Constants.VisioXmlNamespace2003 + "Value"); prop_el.Add(val_el); val_el.SetAttributeValue("Unit", "STR"); val_el.SetValue(this.Value); } prop_el.Add(this.Prompt.ToXml("Prompt")); prop_el.Add(this.Label.ToXml("Label")); prop_el.Add(this.Format.ToXml("Format")); prop_el.Add(this.SortKey.ToXml("SortKey")); prop_el.Add(this.Type.ToXml("Type")); prop_el.Add(this.Invisible.ToXml("Invisible")); prop_el.Add(this.LangID.ToXml("LangID")); prop_el.Add(this.Calendar.ToXml("Calendar")); parent.Add(prop_el); }
public void AddToElement(SXL.XElement parent) { var el = XMLUtil.CreateVisioSchema2003Element("Fill"); el.Add(this.ForegroundColor.ToXml("FillForegnd")); el.Add(this.BackgroundColor.ToXml("FillBkgnd")); el.Add(this.Pattern.ToXml("FillPattern")); el.Add(this.ShadowForegroundColor.ToXml("ShdwForegnd")); el.Add(this.ShadowBackgroundColor.ToXml("ShdwBkgnd")); el.Add(this.ShadowPattern.ToXml("ShdwPattern")); el.Add(this.ForegroundTransparency.ToXml("FillForegndTrans")); el.Add(this.BackgroundTransparency.ToXml("FillBkgndTrans")); el.Add( this.ShadowForegroundTransparency.ToXml("ShdwForegndTrans")); el.Add( this.ShadowBackgroundTransparency.ToXml("ShdwBkgndTrans")); el.Add(this.ShadowType.ToXml("ShapeShdwType")); el.Add(this.ShadowOffsetX.ToXml("ShapeShdwOffsetX")); el.Add(this.ShadowOffsetY.ToXml("ShapeShdwOffsetY")); el.Add(this.ShadowObliqueAngle.ToXml("ShapeShdwObliqueAngle")); el.Add(this.ShadowScale.ToXml("ShapeShdwScaleFactor")); parent.Add(el); }
public void AddToElement(SXL.XElement parent) { var el = XMLUtil.CreateVisioSchema2003Element("PrintProps"); el.Add(this.PageLeftMargin.ToXml("PageLeftMargin")); el.Add(this.PageRightMargin.ToXml("PageRightMargin")); el.Add(this.PageTopMargin.ToXml("PageTopMargin")); el.Add(this.PageBottomMargin.ToXml("PageBottomMargin")); el.Add(this.ScaleX.ToXml("ScaleX")); el.Add(this.ScaleY.ToXml("ScaleY")); el.Add(this.PagesX.ToXml("PagesX")); el.Add(this.PagesY.ToXml("PagesY")); el.Add(this.CenterX.ToXml("CenterX")); el.Add(this.CenterY.ToXml("CenterY")); el.Add(this.OnPage.ToXml("OnPage")); el.Add(this.PrintGrid.ToXml("PrintGrid")); el.Add(this.PrintPageOrientation.ToXml("PrintPageOrientation")); el.Add(this.PaperKind.ToXml("PaperKind")); el.Add(this.PaperSource.ToXml("PaperSource")); el.Add(this.ShdwObliqueAngle.ToXml("ShdwObliqueAngle")); el.Add(this.ShdwScaleFactor.ToXml("ShdwScaleFactor")); parent.Add(el); }
public void AddToElement(SXL.XElement parent) { if (this.Runs != null) { var text_el = XMLUtil.CreateVisioSchema2003Element("Text"); foreach (var ft in this.m_runs) { if (ft.CharacterFormatIndex.HasValue) { var xcp = XMLUtil.CreateVisioSchema2003Element("cp"); xcp.SetAttributeValue("IX", ft.CharacterFormatIndex.Value); text_el.Add(xcp); } if (ft.ParagraphFormatIndex.HasValue) { var xpp = XMLUtil.CreateVisioSchema2003Element("pp"); xpp.SetAttributeValue("IX", ft.ParagraphFormatIndex.Value); text_el.Add(xpp); } if (ft.TabsFormatIndex.HasValue) { var xtp = XMLUtil.CreateVisioSchema2003Element("tp"); xtp.SetAttributeValue("IX", ft.TabsFormatIndex.Value); text_el.Add(xtp); } text_el.Add(ft.Text); } parent.Add(text_el); } }
public void Save(System.Xml.Linq.XElement parentNode) { parentNode.Add( new XElement("ProteinFileName", ProteinFileName), new XElement("QuanPeptideFileName", QuanPeptideFileName), new XElement("ExpermentalDesignFile", ExpermentalDesignFile), new XElement("PeptideToProteinMethod", PeptideToProteinMethod)); }
public void ToXml(SXL.XElement parent) { var facename_el = XMLUtil.CreateVisioSchema2003Element("FaceName"); facename_el.SetAttributeValueInt("ID", this.ID); facename_el.SetAttributeValue("Name", this.Name); parent.Add(facename_el); }
public override void AddToElement(SXL.XElement parent, int index) { var el = XMLUtil.CreateVisioSchema2003Element("LineTo"); el.SetAttributeValueInt("IX", index); el.Add(this.X.ToXml("X")); el.Add(this.Y.ToXml("Y")); parent.Add(el); }
protected override void SetAttributes(System.Xml.Linq.XElement ele, object propertyValue) { IRasterDrawing drawing = propertyValue as IRasterDrawing; ele.SetAttributeValue("filename", drawing.FileName); XElement bandsElement = new XElement("SelectedBandNos"); bandsElement.SetValue(GetSelectedBandNosString(drawing)); ele.Add(bandsElement); }
public void Save(System.Xml.Linq.XElement parentNode) { parentNode.Add( new XElement("PeptideFile", PeptideFile), new XElement("DesignFile", DesignFile), new XElement("PerformNormalization", PerformNormalizition), new XElement("QuantifyMode", Mode), new XElement("ModifiedAminoacids", ModifiedAminoacids), new XElement("MinimumSiteProbability", MinimumSiteProbability)); }
protected override void AddToTypeEl(SXL.XElement parent) { var data_el = new SXL.XElement("data"); parent.Add(data_el); foreach (Value item in this) { item.AddXmlElement(data_el); } }
public static void WriteElementColor(this System.Xml.Linq.XElement element, string elementName, System.Windows.Media.Color color) { XElement elemColor = new XElement("Color"); elemColor.Add(new XAttribute("Name", elementName)); elemColor.Add(new XAttribute("R", color.R.ToString())); elemColor.Add(new XAttribute("G", color.G.ToString())); elemColor.Add(new XAttribute("B", color.B.ToString())); element.Add(elemColor); }
public void AddToElement(SXL.XElement parent) { var el = XMLUtil.CreateVisioSchema2003Element("XForm1D"); el.Add(this.BeginX.ToXml("BeginX")); el.Add(this.BeginY.ToXml("BeginY")); el.Add(this.EndX.ToXml("EndX")); el.Add(this.EndY.ToXml("EndY")); parent.Add(el); }
public void SaveToXml(System.Xml.Linq.XElement option) { var keyele = new XElement(key); option.Add(keyele); foreach (ColumnHeader col in lvValue.Columns) { keyele.Add(new XElement("column", new XElement("name", col.Text), new XElement("width", col.Width))); } }
protected override void SaveConfig(System.Xml.Linq.XElement moduleEl) { base.SaveConfig(moduleEl); foreach (var user in _users) { var userEl = new XElement("user"); BotModule.SaveProperties(user, userEl); moduleEl.Add(userEl); } }
public static void SaveToXml(this Dictionary <string, List <string> > dic, System.Xml.Linq.XElement option, string nodeName, string pattern) { option.RemoveChild(nodeName); option.Add(new XElement(nodeName, string.IsNullOrEmpty(pattern) ? null : new XElement("Pattern", pattern), from d in dic select new XElement("Set", new XAttribute("Key", d.Key), from e in d.Value select new XElement("Value", e)))); }
/// <summary> /// 将配置信息保存到XML /// </summary> /// <param name="CurrentNode">当前XML节点</param> public void SerializeConfigToXmlNode(System.Xml.Linq.XElement CurrentNode) { CurrentNode.Add(new XElement("MatchText", this.MatchText)); //处理状态成员 XElement xeReady, xeSuccess, xeFail; this.SerializeStatusMember(out xeReady, out xeSuccess, out xeFail); if (xeReady != null) { CurrentNode.Add(xeReady); } if (xeSuccess != null) { CurrentNode.Add(xeSuccess); } if (xeFail != null) { CurrentNode.Add(xeFail); } }