AcTools.Kn5File.Kn5Reader.ReadTexture C# (CSharp) Method

ReadTexture() public method

public ReadTexture ( ) : Kn5Texture
return Kn5Texture
        public Kn5Texture ReadTexture() {
            return new Kn5Texture {
                Active = ReadInt32() == 1,
                Name = ReadString(),
                Length = (int)ReadUInt32()
            };
        }

Usage Example

Example #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;
            }
        }
All Usage Examples Of AcTools.Kn5File.Kn5Reader::ReadTexture