本文整理汇总了C#中XmlData.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# XmlData.AddChild方法的具体用法?C# XmlData.AddChild怎么用?C# XmlData.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlData
的用法示例。
在下文中一共展示了XmlData.AddChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMockGroupProperties
private static Stream CreateMockGroupProperties()
{
var xmlData = new XmlData("Groups");
xmlData.AddChild(CreateTestGroup("Paper2", "Paper, Paper"));
xmlData.AddChild(CreateTestGroup("Cloth3", "Cloth, Cloth, Cloth"));
return new XmlFile(xmlData).ToMemoryStream();
}
示例2: CreateMockCreepProperties
private static Stream CreateMockCreepProperties()
{
var xmlData = new XmlData("CreepProperties");
xmlData.AddChild(CreateTestCottonCreep());
xmlData.AddChild(CreateTestGlassCreep());
return new XmlFile(xmlData).ToMemoryStream();
}
示例3: GetDevicesXmlStream
protected override Stream GetDevicesXmlStream()
{
var devicesXmlData = new XmlData("Devices");
devicesXmlData.AddChild(EmulatorTestExtensions.CreateDefaultDeviceData());
devicesXmlData.AddChild(EmulatorTestExtensions.CreateWindows8DeviceData());
return new XmlFile(devicesXmlData).ToMemoryStream();
}
示例4: GetChild
public void GetChild()
{
var root = new XmlData("root");
root.AddChild(new XmlData("child1"));
var child2 = new XmlData("child2");
root.AddChild(child2);
Assert.AreEqual(child2, root.GetChild("child2"));
}
示例5: CreateMockTowerProperties
private static Stream CreateMockTowerProperties()
{
var xmlData = new XmlData("TowerProperties");
var testAcid = CreateTestTower("TowerAcidConeJanitorHigh", "Acid", "DirectShot");
testAcid.AddAttribute("Cost", "200");
xmlData.AddChild(testAcid);
var testFire = CreateTestTower("TowerFireCandlehulaHigh", "Fire", "Circle");
testFire.AddAttribute("Cost", "75");
xmlData.AddChild(testFire);
return new XmlFile(xmlData).ToMemoryStream();
}
示例6: CreateContentMetaDataAndRealFiles
private static void CreateContentMetaDataAndRealFiles()
{
Directory.CreateDirectory(ContentProjectDirectoryName);
var root = new XmlData("ContentMetaData");
root.AddAttribute("Name", "DeltaEngine.Content.Disk.Tests");
root.AddAttribute("Type", "Scene");
root.AddChild(CreateImageEntryAndFile("DeltaEngineLogo", new Size(128, 128)));
root.AddChild(CreateImageEntryAndFile("SmallImage", new Size(32, 32)));
root.AddChild(CreateAnimationNode());
root.AddChild(CreateXmlEntryAndFile());
var contentMetaData = new XmlFile(root);
contentMetaData.Save(Path.Combine(ContentProjectDirectoryName, "ContentMetaData.xml"));
}
示例7: GetChildren
public void GetChildren()
{
var root = new XmlData("root");
var child1 = new XmlData("child");
root.AddChild(child1);
root.AddChild(new XmlData("stepchild"));
var child2 = new XmlData("child");
root.AddChild(child2);
var children = root.GetChildren("child");
Assert.AreEqual(2, children.Count);
Assert.IsTrue(children.Contains(child1));
Assert.IsTrue(children.Contains(child2));
}
示例8: CreateShallowTestXmlData
private static XmlData CreateShallowTestXmlData()
{
var root = new XmlData("Root");
var child1 = new XmlData("Child1") { Value = "Tom" };
child1.AddAttribute("Attr1", "Value1");
child1.AddAttribute("Attr2", "Value2");
root.AddChild(child1);
root.AddChild(null);
var child2 = new XmlData("Child2");
child2.AddAttribute("Attr3", "Value3");
child2.AddAttribute("Attr4", "Value4");
root.AddChild(child2);
return root;
}
示例9: LoadData
protected override void LoadData(Stream fileData)
{
var glyph1 = new XmlData("Glyph");
glyph1.AddAttribute("Character", ' ');
glyph1.AddAttribute("UV", "0 0 1 16");
glyph1.AddAttribute("AdvanceWidth", "7.34875");
glyph1.AddAttribute("LeftBearing", "0");
glyph1.AddAttribute("RightBearing", "4.21875");
var glyph2 = new XmlData("Glyph");
glyph2.AddAttribute("Character", 'a');
glyph2.AddAttribute("UV", "0 0 1 16");
glyph2.AddAttribute("AdvanceWidth", "7.34875");
glyph2.AddAttribute("LeftBearing", "0");
glyph2.AddAttribute("RightBearing", "4.21875");
var glyphs = new XmlData("Glyphs").AddChild(glyph1).AddChild(glyph2);
var kerningPair = new XmlData("Kerning");
kerningPair.AddAttribute("First", " ");
kerningPair.AddAttribute("Second", "a");
kerningPair.AddAttribute("Distance", "1");
var kernings = new XmlData("Kernings");
kernings.AddChild(kerningPair);
var bitmap = new XmlData("Bitmap");
bitmap.AddAttribute("Name", "Verdana12Font");
bitmap.AddAttribute("Width", "128");
bitmap.AddAttribute("Height", "128");
Data = new XmlData("Font");
Data.AddAttribute("Family", "Verdana");
Data.AddAttribute("Size", "12");
Data.AddAttribute("Style", "AddOutline");
Data.AddAttribute("LineHeight", "16");
Data.AddChild(bitmap).AddChild(glyphs).AddChild(kernings);
InitializeDescriptionAndMaterial();
}
示例10: AddChild1
private static void AddChild1(XmlData root)
{
var child1 = new XmlData("Child1");
child1.AddAttribute("Attr1", "Value with space");
child1.AddAttribute("Attr2", "Value2");
root.AddChild(child1);
}
示例11: AddChild2
private static void AddChild2(XmlData root)
{
var child2 = new XmlData("Child2");
child2.AddAttribute("Attr3", "Value3");
child2.AddAttribute("Attr4", "Value4");
child2.AddChild(new XmlData("Grandchild"));
root.AddChild(child2);
}
示例12: SetCommand
private static void SetCommand(XmlData root, string command, IEnumerable<Trigger> triggers)
{
var child = new XmlData("Command");
child.AddAttribute("Name", command);
foreach (Trigger trigger in triggers)
SetTrigger(trigger, child);
root.AddChild(child);
}
示例13: CreateAnimationNode
private static XmlData CreateAnimationNode()
{
var animation = new XmlData("ContentMetaData");
animation.AddAttribute("Name", "TestAnimation");
animation.AddAttribute("Type", "ImageAnimation");
var frame1 = CreateImageEntryAndFile("ImageAnimation01", new Size(64, 64));
var frame2 = CreateImageEntryAndFile("ImageAnimation02", new Size(64, 64));
return animation.AddChild(frame1).AddChild(frame2);
}
示例14: CreateDefaultDeviceData
public static XmlData CreateDefaultDeviceData()
{
var deviceData = new XmlData("Device");
deviceData.AddChild("Type", "Default");
deviceData.AddChild("Name", "Default");
deviceData.AddChild("ImageFile", "");
deviceData.AddChild("ScreenPoint", "");
deviceData.AddChild("ScreenSize", "");
deviceData.AddChild("CanRotate", "False");
deviceData.AddChild("CanScale", "False");
deviceData.AddChild("DefaultScaleIndex", "2");
return deviceData;
}
示例15: CreateWindows8DeviceData
public static XmlData CreateWindows8DeviceData()
{
var deviceData = new XmlData("Device");
deviceData.AddChild("Type", "Windows");
deviceData.AddChild("Name", "Windows 8 1080p");
deviceData.AddChild("ImageFile", "W8Emulator1080p");
deviceData.AddChild("ScreenPoint", "33,33");
deviceData.AddChild("ScreenSize", "1920,1080");
deviceData.AddChild("CanRotate", "True");
deviceData.AddChild("CanScale", "True");
deviceData.AddChild("DefaultScaleIndex", "0");
return deviceData;
}