Exemple #1
0
        private void LoadFromFile(string filename)
        {
            // We copy all the data into a memory stream to allow seeking
            using (var s = new OptionalGzipStream(filename))
            {
                s.CopyTo(_stream);
                _stream.Seek(0, SeekOrigin.Begin);
            }

            // We parse the header
            Header.Parse(_stream);

            // And the GD3 tag, if present
            if (Header.Gd3Offset != 0)
            {
                Gd3Tag.Parse(_stream, Header.Gd3Offset);
            }
        }
Exemple #2
0
        public static Gd3Tag LoadFromVgm(string filename)
        {
            // Open the stream
            using (var s = new OptionalGzipStream(filename))
                using (var r = new BinaryReader(s, Encoding.ASCII))
                {
                    r.ReadBytes(0x14);
                    var offset = r.ReadUInt32() + 0x14;
                    if (offset == 0)
                    {
                        // No tag
                        return(null);
                    }

                    if (offset > s.Length - 8 - 11 * 2)
                    {
                        throw new InvalidDataException("Not enough room in file for GD3 offset");
                    }

                    var result = new Gd3Tag();
                    result.Parse(s, offset);
                    return(result);
                }
        }