示例#1
0
 private static DdsFile GetDdsFile(Stream stream)
 {
     using (var reader = new BinaryReader(stream))
     {
         return(DdsFile.Deserialize(reader));
     }
 }
示例#2
0
        public static DdsFile Deserialize(BinaryReader reader)
        {
            var file = new DdsFile();

            file.dwMagic = reader.ReadString(4);
            if (file.dwMagic != magicNumber)
            {
                throw new IOException($"Expected header file identifier ({magicNumber}) does not match the deserialized identifier ({file.dwMagic})");
            }

            file.header = DdsHeader.Deserialize(reader);
            file.data   = reader.ReadRemainingBytes();

            return(file);
        }