public static ExplosivesConfig FromXmlElement(XmlElement xmlData) { ExplosivesConfig resultingExplosivesConfig = new ExplosivesConfig(); resultingExplosivesConfig.BlastAreaShape = (ExplosionAreaShape)Enum.Parse(typeof(ExplosionAreaShape), xmlData["BlastAreaShape"].InnerText); resultingExplosivesConfig.BlastAreaWidth = int.Parse(xmlData["BlastAreaWidth"].InnerText); resultingExplosivesConfig.BlastAreaHeight = int.Parse(xmlData["BlastAreaHeight"].InnerText); resultingExplosivesConfig.BlockDestroyMethod = (BlockDestroyMethod)Enum.Parse(typeof(BlockDestroyMethod), xmlData["BlockDestroyMethod"].InnerText); resultingExplosivesConfig.DropDestroyedBlocks = bool.Parse(xmlData["DropDestroyedBlocks"].InnerText); resultingExplosivesConfig.DropDestroyedWires = bool.Parse(xmlData["DropDestroyedWires"].InnerText); resultingExplosivesConfig.DestroyWalls = bool.Parse(xmlData["DestroyWalls"].InnerText); resultingExplosivesConfig.DestroyWires = bool.Parse(xmlData["DestroyWires"].InnerText); resultingExplosivesConfig.RemoveLiquid = bool.Parse(xmlData["RemoveLiquid"].InnerText); resultingExplosivesConfig.PlayerDamage = int.Parse(xmlData["PlayerDamage"].InnerText); resultingExplosivesConfig.NpcDamage = int.Parse(xmlData["NpcDamage"].InnerText); resultingExplosivesConfig.MobDamage = int.Parse(xmlData["MobDamage"].InnerText); if (xmlData["TriggerPermission"] != null) { resultingExplosivesConfig.TriggerPermission = xmlData["TriggerPermission"].InnerText; } if (xmlData["WirePermission"] != null) { resultingExplosivesConfig.WirePermission = xmlData["WirePermission"].InnerText; } return(resultingExplosivesConfig); }
public static ExplosivesConfig FromXmlElement(XmlElement xmlData) { ExplosivesConfig resultingExplosivesConfig = new ExplosivesConfig(); resultingExplosivesConfig.BlastAreaShape = (ExplosionAreaShape)Enum.Parse(typeof(ExplosionAreaShape), xmlData["BlastAreaShape"].InnerText); resultingExplosivesConfig.BlastAreaWidth = int.Parse(xmlData["BlastAreaWidth"].InnerText); resultingExplosivesConfig.BlastAreaHeight = int.Parse(xmlData["BlastAreaHeight"].InnerText); resultingExplosivesConfig.BlockDestroyMethod = (BlockDestroyMethod)Enum.Parse(typeof(BlockDestroyMethod), xmlData["BlockDestroyMethod"].InnerText); resultingExplosivesConfig.DropDestroyedBlocks = bool.Parse(xmlData["DropDestroyedBlocks"].InnerText); resultingExplosivesConfig.DropDestroyedWires = bool.Parse(xmlData["DropDestroyedWires"].InnerText); resultingExplosivesConfig.DestroyWalls = bool.Parse(xmlData["DestroyWalls"].InnerText); resultingExplosivesConfig.DestroyWires = bool.Parse(xmlData["DestroyWires"].InnerText); resultingExplosivesConfig.RemoveLiquid = bool.Parse(xmlData["RemoveLiquid"].InnerText); resultingExplosivesConfig.PlayerDamage = int.Parse(xmlData["PlayerDamage"].InnerText); resultingExplosivesConfig.NpcDamage = int.Parse(xmlData["NpcDamage"].InnerText); resultingExplosivesConfig.MobDamage = int.Parse(xmlData["MobDamage"].InnerText); if (xmlData["TriggerPermission"] != null) resultingExplosivesConfig.TriggerPermission = xmlData["TriggerPermission"].InnerText; if (xmlData["WirePermission"] != null) resultingExplosivesConfig.WirePermission = xmlData["WirePermission"].InnerText; return resultingExplosivesConfig; }