예제 #1
0
        public IEnumerable <Record> Read(Stream s)
        {
            if (Encoding.ASCII.GetString(s.ReadBytes(7)) != "ARCH000")
            {
                throw new NotSupportedException("Not a boir file");
            }
            var compressed  = s.ReadByte();
            var recordStart = s.ReadInt32();
            var recordCount = s.ReadInt16();

            s.Position = recordStart;
            for (int i = 0; i < recordCount; i++)
            {
                Record rec = null;
                switch ((FileType)compressed)
                {
                case FileType.Compressed:
                    rec = (Record) new CompressedRecord();
                    break;

                case FileType.Encrypted:
                    rec = new EncryptedRecord();
                    break;

                case FileType.Encrypted2:
                    rec = new MiniZCompressedRecord();
                    break;
                }
                rec.Read(s);

                yield return(rec);
            }
        }
예제 #2
0
        public IEnumerable<Record> Read(Stream s)
        {
            if (Encoding.ASCII.GetString(s.ReadBytes(7)) != "ARCH000")
                throw new NotSupportedException("Not a boir file");
            var compressed = s.ReadByte();
            var recordStart = s.ReadInt32();
            var recordCount = s.ReadInt16();

            s.Position = recordStart;
            for (int i = 0; i < recordCount; i++)
            {
                Record rec = null;
                switch ((FileType)compressed)
                {
                    case FileType.Compressed:
                        rec = (Record)new CompressedRecord();
                        break;
                    case FileType.Encrypted:
                        rec = new EncryptedRecord();
                        break;
                    case FileType.Encrypted2:
                        rec = new MiniZCompressedRecord();
                        break;
                }
                rec.Read(s);

                yield return rec;
            }
        }