Telemetry usb disk detection

This commit is contained in:
Martijn Scheepers
2021-11-26 12:38:26 +01:00
parent 6aeaceafc2
commit 3771a53d02
3 changed files with 14 additions and 1 deletions

View File

@@ -54,6 +54,7 @@ namespace UCS.Telemetry
public String VideoControllerDescription { get; }
public List<String> Monitors { get; }
public String BIOSVersion { get; }
public List<string> USBDisks { get; }
public ComputerInfo()
{
@@ -65,6 +66,7 @@ namespace UCS.Telemetry
Monitors = new List<string>();
Monitors = VersionInfo.GetDesktopMonitorsWMI();
BIOSVersion = VersionInfo.GetBIOSVersionWMI();
USBDisks = VersionInfo.GetUSBDisks();
}
}

View File

@@ -59,7 +59,7 @@ namespace UCS.Telemetry
PushTimer.Elapsed += OnPushTimerEvent;
PushTimer.Interval = (intervalSeconds * 1000);
PushTimer.Start();
}
}
}
public static bool TelemeteryEnabled(Boolean state)
{

View File

@@ -4,6 +4,7 @@ using System.Management;
using System.Linq;
using System.Collections.Generic;
using Microsoft.Win32;
using System.IO;
namespace UCS.Telemetry
{
@@ -206,5 +207,15 @@ namespace UCS.Telemetry
}
return "Error";
}
public static List<string> GetUSBDisks()
{
List<String> usbDisks = new List<string>();
foreach (var usbDisk in DriveInfo.GetDrives().Where(drive => drive.IsReady && drive.DriveType == DriveType.Removable))
{
usbDisks.Add($"{usbDisk.Name} - {usbDisk.VolumeLabel}");
}
return usbDisks;
}
}
}