Exemplo n.º 1
0
        public bool ReadFromFile(BinaryReader br)
        {
            mRcd = null;
            mFsc = null;
            mDsc = null;

            try {
                while (true)
                {
                    var subChunk1Id = br.ReadInt32();
                    switch (subChunk1Id)
                    {
                    case ((int)('R')) + (((int)('I')) << 8) + (((int)('F')) << 16) + (((int)('F')) << 24):
                        mRcd = new RiffChunkDescriptor();
                        if (!mRcd.Read(br))
                        {
                            return(false);
                        }
                        break;

                    case ((int)('f')) + (((int)('m')) << 8) + (((int)('t')) << 16) + (((int)(' ')) << 24):
                        mFsc = new FmtSubChunk();
                        if (!mFsc.Read(br))
                        {
                            return(false);
                        }
                        break;

                    case ((int)('d')) + (((int)('a')) << 8) + (((int)('t')) << 16) + (((int)('a')) << 24):
                        mDsc = new DataSubChunk();
                        if (!mDsc.Read(br))
                        {
                            return(false);
                        }
                        break;

                    default:
                        SkipUnknownChunk(br);
                        break;
                    }
                }
            } catch (EndOfStreamException ex) {
                // 正常終了wwww
            }

            return(mRcd != null && mFsc != null && mDsc != null);
        }
Exemplo n.º 2
0
        public bool ReadFromFile(BinaryReader br)
        {
            mRcd = null;
            mFsc = null;
            mDsc = null;

            try {
                while (true) {
                    var subChunk1Id = br.ReadInt32();
                    switch (subChunk1Id) {
                    case ((int)('R')) + (((int)('I')) << 8) + (((int)('F')) << 16) + (((int)('F')) << 24):
                        mRcd = new RiffChunkDescriptor();
                        if (!mRcd.Read(br)) {
                            return false;
                        }
                        break;

                    case ((int)('f')) + (((int)('m')) << 8) + (((int)('t')) << 16) + (((int)(' ')) << 24):
                        mFsc = new FmtSubChunk();
                        if (!mFsc.Read(br)) {
                            return false;
                        }
                        break;
                    case ((int)('d')) + (((int)('a')) << 8) + (((int)('t')) << 16) + (((int)('a')) << 24):
                        mDsc = new DataSubChunk();
                        if (!mDsc.Read(br)) {
                            return false;
                        }
                        break;
                    default:
                        SkipUnknownChunk(br);
                        break;
                    }
                }
            } catch (EndOfStreamException ex) {
                // 正常終了wwww
            }

            return mRcd != null && mFsc != null && mDsc != null;
        }