private TerrainType Clone(TerrainType terrainType) { TerrainType returnValue = new TerrainType(); returnValue.ImageXCoordinate = terrainType.ImageXCoordinate; returnValue.ImageXScale = terrainType.ImageXScale; returnValue.ImageYCoordinate = terrainType.ImageYCoordinate; returnValue.ImageYScale = terrainType.ImageYScale; returnValue.TerrainTypeDescription = terrainType.TerrainTypeDescription; returnValue.TerrainTypeId = terrainType.TerrainTypeId; returnValue.TerrainGroup = terrainType.TerrainGroup; return returnValue; }
public TerrainTypeFactory() { TarrainTypes = new List<TerrainType>(); TerrainGroupFactory = new TerrainGroupFactory(); Uri uri = new Uri(Constants.TerrainTypeDataPath, UriKind.Relative); XElement applicationXml; StreamResourceInfo xmlStream = Application.GetResourceStream(uri); applicationXml = XElement.Load(xmlStream.Stream); var data = from t in applicationXml.Descendants("TerrainType") select t; TerrainType terrainType = null; foreach (var d in data) { terrainType = new TerrainType(); terrainType.TerrainTypeId = (Int32)d.Element("TerrainTypeId"); terrainType.TerrainTypeDescription = (String)d.Element("TerrainTypeDescription"); terrainType.InitiativeCap = (Int32)d.Element("InitiativeCap"); terrainType.TerrainGroup = TerrainGroupFactory.GetTerrainGroup((Int32)d.Element("TerrainGroupId")); TarrainTypes.Add(terrainType); } }