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

Map() публичный Метод

public Map ( long Offset, Stream Stream ) : MapStream
Offset long
Stream Stream
Результат MapStream
		public MapStream Map(long Offset, Stream Stream)
		{
			_StreamEntries.Add(new StreamEntry(Offset, Stream));
			return this;
		}

Usage Example

Пример #1
0
		public void TestRead()
		{
			var Stream1 = new ZeroStream(5, 0x11);
			var Stream2 = new ZeroStream(3, 0x22);
			var MapStream = new MapStream();
			byte[] Readed1, Readed2, Readed3, Readed4;

			MapStream.Map(3, Stream1);
			MapStream.Map(3 + 5, Stream2);

			MapStream.Position = 4;

			Readed1 = MapStream.ReadBytesUpTo(3);
			CollectionAssert.AreEqual(new byte[] { 0x11, 0x11, 0x11 }, Readed1);

			Readed2 = MapStream.ReadBytesUpTo(3);
			CollectionAssert.AreEqual(new byte[] { 0x11, 0x22, 0x22 }, Readed2);

			Readed3 = MapStream.ReadBytesUpTo(1);
			CollectionAssert.AreEqual(new byte[] { 0x22 }, Readed3);

			MapStream.Position = 3;
			Readed4 = MapStream.ReadBytesUpTo(8);
			CollectionAssert.AreEqual(new byte[] { 0x11, 0x11, 0x11, 0x11, 0x11, 0x22, 0x22, 0x22 }, Readed4);
		}
All Usage Examples Of CSharpUtils.Streams.MapStream::Map