非常感谢您提出这个问题。我正在做一个相同的项目,这非常有帮助。
答案正是我所需要的。
我建议为 SysInfo() 函数编辑winglerw28 的代码sn-p:
systemInformation.AppendFormat("\t Drive: {0}" +
"\n\t\t VolumeLabel: {1}" +
"\n\t\t DriveType: {2}" +
"\n\t\t DriveFormat: {3}" +
"\n\t\t TotalSize: {4}" +
"\n\t\t AvailableFreeSpace: {5}\n",
DriveInfo1.Name, DriveInfo1.VolumeLabel, DriveInfo1.DriveType,
DriveInfo1.DriveFormat, DriveInfo1.TotalSize, DriveInfo1.AvailableFreeSpace);
我很确定“DriveInfo1”引用应全部更改为“驱动器”,如下所示:
systemInformation.AppendFormat("\t Drive: {0}" +
"\n\t\t VolumeLabel: {1}" +
"\n\t\t DriveType: {2}" +
"\n\t\t DriveFormat: {3}" +
"\n\t\t TotalSize: {4}" +
"\n\t\t AvailableFreeSpace: {5}\n",
drive.Name, drive.VolumeLabel, drive.DriveType,
drive.DriveFormat, drive.TotalSize, drive.AvailableFreeSpace);