示例#1
0
		private static void AddChild1(XmlData root)
		{
			var child1 = new XmlData("Child1");
			child1.AddAttribute("Attr1", "Value with space");
			child1.AddAttribute("Attr2", "Value2");
			root.AddChild(child1);
		}
		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());
		}
示例#3
0
 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();
 }
 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());
 }
        private static void AddChild1(XmlData root)
        {
            var child1 = new XmlData("Child1");

            child1.AddAttribute("Attr1", "Value with space");
            child1.AddAttribute("Attr2", "Value2");
            root.AddChild(child1);
        }
示例#6
0
        private static XmlData CreateSpawnPoint()
        {
            var xmlData = new XmlData("SpawnPoint");

            xmlData.AddAttribute("Name", "Spawn0");
            xmlData.AddAttribute("Position", "2, 4");
            return(xmlData);
        }
示例#7
0
        private static XmlData CreateExitPoint()
        {
            var xmlData = new XmlData("ExitPoint");

            xmlData.AddAttribute("Name", "Exit0");
            xmlData.AddAttribute("Position", "13, 4");
            return(xmlData);
        }
示例#8
0
		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);
		}
		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;
		}
示例#10
0
        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);
        }
示例#11
0
        private static XmlData CreateTestAdjustment()
        {
            var xmlData = new XmlData("TestAdjustment");

            xmlData.AddAttribute("Attribute", "Hp");
            xmlData.AddAttribute("Resist", "");
            xmlData.AddAttribute("Adjustment", -100.0f);
            return(xmlData);
        }
		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;
		}
示例#13
0
        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);
        }
		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);
		}
示例#15
0
        private static XmlData CreateKerningPair(string name)
        {
            var xmlData = new XmlData(name);

            xmlData.AddAttribute("First", " ");
            xmlData.AddAttribute("Second", "a");
            xmlData.AddAttribute("Distance", "1");
            return(xmlData);
        }
示例#16
0
        private static XmlData CreateBitmap(string name)
        {
            var xmlData = new XmlData(name);

            xmlData.AddAttribute("Name", "Verdana12Font");
            xmlData.AddAttribute("Width", "128");
            xmlData.AddAttribute("Height", "128");
            return(xmlData);
        }
示例#17
0
        private static XmlData CreateCreepData(string name, string type, string hp)
        {
            var testCreep = new XmlData("CreepData");

            testCreep.AddAttribute("Name", name);
            testCreep.AddAttribute("Type", type);
            testCreep.AddAttribute("MaxHp", hp);
            return(testCreep);
        }
示例#18
0
        private static XmlData CreateModifier(string acid, string fire, string water)
        {
            var testModifier = new XmlData("Modifiers");

            testModifier.AddAttribute("Acid", acid);
            testModifier.AddAttribute("Fire", fire);
            testModifier.AddAttribute("Water", water);
            return(testModifier);
        }
示例#19
0
        private static XmlData CreateDragonRangeBuff()
        {
            var xmlData = new XmlData("DragonRangeMultiplier");

            xmlData.AddAttribute("Attribute", "Range");
            xmlData.AddAttribute("Multiplier", 1.25f);
            xmlData.AddAttribute("Addition", 0.0f);
            xmlData.AddAttribute("Duration", 0.0f);
            return(xmlData);
        }
示例#20
0
        private static XmlData CreateFont(string name)
        {
            var xmlData = new XmlData(name);

            xmlData.AddAttribute("Family", "Verdana");
            xmlData.AddAttribute("Size", "12");
            xmlData.AddAttribute("Style", "AddOutline");
            xmlData.AddAttribute("LineHeight", "16");
            return(xmlData);
        }
示例#21
0
        private static XmlData CreatePiggyBankPayDayMultiplierBuff()
        {
            var xmlData = new XmlData("PiggyBankPayDayGoldMultiplier");

            xmlData.AddAttribute("Attribute", "Gold");
            xmlData.AddAttribute("Multiplier", 1.5f);
            xmlData.AddAttribute("Addition", 0.0f);
            xmlData.AddAttribute("Duration", 5.0f);
            return(xmlData);
        }
示例#22
0
        private static XmlData CreateTestGoldBuff()
        {
            var xmlData = new XmlData("TestGoldBuff");

            xmlData.AddAttribute("Attribute", "Gold");
            xmlData.AddAttribute("Multiplier", 2.0f);
            xmlData.AddAttribute("Addition", -3.0f);
            xmlData.AddAttribute("Duration", 5.0f);
            return(xmlData);
        }
示例#23
0
        private static XmlData CreatePenguinAttackFrequencyBuff()
        {
            var xmlData = new XmlData("PenguinAttackFrequencyMultiplier");

            xmlData.AddAttribute("Attribute", "AttackFrequency");
            xmlData.AddAttribute("Multiplier", 1.3333f);
            xmlData.AddAttribute("Addition", 0.0f);
            xmlData.AddAttribute("Duration", 0.0f);
            return(xmlData);
        }
示例#24
0
        private static XmlData CreateTestHpBuff()
        {
            var xmlData = new XmlData("TestHpBuff");

            xmlData.AddAttribute("Attribute", "Hp");
            xmlData.AddAttribute("Multiplier", 3.0f);
            xmlData.AddAttribute("Addition", 4.0f);
            xmlData.AddAttribute("Duration", 6.0f);
            return(xmlData);
        }
		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);
		}
示例#26
0
		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;
		}
示例#27
0
        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));
        }
示例#28
0
		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);
			}
		}
示例#29
0
        private static XmlData CreateGlyph(string name, char character)
        {
            var xmlData = new XmlData(name);

            xmlData.AddAttribute("Character", character);
            xmlData.AddAttribute("UV", "0 0 1 16");
            xmlData.AddAttribute("AdvanceWidth", "7.34875");
            xmlData.AddAttribute("LeftBearing", "0");
            xmlData.AddAttribute("RightBearing", "4.21875");
            return(xmlData);
        }
示例#30
0
        private static Stream CreateMockGameLevel()
        {
            var xmlData = new XmlData("Level");

            xmlData.AddAttribute("Name", "TestGameLevelInfo");
            xmlData.AddAttribute("Size", "16, 10");
            xmlData.AddChild(CreateSpawnPoint());
            xmlData.AddChild(CreateExitPoint());
            xmlData.AddChild("Map", KidsRoomMapInfo());
            xmlData.AddChild("Wave", CreateWave());
            return(new XmlFile(xmlData).ToMemoryStream());
        }
示例#31
0
        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);
        }
示例#32
0
 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;
 }
示例#33
0
        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);
            }
        }
示例#34
0
        private void AddAppToStorageData(AppInfo app)
        {
            var appDataNode = new XmlData("App");

            appDataNode.AddAttribute(XmlAttributeNameOfFileName, Path.GetFileName(app.FilePath));
            appDataNode.AddAttribute(XmlAttributeNameOfPlatform, app.Platform);
            appDataNode.AddAttribute(XmlAttributeNameOfAppGuid, app.AppGuid);
            appDataNode.AddAttribute(XmlAttributeNameOfBuildDate, app.BuildDate);
            appDataNode.AddAttribute(XmlAttributeNameOfSolutionFilePath, app.SolutionFilePath);
            storageData.AddChild(appDataNode);
            UpdateStorageDataInSettings();
        }
示例#35
0
        public void RemoveAttribute()
        {
            var root = new XmlData("root");

            root.AddAttribute("attribute1", "value1");
            root.AddAttribute("attribute2", "value2");
            root.AddAttribute("attribute1", "value3");
            root.RemoveAttribute("attribute1");
            Assert.AreEqual(1, root.Attributes.Count);
            root.RemoveAttribute("attribute3");
            Assert.AreEqual(1, root.Attributes.Count);
        }
		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;
		}
		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;
		}
		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"));
		}
		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);
		}
示例#40
0
		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;
		}
示例#41
0
        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);
        }
示例#42
0
        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"));
        }
示例#43
0
        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);
        }
示例#44
0
 public void AddAttribute()
 {
     var root = new XmlData("root");
     root.AddAttribute("attribute", "value");
     Assert.AreEqual(1, root.Attributes.Count);
     Assert.AreEqual(new XmlAttribute("attribute", "value"), root.Attributes[0]);
 }
示例#45
0
 public void AddAttributeObject()
 {
     var root = new XmlData("root");
     root.AddAttribute("attribute", DayOfWeek.Friday);
     Assert.AreEqual(1, root.Attributes.Count);
     Assert.AreEqual(new XmlAttribute("attribute", "Friday"), root.Attributes[0]);
 }
示例#46
0
        private static void ImportXmlData(XmlNode node, ref XmlData data)
        {
            data.SetNodeName(node.Name);
            var attributes = node.Attributes;

            if (null != attributes)
            {
                int attriCount = attributes.Count;
                for (int idx = 0; idx < attriCount; ++idx)
                {
                    var attribute = attributes[idx];
                    data.AddAttribute(attribute.Name, attribute.Value);
                }
            }

            var childNodes = node.ChildNodes;

            if (null == childNodes)
            {
                return;
            }

            int nodeCount = childNodes.Count;

            for (int idx = 0; idx < nodeCount; ++idx)
            {
                var     childNode = childNodes.Item(idx);
                XmlData childData = new XmlData();
                ImportXmlData(childNode, ref childData);
                data.AddChild(childData);
            }
        }
示例#47
0
		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);
		}
示例#48
0
        public void UpdateExistingAttributeWithSameValue()
        {
            var root = new XmlData("root");

            root.AddAttribute("number", "123");
            root.UpdateAttribute("number", "123");
            Assert.AreEqual("123", root.GetAttributeValue("number"));
        }
示例#49
0
        public void GetAttributeValueAsInteger()
        {
            var root = new XmlData("root");

            root.AddAttribute("number", "123");
            Assert.AreEqual(123, root.GetAttributeValue("number", 0));
            Assert.AreEqual("", root.GetAttributeValue("nonexistant", ""));
        }
示例#50
0
文件: Map.cs 项目: seeseekey/CSCL
		public static void SaveToMapsXml(string filename, List<Map> maps)
		{
			XmlData xml=new XmlData(filename, true);

			maps.Sort();

			XmlNode mapsnode=xml.AddRoot("maps");

			foreach(Map i in maps)
			{
				XmlNode mapNode=xml.AddElement(mapsnode, "map");
				xml.AddAttribute(mapNode, "id", i.ID);
				xml.AddAttribute(mapNode, "name", i.Name);
			}

			xml.Save();
		}
示例#51
0
		private static XmlData CreateDeepTestXmlData()
		{
			XmlData root = CreateShallowTestXmlData();
			var grandchild = new XmlData("Grandchild");
			grandchild.AddAttribute("Attr5", "Value5");
			root.Children[1].AddChild(grandchild);
			return root;
		}
		private static Settings GetMockSettingsWithAlreadyBuiltApps()
		{
			var settings = new MockSettings();
			var storageData = new XmlData("BuiltApps");
			storageData.AddAttribute("StoragePath", storageData.Name);
			settings.SetValue(storageData.Name, storageData);
			var appsStorage = new AppsStorage(settings);
			appsStorage.AddApp(new WindowsAppInfo("Rebuildable app", Guid.NewGuid(), DateTime.Now)
			{
				SolutionFilePath = "A.sln"
			});
			appsStorage.AddApp(new WindowsAppInfo("Non-Rebuildable app ", Guid.NewGuid(), DateTime.Now));
			return settings;
		}
		private static XmlData CreateTestTower(string name, string type, string shotType)
		{
			var testTower = new XmlData("TowerData");
			testTower.AddAttribute("Name", name);
			testTower.AddAttribute("Type", type);
			testTower.AddAttribute("AttackType", shotType);
			testTower.AddAttribute("Range", "3.0");
			testTower.AddAttribute("AttackFrequency", "0.5");
			testTower.AddAttribute("AttackDamage", "35.0");
			return testTower;
		}
示例#54
0
		public XmlData AsXmlData()
		{
			var xml = new XmlData("Wave");
			xml.AddAttribute("WaitTime", WaitTime);
			xml.AddAttribute("SpawnInterval", SpawnInterval);
			xml.AddAttribute("ShortName", ShortName);
			xml.AddAttribute("MaxTime", MaxTime);
			xml.AddAttribute("MaxSpawnItems", MaxSpawnItems);
			xml.AddAttribute("SpawnTypeList", SpawnTypeList.ToText());
			return xml;
		}
 private static void CreateImageFile(XmlData image, string filename, Size pixelSize)
 {
     var newBitmap = new Bitmap((int)pixelSize.Width, (int)pixelSize.Height,
         PixelFormat.Format32bppArgb);
     for (int y = 0; y < newBitmap.Height; y++)
         for (int x = 0; x < newBitmap.Width; x++)
             newBitmap.SetPixel(x, y, Color.White);
     if (filename == "DeltaEngineLogo.png")
         newBitmap.SetPixel(50, 70, Color.FromArgb(0, 0, 0, 0));
     string filePath = Path.Combine("Content", filename);
     newBitmap.Save(filePath);
     image.AddAttribute("FileSize", new FileInfo(filePath).Length);
     image.AddAttribute("PixelSize", pixelSize.ToString());
 }
示例#56
0
		private void AddAppToStorageData(AppInfo app)
		{
			var appDataNode = new XmlData("App");
			appDataNode.AddAttribute(XmlAttributeNameOfFileName, Path.GetFileName(app.FilePath));
			appDataNode.AddAttribute(XmlAttributeNameOfPlatform, app.Platform);
			appDataNode.AddAttribute(XmlAttributeNameOfAppGuid, app.AppGuid);
			appDataNode.AddAttribute(XmlAttributeNameOfBuildDate, app.BuildDate);
			appDataNode.AddAttribute(XmlAttributeNameOfSolutionFilePath, app.SolutionFilePath);
			storageData.AddChild(appDataNode);
			UpdateStorageDataInSettings();
		}
示例#57
0
		public void UpdateExistingAttributeWithSameValue()
		{
			var root = new XmlData("root");
			root.AddAttribute("number", "123");
			root.UpdateAttribute("number", "123");
			Assert.AreEqual("123", root.GetAttributeValue("number"));
		}
示例#58
0
		public void GetAttributeValueAsInteger()
		{
			var root = new XmlData("root");
			root.AddAttribute("number", "123");
			Assert.AreEqual(123, root.GetAttributeValue("number", 0));
			Assert.AreEqual("", root.GetAttributeValue("nonexistant", ""));
		}
示例#59
0
		public void GetAttributeValue()
		{
			var root = new XmlData("root");
			root.AddAttribute("attribute", "value");
			Assert.AreEqual("value", root.GetAttributeValue("attribute"));
			Assert.AreEqual("", root.GetAttributeValue("attribute2"));
		}
示例#60
0
		public void RemoveAttribute()
		{
			var root = new XmlData("root");
			root.AddAttribute("attribute1", "value1");
			root.AddAttribute("attribute2", "value2");
			root.AddAttribute("attribute1", "value3");
			root.RemoveAttribute("attribute1");
			Assert.AreEqual(1, root.Attributes.Count);
			root.RemoveAttribute("attribute3");
			Assert.AreEqual(1, root.Attributes.Count);
		}