Пример #1
0
        public static SimisReader FromStream(Stream stream, SimisProvider simisProvider, SimisJinxFormat jinxStreamFormat)
        {
            if (!stream.CanRead)
            {
                throw new ArgumentException("Stream must support reading.", "stream");
            }
            if (!stream.CanSeek)
            {
                throw new ArgumentException("Stream must support seeking.", "stream");
            }

            var reader    = SimisStreamReader.FromStream(stream);
            var position  = reader.BaseStream.Position;
            var signature = new String(reader.ReadChars(4));

            switch (signature)
            {
            case "JINX":
                return(new SimisJinxReader(reader, simisProvider, jinxStreamFormat));

            case "\x01\x00\x00\x00":
                return(new SimisAceReader(reader));

            default:
                throw new ReaderException(reader, reader.StreamIsBinary, (int)(reader.BaseStream.Position - position), "Signature '" + signature + "' is invalid.");
            }
        }
Пример #2
0
 public SimisJinxReader(SimisStreamReader reader, SimisProvider provider, SimisJinxFormat jinxStreamFormat)
     : base(reader)
 {
     JinxStreamFormat = jinxStreamFormat;
     SimisProvider    = provider;
     StreamLength     = reader.UncompressedLength;
     BlockEndOffsets  = new Stack <uint>();
     PendingTokens    = new Queue <SimisToken>();
     ReadStream(out JinxStreamIsBinary, ref JinxStreamFormat);
 }
Пример #3
0
 public SimisAceReader(SimisStreamReader reader)
     : base(reader)
 {
 }
Пример #4
0
 protected SimisReader(SimisStreamReader reader)
 {
     Reader = reader;
 }
Пример #5
0
 public SimisJinxReader(SimisStreamReader reader, SimisProvider provider)
     : this(reader, provider, null)
 {
 }