public InMemoryFile(InMemoryFileSystem fileSystem, string path) { FullName = path; FileSystem = fileSystem; Exists = false; // File doesn't exist until Create is called. FileBuffer = new byte[900000]; ContentsStream = new InMemoryFileStream(); ContentsStream.Disposing += new EventHandler(ContentsStream_Disposing); //ContentsStream = new MemoryStream(); //BinaryReader reader = new BinaryReader(ContentsStream); }
public Stream Open(FileMode mode) { if (!ContentsStream.CanRead) { // Stream must have been closed so create a new one based on the // FileBuffer we have ContentsStream = new InMemoryFileStream(FileBuffer); } ContentsStream.Seek(0, SeekOrigin.Begin); return ContentsStream; }