// Token: 0x060012B6 RID: 4790 RVA: 0x000713AC File Offset: 0x0006F5AC internal void RenderEntryXml(XmlTextWriter xmlWriter, string entryName) { if (xmlWriter == null) { throw new ArgumentNullException("writer"); } if (entryName == null) { throw new ArgumentNullException("entryName"); } xmlWriter.WriteStartElement(entryName); xmlWriter.WriteAttributeString("folderId", this.folderId); xmlWriter.WriteAttributeString("lastAccessedDateTimeTicks", this.lastAccessedDateTimeTicks.ToString()); if (this.calendarViewType != null) { xmlWriter.WriteAttributeString("calendarViewType", this.calendarViewType.Value.ToString()); } if (this.dailyViewDays != null) { xmlWriter.WriteAttributeString("dailyViewDays", this.dailyViewDays.Value.ToString()); } if (this.multiLine != null) { xmlWriter.WriteAttributeString("multiLine", this.multiLine.Value.ToString()); } if (this.readingPanePosition != null) { xmlWriter.WriteAttributeString("readingPanePosition", this.readingPanePosition.Value.ToString()); } if (this.readingPanePositionMultiDay != null) { xmlWriter.WriteAttributeString("readingPanePositionMultiDay", this.readingPanePositionMultiDay.Value.ToString()); } if (!string.IsNullOrEmpty(this.sortColumn)) { xmlWriter.WriteAttributeString("sortColumn", this.sortColumn); } if (this.sortOrder != null) { xmlWriter.WriteAttributeString("sortOrder", this.sortOrder.Value.ToString()); } if (this.viewHeight != null) { xmlWriter.WriteAttributeString("viewHeight", this.viewHeight.Value.ToString()); } if (this.viewWidth != null) { xmlWriter.WriteAttributeString("viewWidth", this.viewWidth.Value.ToString()); } xmlWriter.WriteFullEndElement(); this.dirty = false; }
/// <summary> /// /// </summary> /// <param name="config"></param> /// <param name="resolver"></param> /// <param name="resolution"></param> /// <returns></returns> private static Dictionary <string, string> ResolveStatic(IBaseMessageContext messageContext) { Dictionary <string, string> resolverDictionary = new Dictionary <string, string>(); string result = null; StringWriter stringWriter = null; XmlTextWriter xmlTextWriter = null; try { stringWriter = new StringWriter(); xmlTextWriter = new XmlTextWriter(stringWriter); xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartDocument(); xmlTextWriter.WriteStartElement("ContextProperties"); int num = 0; while ((long)num < (long)((ulong)messageContext.CountProperties)) { string propName; string propNamespace; string propValue = messageContext.ReadAt(num, out propName, out propNamespace).ToString(); xmlTextWriter.WriteStartElement("Property"); xmlTextWriter.WriteAttributeString("name", propName); xmlTextWriter.WriteAttributeString("namespace", propNamespace); xmlTextWriter.WriteString(propValue); xmlTextWriter.WriteEndElement(); num++; } xmlTextWriter.WriteFullEndElement(); xmlTextWriter.WriteEndDocument(); result = stringWriter.ToString(); } catch { throw; } finally { if (xmlTextWriter != null) { xmlTextWriter.Close(); } if (stringWriter != null) { stringWriter.Close(); stringWriter.Dispose(); } } resolverDictionary.Add("MessageContext", result); return(resolverDictionary); }
public void WriteSection(XmlTextWriter xmlWr, string name, Hashtable innerData) { if (Commnets.ContainsKey("section::" + name)) { xmlWr.WriteComment(Commnets.GetValue <string>("section::" + name)); } if (name.Length != 0) { xmlWr.WriteStartElement("section"); xmlWr.WriteAttributeString("name", name); } foreach (DictionaryEntry de in innerData) { try { if (de.Value == null) { WriteProperty(xmlWr, de); } else { switch (de.Value.GetType().ToString()) { case "System.Collections.Hashtable": { WriteSection(xmlWr, de.Key.ToString(), (Hashtable)de.Value); break; } default: { WriteProperty(xmlWr, de); break; } } } } catch { } } //if (innerData.Count == 0) // xmlWr.WriteValue(null); if (name.Length != 0) { xmlWr.WriteFullEndElement(); } //xmlWr.WriteWhitespace("\r\n\r\n"); }
//------------------------------------------------------------------------------ public override void WriteXmlData(ref XmlTextWriter outs) { outs.WriteStartElement("Branch"); base.WriteXmlData(ref outs); foreach (OctreeNode o in _chld) { if (o != null) { o.WriteXmlData(ref outs); } } outs.WriteFullEndElement(); }
/// <summary> /// 生成XML文件 /// </summary> /// <param name="XmlPath">文件路径,如"C:\\text.xml"</param> /// <param name="RootName">根元素的名称</param> /// <returns></returns> public static bool CreateXml(string XmlPath, string RootName) { bool bReturn = false; XmlTextWriter writer = new XmlTextWriter(XmlPath, Encoding.Default); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(true); writer.WriteStartElement(RootName); writer.WriteFullEndElement(); writer.WriteEndDocument(); writer.Close(); return(bReturn); }
public static void SaveConfig() { FileStream file = new FileStream(Paths.ConfigPath, FileMode.Create, FileAccess.Write, FileShare.Read); XmlTextWriter writer = new XmlTextWriter(file, new UTF8Encoding()); writer.WriteStartElement("EimuConfig"); SaveObjectData(typeof(Config), writer); SaveObjectData(typeof(Chip8XConfig), writer); writer.WriteRaw("\r\n"); writer.WriteFullEndElement(); writer.Close(); file.Close(); }
/// <summary> /// Force writing separate open and start tags, even for empty elements /// </summary> /// <param name="writer">XmlTextWriter to write out with</param> /// <param name="localName">Name of the element</param> /// <param name="value">Value to write in the element</param> public static void WriteRequiredElementString(this XmlTextWriter writer, string localName, string value) { writer.WriteStartElement(localName); if (value == null) { writer.WriteRaw(string.Empty); } else { writer.WriteString(value); } writer.WriteFullEndElement(); }
private void CreateNewCredentialsFile(FileInfo file) { // Replace the file if it exists. using (FileStream fs = file.Open(FileMode.Create, FileAccess.Write, FileShare.None)) { using (XmlTextWriter writer = new XmlTextWriter(fs, Encoding.UTF8)) { writer.Formatting = Formatting.Indented; writer.WriteStartDocument(); writer.WriteStartElement("Configurations"); writer.WriteFullEndElement(); writer.WriteEndDocument(); } } }
//************************************************************************* // Method: saveFaultXmlDocument // Description: recreating fault.xml document // // Parameters: // faultXMLNavigator // // Return Value: None //************************************************************************* public void saveFaultXmlDocument(FaultXMLNavigator faultXMLNavigator, string fileNameToSaveAs) { XmlTextWriter saveFaultXml = new XmlTextWriter(fileNameToSaveAs, null); saveFaultXml.Formatting = Formatting.Indented; saveFaultXml.WriteRaw("<?xml version= \"1.0\"?>"); saveFaultXml.WriteDocType("Faults", null, "faultsNew.dtd", ""); saveFaultXml.WriteStartElement("Faults"); foreach (string FaultNameAsKey in FaultTableByName.Keys) { Fault FaultToSave = faultXMLNavigator.GetFaultByName(FaultNameAsKey); ///Element = Fault saveFaultXml.WriteStartElement("Fault"); ///Attribute = Name if (FaultToSave.Name != null) { saveFaultXml.WriteAttributeString("Name", FaultToSave.Name); } Console.WriteLine("{0}", FaultToSave.Name.ToString()); ///Attribute = ReturnValue if (FaultToSave.ReturnValue != null) { saveFaultXml.WriteAttributeString("ReturnValue", FaultToSave.ReturnValue); } Console.WriteLine("{0}", FaultToSave.ReturnValue.ToString()); ///Attribute = ErrorCode if (FaultToSave.ErrorCode != null) { saveFaultXml.WriteAttributeString("ErrorCode", FaultToSave.ErrorCode); } Console.WriteLine("{0}", FaultToSave.ErrorCode.ToString()); saveFaultXml.WriteEndElement(); Console.WriteLine("{0}", FaultToSave.Name.ToString()); Console.WriteLine("============"); } //closeing Faluts Tag saveFaultXml.WriteFullEndElement(); Console.WriteLine("Save Complete"); //saveFaultXml.WriteEndDocument(); }
public static void ToXmlRowCell <T>(this T thingToRead, XmlTextWriter writer, int rowID, GridSpec <T> gridSpec) { writer.WriteStartElement("row"); writer.WriteAttributeString("id", rowID.ToString(CultureInfo.InvariantCulture)); foreach (var columnSpec in gridSpec) { writer.WriteStartElement("cell"); var cellCssClass = columnSpec.CalculateCellCssClass(thingToRead); var title = columnSpec.CalculateTitle(thingToRead); if (!String.IsNullOrEmpty(cellCssClass)) { writer.WriteAttributeString("class", cellCssClass); } if (!String.IsNullOrEmpty(title)) { writer.WriteAttributeString("title", title); } //if (columnSpec.IsHidden) //{ // writer.WriteAttributeString("hidden", "true"); //} var value = columnSpec.CalculateStringValue(thingToRead) ?? String.Empty; var stripped = XmlResult.StripInvalidCharacters(value); var xmlEncoded = SecurityElement.Escape(stripped); var translated = XmlResult.XmlEncodeCodePage1252Characters(xmlEncoded); writer.WriteRaw(translated); writer.WriteFullEndElement(); } writer.WriteFullEndElement(); }
public void Save(MailboxSession mailboxSession) { using (UserConfiguration userConfiguration = this.GetUserConfiguration(this.configurationAttribute.ConfigurationName, mailboxSession)) { using (Stream xmlStream = userConfiguration.GetXmlStream()) { xmlStream.SetLength(0L); using (StreamWriter streamWriter = PendingRequestUtilities.CreateStreamWriter(xmlStream)) { using (XmlTextWriter xmlTextWriter = new XmlTextWriter(streamWriter)) { xmlTextWriter.WriteStartElement(this.configurationAttribute.ConfigurationRootNodeName); foreach (T t in this.entries) { SimpleConfigurationAttribute simpleConfigurationAttribute; lock (SimpleConfiguration <T> .simpleConfigurationTable) { simpleConfigurationAttribute = SimpleConfiguration <T> .simpleConfigurationTable[t.GetType()]; } xmlTextWriter.WriteStartElement("entry"); this.WriteCustomAttributes(xmlTextWriter, t); foreach (SimpleConfigurationPropertyAttribute simpleConfigurationPropertyAttribute in simpleConfigurationAttribute.GetPropertyCollection()) { object value = simpleConfigurationPropertyAttribute.GetValue(t); if (value != null) { xmlTextWriter.WriteAttributeString(simpleConfigurationPropertyAttribute.Name, value.ToString()); } } xmlTextWriter.WriteFullEndElement(); } xmlTextWriter.WriteFullEndElement(); } } } this.TrySaveConfiguration(userConfiguration, true); } }
public override void ProcessRequest(string request, ref Socket socket, bool authenticated, string body) { QueryString query = new QueryString(request); String sMimeType = "text/xml"; string data = ""; string id = query.GetValues("id")[0]; int hash = 0; try { hash = Convert.ToInt32(id); if (Earth3d.ImagesetHashTable.ContainsKey(hash)) { StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); using (XmlTextWriter xmlWriter = new XmlTextWriter(sw)) { xmlWriter.Formatting = Formatting.Indented; xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); xmlWriter.WriteStartElement("Folder"); IImageSet imageset = (IImageSet)Earth3d.ImagesetHashTable[hash]; string alternateUrl = ""; try { if (File.Exists(imageset.Url)) { alternateUrl = string.Format("http://{0}:5050/imageset/{1}/{2}", MyWebServer.IpAddress, hash, Path.GetFileName(imageset.Url)); } } catch { } ImageSetHelper.SaveToXml(xmlWriter, imageset, alternateUrl); xmlWriter.WriteFullEndElement(); xmlWriter.Close(); } data = sb.ToString(); } } catch { } SendHeaderAndData(data, ref socket, sMimeType); }
private void btnFinishConfig_Click(object sender, EventArgs e) { XmlTextWriter xmlwr = new XmlTextWriter("MikroSRZ104Config.ea", null); xmlwr.Formatting = Formatting.Indented; xmlwr.IndentChar = '\t'; xmlwr.Indentation = 1; xmlwr.WriteStartDocument(); xmlwr.WriteStartElement("root"); xmlwr.WriteFullEndElement(); xmlwr.Close(); // ConcatFunction(filePathes, fileNames, currentMinRes, currentMaxRes); // XmlDocument xml = new XmlDocument(); xml.Load("MikroSRZ104Config.ea"); XmlNode root = xml.DocumentElement; XmlNodeList configs = root.ChildNodes; int y = 0; foreach (XmlNode config in configs) { XmlNodeList parameters = config.ChildNodes; foreach (XmlNode parameter in parameters) { if (parameter.Name == "NAME") { parameter.InnerText = deviceNames[y]; } } y++; } xml.Save("MikroSRZ104Config.ea"); this.Close(); }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { if (context.connectingedge) { this.MyStrokePath = this.MyStrokePath + " Z"; context.connectingedge = false; } if (!this.MyFillPath.TrimEnd(new char[0]).EndsWith("Z")) { this.MyFillPath = this.MyFillPath + "Z"; } if (!this.MyFillPath.TrimStart(new char[0]).StartsWith("M")) { this.MyFillPath = "M" + this.MyFillPath.TrimStart(new char[0]).Substring(1); } if (!String.IsNullOrEmpty(this.MyStrokePath) && !this.MyStrokePath.TrimStart(new char[0]).StartsWith("M"))//if ((StringType.StrCmp(this.MyStrokePath, "", false) != 0) && !this.MyStrokePath.TrimStart(new char[0]).StartsWith("M")) { this.MyStrokePath = "M" + this.MyStrokePath.TrimStart(new char[0]).Substring(1); } if (context.interiorstyle == 3) { context.getHatch(doc); } doc.WriteStartElement("g"); doc.WriteStartElement("path"); doc.WriteAttributeString("d", this.MyFillPath); doc.WriteAttributeString("fill", context.fill); doc.WriteAttributeString("fill-rule", "evenodd"); doc.WriteAttributeString("stroke", "none"); doc.WriteFullEndElement(); doc.WriteStartElement("path"); doc.WriteAttributeString("d", this.MyStrokePath); doc.WriteAttributeString("fill", "none"); context.PrintEdgeArc(doc); doc.WriteFullEndElement(); doc.WriteFullEndElement(); }
/// <summary> /// /// </summary> /// <param name="config"></param> /// <param name="resolver"></param> /// <param name="resolution"></param> /// <returns></returns> private static Dictionary <string, string> ResolveStatic(XLANGMessage message) { Dictionary <string, string> resolverDictionary = new Dictionary <string, string>(); string result = null; StringWriter stringWriter = null; XmlTextWriter xmlTextWriter = null; try { stringWriter = new StringWriter(); xmlTextWriter = new XmlTextWriter(stringWriter); xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartDocument(); xmlTextWriter.WriteStartElement("ContextProperties"); foreach (DictionaryEntry dictionary in GetContext(message)) { XmlQName qName = (XmlQName)dictionary.Key; xmlTextWriter.WriteStartElement("Property"); xmlTextWriter.WriteAttributeString("name", qName.Name); xmlTextWriter.WriteAttributeString("namespace", qName.Namespace); xmlTextWriter.WriteString(dictionary.Value.ToString()); xmlTextWriter.WriteEndElement(); } xmlTextWriter.WriteFullEndElement(); xmlTextWriter.WriteEndDocument(); result = stringWriter.ToString(); } catch { throw; } finally { if (xmlTextWriter != null) { xmlTextWriter.Close(); } if (stringWriter != null) { stringWriter.Close(); stringWriter.Dispose(); } } resolverDictionary.Add("MessageContext", result); return(resolverDictionary); }
/// <summary> /// Returns a <see cref="XPathDocument"/> /// based on the data of the type <see cref="DbDataReader"/>. /// </summary> /// <param name="documentElement">Document element name of the XML set.</param> /// <param name="rowElement">Row element name of the XML set.</param> /// <param name="reader">Set implementing <see cref="IDataReader"/>.</param> public static XPathDocument GetXPathDocument(string documentElement, string rowElement, IDataReader reader) { if (string.IsNullOrEmpty(documentElement)) { throw new ArgumentException("The Document Element name for the XPath Document was not specified."); } if (string.IsNullOrEmpty(rowElement)) { throw new ArgumentException("The row Element name for the XPath Document was not specified."); } if (reader == null) { throw new ArgumentNullException("reader", "The implementing Data Reader is null."); } if (reader.IsClosed) { throw new ArgumentException("The implementing Data Reader is closed.", "reader"); } MemoryStream ms = new MemoryStream(); XPathDocument xpDoc = null; using (XmlTextWriter writer = new XmlTextWriter(ms, Encoding.UTF8)) { writer.WriteStartDocument(); writer.WriteStartElement(documentElement); while (reader.Read()) { writer.WriteStartElement(rowElement); for (int i = 0; i < reader.FieldCount; i++) { writer.WriteRaw(string.Format("<{0}>{1}</{0}>", reader.GetName(i), reader[i].ToString())); } writer.WriteEndElement(); } writer.WriteFullEndElement(); writer.WriteEndDocument(); writer.Flush(); ms.Position = 0; xpDoc = new XPathDocument(ms); } return(xpDoc); }
// Token: 0x06000927 RID: 2343 RVA: 0x00041DF8 File Offset: 0x0003FFF8 public void RenderXml(TextWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } using (XmlTextWriter xmlTextWriter = new XmlTextWriter(writer)) { xmlTextWriter.WriteStartElement("FolderMruCache"); for (int i = 0; i < this.cacheLength; i++) { this.cacheEntries[i].RenderEntryXml(xmlTextWriter, "entry"); } xmlTextWriter.WriteFullEndElement(); } }
bool SaveConfigFile(string filePath) { try { string dirPath = PWLib.Platform.Windows.Path.GetStemName(filePath); if (!PWLib.Platform.Windows.Directory.Exists(dirPath)) { PWLib.Platform.Windows.Directory.CreateDirectory(dirPath); } XmlTextWriter configWriter = new XmlTextWriter(filePath, Encoding.Unicode); configWriter.Formatting = Formatting.Indented; configWriter.WriteStartDocument(); configWriter.WriteStartElement("AutoUSBBackup"); configWriter.WriteStartElement("config"); configWriter.WriteElementString("rootdatadirectory", mDefaultRootDataDirectory); configWriter.WriteElementString("workerthreadsleeptime", mWorkerThreadSleepTime.ToString()); configWriter.WriteElementString("compressbackups", mCompressBackups.ToString()); configWriter.WriteStartElement("volumes"); lock (VolumeDescriptorList.Instance.Descriptors) { foreach (VolumeDescriptor cvid in VolumeDescriptorList.Instance.Descriptors) { string volumeFilename = cvid.VolumeFilename; configWriter.WriteStartElement("volume"); configWriter.WriteAttributeString("name", cvid.VolumeName); configWriter.WriteString(volumeFilename); configWriter.WriteEndElement(); } } configWriter.WriteEndElement(); configWriter.WriteEndElement(); configWriter.WriteFullEndElement(); configWriter.Close(); } catch (System.Exception e) { Log.WriteException("SaveConfigFile failed", e); return(false); } Log.WriteLine(LogType.TextLog, "Config file saved, describing " + VolumeDescriptorList.Instance.Descriptors.Count + " volumes"); return(true); }
public void SaveCenterXML(string valueDZcenter, string valueDYcenter, string valueDZcom1, string valueDZcom2) { XmlTextWriter writer = new XmlTextWriter("center.xml", null); writer.WriteStartElement("Sosnay_center"); writer.Formatting = Formatting.Indented; writer.WriteStartElement("Sosnay_description"); writer.WriteElementString("DZcenter", valueDZcenter); writer.WriteElementString("DYcenter", valueDYcenter); writer.WriteElementString("DZcom", valueDZcom1); writer.WriteElementString("DYcom", valueDZcom2); writer.WriteEndElement(); writer.WriteFullEndElement(); writer.Close(); }
private void RenderXml(TextWriter writer) { using (XmlTextWriter xmlTextWriter = new XmlTextWriter(writer)) { xmlTextWriter.WriteStartElement("PublicFolderViewStates"); PublicFolderViewStatesEntry[] array = new PublicFolderViewStatesEntry[this.cacheEntries.Count]; this.cacheEntries.Values.CopyTo(array, 0); Array.Sort <PublicFolderViewStatesEntry>(array, new PublicFolderViewStatesEntry.LastAccessDateTimeTicksComparer()); int num = 0; while (num < array.Length && num < 50) { array[num].RenderEntryXml(xmlTextWriter, "Entry"); num++; } xmlTextWriter.WriteFullEndElement(); } }
public string GetProps() { MemoryStream ms = new MemoryStream(); using (XmlTextWriter xmlWriter = new XmlTextWriter(ms, System.Text.Encoding.UTF8)) { xmlWriter.Formatting = Formatting.Indented; xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); xmlWriter.WriteStartElement("LayerApi"); xmlWriter.WriteElementString("Status", "Success"); xmlWriter.WriteStartElement("Frame"); xmlWriter.WriteAttributeString("Class", this.GetType().ToString().Replace("TerraViewer.", "")); Type thisType = this.GetType(); PropertyInfo[] properties = thisType.GetProperties(); Type layerPropType = typeof(LayerProperty); foreach (PropertyInfo pi in properties) { bool safeToGet = false; object[] attributes = pi.GetCustomAttributes(false); foreach (object var in attributes) { if (var.GetType() == layerPropType) { safeToGet = true; break; } } if (safeToGet) { xmlWriter.WriteAttributeString(pi.Name, pi.GetValue(this, null).ToString()); } } xmlWriter.WriteEndElement(); xmlWriter.WriteFullEndElement(); xmlWriter.Close(); } byte[] data = ms.GetBuffer(); return(Encoding.UTF8.GetString(data)); }
public void UpdateSVG(XmlTextWriter doc, SVGContext mycontext) { this.Position = mycontext.fxy(this.Position); doc.WriteStartElement("text"); doc.WriteAttributeString("x", this.Position.X.ToString()); doc.WriteAttributeString("y", (Convert.ToDouble(this.Position.Y) + mycontext.compAliVert()).ToString()); doc.WriteAttributeString("fill", mycontext.Text); mycontext.PrintTextRotation(doc, this.Position); mycontext.PrintTextHeight(doc, this.TextSize); mycontext.PrintTextAlign(doc); if (!String.IsNullOrEmpty(mycontext.Font)) //if (StringType.StrCmp(mycontext.Font, "", false) != 0) { doc.WriteAttributeString("font-family", mycontext.Font); } if (mycontext.isClip & !String.IsNullOrEmpty(mycontext.CurrClipID)) //if (mycontext.isClip & (StringType.StrCmp(mycontext.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + mycontext.CurrClipID + ")"); } mycontext.printTextAngle(doc, this.Position); if (mycontext.TextSpacing != 0.0) { doc.WriteAttributeString("letter-spacing", (mycontext.TextSpacing * 4.8).ToString()); } int num = this.Text.Length; this.Text = ""; string[] strArray = new string[] { "d", "e", "m", "o" }; int index = 0; while (this.Text.Length <= num) { this.Text = this.Text + strArray[index]; if (strArray[index] == "o") //if (StringType.StrCmp(strArray[index], "o", false) == 0) { index = 0; } else { index++; } } doc.WriteString(this.Text); doc.WriteFullEndElement(); }
// Methods public void WriteBackground(XmlTextWriter doc, SVGContext mycontext) { if (!mycontext.options.SingleBackground || !mycontext.backgroundProduced) { try { doc.WriteStartElement("rect"); doc.WriteAttributeString("width", mycontext.rw.ToString()); doc.WriteAttributeString("height", mycontext.rh.ToString()); doc.WriteAttributeString("fill", mycontext.Back.ToString()); } finally { doc.WriteAttributeString("qsvg:element", "background"); doc.WriteFullEndElement(); mycontext.backgroundProduced = true; } } }
//Aqui ficarão os métodos public static void AdicionarFruta(Fruta fruta) { try { XmlTextWriter writer = new XmlTextWriter("Frutas.xml", null); writer.WriteStartDocument(); writer.Formatting = Formatting.Indented; writer.WriteStartElement("frutas"); writer.WriteStartElement("fruta"); writer.WriteElementString("id", fruta.ID.ToString()); writer.WriteElementString("nome", fruta.Nome); writer.WriteElementString("categoria", fruta.Categoria); writer.WriteElementString("carboidratos", fruta.Carbo); writer.WriteElementString("lipideos", fruta.Lipid); writer.WriteElementString("proteinas", fruta.Protein); writer.WriteElementString("vitamina_A", fruta.VitA); writer.WriteElementString("vitamina_B1", fruta.VitB1); writer.WriteElementString("vitamina_B2", fruta.VitB2); writer.WriteElementString("vitamina_B6", fruta.VitB6); writer.WriteElementString("vitamina_B12", fruta.VitB12); writer.WriteElementString("vitamina_C", fruta.VitC); writer.WriteElementString("vitamina_D", fruta.VitD); writer.WriteElementString("vitamina_E", fruta.VitE); writer.WriteElementString("vitamina_F", fruta.VitF); writer.WriteElementString("calcio", fruta.Calcium); writer.WriteElementString("sodio", fruta.Sodium); writer.WriteElementString("cobre", fruta.Cobre); writer.WriteElementString("manganes", fruta.Manganes); writer.WriteElementString("zinco", fruta.Zinc); writer.WriteElementString("iodo", fruta.Iodo); writer.WriteElementString("fluor", fruta.Fluor); writer.WriteElementString("fosforo", fruta.Fosforo); writer.WriteElementString("ferro", fruta.Ferro); writer.WriteElementString("potassio", fruta.Potassio); writer.WriteElementString("magnesio", fruta.Magnesio); writer.WriteEndElement(); writer.WriteFullEndElement(); writer.Close(); } catch (Exception Erro) { } }
public void SaveXML() { XmlTextWriter writer = new XmlTextWriter("config.xml", null); writer.WriteStartElement("Sosnay_config"); writer.Formatting = Formatting.Indented; writer.WriteStartElement("Sosnay_description"); writer.WriteElementString("T", textBox1.Text); writer.WriteElementString("Fstart", textBox2.Text); writer.WriteElementString("Fend", textBox6.Text); writer.WriteElementString("D", textBox3.Text); writer.WriteElementString("Tay", textBox4.Text); writer.WriteElementString("V", textBox5.Text); writer.WriteEndElement(); writer.WriteFullEndElement(); writer.Close(); }
public string GetXml(string elementName, bool includeCustomFields, Tags tags = null) { MemoryStream stream = new MemoryStream(); XmlTextWriter writer = new XmlTextWriter(stream, new UTF8Encoding(false)); writer.Formatting = System.Xml.Formatting.Indented; writer.WriteStartDocument(); writer.WriteStartElement(elementName); WriteToXml(writer, includeCustomFields, tags); writer.WriteFullEndElement(); writer.WriteEndDocument(); writer.Flush(); stream.Position = 0; StreamReader reader = new StreamReader(stream); return(reader.ReadToEnd()); }
public Task EndWritePageAsync(DocumentInstructionContextV1 context) { _pageXmlTextWriter.WriteFullEndElement();; _pages.Add(_pageStringWriter.ToString()); _pageXmlTextWriter.Dispose(); _pageStringWriter.Dispose(); _pageXmlTextWriter = null; _pageStringWriter = null; return(Task.CompletedTask); }
public static void ExportPluginsLocalizerXml() { var plugins = ActGlobals.oFormActMain.ActPlugins; Directory.CreateDirectory(GetLocalizerXmlPath("en-US\\Plugins", "")); foreach (var plugin in plugins) { if (plugin.cbEnabled.Checked) { var pluginTitle = plugin.lblPluginTitle.Text; using (var writer = new XmlTextWriter(GetLocalizerXmlPath("en-US\\Plugins", pluginTitle + ".xml"), null)) { writer.Formatting = Formatting.Indented; writer.WriteStartElement("ControlText"); ActGlobals.oFormActMain.ExportControlChildrenText(writer, plugin.tpPluginSpace, "root\\tc1\\tpPlugins\\tcPlugins\\"); writer.WriteFullEndElement(); } } } MessageBox.Show("Successfully exported plugin translations files."); }
public void SerializeCategories(List <Category> CategoriesToBeSaved, string CategoriesURL) { File.Delete(CategoriesURL); XmlTextWriter XMLWriter = new XmlTextWriter(CategoriesURL, null); XMLWriter.Formatting = Formatting.Indented; XMLWriter.WriteStartElement("categories"); foreach (Category category in CategoriesToBeSaved) { XMLWriter.WriteStartElement("category"); XMLWriter.WriteElementString("name", category.Name); XMLWriter.WriteWhitespace("\n"); XMLWriter.WriteEndElement(); } XMLWriter.WriteFullEndElement(); XMLWriter.Close(); }
public void UpdateSVG(XmlTextWriter doc, SVGContext context) { try { this.center = context.fxy(this.center); doc.WriteStartElement("circle"); doc.WriteAttributeString("cx", this.center.X.ToString()); doc.WriteAttributeString("cy", this.center.Y.ToString()); doc.WriteAttributeString("r", context.fscale((double)this.radius).ToString()); context.PrintEdge(doc); } finally { doc.WriteAttributeString("fill", context.fill); if (context.isClip & !String.IsNullOrEmpty(context.CurrClipID))//if (context.isClip & (StringType.StrCmp(context.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + context.CurrClipID + ")"); } doc.WriteFullEndElement(); } }
public void SaveToXML(System.IO.Stream oStream, System.Text.Encoding Encoding) { xtw = new System.Xml.XmlTextWriter(oStream, Encoding); xtw.Formatting = Formatting.Indented; xtw.Indentation = 4; xtw.IndentChar = ' '; xtw.WriteStartDocument(); xtw.WriteStartElement("TreeView"); //ukladani stylu TV if (this.TreeViewStyle) { xtw.WriteStartElement("TreeViewStyles"); SaveObject(oTV.Style, "Style"); xtw.WriteFullEndElement(); } if (this.TreeViewContent) { xtw.WriteStartElement("TreeViewContent"); xtw.WriteStartElement("Behavior"); xtw.WriteAttributeString("CheckBoxes",oTV.CheckBoxes.ToString()); xtw.WriteAttributeString("Flags",oTV.Flags.ToString()); xtw.WriteAttributeString("Multiline",oTV.Multiline.ToString()); xtw.WriteAttributeString("NodeAutoNumbering",oTV.NodeAutoNumbering.ToString()); xtw.WriteAttributeString("Sorted",oTV.Sorted.ToString()); xtw.WriteFullEndElement(); SaveNodes(oTV.Nodes); xtw.WriteFullEndElement(); } xtw.WriteEndDocument(); xtw.Flush(); }