SharpCifs.Smb.SmbFile.GetDiskFreeSpace C# (CSharp) Method

GetDiskFreeSpace() public method

This method returns the free disk space in bytes of the drive this share represents or the drive on which the directory or file resides.
This method returns the free disk space in bytes of the drive this share represents or the drive on which the directory or file resides. Objects other than TYPE_SHARE or TYPE_FILESYSTEM will result in 0L being returned.
public GetDiskFreeSpace ( ) : long
return long
        public virtual long GetDiskFreeSpace()
        {
            if (GetType() == TypeShare || Type == TypeFilesystem)
            {
                int level = Trans2QueryFsInformationResponse.SmbFsFullSizeInformation;
                try
                {
                    return QueryFsInformation(level);
                }
                catch (SmbException ex)
                {
                    switch (ex.GetNtStatus())
                    {
                        case NtStatus.NtStatusInvalidInfoClass:
                        case NtStatus.NtStatusUnsuccessful:
                            {
                                // NetApp Filer
                                // SMB_FS_FULL_SIZE_INFORMATION not supported by the server.
                                level = Trans2QueryFsInformationResponse.SMB_INFO_ALLOCATION;
                                return QueryFsInformation(level);
                            }
                    }
                    throw;
                }
            }
            return 0L;
        }