public SeekableCryptoStream(SegmentReader reader) { _reader = reader; byte[] lenbytes = reader.ReadSegment(0); len = BitConverter.ToInt64(lenbytes, 0); }
/// <summary> /// Opens the specified file. /// </summary> /// <returns> /// A pointer to the file. /// </returns> /// <param name='fileID'> /// The file name to open /// </param> public long OpenFile(long fileID) { SegmentReader mreader = new SegmentReader(fstream,fragments[fileID]); long keyval = 0; lock (fileHandles) { if (fileHandles.ContainsKey(fileHandles.Count)) { keyval = fileHandles.Count + 1; while (fileHandles.ContainsKey(keyval)) { keyval++; } fileHandles.Add(keyval, mreader); } else { keyval = fileHandles.Count; fileHandles.Add(fileHandles.Count, mreader); } } return keyval; }
public SeekableCryptoStream(SegmentReader reader) { _reader = reader; byte[] mb = new byte[sizeof(long)]; reader.rawRead(0,mb); len = BitConverter.ToInt64(mb, 0); if(len>reader.basestream.Length) { len = 0; } }
/// <summary> /// Opens the specified file. /// </summary> /// <returns> /// A pointer to the file. /// </returns> /// <param name='fileID'> /// The file name to open /// </param> public long OpenFile(long fileID) { SegmentReader mreader = new SegmentReader(fstream,fragments[fileID],fileID); long keyval = 0; lock (fileHandles) { while (fileHandles.ContainsKey(keyval)) { keyval++; } fileHandles.Add(keyval, mreader); if(!handleMappings.ContainsKey(fileID)) { handleMappings.Add(fileID,new List<long>()); } handleMappings[fileID].Add(keyval); return keyval; } }