ReadTexture() public method

public ReadTexture ( ) : Kn5Texture
return Kn5Texture
Beispiel #1
0
        private void FromFile_Textures(Kn5Reader reader, [NotNull] IKn5TextureLoader textureLoader)
        {
            try {
                var count = reader.ReadInt32();

                Textures     = new Dictionary <string, Kn5Texture>(count);
                TexturesData = new Dictionary <string, byte[]>(count);

                for (var i = 0; i < count; i++)
                {
                    var texture = reader.ReadTexture();
                    if (texture.Length > 0)
                    {
                        Textures[texture.Name]     = texture;
                        TexturesData[texture.Name] = textureLoader.LoadTexture(texture.Name, reader.BaseStream, texture.Length) ?? new byte[0];
                    }
                }
            } catch (NotImplementedException) {
                Textures     = null;
                TexturesData = null;
            }
        }
Beispiel #2
0
        private void FromFile_Textures(Kn5Reader reader) {
            try {
                var count = reader.ReadInt32();

                Textures = new Dictionary<string, Kn5Texture>(count);
                TexturesData = new Dictionary<string, byte[]>(count);

                for (var i = 0; i < count; i++) {
                    var texture = reader.ReadTexture();
                    if (!Textures.ContainsKey(texture.Name)) {
                        Textures[texture.Name] = texture;
                        TexturesData[texture.Name] = reader.ReadBytes(texture.Length);
                    } else {
                        reader.BaseStream.Seek(texture.Length, SeekOrigin.Current);
                    }
                }
            } catch (NotImplementedException) {
                Textures = null;
                TexturesData = null;
            }
        }