//OK, this method puts the responsibility of searching //for property names within the Property Manager. The key reason for //this is that is a lot easier from the UI's perspective to work with a //collection of 'fileType' business objects rather than straight XML public static void GetFileTypes(List <AirFileType> fileTypes) { XmlNode propertyNode; AirFileType fileType; fileTypes.Clear(); propertyNode = _rootNode.SelectSingleNode("air:fileTypes", _namespaceManager); if (propertyNode != null && propertyNode.HasChildNodes) { // Loop through collection of xml fileType nodes foreach (XmlNode childNode in propertyNode.ChildNodes) { // Create a new fileType business object fileType = new AirFileType(); fileType.Name = GetProperty("name", childNode); fileType.Extension = GetProperty("extension", childNode); fileType.Description = GetProperty("description", childNode); fileType.ContentType = GetProperty("contentType", childNode); foreach (AirFileType.AirFileTypeIcon icon in fileType.Icons) { if (icon.MinVersion <= _version) { icon.FilePath = GetProperty("icon/image" + icon.Size + "x" + icon.Size, childNode); } } // Add to the business object collection fileTypes.Add(fileType); } } }
//OK, this method puts the responsibility of searching //for property names within the Property Manager. The key reason for //this is that is a lot easier from the UI's perspective to work with a //collection of 'fileType' business objects rather than straight XML public static void GetFileTypes(List<AirFileType> fileTypes) { XmlNode propertyNode; AirFileType fileType; fileTypes.Clear(); propertyNode = _rootNode.SelectSingleNode("air:fileTypes", _namespaceManager); if (propertyNode != null && propertyNode.HasChildNodes) { // Loop through collection of xml fileType nodes foreach (XmlNode childNode in propertyNode.ChildNodes) { // Create a new fileType business object fileType = new AirFileType(); fileType.Name = GetProperty("name", childNode); fileType.Extension = GetProperty("extension", childNode); fileType.Description = GetProperty("description", childNode); fileType.ContentType = GetProperty("contentType", childNode); foreach (AirFileType.AirFileTypeIcon icon in fileType.Icons) { if (icon.MinVersion <= _version) { icon.FilePath = GetProperty("icon/image" + icon.Size + "x" + icon.Size, childNode); } } // Add to the business object collection fileTypes.Add(fileType); } } }