public void WriteXml(System.Xml.XmlWriter writer) { foreach (string key in Subkey.Keys) { writer.WriteStartElement(XML_SUBKEY_ELEMENTNAME); // Start the SubKey element writer.WriteElementString(XML_SUBKEYNAME_ELEMENTNAME, key); // Write the subkey name writer.WriteElementString(XML_DEFAULTVALUE_ELEMENTNAME, Subkey[key].Item[""]); // Write the default value writer.WriteStartElement(XML_VALUES_ELEMENTNAME); // Start the values element foreach (Generic.KeyValuePair <string, string> kvp in Subkey[key]) // Write name values pairs except for default value { if (!string.IsNullOrEmpty(kvp.Key)) { writer.WriteStartElement(XML_VALUE_ELEMENTNAME); writer.WriteElementString(XML_NAME_ELEMENTNAME, kvp.Key); writer.WriteElementString(XML_DATA_ELEMENTNAME, kvp.Value); writer.WriteEndElement(); } } writer.WriteEndElement(); // Close the values element writer.WriteEndElement(); // Close the subkey element } }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("Width", Width.ToString()); writer.WriteAttributeString("Height", Height.ToString()); writer.WriteAttributeString("Top", Top.ToString()); writer.WriteAttributeString("Left", Left.ToString()); writer.WriteAttributeString("TabIndex", TabIndex.ToString()); //***// writer.WriteAttributeString("ForeColor", ForeColor.Name); writer.WriteAttributeString("FontName", Font.Name); writer.WriteAttributeString("FontSize", Font.SizeInPoints.ToString()); writer.WriteAttributeString("FontStyle", ((int)Font.Style).ToString()); //***// writer.WriteAttributeString("Name", Name); //***// writer.WriteAttributeString("ItemsCount", this.Items.Count.ToString()); for (int i = 0; i < Items.Count; ++i) { writer.WriteElementString("Item" + i.ToString(), Items[i].ToString()); } writer.WriteElementString("Text", Text); }
public static async Task WriteXmlFile(Windows.Storage.StorageFile file, Person person) { try { 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; using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(s, settings)) { writer.WriteStartElement("Person"); writer.WriteElementString("Name", person.Name); writer.WriteElementString("Age", Convert.ToString(person.Age)); writer.WriteElementString("City", person.City); writer.Flush(); await writer.FlushAsync(); } } } catch { } }
public override void buildXml(System.Xml.XmlWriter xmlWriter) { xmlWriter.WriteStartElement("excel_interface"); xmlWriter.WriteElementString("excel_type", "excel_fixedBond"); xmlWriter.WriteStartElement("excel_fixedBond"); this.excel_issueInfoViewModel_.buildXml(xmlWriter); this.excel_fixedCouponScheduleListViewModel_.buildXml(xmlWriter); this.excel_fixedBond_subtypeViewModel_.buildXml(xmlWriter); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
public void WriteXmlDigest(System.Xml.XmlWriter writer, FFTPatch FFTPatch) { if (HasChanged) { writer.WriteStartElement(this.GetType().Name); writer.WriteAttributeString("changed", HasChanged.ToString()); foreach (InflictStatus i in InflictStatuses) { if (i.HasChanged) { writer.WriteStartElement(i.GetType().Name); writer.WriteAttributeString("value", i.Value.ToString("X2")); DigestGenerator.WriteXmlDigest(i, writer, false, false); writer.WriteElementString("CorrespondingAbilities", i.GetCorrespondingAbilities(FFTPatch)); writer.WriteElementString("CorrespondingChemistItems", i.GetCorrespondingChemistItems(FFTPatch)); writer.WriteElementString("CorrespondingWeapons", i.GetCorrespondingWeapons(FFTPatch)); writer.WriteEndElement(); } } writer.WriteEndElement(); } }
/// <summary> /// Serializa os dados xml. /// </summary> /// <param name="writer"></param> void IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { PingMessage[] messages = null; try { if (Notifications != null) { messages = Notifications.Where(f => f != null).Select(f => new PingMessage(f)).ToArray(); } else { messages = new PingMessage[0]; } } catch (Exception ex) { Message = ex; Status = TokenPingResultStatus.Error; } writer.WriteStartElement("Message", SecurityNamespaces.Security); if (Message != null) { ((IXmlSerializable)Message).WriteXml(writer); } writer.WriteEndElement(); writer.WriteElementString("ServerTime", SecurityNamespaces.Security, ServerTime.ToString(System.Globalization.CultureInfo.InvariantCulture)); writer.WriteElementString("Status", SecurityNamespaces.Security, Status.ToString()); writer.WriteStartElement("Notifications", SecurityNamespaces.Security); if (Notifications != null) { foreach (var item in messages) { writer.WriteStartElement("PingMessage", SecurityNamespaces.Security); item.WriteXml(writer); writer.WriteEndElement(); } } writer.WriteEndElement(); }
public void GetXml(System.Xml.XmlWriter xw) { xw.WriteStartElement("DebugEntry"); xw.WriteElementString("Message", msg); xw.WriteElementString("Counter", counter.ToString()); xw.WriteElementString("Severity", severity.ToString()); xw.WriteElementString("DateTimeUtc", utc.ToString("yyyyMMddTHHmmssZ")); if ((parameters == null) || parameters.Length == 0) { xw.WriteElementString("Parameters", null); } else { xw.WriteStartElement("Parameters"); foreach (string p in parameters) { xw.WriteElementString("Param", p); } xw.WriteEndElement(); } if (sf.Count == 0) { xw.WriteElementString("StackFrames", null); } else { xw.WriteStartElement("StackFrames"); foreach (var f in sf) { xw.WriteStartElement("StackFrame"); xw.WriteElementString("Method", f.GetMethod().Name + " (" + f.GetMethod().DeclaringType.FullName + ")"); xw.WriteElementString("FileName", System.IO.Path.GetFileName(f.GetFileName())); xw.WriteElementString("Line", f.GetFileLineNumber().ToString()); xw.WriteEndElement(); } xw.WriteEndElement(); } xw.WriteEndElement(); }
/// <summary> /// Writes the list elements. /// </summary> /// <param name="xmlWriter">The XML writer.</param> /// <param name="collection">The collection.</param> /// <param name="elementName">Name of the element.</param> public static void WriteListElements(this System.Xml.XmlWriter xmlWriter , System.Collections.Generic.IEnumerable <IValue> collection, string elementName) { if (collection == null) { return; } foreach (IValue item in collection) { xmlWriter.WriteElementString(elementName, item.Value); } }
void IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { if (Abc != null) { writer.WriteElementString("Abc", Abc); } if (Bcd != null) { writer.WriteStartElement("Bcd"); writer.WriteBase64(Bcd, 0, Bcd.Length); writer.WriteEndElement(); } }
void IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { // This is the chunking code. // ASP.NET buffering must be turned off for this to work. int bufferSize = 4096; char[] songBytes = new char[bufferSize]; FileStream inFile = File.Open(this.filePath, FileMode.Open, FileAccess.Read); long length = inFile.Length; // Write the file name. writer.WriteElementString("fileName", ns, Path.GetFileNameWithoutExtension(this.filePath)); // Write the size. writer.WriteElementString("size", ns, length.ToString()); // Write the song bytes. writer.WriteStartElement("song", ns); StreamReader sr = new StreamReader(inFile, true); int readLen = sr.Read(songBytes, 0, bufferSize); while (readLen > 0) { writer.WriteStartElement("chunk", ns); writer.WriteChars(songBytes, 0, readLen); writer.WriteEndElement(); writer.Flush(); readLen = sr.Read(songBytes, 0, bufferSize); } writer.WriteEndElement(); inFile.Close(); }
private void Click_Export(object sender, RoutedEventArgs e) { if (tbxPath.Text.Length == 0) { MessageBox.Show("Выберите папку для сохраения файла!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (rbXLS.IsChecked == true) { string connectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Extended properties = Excel 8.0; Data Source = " + tbxPath.Text + @"\Export.xls"; OleDbConnection conn = new OleDbConnection(connectionString); conn.Open(); OleDbCommand cmd = new OleDbCommand(); cmd.Connection = conn; cmd.CommandText = "Create Table [Sponsorships] (Name Varchar, Championship Varchar, Skill Varchar, SponsorClassName Varchar, Sponsor Varchar, Amount Varchar, Picture Varchar)"; cmd.ExecuteNonQuery(); foreach (var i in cs.StaticClass.SponsorshipList) { cmd.CommandText = "Insert Into [Sponsorships] (Name , Championship , Skill , SponsorClassName , Sponsor , Amount , Picture) Values ('" + i.Name + "', '" + i.Championship.Name + "', '" + i.Competition.NameRussian + "', '" + i.SponsorClassName + "', '" + i.Sponsor + "', '" + i.Amount + "', '" + i.Picture + "')"; cmd.ExecuteNonQuery(); } conn.Close(); } else if (rbXML.IsChecked == true) { System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(tbxPath.Text + @"\Export.xml"); writer.WriteStartDocument(); writer.WriteStartElement("Sponsorships"); foreach (var i in cs.StaticClass.SponsorshipList) { writer.WriteStartElement("Sponsorship"); writer.WriteElementString("Name", i.Name); writer.WriteElementString("Championship", i.Championship.Name); writer.WriteElementString("Skill", i.Competition.NameRussian); writer.WriteElementString("SponsorClassName", i.SponsorClassName); writer.WriteElementString("Sponsor", i.Sponsor); writer.WriteElementString("Amount", i.Amount + ""); writer.WriteElementString("Picture", i.Picture + ""); writer.WriteEndElement(); writer.Flush(); } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); } MessageBox.Show("Экспорт совершён!", "Perfect", MessageBoxButton.OK, MessageBoxImage.Information); }
public void WriteXml(System.Xml.XmlWriter writer) { this.Font = (this.Font == null) ? new Font("Arial", 20) : Font; writer.WriteElementString("Token", this.Token); writer.WriteElementString("CloseToken", this.CloseToken); writer.WriteElementString("Color", Color.R.ToString() + "," + Color.G.ToString() + "," + Color.B.ToString()); writer.WriteElementString("Font", this.Font.Name + "," + this.Font.Size.ToString()); writer.WriteElementString("DescriptorType", this.DescriptorType.ToString()); writer.WriteElementString("DescriptorRecognition", this.DescriptorRecognition.ToString()); writer.WriteElementString("UseForAutoComplete", this.UseForAutoComplete.ToString()); }
public void WriteSettings(System.Xml.XmlWriter xml) { xml.WriteStartElement("settings_start"); xml.WriteElementString("state", (started) ? "true" : "false"); //Add the states of the blocking services foreach (bool b in bState) { xml.WriteElementString("b_inc_state", (b) ? "true" : "false"); } //Add the states of the dumping services foreach (bool d in dState) { xml.WriteElementString("d_inc_state", (d) ? "true" : "false"); } foreach (bool i in iState) { xml.WriteElementString("i_inc_state", (i) ? "true" : "false"); } xml.WriteEndElement(); }
public override void buildXml(System.Xml.XmlWriter xmlWriter) { xmlWriter.WriteStartElement("excel_interface"); xmlWriter.WriteElementString("excel_type", "excel_vanillaFloatingBond"); xmlWriter.WriteStartElement("excel_vanillaFloatingBond"); excel_issueInfoViewModel_.buildXml(xmlWriter); excel_underlyingCalcInfoViewModel_.buildXml(xmlWriter); excel_vanillaFloatingCouponScheduleListViewModel_.buildXml(xmlWriter); excel_vanillaFloatingBond_subtypeViewModel_.buildXml(xmlWriter); xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
void IReflectorPersistance.Save(System.Xml.XmlWriter w) { if (tracker == null) { return; } w.WriteStartElement("SQL_Security"); foreach (string s in tracker.tokens) { w.WriteElementString("Token", s); } w.WriteEndElement(); //throw new Exception( "The method or operation is not implemented." ); }
public void WriteContractBody(System.Xml.XmlWriter writer, bool isRoot) { if (isRoot == false) { writer.WriteStartElement(RootElementName); } writer.WriteElementString(CodeElementName, EnumHelper.GetDescription(this.Code)); if (isRoot == false) { writer.WriteEndElement(); } }
public void WriteContractBody(System.Xml.XmlWriter writer, bool isRoot) { if (isRoot == false) { writer.WriteStartElement(RootElementName); } writer.WriteElementString(CommentElementName, this.Comment); if (isRoot == false) { writer.WriteEndElement(); } }
/// <summary> /// Serializa os dados. /// </summary> /// <param name="writer"></param> void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("uid", Uid.ToString()); writer.WriteAttributeString("name", Name); writer.WriteElementString("Description", Description); writer.WriteStartElement("InputRules"); foreach (System.Xml.Serialization.IXmlSerializable i in InputRules) { writer.WriteStartElement("InputRulesInputRulesGroup"); i.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); }
/// <summary> /// Write text /// </summary> /// <param name="w"></param> internal override void WriteText(System.Xml.XmlWriter xw) { // Now output xw.WriteStartElement("table", NS_XHTML); xw.WriteElementString("caption", NS_XHTML, "Demographic Information"); xw.WriteStartElement("tbody", NS_XHTML); base.WriteTableRows(xw, "Name", this.Name.ToArray()); base.WriteTableRows(xw, "DOB", this.BirthDate); base.WriteTableRows(xw, "Gender", this.Gender); base.WriteTableRows(xw, "Address", this.Address.ToArray()); base.WriteTableRows(xw, "Contacts", this.Telecom.ToArray()); xw.WriteEndElement(); // tbody xw.WriteEndElement(); // table }
public virtual void WriteXml(System.Xml.XmlWriter writer) { var cult = System.Globalization.CultureInfo.InvariantCulture; var info = TypeInfo; writer.WriteStartElement(info.Name); foreach (var p in info.Properties) { var v = p.GetValue(this, null); var s = string.Format(cult, "{0}", v); writer.WriteElementString(p.Name, s); } writer.WriteEndElement(); }
public override void buildXml(System.Xml.XmlWriter xmlWriter) { xmlWriter.WriteStartElement("underlyingInformation"); xmlWriter.WriteElementString("type", "indexUnderInfo"); xmlWriter.WriteStartElement("indexUnderInfo"); foreach (var item in indexUnderList_) { item.buildXml(xmlWriter); } xmlWriter.WriteEndElement(); xmlWriter.WriteEndElement(); }
public void WriteContractBody(System.Xml.XmlWriter writer, bool isRoot) { if (isRoot == false) { writer.WriteStartElement(RootElementName); } if (string.IsNullOrEmpty(this.Id) == false) { writer.WriteElementString(IdElementName, this.Id); } if (this.Timestamp > 0) { writer.WriteElementString(TimestampElementName, this.Timestamp.ToString("G")); } if (string.IsNullOrEmpty(this.Comment) == false) { writer.WriteElementString(CommentElementName, this.Comment); } if (this.Content != null) { this.Content.WriteContractBody(writer, false); } if (this.Visibility != null) { this.Visibility.WriteContractBody(writer, false); } if (isRoot == false) { writer.WriteEndElement(); } }
/// <summary> /// Converts an object into its XML representation. /// </summary> /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"/> stream to which the object is serialized.</param> public void WriteXml(System.Xml.XmlWriter writer) { if (String.IsNullOrEmpty(TechniqueName) == false) { writer.WriteElementString("TechniqueName", TechniqueName); } writer.WriteElementString("Score", Score.ToString()); if (BaseData != null) { writer.WriteStartElement("BaseData"); writer.WriteAttributeString("type", BaseData.GetType().GetTraceLabQualifiedName()); var serializer = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(BaseData.GetType(), null); serializer.Serialize(writer, BaseData); writer.WriteEndElement(); } var datasetsResultSerializer = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(DatasetResults), null); if (DatasetsResults != null) { writer.WriteStartElement("DatasetsResults"); foreach (DatasetResults datasetResults in DatasetsResults) { datasetsResultSerializer.Serialize(writer, datasetResults); } writer.WriteEndElement(); } if (AcrossAllDatasetsResults != null) { writer.WriteStartElement("AcrossAllDatasetsResults"); datasetsResultSerializer.Serialize(writer, AcrossAllDatasetsResults); writer.WriteEndElement(); } }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteElementString("ConnectionName", this.ConnectionName); writer.WriteElementString("Database", this.Database); writer.WriteElementString("Password", EncryptPassword(this.Password)); writer.WriteElementString("Url", this.Url); writer.WriteElementString("UserName", this.UserName); writer.WriteElementString("IomVersion", this.IomVersion); }
public override void Serialize(System.Xml.XmlWriter writer) { writer.WriteStartElement("Player"); writer.WriteAttributeString("params", "level"); writer.WriteElementString("Texture", texture.Name); writer.WriteElementString("ReflectionTexture", reflectionTexture.Name); writer.WriteElementString("BufferedPosition", ((int)BufferedPosition.Value.X).ToString() + "," + ((int)BufferedPosition.Value.Y).ToString()); writer.WriteElementString("Friction", friction.ToString()); writer.WriteElementString("Density", density.ToString()); writer.WriteElementString("Restitution", restitution.ToString()); writer.WriteElementString("Initialize", ""); writer.WriteEndElement(); }
/// <summary> /// Serializa os dados. /// </summary> /// <param name="writer"></param> void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("uid", Uid.ToString()); writer.WriteAttributeString("name", Name); writer.WriteAttributeString("type", Type != null ? Type.AssemblyQualifiedName : null); writer.WriteElementString("Description", Description); writer.WriteStartElement("Parameters"); foreach (System.Xml.Serialization.IXmlSerializable parameter in Parameters) { writer.WriteStartElement("ValidationTypeParameter"); parameter.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); }
void IXmlSerializable.WriteXml(System.Xml.XmlWriter a) { a.WriteElementString("ProfileId", ProfileId.ToString()); a.WriteElementString("UserName", this.UserName); a.WriteElementString("FullName", this.FullName); a.WriteElementString("SearchMode", this.SearchMode.ToString()); a.WriteDateTimeOffset(LastActivityDate, "LastActivityDate"); a.WriteDateTimeOffset(LastUpdatedDate, "LastUpdatedDate"); a.WriteStartElement("Source", null); if (Source != null) { ((IXmlSerializable)Source).WriteXml(a); } a.WriteEndElement(); a.WriteStartElement("IsAnonymous", null); a.WriteValue(IsAnonymous); a.WriteEndElement(); a.WriteStartElement("MarkGroupId"); if (MarkGroupId.HasValue) { a.WriteValue(MarkGroupId.Value); } a.WriteEndElement(); a.WriteStartElement("SellerTreeId"); if (SellerTreeId.HasValue) { a.WriteValue(SellerTreeId.Value); } a.WriteEndElement(); a.WriteStartElement("IntermediateId"); if (IntermediateId.HasValue) { a.WriteValue(IntermediateId.Value); } a.WriteEndElement(); }
/// <summary> /// Writes the XML representation of the answer at the specified depth. /// </summary> /// <param name="writer">The XmlWriter to which to write the answer value.</param> /// <param name="atDepth">The depth of the answer value.</param> public void WriteXml(System.Xml.XmlWriter writer, int atDepth) { if (atDepth == 0) { _value.WriteXml(writer); } else if (_children != null) { _children.WriteXml(writer, --atDepth); } else // no children but not yet at answer's full repeat depth, so { writer.WriteElementString("RptValue", null); // write a empty repeat value node (placeholder) } }
public void WriteXml(System.Xml.XmlWriter writer, XmlSerializableHashtable serializableHashtable) { foreach (var key in serializableHashtable.Keys) { object value = serializableHashtable[key]; if (value is XmlSerializableHashtable) { WriteXml(writer, (XmlSerializableHashtable)value); } else { writer.WriteElementString(key.ToString(), value.ToString()); } } }
public void GetSettings(System.Xml.XmlWriter xml) { foreach (KeyValuePair <string, Filter> kvp in filters) { //Write Start tag for new filter element with name xml.WriteElementString("f_name", kvp.Key); //Write Start tag for rules of the Filter object xml.WriteStartElement("f_equal"); foreach (String rule in kvp.Value.equalFilter) { xml.WriteElementString("f_rule", rule); } xml.WriteEndElement(); xml.WriteStartElement("f_not_equal"); foreach (String rule in kvp.Value.notEqualFilter) { xml.WriteElementString("f_rule", rule); } xml.WriteEndElement(); xml.WriteStartElement("f_starts_with"); foreach (String rule in kvp.Value.startsWithFilter) { xml.WriteElementString("f_rule", rule); } xml.WriteEndElement(); xml.WriteStartElement("f_contains"); foreach (String rule in kvp.Value.containsFilter) { xml.WriteElementString("f_rule", rule); } xml.WriteEndElement(); } }