Example #1
0
    public static bool GetDirectoryFreeDiskSpaceUnc(string uncPath, out ulong freeSpace)
    {
        freeSpace = 0UL;
        ulong lpFreeBytesAvailable = 0;
        ulong lpTotalNumberOfBytes = 0;

        return(Win32Utils.GetDiskFreeSpaceEx(uncPath, out lpFreeBytesAvailable, out lpTotalNumberOfBytes, out freeSpace) != 0);
    }
Example #2
0
    public static bool GetDirectoryFreeDiskSpace(string directory, out ulong freeSpace)
    {
        bool flag = false;

        freeSpace = 0UL;
        ulong lpFreeBytesAvailable = 0;
        int   startIndex;

        for (ulong lpTotalNumberOfBytes = 0; Win32Utils.GetDiskFreeSpaceEx(directory, out lpFreeBytesAvailable, out lpTotalNumberOfBytes, out freeSpace) == 0; directory = directory.Remove(startIndex))
        {
            startIndex = directory.LastIndexOf('\\');
            if (startIndex == -1)
            {
                goto label_5;
            }
        }
        flag = true;
label_5:
        return(flag);
    }