标签:ifile sdi sys write form gic rect new disk
Add Reference:System.Management;
using System.Management;
private string CheckDisk()
{
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * From Win32_LogicalDisk");
string sDisc = ""; //盘符
double dCurSize = 0.0;
//test
// string sCurPath = "";
// sCurPath = System.Environment.CurrentDirectory;
// var ini = new IniFile(sCurPath + "\\debug.ini");
// int i = 0;
foreach (ManagementObject mo in searcher.Get())
{
string disc = mo["Name"].ToString().Trim();
string size = mo["Size"].ToString().Trim();
string DriveType = mo["DriveType"].ToString().Trim();
if(string.Compare(DriveType,"3") == 0)
{
double dSize = Convert.ToDouble(size);
if (dSize > dCurSize) //string.Compare(size, sSize) > 0
{
sDisc = disc;
dCurSize = dSize;
// string sCurDisc = String.Format("CurDisc{0}", i);
// ini.IniWritevalue("SYSTEM", sCurDisc, sDisc);
}
}
// i++;
}
return sDisc;
}
catch
{
return "";
}
}
标签:ifile sdi sys write form gic rect new disk
原文地址:http://www.cnblogs.com/waterair/p/6908643.html