Exemple #1
0
        public void Load(string filename)
        {
            Filename = filename;
            var br = new ByteReader(File.ReadAllBytes(Filename));

            if (br.NTSTRING(14, ENC.ASCII) != "Resource File")
            {
                throw new InvalidFileException();
            }

            // 4 unknown bytes
            br.UINT();

            // Load the image offsets
            uint count   = br.UINT();
            var  offsets = new List <uint>();

            for (uint i = 0; i < count; i++)
            {
                var offset = br.UINT();

                if (offset != 0)
                {
                    offsets.Add(offset);
                }
            }

            // Load the image at each offset
            Sprites = new List <Sprite>();

            for (int i = 0; i < offsets.Count; i++)
            {
                uint offset = offsets[i];

                try
                {
                    Sprites.Add(LoadSprite(br, i));
                }
                catch (WeirdSizeException)
                {
                    Debug.WriteLine("Skipping weird 99999x99999 image");
                }
            }
        }