فضای کل یک پارتیش رو چگونه بدست آوریم؟
یک شنبه 26 آذر 1391 8:38 AM
using System.Management;
public double getHDDSize(string drive)
{
//check to see if the user provided a drive letter
//if not default it to "C"
if (drive == "" || drive == null)
{
drive = "C";
}
//create our ManagementObject, passing it the drive letter to the
//DevideID using WQL
ManagementObject disk = new ManagementObject("Win32_LogicalDisk.DeviceID=\"" + drive + ":\"");
//bind our management object
disk.Get();
//return the HDD's initial size
return Convert.ToDouble(disk["Size"]);
}
مدیر تالار های: