-
Notifications
You must be signed in to change notification settings - Fork 0
/
Disk.cs
31 lines (30 loc) · 1 KB
/
Disk.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace SSDStressTest
{
public class Disk
{
public string driveLetter { get; set; }
public string productName { get; set; }
public string pnpId { get; set; }
public Dictionary<string, int> smartData { get; set; }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("Disk ").Append(this.driveLetter).Append(": ").AppendLine(this.productName);
if (this.smartData != null)
{
foreach (var item in this.smartData)
sb.Append(item.Key).Append(": ").Append(item.Value).AppendLine();
}
return sb.ToString();
}
public void QuerySpace(out long freespace, out long totalspace)
{
DriveInfo di = new DriveInfo(this.driveLetter);
freespace = di.AvailableFreeSpace;
totalspace = di.TotalSize;
}
}
}