public void Upgrade(string projectPath, string userSettingsPath, ref System.Xml.XmlDocument projectDocument, ref System.Xml.XmlDocument userSettingsDocument, ref System.Xml.XmlNamespaceManager nsm) { //Add DataTypeReferencedTableMappingSchemaName to each Parameter. foreach (XmlAttribute node in projectDocument.SelectNodes("//*/@DataTypeReferencedTableMappingName", nsm)) { XmlAttribute tableSchemaName = (XmlAttribute)node.SelectSingleNode("//P:TableMapping[@TableName='{0}']/@SchemaName".FormatString(node.Value), nsm); XmlAttribute dataTypeReferencedTableMappingSchemaName = projectDocument.CreateAttribute("DataTypeReferencedTableMappingSchemaName"); dataTypeReferencedTableMappingSchemaName.Value = tableSchemaName.Value; node.OwnerElement.Attributes.Append(dataTypeReferencedTableMappingSchemaName); } //Add ParentTableMappingSchemaName and ReferencedTableMappingSchemaName to each Foreign Key Mapping. foreach (XmlElement node in projectDocument.SelectNodes("//P:ForeignKeyMapping", nsm)) { XmlAttribute parentTableSchemaName = (XmlAttribute)projectDocument.SelectSingleNode("//P:TableMapping[@TableName='{0}']/@SchemaName".FormatString(node.GetAttribute("ParentTableMappingName")), nsm); XmlAttribute referencedTableSchemaName = (XmlAttribute)projectDocument.SelectSingleNode("//P:TableMapping[@TableName='{0}']/@SchemaName".FormatString(node.GetAttribute("ReferencedTableMappingName")), nsm); XmlAttribute parentTableMappingSchemaName = projectDocument.CreateAttribute("ParentTableMappingSchemaName"); XmlAttribute referencedTableMappingSchemaName = projectDocument.CreateAttribute("ReferencedTableMappingSchemaName"); parentTableMappingSchemaName.Value = parentTableSchemaName.Value; referencedTableMappingSchemaName.Value = referencedTableSchemaName.Value; node.Attributes.Append(parentTableMappingSchemaName); node.Attributes.Append(referencedTableMappingSchemaName); } //Add ReferencedTableMappingSchemaName to each Enumeration Mapping. //Rename ReferencedTableName to ReferencedTableMappingName for each Enumeration Mapping foreach (XmlAttribute node in projectDocument.SelectNodes("//P:EnumerationMapping/@ReferencedTableName", nsm)) { XmlAttribute tableSchemaName = (XmlAttribute)projectDocument.SelectSingleNode("//P:TableMapping[@TableName='{0}']/@SchemaName".FormatString(node.Value), nsm); XmlAttribute tableMappingSchemaName = projectDocument.CreateAttribute("ReferencedTableMappingSchemaName"); XmlAttribute tableMappingName = projectDocument.CreateAttribute("ReferencedTableMappingName"); tableMappingSchemaName.Value = tableSchemaName.Value; tableMappingName.Value = node.Value; node.OwnerElement.Attributes.Append(tableMappingSchemaName); node.OwnerElement.Attributes.Append(tableMappingName); node.OwnerElement.Attributes.Remove(node); } //Remove Template.Name attribute. foreach (XmlAttribute node in projectDocument.SelectNodes("//P:Template/@Name", nsm)) node.OwnerElement.Attributes.Remove(node); }
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(); }
public override System.Xml.XmlNode SerializeToXML(System.Xml.XmlDocument xdoc) { XmlNode xn = base.SerializeToXML (xdoc); xn.Attributes.Append(xdoc.CreateAttribute("Angle")).Value = mAngle.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("CropWidth")).Value = mCropWidth.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("CropHeight")).Value = mCropHeight.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("AspectRatio")).Value = mAspectRatio.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("AspectRatioPreset")).Value = mAspectRatioPreset.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("AspectRatioCustom")).Value = mAspectRatioCustom.ToString(); xn.Attributes.Append(xdoc.CreateAttribute("Mode")).Value = ((int)mMode).ToString(); xn.AppendChild(mCenter.SerializeToXML(xdoc)).Attributes.Append(xdoc.CreateAttribute("Name")).Value = "Center"; return xn; }
/// <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 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; }
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; }
/// <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> /// 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; }
public System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { string connectionString = string.Empty; string tableName = string.Empty; string projectPath = string.Empty; string viewName = string.Empty; if (dashboardHelper.View == null) { connectionString = dashboardHelper.Database.ConnectionString; tableName = dashboardHelper.TableName; } else { projectPath = dashboardHelper.View.Project.FilePath; viewName = dashboardHelper.View.Name; } string dataKey = cbxDataKey.SelectedItem.ToString(); string shapeKey = cbxShapeKey.SelectedItem.ToString(); string value = cbxValue.SelectedItem.ToString(); SolidColorBrush dotColor = (SolidColorBrush)rctDotColor.Fill; string xmlString = "<shapeFile>" + shapeFilePath + "</shapeFile><dotValue>" + txtDotValue.Text + "</dotValue><dotColor>" + dotColor.Color.ToString() + "</dotColor><dataKey>" + dataKey + "</dataKey><shapeKey>" + shapeKey + "</shapeKey><value>" + value + "</value>"; System.Xml.XmlElement element = doc.CreateElement("dataLayer"); element.InnerXml = xmlString; element.AppendChild(dashboardHelper.Serialize(doc)); System.Xml.XmlAttribute type = doc.CreateAttribute("layerType"); type.Value = "EpiDashboard.Mapping.DotDensityLayerProperties"; element.Attributes.Append(type); 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>" + "<expression>" + expression + "</expression>" + "<destinationColumnName>" + destinationColumnName + "</destinationColumnName>" + "<destinationColumnType>" + destinationColumnType + "</destinationColumnType>"; 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_ExpressionAssign"; element.Attributes.Append(type); return element; }
public System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { string xmlString = "<referenceLayer><fileName>" + lblFileName.Content + "</fileName></referenceLayer>"; System.Xml.XmlElement element = doc.CreateElement("referenceLayer"); element.InnerXml = xmlString; System.Xml.XmlAttribute type = doc.CreateAttribute("layerType"); type.Value = "EpiDashboard.Mapping.ShapeLayerProperties"; element.Attributes.Append(type); return element; }
public System.Xml.XmlNode SerializeToXML(System.Xml.XmlDocument xdoc) { XmlNode xn = xdoc.CreateElement("Tone"); xn.Attributes.Append(xdoc.CreateAttribute("R")).Value = mR.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("G")).Value = mG.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("B")).Value = mB.ToString(nfi); return xn; }
/// <summary> /// Save font. It will create this /// <font Name="something" StemV="20" Width="[234 34]"><EmbeddedFont>dasjdlkajsdljxlkjsaldjasldjxflj</embeddedFont></font> /// </summary> /// <param name="doc"></param> /// <param name="element"></param> public void Save(System.Xml.XmlDocument doc, System.Xml.XmlElement element) { // save font XmlElement el = doc.CreateElement("Font"); XmlAttribute attr = doc.CreateAttribute("Name"); attr.Value = this.Font.Name; el.SetAttributeNode(attr); attr = doc.CreateAttribute("SaveID"); attr.Value = this.SaveID.ToString(); el.SetAttributeNode(attr); // save metrics attr = doc.CreateAttribute("EmHeight"); attr.Value = this.Font.FontFamily.GetEmHeight(this.Font.Style).ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("Ascent"); attr.Value = this.Font.FontFamily.GetCellAscent(this.font.Style).ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("Descent"); attr.Value = this.Font.FontFamily.GetCellDescent(this.font.Style).ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("Bold"); attr.Value = this.Font.Bold ? "1" : "0"; el.SetAttributeNode(attr); attr = doc.CreateAttribute("Italic"); attr.Value = this.Font.Italic ? "1" : "0"; el.SetAttributeNode(attr); // Get font metrics to save some properties of font FontMetrics metrics = new FontMetrics(this.Font); attr = doc.CreateAttribute("EmbeddingLicense"); attr.Value = ((int)metrics.EmbeddingLicense).ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("ItalicAngle"); attr.Value = metrics.ItalicAngle.ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("BBoxLeft"); attr.Value = metrics.FontBBox.Left.ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("BBoxRight"); attr.Value = metrics.FontBBox.Right.ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("BBoxTop"); attr.Value = metrics.FontBBox.Top.ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("BBoxBottom"); attr.Value = metrics.FontBBox.Bottom.ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("StemV"); attr.Value = metrics.StemV.ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("Flags"); attr.Value = metrics.Flags.ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("FirstChar"); attr.Value = metrics.FirstChar.ToString(); el.SetAttributeNode(attr); attr = doc.CreateAttribute("LastChar"); attr.Value = metrics.LastChar.ToString(); el.SetAttributeNode(attr); // make glyph widths string glyphwidth = "[ "; for (int i = metrics.FirstChar; i <= metrics.LastChar; i++) { int gw = metrics.GetGlyphWidth(this.font, i); glyphwidth += gw.ToString() + " "; } glyphwidth += " ]"; attr = doc.CreateAttribute("Widths"); attr.Value = glyphwidth; el.SetAttributeNode(attr); // embedd font if not std font if (!this.IsStandardFont) { byte[] fontBuffer = FontMetrics.GetFontData(this.Font); attr = doc.CreateAttribute("EmbeddedDecodedFontLength"); attr.Value = fontBuffer.Length.ToString(); el.SetAttributeNode(attr); XmlText textValue = doc.CreateTextNode("EmdeddedFont"); textValue.Value = Convert.ToBase64String(fontBuffer); attr = doc.CreateAttribute("EmbeddedFontLength"); attr.Value = textValue.Value.Length.ToString(); el.SetAttributeNode(attr); el.AppendChild(textValue); } element.AppendChild(el); }
/// <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 rasterDef = doc.CreateElement("RasterDefinition"); //NOXLATE var n = doc.CreateAttribute("name"); //NOXLATE n.Value = this.RasterPropertyName; rasterDef.Attributes.Append(n); { var format = doc.CreateElement("Format"); //NOXLATE format.InnerText = this.ImageFormat; var mimeType = doc.CreateElement("FormatType"); //NOXLATE if (!string.IsNullOrEmpty(this.ImageFormat)) { switch (this.ImageFormat) { case WmsImageFormat.GIF: mimeType.InnerText = "image/gif"; //NOXLATE break; case WmsImageFormat.JPG: mimeType.InnerText = "image/jpeg"; //NOXLATE break; case WmsImageFormat.PNG: mimeType.InnerText = "image/png"; //NOXLATE break; case WmsImageFormat.TIF: mimeType.InnerText = "image/tiff"; //NOXLATE break; } } var transparent = doc.CreateElement("Transparent"); //NOXLATE transparent.InnerText = this.IsTransparent ? "true" : "false"; //NOXLATE var bgcolor = doc.CreateElement("BackgroundColor"); //NOXLATE bgcolor.InnerText = "0x" + Utility.SerializeHTMLColor(this.BackgroundColor, false); //NOXLATE var useTileCache = doc.CreateElement("UseTileCache"); //NOXLATE useTileCache.InnerText = this.UseTileCache ? "true" : "false"; //NOXLATE var time = doc.CreateElement("Time"); //NOXLATE time.InnerText = this.Time; var elevation = doc.CreateElement("Elevation"); //NOXLATE elevation.InnerText = this.ElevationDimension; var sc = doc.CreateElement("SpatialContext"); //NOXLATE sc.InnerText = this.SpatialContextName; rasterDef.AppendChild(format); rasterDef.AppendChild(mimeType); rasterDef.AppendChild(transparent); rasterDef.AppendChild(useTileCache); rasterDef.AppendChild(bgcolor); rasterDef.AppendChild(time); rasterDef.AppendChild(elevation); rasterDef.AppendChild(sc); foreach (var layer in this.Layers) { layer.WriteXml(doc, rasterDef); } }; currentNode.AppendChild(rasterDef); }
/// <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 loc = doc.CreateElement("Location"); //NOXLATE var locName = doc.CreateAttribute("name"); //NOXLATE locName.Value = this.Location; loc.Attributes.Append(locName); foreach (var item in _items.Values) { item.WriteXml(doc, loc); } currentNode.AppendChild(loc); }
/// <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 feat = doc.CreateElement("Feature"); //NOXLATE var featName = doc.CreateAttribute("name"); //NOXLATE featName.Value = Path.GetFileNameWithoutExtension(this.FileName); feat.Attributes.Append(featName); { var band = doc.CreateElement("Band"); //NOXLATE var bandName = doc.CreateAttribute("name"); //NOXLATE bandName.Value = "RGB"; //NOXLATE var bandNo = doc.CreateAttribute("number"); //NOXLATE bandNo.Value = "1"; //NOXLATE band.Attributes.Append(bandName); band.Attributes.Append(bandNo); { var img = doc.CreateElement("Image"); //NOXLATE var imgFrame = doc.CreateAttribute("frame"); //NOXLATE imgFrame.Value = "1"; //NOXLATE var imgName = doc.CreateAttribute("name"); //NOXLATE imgName.Value = this.FileName; img.Attributes.Append(imgFrame); img.Attributes.Append(imgName); { var bounds = doc.CreateElement("Bounds"); //NOXLATE bounds.InnerXml = string.Format(CultureInfo.InvariantCulture, "<MinX>{0}</MinX><MinY>{1}</MinY><MaxX>{2}</MaxX><MaxY>{3}</MaxY>", this.MinX, this.MinY, this.MaxX, this.MaxY); //NOXLATE img.AppendChild(bounds); } band.AppendChild(img); } feat.AppendChild(band); } currentNode.AppendChild(feat); }
public System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { int size = int.Parse(cbxSize.SelectedItem.ToString()); SolidColorBrush color = (SolidColorBrush)rctColor.Fill; string style = cbxStyle.SelectedItem.ToString(); string xmlString = "<graphicsLayer><size>" + size + "</size><color>" + color.Color.ToString() + "</color><style>" + style + "</style></graphicsLayer>"; System.Xml.XmlElement element = doc.CreateElement("graphicsLayer"); element.InnerXml = xmlString; System.Xml.XmlAttribute type = doc.CreateAttribute("layerType"); type.Value = "EpiDashboard.Mapping.MarkerProperties"; 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> /// 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) { var map = doc.CreateElement("SchemaMapping"); //NOXLATE map.SetAttribute("provider", "OSGeo.WMS.3.2"); //NOXLATE map.SetAttribute("xmlns", "http://fdowms.osgeo.org/schemas"); //NOXLATE //TODO: Is WMS multi-schema? We should factor this in map.SetAttribute("name", base._schemas[0].Name); //NOXLATE { foreach(var ritem in _rasterItems) { if (ritem.SchemaName != base._schemas[0].Name) continue; var ctype = doc.CreateElement("complexType"); //NOXLATE var ctypeName = doc.CreateAttribute("name"); //NOXLATE ctypeName.Value = Utility.EncodeFDOName(ritem.FeatureClass) + "Type"; //NOXLATE ctype.Attributes.Append(ctypeName); { ritem.WriteXml(doc, ctype); } map.AppendChild(ctype); } } currentNode.AppendChild(map); }
/// <summary> /// Creates an xml Element to be added to a Project xml /// </summary> /// <param name="contentName">The name of the artifact for which to create a "Content" node</param> /// <param name="origXMLDoc">the document that the element will be added to, not by this method</param> /// <returns>XMLNode of name "Content"</returns> private System.Xml.XmlElement GetProjectContentNode(string contentName, System.Xml.XmlDocument origXMLDoc) { System.Xml.XmlElement contentNode = origXMLDoc.CreateElement("Content"); System.Xml.XmlElement subTypeNode = origXMLDoc.CreateElement("SubType"); System.Xml.XmlElement excludedNode = origXMLDoc.CreateElement("Excluded"); System.Xml.XmlAttribute includeAttr = origXMLDoc.CreateAttribute("Include"); subTypeNode.InnerText = "Content"; includeAttr.Value = contentName; contentNode.Attributes.Append(includeAttr); contentNode.AppendChild(subTypeNode); contentNode.AppendChild(excludedNode); return contentNode; }
/// <summary> /// Creates an Element of type "Folder" to be added to an ItemGroup node /// </summary> /// <param name="folderName">Name of the folder</param> /// <param name="origXMLDoc">The XML Document</param> /// <returns>XmlElement of type Folder</returns> private System.Xml.XmlElement GetProjectFolderNode(string folderName, System.Xml.XmlDocument origXMLDoc) { System.Xml.XmlElement folderNode = origXMLDoc.CreateElement("Folder"); System.Xml.XmlAttribute includeAttr = origXMLDoc.CreateAttribute("Include"); includeAttr.Value = folderName; folderNode.Attributes.Append(includeAttr); return folderNode; }
/// <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); } }
public System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { string unit = cbxUnits.SelectedItem.ToString(); string radius = txtRadius.Text; SolidColorBrush color = (SolidColorBrush)rctColor.Fill; string xmlString = "<graphicsLayer><unit>" + unit + "</unit><color>" + color.Color.ToString() + "</color><radius>" + radius + "</radius></graphicsLayer>"; System.Xml.XmlElement element = doc.CreateElement("graphicsLayer"); element.InnerXml = xmlString; System.Xml.XmlAttribute type = doc.CreateAttribute("layerType"); type.Value = "EpiDashboard.Mapping.ZoneProperties"; 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; }
private System.Xml.XmlAttribute CreateAttribute(string xname, string xvalue, System.Xml.XmlDocument xdoc) { System.Xml.XmlAttribute xatt = xdoc.CreateAttribute(xname); xatt.Value = xvalue; return xatt; }
/// <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>" + "<sourceColumnType>" + sourceColumnType + "</sourceColumnType>" + "<destinationColumnName>" + destinationColumnName + "</destinationColumnName>" + "<destinationColumnType>" + destinationColumnType + "</destinationColumnType>" + "<tableColumns>" + recodeInputTable.Columns.Count.ToString() + "</tableColumns>" + "<elseValue>" + ElseValue + "</elseValue>" + "<shouldUseWildcards>" + shouldUseWildcards + "</shouldUseWildcards>" + "<shouldMaintainSortOrder>" + shouldMaintainSortOrder + "</shouldMaintainSortOrder>"; xmlString = xmlString + "<recodeTable>"; foreach (DataRow row in recodeInputTable.Rows) { xmlString = xmlString + "<recodeTableRow>"; object[] objects = row.ItemArray; foreach (object obj in objects) { xmlString = xmlString + "<recodeTableData>"; xmlString = xmlString + obj.ToString().Replace("<", "<").Replace(">", ">").Replace("&", "&"); xmlString = xmlString + "</recodeTableData>"; } xmlString = xmlString + "</recodeTableRow>"; } xmlString = xmlString + "</recodeTable>"; System.Xml.XmlElement element = doc.CreateElement("rule"); element.InnerXml = xmlString; System.Xml.XmlAttribute type = doc.CreateAttribute("ruleType"); type.Value = "EpiDashboard.Rules.Rule_Recode"; element.Attributes.Append(type); 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; }
public System.Xml.XmlNode SerializeToXML(System.Xml.XmlDocument xdoc) { XmlNode xn = xdoc.CreateElement("Point"); xn.Attributes.Append(xdoc.CreateAttribute("X")).Value = _X.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("Y")).Value = _Y.ToString(nfi); return xn; }
public override System.Xml.XmlNode SerializeToXML(System.Xml.XmlDocument xdoc) { XmlNode xn = base.SerializeToXML (xdoc); xn.Attributes.Append(xdoc.CreateAttribute("Edge")).Value = mEdge.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("Softness")).Value = mSoftness.ToString(nfi); xn.AppendChild(mDarkTone.SerializeToXML(xdoc)).Attributes.Append(xdoc.CreateAttribute("Name")).Value = "DarkTone"; xn.AppendChild(mLightTone.SerializeToXML(xdoc)).Attributes.Append(xdoc.CreateAttribute("Name")).Value = "LightTone"; xn.Attributes.Append(xdoc.CreateAttribute("AutoDarkTone")).Value = mAutoDarkTone.ToString(); xn.Attributes.Append(xdoc.CreateAttribute("AutoLightTone")).Value = mAutoLightTone.ToString(); xn.Attributes.Append(xdoc.CreateAttribute("AutoDarkRadius")).Value = mAutoDarkRadius.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("AutoLightRadius")).Value = mAutoLightRadius.ToString(nfi); xn.AppendChild(mAutoDarkCenter.SerializeToXML(xdoc)).Attributes.Append(xdoc.CreateAttribute("Name")).Value = "AutoDarkCenter"; xn.AppendChild(mAutoLightCenter.SerializeToXML(xdoc)).Attributes.Append(xdoc.CreateAttribute("Name")).Value = "AutoLightCenter"; return xn; }
public System.Xml.XmlNode Serialize(System.Xml.XmlDocument doc) { string connectionString = string.Empty; string tableName = string.Empty; string projectPath = string.Empty; string viewName = string.Empty; if (dashboardHelper.View == null) { connectionString = dashboardHelper.Database.ConnectionString; tableName = dashboardHelper.TableName; } else { projectPath = dashboardHelper.View.Project.FilePath; viewName = dashboardHelper.View.Name; } string latitude = cbxLatitude.SelectedItem.ToString(); string longitude = cbxLongitude.SelectedItem.ToString(); SolidColorBrush color = (SolidColorBrush)rctColor.Fill; string description = txtDescription.Text; string xmlString = "<description>" + description + "</description><color>" + color.Color.ToString() + "</color><latitude>" + latitude + "</latitude><longitude>" + longitude + "</longitude>"; System.Xml.XmlElement element = doc.CreateElement("dataLayer"); element.InnerXml = xmlString; element.AppendChild(dashboardHelper.Serialize(doc)); System.Xml.XmlAttribute type = doc.CreateAttribute("layerType"); type.Value = "EpiDashboard.Mapping.ClusterLayerProperties"; element.Attributes.Append(type); return element; }
public override System.Xml.XmlNode SerializeToXML(System.Xml.XmlDocument xdoc) { XmlNode xn = base.SerializeToXML (xdoc); xn.Attributes.Append(xdoc.CreateAttribute("NewWidth")).Value = mNewWidth.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("NewHeight")).Value = mNewHeight.ToString(nfi); xn.Attributes.Append(xdoc.CreateAttribute("LimitWidth")).Value = mLimitWidth.ToString(); xn.Attributes.Append(xdoc.CreateAttribute("LimitHeight")).Value = mLimitHeight.ToString(); return xn; }
public override System.Xml.XmlNode SerializeToXML(System.Xml.XmlDocument xdoc) { XmlNode xn = base.SerializeToXML (xdoc); xn.Attributes.Append(xdoc.CreateAttribute("Saturation")).Value = mSaturation.ToString(nfi); return xn; }