internal SMBFileInfo(FileInfo fileInfo,
                      IFileSystem fileSystem) : this(fileInfo.FullName, fileSystem)
 {
     _creationTime      = fileInfo.CreationTime;
     _creationTimeUtc   = fileInfo.CreationTimeUtc;
     _lastAccessTime    = fileInfo.LastAccessTime;
     _lastAccessTimeUtc = fileInfo.LastAccessTimeUtc;
     _lastWriteTime     = fileInfo.LastWriteTime;
     _lastWriteTimeUtc  = fileInfo.LastWriteTimeUtc;
     _attributes        = fileInfo.Attributes;
     _directory         = _dirInfoFactory.FromDirectoryName(fileInfo.Directory.FullName);
     _directoryName     = fileInfo.DirectoryName;
     _exists            = fileInfo.Exists;
     _isReadOnly        = fileInfo.IsReadOnly;
     _length            = fileInfo.Length;
 }
Beispiel #2
0
 internal SMBDirectoryInfo(DirectoryInfo directoryInfo,
                           IFileSystem fileSystem,
                           ISMBCredentialProvider credentialProvider) : this(directoryInfo.FullName, fileSystem, credentialProvider)
 {
     _creationTime      = directoryInfo.CreationTime;
     _creationTimeUtc   = directoryInfo.CreationTimeUtc;
     _fileSystem        = fileSystem;
     _lastAccessTime    = directoryInfo.LastAccessTime;
     _lastAccessTimeUtc = directoryInfo.LastAccessTimeUtc;
     _lastWriteTime     = directoryInfo.LastWriteTime;
     _lastWriteTimeUtc  = directoryInfo.LastWriteTimeUtc;
     _parent            = (directoryInfo.Parent != null) ? _directoryInfoFactory.FromDirectoryName(directoryInfo.Parent.FullName) : null;
     _root      = new SMBDirectoryInfo(directoryInfo.Root.FullName, fileSystem, credentialProvider);
     _exists    = directoryInfo.Exists;
     _extension = directoryInfo.Extension;
     _name      = directoryInfo.Name;
 }
        public SMBDriveInfo(string path, IFileSystem fileSystem, SMBFileSystemInformation smbFileSystemInformation, ISMBCredential credential)
        {
            FileSystem    = fileSystem;
            DriveFormat   = smbFileSystemInformation.AttributeInformation.FileSystemName;
            Name          = path.ShareName();
            RootDirectory = _dirInfoFactory.FromDirectoryName(path, credential);
            var actualAvailableAllocationUnits = smbFileSystemInformation.SizeInformation.ActualAvailableAllocationUnits;
            var sectorsPerUnit           = smbFileSystemInformation.SizeInformation.SectorsPerAllocationUnit;
            var bytesPerSector           = smbFileSystemInformation.SizeInformation.BytesPerSector;
            var totalAllocationUnits     = smbFileSystemInformation.SizeInformation.TotalAllocationUnits;
            var availableAllocationUnits = smbFileSystemInformation.SizeInformation.CallerAvailableAllocationUnits;

            AvailableFreeSpace = availableAllocationUnits * sectorsPerUnit * bytesPerSector;
            TotalFreeSpace     = actualAvailableAllocationUnits * sectorsPerUnit * bytesPerSector;
            TotalSize          = totalAllocationUnits * sectorsPerUnit * bytesPerSector;
            _volumeLabel       = smbFileSystemInformation.VolumeInformation.VolumeLabel;
        }