public DiskStringLog() { var path = TempFileCleaner.GetTempFilename("movieOnDisk"); stream = new FileStream(path, FileMode.Create, System.Security.AccessControl.FileSystemRights.FullControl, FileShare.None, 4 * 1024, FileOptions.DeleteOnClose); bw = new BinaryWriter(stream); br = new BinaryReader(stream); }
public StreamStringLog(bool disk) { mDisk = disk; if (disk) { var path = TempFileCleaner.GetTempFilename("movieOnDisk"); stream = new FileStream(path, FileMode.Create, System.Security.AccessControl.FileSystemRights.FullControl, FileShare.None, 4 * 1024, FileOptions.DeleteOnClose); } else { stream = new AWEMemoryStream(); } bw = new BinaryWriter(stream); br = new BinaryReader(stream); }
public StreamBlobDatabase(bool onDisk, long capacity, StreamBlobDatabaseBufferManager mBufferManage) { _mBufferManage = mBufferManage; _mCapacity = capacity; if (onDisk) { var path = TempFileCleaner.GetTempFilename("rewindbuf"); // I checked the DeleteOnClose operation to make sure it cleans up when the process is aborted, and it seems to. // Otherwise we would have a more complex tempfile management problem here. // 4KB buffer chosen due to similarity to .net defaults, and fear of anything larger making hiccups for small systems (we could try asyncing this stuff though...) _mStream = new FileStream(path, FileMode.Create, System.Security.AccessControl.FileSystemRights.FullControl, FileShare.None, 4 * 1024, FileOptions.DeleteOnClose); } else { _mAllocatedBuffer = _mBufferManage(null, ref _mCapacity, true); _mStream = new MemoryStream(_mAllocatedBuffer); } }