private static void HandleFolder(pstsdk.definition.pst.folder.IFolder rootfolder, System.Xml.XmlDocument doc, System.Xml.XmlNode node, string currpath, bool unicode) { uint messagecnt = (uint)rootfolder.MessageCount; uint attachcnt = (uint)rootfolder.Messages.Sum(x => x.AttachmentCount); System.Xml.XmlElement folderinfo = doc.CreateElement("folderinfo"); System.Xml.XmlNode folderinfonode = node.AppendChild(folderinfo); System.Xml.XmlElement numofmsg = doc.CreateElement("numOfMsg"); System.Xml.XmlNode numofmsgnode = folderinfonode.AppendChild(numofmsg); numofmsgnode.InnerText = messagecnt.ToString(); System.Xml.XmlElement numofattachments = doc.CreateElement("numOfAttachments"); System.Xml.XmlNode numofattachmentsnode = folderinfonode.AppendChild(numofattachments); numofattachmentsnode.InnerText = attachcnt.ToString(); System.Xml.XmlElement foldername = doc.CreateElement("foldername"); System.Xml.XmlNode foldernamenode = folderinfonode.AppendChild(foldername); System.Xml.XmlAttribute foldernameattrib = doc.CreateAttribute("type"); foldernameattrib.InnerText = unicode == true ? "PT_UNICODE" : "PT_ASCII"; foldernamenode.Attributes.Append(foldernameattrib); // if (currpath == "Root Container") // foldernamenode.InnerText = String.Format("cb: {0} lpb: {1}", 0, string.Empty); // else // { byte[] bytes = null; if (unicode == true) bytes = System.Text.UnicodeEncoding.Unicode.GetBytes(currpath); else bytes = System.Text.UnicodeEncoding.ASCII.GetBytes(currpath); foldernamenode.InnerText = String.Format("cb: {0} lpb: {1}", bytes.Length, bytes.Select(x => String.Format("{0:X2}", x)).Aggregate((i, j) => i + j)); // } System.Xml.XmlElement folderid = doc.CreateElement("folderid"); System.Xml.XmlNode folderidnode = folderinfonode.AppendChild(folderid); folderidnode.InnerText = rootfolder.EntryID.ToString(); }
AddData( System.Xml.XmlDocument document, string name, string value, System.Xml.XmlElement parent) { var data = document.CreateElement("data"); parent.AppendChild(data); data.SetAttribute("name", name); var valueEl = document.CreateElement("value"); valueEl.InnerText = value; data.AppendChild(valueEl); }
public System.Xml.XmlNode GetSettings(System.Xml.XmlDocument document) { var settingsNode = document.CreateElement("Settings"); settingsNode.AppendChild(SettingsHelper.ToElement(document, "Version", "1.4")); settingsNode.AppendChild(SettingsHelper.ToElement(document, "ScriptPath", ScriptPath)); return settingsNode; }
internal virtual XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode) { XmlElement gr = doc.CreateElement("pointmass"); grnode.AppendChild(gr); gr.SetAttribute("name", Name); gr.AppendChild(Location.CreateXmlNode(doc, "Pointmass "+Name)); gr.AppendChild(weight.CreateXmlNode(doc, "weight")); return gr; }
internal virtual XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode) { XmlElement gr = doc.CreateElement("force"); grnode.AppendChild(gr); gr.SetAttribute("name", name); gr.SetAttribute("frame", frame); gr.AppendChild(location.CreateXmlNode(doc)); gr.AppendChild(direction.CreateXmlNode(doc, null, "direction")); return gr; }
public static System.Xml.XmlElement save(System.Xml.XmlDocument doc, List<instrument> instrumentList) { /* public string ip; public int port; public bool local; public bool flat; */ System.Xml.XmlElement instruments = doc.CreateElement("instruments"); foreach(instrument i in instrumentList) { System.Xml.XmlElement ele = doc.CreateElement("instrument"); ele.SetAttribute("ip", i.ip); ele.SetAttribute("port", i.port.ToString()); ele.SetAttribute("local", i.local.ToString()); ele.SetAttribute("flat", i.flat.ToString()); ele.SetAttribute("type", System.Enum.GetName(typeof(instrumentType), i.mytype)); instruments.AppendChild(ele); } return instruments; }
internal XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode, int tank_index) { XmlElement gr = doc.CreateElement("tank"); gr.AppendChild(doc.CreateComment(String.Format("{0}: {1}", tank_index, Name))); grnode.AppendChild(gr); gr.SetAttribute("type", "FUEL"); gr.AppendChild(Location.CreateXmlNode(doc)); gr.AppendChild(Capacity.CreateXmlNode(doc, "capacity")); if (Standpipe != null) gr.AppendChild(Standpipe.CreateXmlNode(doc, "standpipe")); gr.AppendChild(Capacity.CreateXmlNode(doc, "contents")); { XmlElement p = doc.CreateElement("priority"); p.InnerText = Priority.ToString(); gr.AppendChild(p); } return gr; }
internal override XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode) { var xe = base.CreateXmlNodes(doc, grnode); xe.SetAttribute("type", "BOGEY"); xe.AppendChild(MaxSteer.CreateXmlNode(doc, "max_steer")); if (!string.IsNullOrEmpty(BrakeGroup)) { XmlElement bg = doc.CreateElement("brake_group"); xe.AppendChild(bg); bg.InnerText = BrakeGroup; } if (Retractable) { var re = doc.CreateElement("retractable"); xe.AppendChild(re); re.InnerText = "1"; } return xe; }
AddResHeader( System.Xml.XmlDocument document, string name, string value, System.Xml.XmlElement parent) { var resHeader = document.CreateElement("resheader"); parent.AppendChild(resHeader); resHeader.SetAttribute("name", name); resHeader.InnerText = value; }
public static System.Xml.XmlElement save(System.Xml.XmlDocument doc, List<section> sections) { System.Xml.XmlElement ret = doc.CreateElement("Sections"); foreach(section s in sections) { System.Xml.XmlElement sec = doc.CreateElement("section"); sec.SetAttribute("name", s.name); sec.SetAttribute("instrumentID", s.instrumentid.ToString()); sec.SetAttribute("startTime", s.starttime.ToString()); foreach(note n in s.notes) { System.Xml.XmlElement xnote = doc.CreateElement("note"); xnote.SetAttribute("pitch", n.pitch); xnote.SetAttribute("time", n.time.ToString()); xnote.SetAttribute("duration", n.duration.ToString()); sec.AppendChild(xnote); } ret.AppendChild(sec); } return ret; }
internal XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode) { XmlElement gr = doc.CreateElement("engine"); grnode.AppendChild(gr); gr.SetAttribute("file", Name); gr.AppendChild(Location.CreateXmlNode(doc)); gr.AppendChild(Orient.CreateOrientXmlNode(doc,null,"orient")); foreach (var f in Feed) { XmlElement feed = doc.CreateElement("feed"); gr.AppendChild(feed); feed.InnerText = f.ToString(); } XmlElement th = doc.CreateElement("thruster"); gr.AppendChild(th); th.SetAttribute("file", "direct"); th.AppendChild(Location.CreateXmlNode(doc)); th.AppendChild(Orient.CreateOrientXmlNode(doc, null, "orient")); return gr; }
internal virtual XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode) { XmlElement gr = doc.CreateElement("contact"); grnode.AppendChild(gr); gr.SetAttribute("type", "STRUCTURE"); gr.SetAttribute("name", Name); gr.AppendChild(Location.CreateXmlNode(doc)); gr.AppendChild(static_friction.CreateXmlNode(doc, "static_friction")); gr.AppendChild(dynamic_friction.CreateXmlNode(doc, "dynamic_friction")); gr.AppendChild(rolling_friction.CreateXmlNode(doc, "rolling_friction")); gr.AppendChild(spring_coeff.CreateXmlNode(doc, "spring_coeff")); gr.AppendChild(damping_coeff.CreateXmlNode(doc, "damping_coeff")); return gr; }
/// <summary> /// Writes the current element's content /// </summary> /// <param name="doc"></param> /// <param name="currentNode"></param> public void WriteXml(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode) { var cls = this.Parent.GetClass(this.SchemaName, this.ClassName); if (cls != null) { var ctype = doc.CreateElement("complexType"); //NOXLATE ctype.SetAttribute("name", Utility.EncodeFDOName(this.ClassName) + "Type"); //NOXLATE { var table = doc.CreateElement("Table"); //NOXLATE table.SetAttribute("name", this.ClassName); //NOXLATE ctype.AppendChild(table); PropertyDefinition geomProp = null; foreach (var prop in cls.Properties) { //If this is geometry, we'll handle it later if (prop.Name == cls.DefaultGeometryPropertyName) { geomProp = prop; continue; } //If this is a geometry mapped X/Y/Z property, skip it if (prop.Name == this.XColumn || prop.Name == this.YColumn || prop.Name == this.ZColumn) continue; var el = doc.CreateElement("element"); //NOXLATE el.SetAttribute("name", Utility.EncodeFDOName(prop.Name)); //NOXLATE var col = doc.CreateElement("Column"); //NOXLATE col.SetAttribute("name", prop.Name); //NOXLATE el.AppendChild(col); ctype.AppendChild(el); } //Append geometry mapping if (geomProp != null) { var el = doc.CreateElement("element"); //NOXLATE el.SetAttribute("name", geomProp.Name); //NOXLATE if (!string.IsNullOrEmpty(this.XColumn)) el.SetAttribute("xColumnName", this.XColumn); //NOXLATE if (!string.IsNullOrEmpty(this.YColumn)) el.SetAttribute("yColumnName", this.YColumn); //NOXLATE if (!string.IsNullOrEmpty(this.ZColumn)) el.SetAttribute("zColumnName", this.ZColumn); //NOXLATE ctype.AppendChild(el); } } currentNode.AppendChild(ctype); } }
/// <summary> /// Writes the current element's content /// </summary> /// <param name="doc"></param> /// <param name="currentNode"></param> public override void WriteXml(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode) { var en = Utility.EncodeFDOName(this.Name); var geom = doc.CreateElement("xs", "element", XmlNamespaces.XS); //NOXLATE geom.SetAttribute("name", en); //NOXLATE geom.SetAttribute("type", "fdo:RasterPropertyType"); //NOXLATE geom.SetAttribute("defaultImageXSize", XmlNamespaces.FDO, this.DefaultImageXSize.ToString()); //NOXLATE geom.SetAttribute("defaultImageYSize", XmlNamespaces.FDO, this.DefaultImageYSize.ToString()); //NOXLATE geom.SetAttribute("srsName", XmlNamespaces.FDO, this.SpatialContextAssociation); //NOXLATE //Write description node var anno = doc.CreateElement("xs", "annotation", XmlNamespaces.XS); //NOXLATE var docN = doc.CreateElement("xs", "documentation", XmlNamespaces.XS); //NOXLATE docN.InnerText = this.Description; geom.AppendChild(anno); anno.AppendChild(docN); currentNode.AppendChild(geom); }
/// <summary> /// Сохранить параметр в Xml узел /// </summary> /// <param name="document">XML документ, куда будет добавлен данный XmlNode</param> /// <returns>Узел в котором сохранен параметр</returns> public override XmlNode Save(System.Xml.XmlDocument document) { XmlNode root = base.Save(document); if (root != null) { try { if (slim.TryEnterReadLock(100)) { try { XmlNode valNode = document.CreateElement(valName); XmlNode sourceNode = document.CreateElement(sourceName); valNode.InnerText = val.ToString(); sourceNode.InnerText = source.ToString(); root.AppendChild(valNode); root.AppendChild(sourceNode); return root; } finally { slim.ExitReadLock(); } } } catch { } } return root; }
public System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { string text = txtText.Text; string fontName = font.Name; string fontSize = font.Size.ToString(); SolidColorBrush color = (SolidColorBrush)rctColor.Fill; string xmlString = "<graphicsLayer><text>" + text + "</text><color>" + color.Color.ToString() + "</color><font>" + ConvertToString(this.font) + "</font></graphicsLayer>"; System.Xml.XmlElement element = doc.CreateElement("graphicsLayer"); element.InnerXml = xmlString; System.Xml.XmlAttribute type = doc.CreateAttribute("layerType"); type.Value = "EpiDashboard.Mapping.TextProperties"; element.Attributes.Append(type); System.Xml.XmlAttribute x = doc.CreateAttribute("locationX"); x.Value = point.X.ToString(); element.Attributes.Append(x); System.Xml.XmlAttribute y = doc.CreateAttribute("locationY"); y.Value = point.Y.ToString(); element.Attributes.Append(y); return element; }
/// <summary> /// Generates an Xml element for this rule /// </summary> /// <param name="doc">The parent Xml document</param> /// <returns>XmlNode representing this rule</returns> public override System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { string xmlString = "<friendlyRule>" + friendlyRule + "</friendlyRule>" + "<assignmentType>" + ((int)assignmentType).ToString() + "</assignmentType>" + "<destinationColumnName>" + destinationColumnName + "</destinationColumnName>" + "<destinationColumnType>" + destinationColumnType + "</destinationColumnType>"; xmlString = xmlString + "<parameterList>"; foreach (string parameter in this.AssignmentParameters) { DateTime dt; DateTime? dtN = null; if (DateTime.TryParse(parameter, out dt)) dtN = dt; if (dtN.HasValue) { xmlString = xmlString + "<parameter type=\"literal\" unit=\"ticks\">" + dtN.Value.Ticks + "</parameter>"; } else { xmlString = xmlString + "<parameter type=\"fieldName\">" + parameter + "</parameter>"; } } xmlString = xmlString + "</parameterList>"; System.Xml.XmlElement element = doc.CreateElement("rule"); element.InnerXml = xmlString; System.Xml.XmlAttribute order = doc.CreateAttribute("order"); System.Xml.XmlAttribute type = doc.CreateAttribute("ruleType"); type.Value = "EpiDashboard.Rules.Rule_SimpleAssign"; element.Attributes.Append(type); return element; }
/// <summary> /// Creates the XmlElement for the third level, or TestGroup level of the /// tree. /// </summary> /// <param name="doc"> /// The XmlDocument object that will eventually contain this Element. /// </param> /// <param name="node"> /// The TreeNode representation of this TestGroup /// </param> /// <returns> /// The XmlElement that contains the TestGroup and all its children. /// </returns> private System.Xml.XmlElement SaveTestGroupNodeToXmlElement( System.Xml.XmlDocument doc, TreeNode node) { System.Xml.XmlElement ret = doc.CreateElement("TestGroup"); IUPnPTestGroup group = node.Tag as IUPnPTestGroup; if (group != null) { ret.SetAttribute("name", group.GroupName); ret.SetAttribute("state", Util.UPnPTestStatesToString(group.GroupState)); ret.SetAttribute("description", group.Description); for (int i = 0; i < group.TestNames.GetLength(0); i++) { string result = ""; if (group.Result.GetLength(0) > i) { result = group.Result[i]; } System.Xml.XmlElement testElement = SaveTestToXmlElement( doc, group.TestNames[i], Util.UPnPTestStatesToString(group.TestStates[i]), group.TestDescription[i], result, group.Log); ret.AppendChild(testElement); } // output the packets. I wish that there were a way to // associate this with the individual tests, but it doesn't // appear to be possible with the current data structures. foreach (HTTPMessage httpMesg in group.PacketTrace) { byte[] packetBytes = httpMesg.RawPacket; System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(); System.Text.Decoder utf8Dec = utf8.GetDecoder(); int len = packetBytes.Length; char[] packetChars = new char[len]; utf8Dec.GetChars(packetBytes, 0, len, packetChars, 0); string packetString = new String(packetChars); System.Xml.XmlElement packetElement = doc.CreateElement("Packet"); packetElement.InnerText = packetString; ret.AppendChild(packetElement); } } return ret; }
/// <summary> /// Creates the element for the second level of the test tree. This should /// be the level denoted by the folders in the gui and is the level directly /// above the test group level /// </summary> /// <param name="doc"> /// The XmlDocument object that will eventually contain this element /// </param> /// <param name="node"> /// The TreeNode that represents this element /// </param> /// <returns> /// The XmlElement representing the TreeNode and all the children underneath /// </returns> private System.Xml.XmlElement SaveCategoryNodeToXmlElement( System.Xml.XmlDocument doc, TreeNode node) { System.Xml.XmlElement ret = doc.CreateElement("Category"); ret.SetAttribute("name", node.Text); foreach (TreeNode subnode in node.Nodes) { ret.AppendChild( SaveTestGroupNodeToXmlElement(doc, subnode)); } return ret; }
/// <summary> /// Write this document's schema mappings to the given XML document /// </summary> /// <param name="doc"></param> /// <param name="currentNode"></param> protected override void WriteSchemaMappings(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode) { foreach (var schema in base._schemas) { var map = doc.CreateElement("SchemaMapping"); //NOXLATE map.SetAttribute("provider", "OSGeo.Gdal.3.2"); //NOXLATE map.SetAttribute("xmlns", "http://fdogrfp.osgeo.org/schemas"); //NOXLATE map.SetAttribute("name", schema.Name); //NOXLATE { var ctype = doc.CreateElement("complexType"); //NOXLATE var ctypeName = doc.CreateAttribute("name"); //NOXLATE ctypeName.Value = schema.Name + "Type"; //NOXLATE ctype.Attributes.Append(ctypeName); { var rasType = doc.CreateElement("complexType"); //NOXLATE var rasTypeName = doc.CreateAttribute("name"); //NOXLATE rasTypeName.Value = "RasterTypeType"; //NOXLATE rasType.Attributes.Append(rasTypeName); { var rasDef = doc.CreateElement("RasterDefinition"); //NOXLATE var rasDefName = doc.CreateAttribute("name"); //NOXLATE rasDefName.Value = "images"; //NOXLATE rasDef.Attributes.Append(rasDefName); foreach (var loc in _items.Values) { loc.WriteXml(doc, rasDef); } rasType.AppendChild(rasDef); } ctype.AppendChild(rasType); } map.AppendChild(ctype); } currentNode.AppendChild(map); } }
public override void SaveToXml(System.Xml.XmlElement xmlEl , System.Xml.XmlDocument doc) { base.SaveToXml(xmlEl, doc); xmlEl.SetAttribute("C", "1"); xmlEl.SetAttribute("FS" , ((int)this.Format).ToString() ); if(this._prompt) xmlEl.SetAttribute("PR", "1"); foreach(Object obj in this._mdxParameters) //calculated member references { if(obj is Dimension) // dimension { throw new NotImplementedException(); } else if(obj is Hierarchy) // hierarchy { System.Xml.XmlElement childEl=doc.CreateElement("H"); childEl.SetAttribute("UN" , obj.UniqueName); xmlEl.AppendChild(childEl); } else if(obj is Level) // level { System.Xml.XmlElement childEl=doc.CreateElement("L"); childEl.SetAttribute("UN" , obj.UniqueName); xmlEl.AppendChild(childEl); } else if(obj is Member) // member { Member mem=obj as Member; System.Xml.XmlElement childEl=doc.CreateElement("M"); mem.SaveToXml(childEl, doc); if(mem.Hierarchy!=this.Hierarchy) childEl.SetAttribute("H" , mem.Hierarchy.UniqueName); xmlEl.AppendChild(childEl); } } }
/// <summary> /// Generates an Xml element for this rule /// </summary> /// <param name="doc">The parent Xml document</param> /// <returns>XmlNode representing this rule</returns> public override System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { if (assignValue.ToString().Length > 0 && string.IsNullOrEmpty(assignValue.ToString().Trim())) { assignValue = " "; } if (UseElse && elseValue != null && elseValue.ToString().Length > 0 && string.IsNullOrEmpty(elseValue.ToString().Trim())) { elseValue = " "; } string xmlString = "<friendlyRule>" + friendlyRule.Replace("&", "&").Replace("<", "<").Replace(">", ">") + "</friendlyRule>" + "<destinationColumnName>" + destinationColumnName + "</destinationColumnName>" + "<destinationColumnType>" + destinationColumnType + "</destinationColumnType>"; if (DestinationColumnType == "System.Decimal" && assignValue is decimal) { decimal d = (decimal)assignValue; xmlString += "<assignValue>" + d.ToString(CultureInfo.InvariantCulture).Replace("&", "&").Replace("<", "<").Replace(">", ">") + "</assignValue>"; } else { xmlString += "<assignValue>" + assignValue.ToString().Replace("&", "&").Replace("<", "<").Replace(">", ">") + "</assignValue>"; } xmlString += "<useElse>" + UseElse + "</useElse>"; if (elseValue != null) { //xmlString = xmlString + "<elseValue>" + elseValue.ToString().Replace("&", "&").Replace("<", "<").Replace(">", ">") + "</elseValue>"; if (DestinationColumnType == "System.Decimal" && elseValue is decimal) { decimal d = (decimal)elseValue; xmlString += "<elseValue>" + d.ToString(CultureInfo.InvariantCulture).Replace("&", "&").Replace("<", "<").Replace(">", ">") + "</elseValue>"; } else { xmlString += "<elseValue>" + elseValue.ToString().Replace("&", "&").Replace("<", "<").Replace(">", ">") + "</elseValue>"; } } System.Xml.XmlElement element = doc.CreateElement("rule"); element.InnerXml = xmlString; element.AppendChild(DataFilters.Serialize(doc)); System.Xml.XmlAttribute order = doc.CreateAttribute("order"); System.Xml.XmlAttribute type = doc.CreateAttribute("ruleType"); type.Value = "EpiDashboard.Rules.Rule_ConditionalAssign"; element.Attributes.Append(type); return element; }
private void CreateKeyValuePair( System.Xml.XmlDocument doc, System.Xml.XmlElement parent, string key, string value) { var keyEl = doc.CreateElement("key"); keyEl.InnerText = key; var valueEl = doc.CreateElement("string"); valueEl.InnerText = value; parent.AppendChild(keyEl); parent.AppendChild(valueEl); }
/// <summary> /// Saves settings to XML. /// </summary> /// <param name="doc">The doc.</param> /// <param name="infoEvents">The info events.</param> void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents) { try { //create node in the package xml document XmlElement taskElement = doc.CreateElement(string.Empty, "PGPTask", string.Empty); XmlAttribute sourceAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPSOURCEFILE, string.Empty); sourceAttr.Value = this.sourceFile; taskElement.Attributes.Append(sourceAttr); XmlAttribute targetAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPTARGETFILE, string.Empty); targetAttr.Value = this.targetFile; taskElement.Attributes.Append(targetAttr); XmlAttribute publicAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPUBLICKEY, string.Empty); publicAttr.Value = this.publicKey; taskElement.Attributes.Append(publicAttr); XmlAttribute privateAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPRIVATEKEY, string.Empty); privateAttr.Value = this.privateKey; taskElement.Attributes.Append(privateAttr); XmlAttribute passAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPASSPHRASE, string.Empty); passAttr.Value = this.passPhrase; taskElement.Attributes.Append(passAttr); XmlAttribute fileActionAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPFILEACTION, string.Empty); fileActionAttr.Value = this.fileAction.ToString(); taskElement.Attributes.Append(fileActionAttr); XmlAttribute overwriteRemoteAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPOVERWRITETARGET, string.Empty); overwriteRemoteAttr.Value = this.overwriteTarget.ToString(); taskElement.Attributes.Append(overwriteRemoteAttr); XmlAttribute removeAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPREMOVESOURCE, string.Empty); removeAttr.Value = this.removeSource.ToString(); taskElement.Attributes.Append(removeAttr); XmlAttribute armoredAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPARMORED, string.Empty); armoredAttr.Value = this.isArmored.ToString(); taskElement.Attributes.Append(armoredAttr); //add the new element to the package document doc.AppendChild(taskElement); } catch (Exception ex) { infoEvents.FireError(0, "Save To XML: ", ex.Message + ex.StackTrace, "", 0); } }
/// <summary> /// /// </summary> /// <param name="doc"></param> /// <returns></returns> public override System.Xml.XmlElement GetAnimationStatus(System.Xml.XmlDocument doc) { XmlElement status = doc.CreateElement("MovieAnimationItem"); status.SetAttribute("Enabled", outputCheckBox.Checked.ToString()); status.SetAttribute("Filename", aviFileName.FileName); status.SetAttribute("NoLimitCheck", noLimitRadio.Checked.ToString()); status.SetAttribute("MaxSizeCheck", maxSizeRadio.Checked.ToString()); status.SetAttribute("MaxSize", maxSizeTextBox.Text); return status; }
public System.Xml.XmlNode GetSettings(System.Xml.XmlDocument document) { System.Xml.XmlElement parent = document.CreateElement("Settings"); CreateSettingsNode(document, parent); return parent; }
/// <summary> /// Creates the XmlElement for the top level node of the test /// tree (UPnpTestRoot) and then puts in all the elements that belong /// inside it. /// </summary> /// <param name="doc"> /// The XmlDocument that this element will /// eventually become part of. This field is required because of the way /// that C# makes you create XmlElement nodes. /// </param> /// <param name="node"> /// The root node of the tree of tests. /// </param> /// <returns> /// A System.Xml.XmlElement containing the data from the root node and all the sub-nodes. /// </returns> private System.Xml.XmlElement SaveRootNodeToXmlElement( System.Xml.XmlDocument doc, TreeNode node) { System.Xml.XmlElement ret = doc.CreateElement("Root"); ret.SetAttribute("name", node.Text); System.Xml.XmlElement targetElement = doc.CreateElement("Target"); targetElement.SetAttribute("friendlyName", targetdevice.FriendlyName); targetElement.SetAttribute("uniqueDeviceName", targetdevice.UniqueDeviceName); ret.AppendChild(targetElement); System.Xml.XmlElement summaryElement = doc.CreateElement("Summary"); summaryElement.SetAttribute("pass", testcount_pass.ToString()); summaryElement.SetAttribute("warn", testcount_warn.ToString()); summaryElement.SetAttribute("failed", testcount_failed.ToString()); summaryElement.SetAttribute("skip", testcount_skip.ToString()); ret.AppendChild(summaryElement); foreach (TreeNode subnode in node.Nodes) { System.Xml.XmlElement childElement = SaveCategoryNodeToXmlElement(doc, subnode); ret.AppendChild(childElement); } return ret; }
/// <summary> /// Generates an Xml element for this rule /// </summary> /// <param name="doc">The parent Xml document</param> /// <returns>XmlNode representing this rule</returns> public override System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { string xmlString = "<friendlyRule>" + friendlyRule + "</friendlyRule>" + "<sourceColumnName>" + sourceColumnName + "</sourceColumnName>" + "<destinationColumnName>" + destinationColumnName + "</destinationColumnName>" + "<destinationColumnType>" + destinationColumnType + "</destinationColumnType>" + "<formatString>" + formatString + "</formatString>" + "<formatType>" + ((int)formatType).ToString() + "</formatType>"; System.Xml.XmlElement element = doc.CreateElement("rule"); element.InnerXml = xmlString; System.Xml.XmlAttribute order = doc.CreateAttribute("order"); System.Xml.XmlAttribute type = doc.CreateAttribute("ruleType"); type.Value = "Epi.WPF.Dashboard.Rules.Rule_Format"; element.Attributes.Append(type); return element; }
/// <summary> /// Creates an XmlElement for the given test. This is a test that is /// inside of the TestGroup, so it doesn't have a proper data /// structure. The information is stored in parallel arrays :P" /// Because of the parallel arrays, we have to get all the different /// attributes passed in individually. /// </summary> /// <param name="doc"> /// The XmlDocument object that will eventually contain this XmlElement /// </param> /// <param name="name"> /// The user readable name of the test /// </param> /// <param name="state"> /// The string version of the state of the test. Note that this is /// usually an enum that must be converted. /// </param> /// <param name="description"> /// The friendly description of what this test does. /// </param> /// <param name="result"> /// The result of this test. You should pass in an empty string if the /// result does not yet exist. /// </param> /// <param name="allLogs"> /// The list of all the logs from the parent TestGroup. These will be /// filtered by this function so that only the log entries pertaining to /// this test will be included in this test's element. /// </param> /// <returns></returns> private System.Xml.XmlElement SaveTestToXmlElement( System.Xml.XmlDocument doc, string name, string state, string description, string result, IList allLogs) { System.Xml.XmlElement ret = doc.CreateElement("Test"); ret.SetAttribute("name", name); ret.SetAttribute("state", state); ret.SetAttribute("result", result); ret.SetAttribute("description", description); foreach (LogStruct log in allLogs) { if (log.TestName.Equals(name)) { System.Xml.XmlElement logElement = doc.CreateElement("LogEntry"); logElement.SetAttribute("importance", UPnPValidator.Util.LogImportanceToString(log.importance)); logElement.InnerText = log.LogEntry; ret.AppendChild(logElement); } } return ret; }
public System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { string visibleLayersCsv = string.Empty; string xmlString = string.Empty; if (visibleLayers != null) { foreach (int x in visibleLayers) { visibleLayersCsv += x.ToString() + ","; } visibleLayersCsv = visibleLayersCsv.Substring(0, visibleLayersCsv.Length - 1); xmlString = "<referenceLayer><serverName>" + lblServerName.Content + "</serverName><visibleLayers>" + visibleLayersCsv + "</visibleLayers></referenceLayer>"; } else { xmlString = "<referenceLayer><serverName>" + lblServerName.Content + "</serverName><visibleLayers/></referenceLayer>"; } System.Xml.XmlElement element = doc.CreateElement("referenceLayer"); element.InnerXml = xmlString; System.Xml.XmlAttribute type = doc.CreateAttribute("layerType"); type.Value = "EpiDashboard.Mapping.MapServerLayerProperties"; element.Attributes.Append(type); return element; }