-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUsbDisk.cs
99 lines (76 loc) · 1.95 KB
/
UsbDisk.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//************************************************************************************************
// Copyright © 2010 Steven M. Cohn. All Rights Reserved.
//************************************************************************************************
namespace CatalogTcx
{
/// <summary>
/// Represents the displayable information for a single USB disk.
/// </summary>
internal class UsbDisk
{
/// <summary>
/// Initialize a new instance with the given values.
/// </summary>
/// <param name="name">The Windows drive letter assigned to this device.</param>
public UsbDisk (string name)
{
Name = name;
Model = string.Empty;
Volume = string.Empty;
FreeSpace = 0;
Size = 0;
}
/// <summary>
/// Gets the description of this disk.
/// </summary>
public string Description =>
string.IsNullOrEmpty(Volume) ? Name : $"{Name} {Volume} ({Model})";
/// <summary>
/// Gets the available free space on the disk, specified in bytes.
/// </summary>
public ulong FreeSpace
{
get;
internal set;
}
/// <summary>
/// Get the model of this disk. This is the manufacturer's name.
/// </summary>
/// <remarks>
/// When this class is used to identify a removed USB device, the Model
/// property is set to String.Empty.
/// </remarks>
public string Model
{
get;
internal set;
}
/// <summary>
/// Gets the name of this disk. This is the Windows identifier, drive letter.
/// </summary>
public string Name
{
get;
}
/// <summary>
/// Gets the total size of the disk, specified in bytes.
/// </summary>
public ulong Size
{
get;
internal set;
}
/// <summary>
/// Get the volume name of this disk. This is the friently name ("Stick").
/// </summary>
/// <remarks>
/// When this class is used to identify a removed USB device, the Volume
/// property is set to String.Empty.
/// </remarks>
public string Volume
{
get;
internal set;
}
}
}