コード例 #1
0
        public override DataReader CreateReader(uint offset, uint length)
        {
            if (offset != 0)
            {
                throw new ArgumentException(nameof(offset));
            }
            var readable = CompressionState?.Temp ?? _readable;

            if (_encryption != null)
            {
                var encrypted = new TempStream();
                using var raw = readable.OpenReader();
                _encryption.Encrypt(raw, encrypted);
                readable = encrypted;
            }
            var bytes = readable.ReadAllBytes();

            return(new DataReader(DataStreamFactory.Create(bytes), offset, (uint)bytes.Length));
        }
コード例 #2
0
 public static DataReader ToDataStream(this byte[] bytes) => new DataReader(DataStreamFactory.Create(bytes), 0u, (uint)bytes.LongLength);