public void Close() { content.Close(); content = null; length = 0; pagedAccess = null; }
private long BinarySearch(StrongPagedAccess access, long low, long high, long searchUid) { while (low <= high) { long mid = (low + high) >> 1; long pos = mid*RootItemSize; long midUid = access.ReadInt64(pos); if (midUid < searchUid) { //mid_timestamp < timestamp) { low = mid + 1; } else if (midUid > searchUid) { //mid_timestamp > timestamp) { high = mid - 1; } else { return mid; } } return -(low + 1); }
public void OpenLocalData() { lock (accessLock) { if (internalFile == null) { internalFile = CreatePathStream(); pagedFile = new StrongPagedAccess(internalFile, 1024); } } }
public bool Open() { content = new MemoryStream(1024); content.SetLength(Header); content.Seek(0, SeekOrigin.Begin); length = Header; pagedAccess = new StrongPagedAccess(content, 2048); return true; }
public bool Open() { // If the store file doesn't exist, throw an error. We can't create // compressed files, they are made by calling the 'compress'. if (!File.Exists(fileName)) throw new ApplicationException("Compressed file '" + fileName + "' was not found."); content = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.None, 2048, FileOptions.WriteThrough); pagedAccess = new StrongPagedAccess(content, 2048); return false; }
private long BinarySearch(StrongPagedAccess access, long low, long high, long timestamp) { while (low <= high) { long mid = (low + high) >> 1; long midTimeStamp = access.ReadInt64(mid * 16); if (midTimeStamp < timestamp) { low = mid + 1; } else if (midTimeStamp > timestamp) { high = mid - 1; } else { return mid; } } return -(low + 1); }
public PathAccess(Stream accessStream, string name, string pathTypeName) { this.name = name; this.pathTypeName = pathTypeName; this.accessStream = accessStream; pagedAccess = new StrongPagedAccess(accessStream, 1024); }
public bool Open() { // If the store file doesn't exist, create it if (!File.Exists(fileName)) { content = new FileStream(fileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read, 2048, FileOptions.WriteThrough); // Set the header table in the newly created file, content.SetLength(Header); content.Seek(0, SeekOrigin.Begin); length = Header; pagedAccess = new StrongPagedAccess(content, 2048); return true; } else { content = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read, 2048, FileOptions.WriteThrough); length = (int)content.Length; pagedAccess = new StrongPagedAccess(content, 2048); return false; } }