This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Device.cs
46 lines (39 loc) · 1.46 KB
/
Device.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
using System.Xml.Linq;
namespace PS5CodeReader
{
internal class Device
{
internal string Port { get; }
internal string? FriendlyName { get; }
internal string? InstanceId { get; }
internal string? DeviceLocationPath { get; }
internal bool IsProductIdSet { get; }
internal bool IsVenderIdSet { get; }
internal bool HasProductAndVendorId => IsProductIdSet && IsVenderIdSet;
internal int ProductId { get; }
internal int VendorId { get; }
internal string? DeviceParent { get; }
internal string? DeviceSerialNumber { get; }
internal Device(string port, string? friendlyName)
{
Port = port;
FriendlyName = friendlyName;
}
internal Device(string port, string friendlyName, string deviceLocationPath) :this(port, friendlyName)
{
DeviceLocationPath = deviceLocationPath;
}
internal Device(string port, string friendlyName, string instanceId, string deviceLocationPath, string deviceParent) : this(port, friendlyName, deviceLocationPath)
{
InstanceId = instanceId;
DeviceParent = deviceParent;
var split = DeviceParent.Split('\\');
if (split != null && split.Length > 0)
DeviceSerialNumber = split.LastOrDefault();
}
public override string? ToString()
{
return FriendlyName;
}
}
}