本文整理汇总了C#中System.Xml.XmlDocument.CreateTextElement方法的典型用法代码示例。如果您正苦于以下问题:C# System.Xml.XmlDocument.CreateTextElement方法的具体用法?C# System.Xml.XmlDocument.CreateTextElement怎么用?C# System.Xml.XmlDocument.CreateTextElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDocument
的用法示例。
在下文中一共展示了System.Xml.XmlDocument.CreateTextElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveConfig
internal static void SaveConfig()
{
{
var rf = GetRecentFiles();
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlElement project_root = doc.CreateElement("Recent");
foreach (var f in rf.Reverse())
{
project_root.AppendChild(doc.CreateTextElement("File", f));
}
doc.AppendChild(project_root);
var dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
doc.InsertBefore(dec, project_root);
doc.Save(configRecentPath);
}
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlElement project_root = doc.CreateElement("GUI");
if (MainForm.WindowState == FormWindowState.Normal)
{
project_root.AppendChild(doc.CreateTextElement("X", MainForm.Location.X.ToString()));
project_root.AppendChild(doc.CreateTextElement("Y", MainForm.Location.Y.ToString()));
project_root.AppendChild(doc.CreateTextElement("Width", MainForm.Width.ToString()));
project_root.AppendChild(doc.CreateTextElement("Height", MainForm.Height.ToString()));
}
else // 最小化、最大化中はその前の位置とサイズを保存
{
project_root.AppendChild(doc.CreateTextElement("X", MainForm.BeforeResizeLocation.X.ToString()));
project_root.AppendChild(doc.CreateTextElement("Y", MainForm.BeforeResizeLocation.Y.ToString()));
project_root.AppendChild(doc.CreateTextElement("Width", MainForm.BeforeResizeWidth.ToString()));
project_root.AppendChild(doc.CreateTextElement("Height", MainForm.BeforeResizeHeight.ToString()));
}
doc.AppendChild(project_root);
var dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
doc.InsertBefore(dec, project_root);
doc.Save(configGuiPath);
}
MainForm.Panel.SaveAsXml(configGuiPanelPath, Encoding.UTF8);
Network.Save(configNetworkPath);
}
示例2: SaveTo
public static void SaveTo(string path)
{
path = System.IO.Path.GetFullPath(path);
FullPath = path;
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
var element = Data.IO.SaveObjectToElement(doc, "Root", Core.Root, false);
var behaviorElement = Data.IO.SaveObjectToElement(doc, "Behavior", EffectBehavior, false);
var cullingElement = Data.IO.SaveObjectToElement(doc, "Culling", Culling, false);
System.Xml.XmlElement project_root = doc.CreateElement("EffekseerProject");
project_root.AppendChild(element);
if(behaviorElement != null) project_root.AppendChild(behaviorElement);
if (cullingElement != null) project_root.AppendChild(cullingElement);
project_root.AppendChild(doc.CreateTextElement("ToolVersion", Core.Version));
project_root.AppendChild(doc.CreateTextElement("Version", 3));
project_root.AppendChild(doc.CreateTextElement("StartFrame", StartFrame));
project_root.AppendChild(doc.CreateTextElement("EndFrame", EndFrame));
project_root.AppendChild(doc.CreateTextElement("IsLoop", IsLoop.ToString()));
doc.AppendChild(project_root);
var dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
doc.InsertBefore(dec, project_root);
doc.Save(path);
IsChanged = false;
if (OnAfterSave != null)
{
OnAfterSave(null, null);
}
}