Exemple #1
0
        public FileSystemState(string rootDir, string filter = "*", EnumerationOptions options = null)
        {
            this.RootDir = rootDir ?? throw new ArgumentNullException(nameof(rootDir));
            this.Filter  = filter ?? throw new ArgumentNullException(nameof(filter));

            if (!Directory.Exists(rootDir))
            {
                throw new DirectoryNotFoundException();
            }

            EnumerationOptions = options ?? new EnumerationOptions();

            this.pathStorage = new PathStorage(new PathStorageOptions()
            {
                NewHashCode               = () => new StandardHashCode(),
                InitialCharCapacity       = 1024,
                InitialHashCapacity       = 256,
                LinearSearchLimit         = 128,
                HashBucketMaxChain        = 128,
                HashBucketInitialCapacity = 64
            });

            _state = new PathToFileStateHashtable(this.pathStorage);
        }
        public void LoadState(Stream stream)
        {
            BinaryFormatter serializer = new BinaryFormatter();

            _state = (PathToFileStateHashtable)serializer.Deserialize(stream);
        }