Esempio n. 1
0
        private static new RiffFile read(StreamAccessor accessor)
        {
            if ("RIFF" != accessor.ReadString(EncodingType.CC4))
            {
                throw new System.ApplicationException("指定したデータは RIFF データではありません。");
            }

            RiffFile ret  = new RiffFile();
            uint     size = accessor.ReadUInt32(EncodingType.U4);

            ret.type = accessor.ReadString(EncodingType.CC4);

            ret.chunks = new Gen::List <Chunk>();
            StreamAccessor acChunks = new StreamAccessor(accessor.ReadSubStream(size - 4));

            try{
                while (acChunks.RestLength > 0)
                {
                    ret.chunks.Add(acChunks.Read <Chunk>());
                }
            }finally{
                acChunks.Stream.Close();
            }
            return(ret);
        }
Esempio n. 2
0
        internal static List read(StreamAccessor accessor)
        {
            List ret = new List();

            if ("LIST" != accessor.ReadString(EncodingType.CC4))
            {
                throw new System.ApplicationException("読み込もうとしているデータは LIST チャンクではないです。");
            }

            uint size = accessor.ReadUInt32(EncodingType.U4);

            ret.type = accessor.ReadString(EncodingType.CC4);

            ret.chunks = new Gen::List <Chunk>();
            StreamAccessor acChunks = new StreamAccessor(accessor.ReadSubStream(size - 4));

            try{
                while (acChunks.RestLength > 0)
                {
                    ret.chunks.Add(acChunks.Read <Chunk>());
                }
            }finally{
                acChunks.Stream.Close();
            }
            return(ret);
        }
Esempio n. 3
0
        private int ReadTagHeader(StreamAccessor accessor, out bool unsync)
        {
            const string DIFF_VERSION = @"読み込もうとしている ID3 タグの版は 2.{0}.{1}です。 
この関数では 2.3.0 の読み取りにしか対応していません。";

            //-------------------------------------------------------

            if (accessor.ReadString(EncodingType.CC3) != "ID3")
            {
                throw new FileFormatException("読み込もうとしているバイナリストリームは ID3 タグではありません。");
            }

            byte minor    = accessor.ReadByte(EncodingType.U1);
            byte revision = accessor.ReadByte(EncodingType.U1);

            if (minor != 3 || revision != 0)
            {
                throw new FileFormatException(string.Format(DIFF_VERSION, minor, revision));
            }

            byte flags = accessor.ReadByte(EncodingType.U1);

            unsync            = (flags & 0x80) != 0;
            this.has_ext      = (flags & 0x40) != 0;
            this.experimental = (flags & 0x20) != 0;

            return(accessor.ReadInt32(EncodingType.Int28BE));
        }
Esempio n. 4
0
        private static ImageDirectory read(StreamAccessor accessor)
        {
            ImageDirectory dir = new ImageDirectory(accessor.ReadString(EncodingType.NoSpecified));

            uint count = accessor.ReadUInt32(EncodingType.U4);

            for (int i = 0; i < count; i++)
            {
                dir.images.Add(accessor.ReadInt32(EncodingType.I4));
            }

            dir.dirs = accessor.Read <DirectoryCollection>();
            return(dir);
        }
Esempio n. 5
0
        private static Chunk read(StreamAccessor accessor)
        {
            string name = accessor.ReadString(EncodingType.CC4);

            if (name == "LIST")
            {
                accessor.Stream.Seek(-4, System.IO.SeekOrigin.Current);
                return(List.read(accessor));
            }

            Chunk ret = new Chunk(name);

            uint size = accessor.ReadUInt32(EncodingType.U4);

            ret._stream = accessor.ReadSubStream(size);

            return(ret);
        }