CSharpUtils.Streams.SliceStream.SliceStream C# (CSharp) Метод

SliceStream() защищенный Метод

Creates a SliceStream specifying a start offset and a length. Please use CreateWithLength or CreateWithBounds to initialite the object.
protected SliceStream ( Stream BaseStream, long ThisStart, long ThisLength = -1, bool CanWrite = null, bool AllowSliceOutsideHigh = true ) : System
BaseStream Stream Base Stream
ThisStart long Starting Offset
ThisLength long Length of the Slice
CanWrite bool Determines if the Stream will be writtable.
AllowSliceOutsideHigh bool
Результат System
		protected SliceStream(Stream BaseStream, long ThisStart = 0, long ThisLength = -1, bool? CanWrite = null, bool AllowSliceOutsideHigh = true)
			: base(BaseStream, CloseParent: false)
		{
			if (!BaseStream.CanSeek) throw(new NotImplementedException("ParentStream must be seekable"));

			this.ThisPosition = 0;
			this.ThisStart = ThisStart;
			this.ThisLength = (ThisLength == -1) ? (BaseStream.Length - ThisStart) : ThisLength;

			bool ErrorCreating = false;

			if ((SliceHigh < SliceLow) || (SliceLow < 0) || (SliceHigh < 0))
			{
				ErrorCreating = true;
			}

			if (!AllowSliceOutsideHigh && ((SliceLow > BaseStream.Length) || (SliceHigh > BaseStream.Length)))
			{
				ErrorCreating = true;
			}

			if (ErrorCreating)
			{
				throw (new InvalidOperationException(String.Format("Trying to SliceStream Parent(Length={0}) Slice({1}-{2})", BaseStream.Length, ThisStart, ThisLength)));
			}
		}