当前位置: 首页>>代码示例>>C#>>正文


C# XmlData.AddAttribute方法代码示例

本文整理汇总了C#中XmlData.AddAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlData.AddAttribute方法的具体用法?C# XmlData.AddAttribute怎么用?C# XmlData.AddAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlData的用法示例。


在下文中一共展示了XmlData.AddAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateImageAndContentMetaData

		public static void CreateImageAndContentMetaData(string filePath, Size pixelSize,
			XmlData image)
		{
			CreateImage(filePath, pixelSize);
			image.AddAttribute("FileSize", new FileInfo(filePath).Length);
			image.AddAttribute("PixelSize", pixelSize.ToString());
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:ContentDiskTestsExtensions.cs

示例2: 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();
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:33,代码来源:MockFont.cs

示例3: 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);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:XmlFileTests.cs

示例4: 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);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:XmlFileTests.cs

示例5: CreateTestGroup

		private static XmlData CreateTestGroup(string groupName, string formation)
		{
			var testGroup = new XmlData("Group");
			testGroup.AddAttribute("Name", groupName);
			testGroup.AddAttribute("CreepTypeList", formation);
			testGroup.AddAttribute("SpawnIntervalList", "0.5");
			return testGroup;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:CreepyTowersMockContentLoader.cs

示例6: 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);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:DiskContentLoaderTests.cs

示例7: CreateProjectMetaData

		public static XmlData CreateProjectMetaData(string projectName, string platformName)
		{
			var data = new XmlData(typeof(ContentMetaData).Name);
			data.AddAttribute("Name", projectName);
			data.AddAttribute("Type", "Scene");
			data.AddAttribute("LastTimeUpdated", DateTime.Now.GetIsoDateTime());
			data.AddAttribute("ContentDeviceName", platformName);
			return data;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:XmlMetaDataExtensions.cs

示例8: AddBasicMetaDataValues

		private static void AddBasicMetaDataValues(XmlData xmlMetaData, ContentMetaData metaData)
		{
			xmlMetaData.AddAttribute("Name", metaData.Name);
			xmlMetaData.AddAttribute("Type", metaData.Type);
			xmlMetaData.AddAttribute("LastTimeUpdated", metaData.LastTimeUpdated.GetIsoDateTime());
			if (metaData.LocalFilePath == null)
				return;
			xmlMetaData.AddAttribute("LocalFilePath", metaData.LocalFilePath);
			xmlMetaData.AddAttribute("FileSize", metaData.FileSize);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:XmlMetaDataExtensions.cs

示例9: BuildXmlData

		public XmlData BuildXmlData()
		{
			var xml = new XmlData("Level");
			xml.AddAttribute("Name", "TestName");
			xml.AddAttribute("Size", level.Size);
			AddPoints(xml, LevelTileType.SpawnPoint);
			AddPoints(xml, LevelTileType.ExitPoint);
			xml.AddChild("Map", level.ToTextForXml());
			AddWaves(xml);
			return xml;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:11,代码来源:LevelTests.cs

示例10: AddPoints

		private void AddPoints(XmlData xml, LevelTileType pointType)
		{
			int counter = 0;
			foreach (var point in FindPoints(pointType))
			{
				var pointXml = new XmlData(pointType.ToString());
				pointXml.AddAttribute("Name", pointType.ToString().Replace("Point", "") + (counter++));
				pointXml.AddAttribute("Position", point);
				xml.AddChild(pointXml);
			}
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:11,代码来源:XmlSaver.cs

示例11: CreateTestXmlData

 private static XmlData CreateTestXmlData()
 {
     var root = new XmlData("Root");
     var child1 = new XmlData("Child1", root);
     child1.AddAttribute("Attr1", "Value with space");
     child1.AddAttribute("Attr2", "Value2");
     var child2 = new XmlData("Child2", root);
     child2.AddAttribute("Attr3", "Value3");
     child2.AddAttribute("Attr4", "Value4");
     new XmlData("Grandchild", child2);
     return root;
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:12,代码来源:XmlFileTests.cs

示例12: CreateXmlEntryAndFile

		private static XmlData CreateXmlEntryAndFile()
		{
			var xml = new XmlData("ContentMetaData");
			xml.AddAttribute("Name", "Test").AddAttribute("Type", "Xml");
			const string Filename = "Test.xml";
			using (var textWriter = File.CreateText(Path.Combine(ContentProjectDirectoryName, Filename)))
				textWriter.WriteLine("<Test></Test>");
			xml.AddAttribute("LocalFilePath", Filename);
			xml.AddAttribute("LastTimeUpdated", DateTime.Now);
			xml.AddAttribute("PlatformFileId", --platformFileId);
			return xml;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:12,代码来源:DiskContentLoaderTests.cs

示例13: 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"));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:13,代码来源:DiskContentLoaderTests.cs

示例14: AddMetaDataEntry

		public static void AddMetaDataEntry(this XmlData projectMetaData,
			ContentMetaData contentEntry)
		{
			var newEntry = new XmlData(typeof(ContentMetaData).Name);
			AddBasicMetaDataValues(newEntry, contentEntry);
			if (contentEntry.Language != null)
				newEntry.AddAttribute("Language", contentEntry.Language);
			if (contentEntry.PlatformFileId != 0)
				newEntry.AddAttribute("PlatformFileId", contentEntry.PlatformFileId);
			foreach (KeyValuePair<string, string> valuePair in contentEntry.Values)
				newEntry.AddAttribute(valuePair.Key, valuePair.Value);
			projectMetaData.AddChild(newEntry);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:13,代码来源:XmlMetaDataExtensions.cs

示例15: CreateImageEntryAndFile

		private static XmlData CreateImageEntryAndFile(string name, Size pixelSize)
		{
			var image = new XmlData("ContentMetaData");
			image.AddAttribute("Name", name);
			image.AddAttribute("Type", "Image");
			string filename = name + ".png";
			string filePath = Path.Combine(ContentProjectDirectoryName, filename);
			ContentDiskTestsExtensions.CreateImageAndContentMetaData(filePath, pixelSize, image);
			image.AddAttribute("LocalFilePath", filename);
			image.AddAttribute("LastTimeUpdated", DateTime.Now);
			image.AddAttribute("PlatformFileId", --platformFileId);
			return image;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:13,代码来源:DiskContentLoaderTests.cs


注:本文中的XmlData.AddAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。