예제 #1
0
 public FileControlBlock AddOrGet(FileIdentifier id)
 {
     if (!_collection.TryGetValue(id, out var result))
     {
         result          = new FileControlBlock(id);
         _collection[id] = result;
         return(result);
     }
     return(result);
 }
예제 #2
0
        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);
        }
예제 #3
0
 public bool TryGet(FileIdentifier id, out FileControlBlock block)
 {
     return(_collection.TryGetValue(id, out block));
 }