mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Be able to enumerate devices under win32 when running under .NET Core.
This commit is contained in:
@@ -100,6 +100,7 @@
|
|||||||
<Compile Include="Windows\UsbFunctions.cs" />
|
<Compile Include="Windows\UsbFunctions.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Management" Version="4.5.0" />
|
||||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.5" />
|
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// /***************************************************************************
|
// /***************************************************************************
|
||||||
// The Disc Image Chef
|
// The Disc Image Chef
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@@ -33,14 +33,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Management;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Win32.SafeHandles;
|
using Microsoft.Win32.SafeHandles;
|
||||||
#if !NETSTANDARD2_0
|
|
||||||
using System.Linq;
|
|
||||||
using System.Management;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace DiscImageChef.Devices.Windows
|
namespace DiscImageChef.Devices.Windows
|
||||||
{
|
{
|
||||||
@@ -72,7 +69,6 @@ namespace DiscImageChef.Devices.Windows
|
|||||||
// TODO: Any way to fill this in .NET Standard ???
|
// TODO: Any way to fill this in .NET Standard ???
|
||||||
List<string> deviceIDs = new List<string>();
|
List<string> deviceIDs = new List<string>();
|
||||||
|
|
||||||
#if !NETSTANDARD2_0
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ManagementObjectSearcher mgmtObjSearcher =
|
ManagementObjectSearcher mgmtObjSearcher =
|
||||||
@@ -99,12 +95,13 @@ namespace DiscImageChef.Devices.Windows
|
|||||||
return null;
|
return null;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
List<DeviceInfo> devList = new List<DeviceInfo>();
|
List<DeviceInfo> devList = new List<DeviceInfo>();
|
||||||
|
|
||||||
foreach(string devId in deviceIDs)
|
foreach(string devId in deviceIDs)
|
||||||
{
|
{
|
||||||
|
if(devId is null) continue;
|
||||||
|
|
||||||
string physId = devId;
|
string physId = devId;
|
||||||
// TODO: This can be done better
|
// TODO: This can be done better
|
||||||
if(devId.Length == 2 && devId[1] == ':') physId = "\\\\?\\" + devId;
|
if(devId.Length == 2 && devId[1] == ':') physId = "\\\\?\\" + devId;
|
||||||
|
|||||||
Reference in New Issue
Block a user