public override ICollection <ImageData> LoadImages() { // Error when suspended if (issuspended) { throw new Exception("Data reader is suspended"); } List <ImageData> images = new List <ImageData>(); foreach (Tile t in artfile.Tiles.Values) { ARTImage img = new ARTImage(t); images.Add(img); } // Add images to the container-specific texture set foreach (ImageData img in images) { textureset.AddImage(img); } // Done return(images); }
public override ICollection <ImageData> LoadImages() { // Error when suspended if (issuspended) { throw new Exception("Data reader is suspended"); } List <ImageData> images = new List <ImageData>(); // Find TILES###.ART lumps Dictionary <int, Lump> artlumps = new Dictionary <int, Lump>(); List <int> artlumpnums = new List <int>(); foreach (var l in lumps) { if (artfile.IsMatch(l.Name)) { // Get art number int num; int.TryParse(l.Name.Substring(5, 3), NumberStyles.Integer, CultureInfo.InvariantCulture, out num); if (artlumps.ContainsKey(num)) { General.ErrorLogger.Add(ErrorType.Error, "ART file \"" + l.Name + "\" is double-defined in resource \"" + location.location + "\""); } else { artlumps.Add(num, l); artlumpnums.Add(num); } } } // No ART lumps? if (artlumps.Count == 0) { return(images); } // Check sequentiality artlumpnums.Sort(); List <int> validartlumpnums = new List <int>(); for (int i = 0; i < artlumpnums.Count - 1; i++) { validartlumpnums.Add(artlumpnums[i]); if (artlumpnums[i + 1] - 1 != artlumpnums[i]) { General.ErrorLogger.Add(ErrorType.Error, "GRP file \"" + location.location + "\" contains inconsistently named ART files (\"TILES" + artlumpnums[i].ToString("D3") + ".ART\" file is missing)"); break; } } // Create Art readers foreach (int i in validartlumpnums) { ART art = new ART(artlumps[i].Name); if (art.Create(artlumps[i].Stream)) { artfiles.Add(art); } } // Load textures foreach (ART art in artfiles) { foreach (Tile t in art.Tiles.Values) { ARTImage img = new ARTImage(t); images.Add(img); } } // Add images to the container-specific texture set foreach (ImageData img in images) { textureset.AddImage(img); } // Done return(images); }