Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public bool TryGet(FileIdentifier id, out FileControlBlock block)
 {
     return(_collection.TryGetValue(id, out block));
 }