Beispiel #1
0
        internal static bool SpaceAvailible(string location, ulong spaceNeeded, out ulong freeSpace)
        {
            ulong foo = 0;
            bool  result;

            result = NativeDisk.GetDiskFreeSpaceEx(location, out foo, out foo, out freeSpace);
            if (!result)
            {
                var exception = new Win32Exception(Marshal.GetLastWin32Error());
                throw new Exception(string.Format("Error occured when trying to get space availible.\nError code: {0}\nMessage: {1}", exception.NativeErrorCode, exception.Message));
            }

            return(spaceNeeded <= freeSpace);
        }