Ejemplo n.º 1
0
 /// <summary>
 /// Constructor that wraps a memory slice
 /// </summary>
 /// <param name="data">Span to wrap and read from</param>
 /// <param name="metaData">Bundle of all related metadata for parsing</param>
 /// <param name="offsetReference">Optional offset reference position to use</param>
 public MutagenMemoryReadStream(
     ReadOnlyMemorySlice <byte> data,
     ParsingBundle metaData,
     long offsetReference = 0)
     : base(data)
 {
     this.MetaData        = metaData;
     this.OffsetReference = offsetReference;
 }
Ejemplo n.º 2
0
 public MutagenInterfaceReadStream(
     IBinaryReadStream stream,
     ParsingBundle metaData,
     long offsetReference = 0)
 {
     _readStream          = stream;
     this.MetaData        = metaData;
     this.OffsetReference = offsetReference;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor that wraps an existing stream
 /// </summary>
 /// <param name="stream">Stream to wrap and read from</param>
 /// <param name="metaData">Bundle of all related metadata for parsing</param>
 /// <param name="bufferSize">Size of internal buffer</param>
 /// <param name="dispose">Whether to dispose the source stream</param>
 /// <param name="offsetReference">Optional offset reference position to use</param>
 public MutagenBinaryReadStream(
     Stream stream,
     ParsingBundle metaData,
     int bufferSize       = 4096,
     bool dispose         = true,
     long offsetReference = 0)
     : base(stream, bufferSize, dispose)
 {
     this.MetaData        = metaData;
     this.OffsetReference = offsetReference;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructor that opens a read stream to a path
 /// </summary>
 /// <param name="path">Path to read from</param>
 /// <param name="metaData">Bundle of all related metadata for parsing</param>
 /// <param name="bufferSize">Size of internal buffer</param>
 /// <param name="offsetReference">Optional offset reference position to use</param>
 public MutagenBinaryReadStream(
     FilePath path,
     ParsingBundle metaData,
     int bufferSize       = 4096,
     long offsetReference = 0)
     : base(path.Path, bufferSize)
 {
     this._path           = path;
     this.MetaData        = metaData;
     this.OffsetReference = offsetReference;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor that opens a read stream to a path
 /// </summary>
 /// <param name="path">Path to read from</param>
 /// <param name="metaData">Bundle of all related metadata for parsing</param>
 /// <param name="bufferSize">Size of internal buffer</param>
 /// <param name="offsetReference">Optional offset reference position to use</param>
 /// <param name="fileSystem">FileSystem to read from</param>
 public MutagenBinaryReadStream(
     FilePath path,
     ParsingBundle metaData,
     int bufferSize         = 4096,
     long offsetReference   = 0,
     IFileSystem?fileSystem = null)
     : base(fileSystem.GetOrDefault().File.OpenRead(path.Path), bufferSize)
 {
     this._path           = path;
     this.MetaData        = metaData;
     this.OffsetReference = offsetReference;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor that opens a read stream to a path
 /// </summary>
 /// <param name="path">Path to read from</param>
 /// <param name="release">Game Release the stream is for</param>
 /// <param name="bufferSize">Size of internal buffer</param>
 /// <param name="offsetReference">Optional offset reference position to use</param>
 public MutagenBinaryReadStream(
     ModPath path,
     GameRelease release,
     int bufferSize       = 4096,
     long offsetReference = 0)
     : base(path, bufferSize)
 {
     this._path    = path;
     this.MetaData = new ParsingBundle(release, MasterReferenceReader.FromPath(path, release))
     {
         ModKey = path.ModKey
     };
     this.OffsetReference = offsetReference;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Constructor that opens a read stream to a path
 /// </summary>
 /// <param name="path">Path to read from</param>
 /// <param name="release">Game Release the stream is for</param>
 /// <param name="bufferSize">Size of internal buffer</param>
 /// <param name="offsetReference">Optional offset reference position to use</param>
 /// <param name="fileSystem">FileSystem to read from</param>
 public MutagenBinaryReadStream(
     ModPath path,
     GameRelease release,
     int bufferSize         = 4096,
     long offsetReference   = 0,
     IFileSystem?fileSystem = null)
     : base(fileSystem.GetOrDefault().File.OpenRead(path), bufferSize)
 {
     this._path    = path;
     this.MetaData = new ParsingBundle(release, MasterReferenceReader.FromPath(path, release, fileSystem: fileSystem))
     {
         ModKey = path.ModKey
     };
     this.OffsetReference = offsetReference;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Constructor that wraps an existing stream
        /// </summary>
        /// <param name="stream">Stream to wrap and read from</param>
        /// <param name="modKey">ModKey</param>
        /// <param name="release">Game Release the stream is for</param>
        /// <param name="bufferSize">Size of internal buffer</param>
        /// <param name="dispose">Whether to dispose the source stream</param>
        /// <param name="offsetReference">Optional offset reference position to use</param>
        public MutagenBinaryReadStream(
            Stream stream,
            ModKey modKey,
            GameRelease release,
            int bufferSize       = 4096,
            bool dispose         = true,
            long offsetReference = 0)
            : base(stream, bufferSize, dispose)
        {
            var startPos = stream.Position;

            this.MetaData = new ParsingBundle(release, MasterReferenceReader.FromStream(stream, modKey, release, disposeStream: false))
            {
                ModKey = modKey
            };
            stream.Position      = startPos;
            this.OffsetReference = offsetReference;
        }