Exemple #1
0
        public Txf(EndianBinaryReader reader)
        {
            Initialize();

            StartPosition = reader.BaseStream.Position;
            PixelDataHeaders.Add(new TxfHeader(reader));
            ConvertImage(reader, PixelDataHeaders.FirstOrDefault(), null);

            reader.BaseStream.Seek(StartPosition + PixelDataHeaders.FirstOrDefault().Offset, SeekOrigin.Begin);
        }
Exemple #2
0
        public Txf(string filePath)
            : base(filePath)
        {
            Initialize();

            using (EndianBinaryReader reader = new EndianBinaryReader(File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Endian.BigEndian))
            {
                rawData = new MemoryStream(reader.ReadBytes((int)reader.BaseStream.Length), 0, (int)reader.BaseStream.Length, false, true);

                using (MemoryStream tempStream = new MemoryStream(rawData.ToArray()))
                {
                    using (EndianBinaryReader tempReader = new EndianBinaryReader(tempStream, Endian.BigEndian))
                    {
                        StartPosition = tempReader.BaseStream.Position;

                        /* Assume a single header, sure hope only anm .dat files have more than one... */
                        PixelDataHeaders.Add(new TxfHeader(tempReader));
                        ConvertImage(tempReader, PixelDataHeaders.FirstOrDefault(), null);
                    }
                }
            }
        }
Exemple #3
0
        public Txf(EndianBinaryReader reader, int imageDataSize, int numPixelHeaders, int numPaletteHeaders)
        {
            Initialize();

            rawData = new MemoryStream(reader.ReadBytes(imageDataSize), 0, imageDataSize, false, true);

            using (MemoryStream tempStream = new MemoryStream(rawData.ToArray()))
            {
                using (EndianBinaryReader tempReader = new EndianBinaryReader(tempStream, Endian.BigEndian))
                {
                    StartPosition = tempReader.BaseStream.Position;

                    for (int i = 0; i < numPixelHeaders; i++)
                    {
                        PixelDataHeaders.Add(new TxfHeader(tempReader));
                    }
                    for (int i = 0; i < numPaletteHeaders; i++)
                    {
                        PaletteDataHeaders.Add(new TxfHeader(tempReader));
                    }
                }
            }
        }