// This loads the textures public override ICollection <ImageData> LoadSprites() { List <ImageData> images = new List <ImageData>(); string rangestart, rangeend; int lumpindex; // Error when suspended if (issuspended) { throw new Exception("Data reader is suspended"); } // Load TEXTURES lump file lumpindex = file.FindLumpIndex("TEXTURES"); while (lumpindex > -1) { MemoryStream filedata = new MemoryStream(file.Lumps[lumpindex].Stream.ReadAllBytes()); WADReader.LoadHighresSprites(filedata, "TEXTURES", ref images, null, null); filedata.Dispose(); // Find next lumpindex = file.FindLumpIndex("TEXTURES", lumpindex + 1); } // Return result return(images); }
// This loads the textures public override ICollection <ImageData> LoadSprites() { Dictionary <long, ImageData> images = new Dictionary <long, ImageData>(); ICollection <ImageData> collection; List <ImageData> imgset = new List <ImageData>(); // Error when suspended if (issuspended) { throw new Exception("Data reader is suspended"); } // Load from wad files // Note the backward order, because the last wad's images have priority for (int i = wads.Count - 1; i >= 0; i--) { collection = wads[i].LoadSprites(); AddImagesToList(images, collection); } // Load TEXTURES lump file imgset.Clear(); string[] alltexturefiles = GetAllFilesWithTitle("", "TEXTURES", false); foreach (string texturesfile in alltexturefiles) { MemoryStream filedata = LoadFile(texturesfile); WADReader.LoadHighresSprites(filedata, texturesfile, ref imgset, null, null); filedata.Dispose(); } // Add images from TEXTURES lump file AddImagesToList(images, imgset); return(new List <ImageData>(images.Values)); }