protected static void SetSpaceData(System.Security.SecurityElement xml) { //var xml = XMLParser.LoadXML(text); var map = XMLParser.LoadIntMap(xml, String.Empty); var type = typeof(SpaceData); var props = type.GetProperties(); foreach (var item in map) { var t = new SpaceData(); foreach (var prop in props) { if (prop.Name == "id") { prop.SetValue(t, item.Key, null); } else { if (item.Value.ContainsKey(prop.Name)) { var value = Utils.GetValue(item.Value[prop.Name], prop.PropertyType); prop.SetValue(t, value, null); } } } if (!SpaceDataMap.ContainsKey(item.Key)) { SpaceDataMap.Add(item.Key, t); } } }
public static void ResetSpaceData(MissionData missionData) { SpaceDataMap.Clear(); int spaceID = missionData.scene; string spaceFileName = string.Concat("s", spaceID); ReadSpaceFile(spaceFileName); }