Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6502

Condition is not resolved as expected

$
0
0

I'm using this library to get the amount of free disk space:

[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)][return: MarshalAs(UnmanagedType.Bool)]private static extern bool GetDiskFreeSpaceEx(string lpDirectoryName, out ulong lpFreeBytesAvailable, out ulong lpTotalNumberOfBytes, out ulong lpTotalNumberOfFreeBytes);

I use it in the method as:

var result = GetDiskFreeSpaceEx(desiredInstallLocation, out var freeBytesAvailable, out var totalNumberOfBytes, out var totalNumberOfFreeBytes);

Then the condition comes to the play:

if (gameSize > (int)freeBytesAvailable){    MessageBox.Show($"There is not enough disk space!\nYou need to free at least {ConvertBytesToMegabytes(gameSize - (int)freeBytesAvailable)} MB.", "Not enough space on a disk", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);    return false;}

Here is the record from the debugging:

enter image description here

enter image description here

Why is the condiiton passed?


Viewing all articles
Browse latest Browse all 6502

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>