public PagedMemoryStream Clone() { PagedMemoryStream pagedMemoryStream = new PagedMemoryStream((long)this.PageSize, this.PageSize); foreach (byte[] page in this.Pages) { byte[] numArray = new byte[page.Length]; Array.Copy((Array)page, (Array)numArray, page.Length); pagedMemoryStream.Pages.Add(numArray); } pagedMemoryStream.SetLength(this.Length); return(pagedMemoryStream); }
public static void Forward(Stream source, int sourceOffset, Stream target, int length) { PagedMemoryStream pagedMemoryStream = source as PagedMemoryStream; if (pagedMemoryStream != null) { pagedMemoryStream.WriteTo(sourceOffset, target, length); } else { MemoryStream memoryStream = source as MemoryStream; if (memoryStream != null) { target.Write(memoryStream.GetBuffer(), sourceOffset, length); } else { long position = source.Position; source.Position = (long)sourceOffset; byte[] buffer = new byte[65536]; int num = length / 65536; for (int index = 0; index < num; ++index) { source.Read(buffer, 0, 65536); target.Write(buffer, 0, 65536); } int count = length - num * 65536; if (count > 0) { source.Read(buffer, 0, count); target.Write(buffer, 0, count); } source.Position = position; } } }
public static void Forward(Stream source, Stream target) { PagedMemoryStream pagedMemoryStream = source as PagedMemoryStream; if (pagedMemoryStream != null) { pagedMemoryStream.WriteTo(target); } else { MemoryStream memoryStream = source as MemoryStream; if (memoryStream != null) { target.Write(memoryStream.GetBuffer(), 0, (int)memoryStream.Length); } else { long position = source.Position; source.Position = 0L; byte[] buffer = new byte[65536]; int num = (int)(source.Length / 65536L); for (int index = 0; index < num; ++index) { source.Read(buffer, 0, 65536); target.Write(buffer, 0, 65536); } int count = (int)(source.Length - (long)(num * 65536)); if (count > 0) { source.Read(buffer, 0, count); target.Write(buffer, 0, count); } source.Position = position; } } }
public PagedMemoryStream(PagedMemoryStream source) { this.int_1 = source.int_1; this.list_0 = source.list_0; this.long_1 = source.long_1; }