public FileControlBlock AddOrGet(FileIdentifier id) { if (!_collection.TryGetValue(id, out var result)) { result = new FileControlBlock(id); _collection[id] = result; return(result); } return(result); }
public FileControlBlock Clone(FileIdentifier newId) { var result = new FileControlBlock(newId) { IsReadOnly = IsReadOnly, Attributes = Attributes, LastWriteTime = LastWriteTime, CreationTime = CreationTime, LastAccessTime = LastAccessTime, }; var copier = new StreamCopier { ResetTarget = true }; copier.Copy(Stream, result.Stream); return(result); }
public bool TryGet(FileIdentifier id, out FileControlBlock block) { return(_collection.TryGetValue(id, out block)); }