Beispiel #1
0
        public void CreateVolume([NotNull] string name, [NotNull] FakeVolumeInfo volumeInfo)
        {
            Guard.NotNullNorWhiteSpace(name, nameof(name));
            Guard.NotNull(volumeInfo, nameof(volumeInfo));
            AssertVolumeDoesNotExist(name);

            var volumeEntry = new VolumeEntry(name, volumeInfo.CapacityInBytes, volumeInfo.FreeSpaceInBytes, volumeInfo.Type,
                                              volumeInfo.Format, volumeInfo.Label, FileSystemLock, SystemClock, ChangeTracker, loggedOnAccount);

            volumes[name] = volumeEntry;
        }
Beispiel #2
0
        public CurrentDirectoryManager([NotNull] VolumeContainer container)
        {
            Guard.NotNull(container, nameof(container));
            this.container = container;

            ICollection <VolumeEntry> drives = container.FilterDrives();

            AssertFileSystemContainsDrives(drives);

            VolumeEntry drive = drives.First();

            path = new AbsolutePath(drive.Name);
        }
Beispiel #3
0
        protected DirectoryEntry([NotNull] string name, FileAttributes attributes, [CanBeNull] DirectoryEntry parent,
                                 [CanBeNull] VolumeEntry root, [NotNull] FakeFileSystemChangeTracker changeTracker, [NotNull] SystemClock systemClock,
                                 [NotNull] ILoggedOnUserAccount loggedOnAccount)
            : base(name, attributes, changeTracker, loggedOnAccount)
        {
            Guard.NotNull(systemClock, nameof(systemClock));

            Parent        = parent;
            Root          = root ?? (VolumeEntry)this;
            SystemClock   = systemClock;
            PathFormatter = new DirectoryEntryPathFormatter(this);

            if (parent?.IsEncrypted == true)
            {
                SetEncrypted();
            }

            CreationTimeUtc = systemClock.UtcNow();
            UpdateLastWriteLastAccessTime();
        }