// <Item Area_ID="1" Citys="1|2|3|4" Populace="1370536875" Publication="1:0.2,2:0.3,3:0.4" Lv_Consume="3" Map_Index="2" Area_Name="中国" Area_Pic=""/> public static Map_AreaObject Load(SecurityElement element) { Map_AreaObject mapareaObject = new Map_AreaObject(); mapareaObject.Area_ID = StrParser.ParseDecInt(StrParser.ParseStr(element.Attribute("Area_ID"), ""), -1); // mapareaObject.Citys = StrParser.ParseDecInt(StrParser.ParseStr(element.Attribute ("Citys"), ""),-1); string Condition = StrParser.ParseStr(element.Attribute("Citys"), ""); if ("" != Condition && null != Condition) { string[] vecs = Condition.Split('|'); mapareaObject._Citys.Clear(); foreach (string Conditionstring in vecs) { int temp = StrParser.ParseDecInt(Conditionstring, -1); mapareaObject._Citys.Add(temp); } } mapareaObject.Populace = StrParser.ParseDecInt(StrParser.ParseStr(element.Attribute("Populace"), ""), -1); mapareaObject.Publication = StrParser.ParseStr(element.Attribute("Publication"), ""); mapareaObject.Lv_Consume = StrParser.ParseDecInt(StrParser.ParseStr(element.Attribute("Lv_Consume"), ""), -1); mapareaObject.Lv_Populace = StrParser.ParseDecInt(StrParser.ParseStr(element.Attribute("Lv_Populace"), ""), -1); mapareaObject.Map_Index = StrParser.ParseDecInt(StrParser.ParseStr(element.Attribute("Map_Index"), ""), -1); mapareaObject.Area_Name = StrParser.ParseStr(element.Attribute("Area_Name"), ""); mapareaObject.Area_Pic = StrParser.ParseStr(element.Attribute("Area_Pic"), ""); return(mapareaObject); }
public override bool Load(SecurityElement element) { if (element.Tag != "Items") { return(false); } if (element.Children != null) { foreach (SecurityElement childrenElement in element.Children) { Map_AreaObject mapareaObject = Map_AreaObject.Load(childrenElement); if (!_Map_AreaObjectDict.ContainsKey(mapareaObject.Area_ID)) { _Map_AreaObjectDict[mapareaObject.Area_ID] = mapareaObject; } } } return(true); }