additional device details
This commit is contained in:
@@ -65,12 +65,24 @@
|
||||
<Compile Include="..\Disco.Models\ClientServices\Enrol.cs">
|
||||
<Link>Models\ClientServices\Enrol.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\BaseBoard.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\BaseBoard.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\Battery.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\Battery.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\Bios.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\Bios.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\Certificate.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\Certificate.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\CertificateStore.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\CertificateStore.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\ComputerSystem.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\ComputerSystem.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Disco.Models\ClientServices\EnrolmentInformation\DeviceHardware.cs">
|
||||
<Link>Models\ClientServices\EnrolmentInformation\DeviceHardware.cs</Link>
|
||||
</Compile>
|
||||
@@ -169,6 +181,11 @@
|
||||
"$(ProjectDir)Package Creation\7z.exe" a -tzip "$(ProjectDir)Package Creation\PreparationClient.zip" "$(TargetDir)*.*" -x!*.tmp -x!*.vshost.* -x!Newtonsoft.Json.xml -x!*.pdb
|
||||
COPY "$(ProjectDir)Package Creation\PreparationClient.zip" "$(ProjectDir)..\Disco.Web\ClientBin"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_StartDate="2000/1/1" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Disco.Models.ClientServices.EnrolmentInformation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
|
||||
@@ -44,6 +45,7 @@ namespace Disco.Client.Interop
|
||||
audit.ApplyProcessorInformation();
|
||||
audit.ApplyPhysicalMemoryInformation();
|
||||
audit.ApplyDiskDriveInformation();
|
||||
audit.ApplyBatteryInformation();
|
||||
|
||||
audit.NetworkAdapters = Network.GetNetworkAdapters();
|
||||
|
||||
@@ -71,13 +73,11 @@ namespace Disco.Client.Interop
|
||||
processor.Manufacturer = (string)mItem.GetPropertyValue("Manufacturer");
|
||||
processor.Name = (string)mItem.GetPropertyValue("Name");
|
||||
processor.Description = (string)mItem.GetPropertyValue("Description");
|
||||
processor.Family = (ushort)mItem.GetPropertyValue("Family");
|
||||
processor.MaxClockSpeed = (uint)mItem.GetPropertyValue("MaxClockSpeed");
|
||||
processor.NumberOfCores = (uint)mItem.GetPropertyValue("NumberOfCores");
|
||||
processor.NumberOfLogicalProcessors = (uint)mItem.GetPropertyValue("NumberOfLogicalProcessors");
|
||||
|
||||
var architectureCode = (ushort)mItem.GetPropertyValue("Architecture");
|
||||
processor.Architecture = Enum.GetName(typeof(ProcessorArchitectures), architectureCode) ?? $"Unknown {architectureCode}";
|
||||
processor.Family = (ushort?)mItem.GetPropertyValue("Family");
|
||||
processor.MaxClockSpeed = (uint?)mItem.GetPropertyValue("MaxClockSpeed");
|
||||
processor.NumberOfCores = (uint?)mItem.GetPropertyValue("NumberOfCores");
|
||||
processor.NumberOfLogicalProcessors = (uint?)mItem.GetPropertyValue("NumberOfLogicalProcessors");
|
||||
processor.Architecture = ((ProcessorArchitectures?)(ushort?)mItem.GetPropertyValue("Architecture"))?.ToString();
|
||||
|
||||
processors.Add(processor);
|
||||
}
|
||||
@@ -114,9 +114,9 @@ namespace Disco.Client.Interop
|
||||
physicalMemory.SerialNumber = (string)mItem.GetPropertyValue("SerialNumber");
|
||||
physicalMemory.Manufacturer = (string)mItem.GetPropertyValue("Manufacturer");
|
||||
physicalMemory.PartNumber = (string)mItem.GetPropertyValue("PartNumber");
|
||||
physicalMemory.Capacity = (ulong)mItem.GetPropertyValue("Capacity");
|
||||
physicalMemory.ConfiguredClockSpeed = (uint)mItem.GetPropertyValue("ConfiguredClockSpeed");
|
||||
physicalMemory.Speed = (uint)mItem.GetPropertyValue("Speed");
|
||||
physicalMemory.Capacity = (ulong?)mItem.GetPropertyValue("Capacity");
|
||||
physicalMemory.ConfiguredClockSpeed = (uint?)mItem.GetPropertyValue("ConfiguredClockSpeed");
|
||||
physicalMemory.Speed = (uint?)mItem.GetPropertyValue("Speed");
|
||||
physicalMemory.DeviceLocator = (string)mItem.GetPropertyValue("DeviceLocator");
|
||||
|
||||
physicalMemories.Add(physicalMemory);
|
||||
@@ -157,7 +157,7 @@ namespace Disco.Client.Interop
|
||||
diskDrive.InterfaceType = (string)diskResult.GetPropertyValue("InterfaceType");
|
||||
diskDrive.SerialNumber = (string)diskResult.GetPropertyValue("SerialNumber");
|
||||
diskDrive.FirmwareRevision = (string)diskResult.GetPropertyValue("FirmwareRevision");
|
||||
diskDrive.Size = (ulong)diskResult.GetPropertyValue("Size");
|
||||
diskDrive.Size = (ulong?)diskResult.GetPropertyValue("Size");
|
||||
|
||||
using (var partitionSearcher = new ManagementObjectSearcher($"ASSOCIATORS OF {{Win32_DiskDrive.DeviceID=\"{diskDrive.DeviceID.Replace(@"\", @"\\")}\"}} WHERE AssocClass = Win32_DiskDriveToDiskPartition"))
|
||||
{
|
||||
@@ -173,11 +173,11 @@ namespace Disco.Client.Interop
|
||||
var partition = new DiskDrivePartition();
|
||||
|
||||
partition.DeviceID = (string)partitionResult.GetPropertyValue("DeviceID");
|
||||
partition.Bootable = (bool)partitionResult.GetPropertyValue("Bootable");
|
||||
partition.BootPartition = (bool)partitionResult.GetPropertyValue("BootPartition");
|
||||
partition.PrimaryParition = (bool)partitionResult.GetPropertyValue("PrimaryPartition");
|
||||
partition.Size = (ulong)partitionResult.GetPropertyValue("Size");
|
||||
partition.StartingOffset = (ulong)partitionResult.GetPropertyValue("StartingOffset");
|
||||
partition.Bootable = (bool?)partitionResult.GetPropertyValue("Bootable");
|
||||
partition.BootPartition = (bool?)partitionResult.GetPropertyValue("BootPartition");
|
||||
partition.PrimaryParition = (bool?)partitionResult.GetPropertyValue("PrimaryPartition");
|
||||
partition.Size = (ulong?)partitionResult.GetPropertyValue("Size");
|
||||
partition.StartingOffset = (ulong?)partitionResult.GetPropertyValue("StartingOffset");
|
||||
partition.Type = (string)partitionResult.GetPropertyValue("Type");
|
||||
|
||||
using (var logicalSearcher = new ManagementObjectSearcher($"ASSOCIATORS OF {{Win32_DiskPartition.DeviceID=\"{partition.DeviceID}\"}} WHERE AssocClass = Win32_LogicalDiskToPartition"))
|
||||
@@ -194,13 +194,11 @@ namespace Disco.Client.Interop
|
||||
|
||||
logical.DeviceID = (string)logicalResult.GetPropertyValue("DeviceID");
|
||||
logical.Description = (string)logicalResult.GetPropertyValue("Description");
|
||||
var driveType = (uint)logicalResult.GetPropertyValue("DriveType");
|
||||
logical.DriveType = Enum.GetName(typeof(DiskLogicalDriveTypes), driveType) ?? $"Unknown {driveType}";
|
||||
var mediaType = (uint)logicalResult.GetPropertyValue("MediaType");
|
||||
logical.MediaType = Enum.GetName(typeof(DiskLogicalMediaTypes), mediaType) ?? $"Unknown {mediaType}";
|
||||
logical.DriveType = ((DiskLogicalDriveTypes?)(uint?)logicalResult.GetPropertyValue("DriveType")).ToString();
|
||||
logical.MediaType = ((DiskLogicalMediaTypes?)(uint?)logicalResult.GetPropertyValue("MediaType")).ToString();
|
||||
logical.FileSystem = (string)logicalResult.GetPropertyValue("FileSystem");
|
||||
logical.Size = (ulong)logicalResult.GetPropertyValue("Size");
|
||||
logical.FreeSpace = (ulong)logicalResult.GetPropertyValue("FreeSpace");
|
||||
logical.Size = (ulong?)logicalResult.GetPropertyValue("Size");
|
||||
logical.FreeSpace = (ulong?)logicalResult.GetPropertyValue("FreeSpace");
|
||||
logical.VolumeName = (string)logicalResult.GetPropertyValue("VolumeName");
|
||||
logical.VolumeSerialNumber = (string)logicalResult.GetPropertyValue("VolumeSerialNumber");
|
||||
|
||||
@@ -233,12 +231,50 @@ namespace Disco.Client.Interop
|
||||
// ignore errors to ensure backwards compatibility
|
||||
}
|
||||
}
|
||||
private static void ApplyBatteryInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT DeviceID, Availability, Chemistry, Description, DesignCapacity, DesignVoltage, FullChargeCapacity, Name FROM Win32_Battery"))
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
if (mResults.Count > 0)
|
||||
{
|
||||
var batteries = new List<Battery>(mResults.Count);
|
||||
foreach (var mItem in mResults.Cast<ManagementObject>())
|
||||
{
|
||||
if (mItem != null)
|
||||
{
|
||||
var battery = new Battery();
|
||||
|
||||
battery.Availability = ((BatteryAvailability?)(ushort?)mItem.GetPropertyValue("Availability"))?.ToString();
|
||||
battery.Chemistry = ((BatteryChemistry?)(ushort?)mItem.GetPropertyValue("Chemistry"))?.ToString();
|
||||
battery.Description = (string)mItem.GetPropertyValue("Description");
|
||||
battery.DesignCapacity = (uint?)mItem.GetPropertyValue("DesignCapacity");
|
||||
battery.DeviceID = (string)mItem.GetPropertyValue("DeviceID");
|
||||
battery.FullChargeCapacity = (uint?)mItem.GetPropertyValue("FullChargeCapacity");
|
||||
battery.Name = (string)mItem.GetPropertyValue("Name");
|
||||
|
||||
batteries.Add(battery);
|
||||
}
|
||||
}
|
||||
deviceHardware.Batteries = batteries;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignore errors to ensure backwards compatibility
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyBIOSInformation(this DeviceHardware deviceHardware)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT SerialNumber, Manufacturer, SMBIOSBIOSVersion FROM Win32_BIOS WHERE PrimaryBios=true"))
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT BIOSVersion, Manufacturer, ReleaseDate, SerialNumber, SMBIOSBIOSVersion, SMBIOSMajorVersion, SMBIOSMinorVersion, SystemBiosMajorVersion, SystemBiosMinorVersion FROM Win32_BIOS WHERE PrimaryBios=true"))
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
@@ -248,17 +284,42 @@ namespace Disco.Client.Interop
|
||||
{
|
||||
var serialNumber = (string)mItem.GetPropertyValue("SerialNumber");
|
||||
if (!string.IsNullOrWhiteSpace(serialNumber))
|
||||
{
|
||||
deviceHardware.SerialNumber = serialNumber.Trim();
|
||||
}
|
||||
|
||||
var manufacturer = (string)mItem.GetPropertyValue("Manufacturer");
|
||||
if (deviceHardware.Manufacturer == null && !string.IsNullOrWhiteSpace(manufacturer))
|
||||
{
|
||||
deviceHardware.Manufacturer = manufacturer.Trim();
|
||||
}
|
||||
|
||||
ErrorReporting.DeviceIdentifier = deviceHardware.SerialNumber;
|
||||
|
||||
var biosVersion = (string[])mItem.GetPropertyValue("BIOSVersion");
|
||||
var releaseDate = default(DateTime?);
|
||||
var releaseDateString = (string)mItem.GetPropertyValue("ReleaseDate");
|
||||
if (releaseDateString != null && releaseDateString.Length == 25 && int.TryParse(releaseDateString.Substring(22), out var offsetMinutes))
|
||||
{
|
||||
releaseDateString = $"{releaseDateString.Substring(0, 22)}{offsetMinutes / 60:00}:{Math.Abs(offsetMinutes % 60):00}";
|
||||
if (DateTime.TryParseExact(releaseDateString, "yyyyMMddHHmmss.ffffffzzz", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out var releaseDateResult))
|
||||
releaseDate = releaseDateResult;
|
||||
}
|
||||
var sMBIOSBIOSVersion = (string)mItem.GetPropertyValue("SMBIOSBIOSVersion");
|
||||
var sMBIOSMajorVersion = (ushort?)mItem.GetPropertyValue("SMBIOSMajorVersion");
|
||||
var sMBIOSMinorVersion = (ushort?)mItem.GetPropertyValue("SMBIOSMinorVersion");
|
||||
var systemBiosMajorVersion = (byte?)mItem.GetPropertyValue("SystemBiosMajorVersion");
|
||||
var systemBiosMinorVersion = (byte?)mItem.GetPropertyValue("SystemBiosMinorVersion");
|
||||
|
||||
var bios = new Bios()
|
||||
{
|
||||
BIOSVersion = biosVersion,
|
||||
Manufacturer = manufacturer,
|
||||
ReleaseDate = releaseDate,
|
||||
SerialNumber = serialNumber,
|
||||
SMBIOSBIOSVersion = sMBIOSBIOSVersion,
|
||||
SMBIOSMajorVersion = sMBIOSMajorVersion,
|
||||
SMBIOSMinorVersion = sMBIOSMinorVersion,
|
||||
SystemBiosMajorVersion = systemBiosMajorVersion,
|
||||
SystemBiosMinorVersion = systemBiosMinorVersion,
|
||||
};
|
||||
deviceHardware.Bios = new List<Bios>() { bios };
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -278,7 +339,7 @@ namespace Disco.Client.Interop
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT Manufacturer, Model, PCSystemType FROM Win32_ComputerSystem"))
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT ChassisSKUNumber, CurrentTimeZone, Description, Manufacturer, Model, OEMStringArray, PCSystemType, PrimaryOwnerContact, PrimaryOwnerName, Roles, SystemSKUNumber, SystemType FROM Win32_ComputerSystem"))
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
@@ -288,17 +349,40 @@ namespace Disco.Client.Interop
|
||||
{
|
||||
var manufacturer = (string)mItem.GetPropertyValue("Manufacturer");
|
||||
if (!string.IsNullOrWhiteSpace(manufacturer))
|
||||
{
|
||||
deviceHardware.Manufacturer = manufacturer.Trim();
|
||||
}
|
||||
|
||||
var model = (string)mItem.GetPropertyValue("Model");
|
||||
if (!string.IsNullOrWhiteSpace(model))
|
||||
{
|
||||
deviceHardware.Model = model.ToString();
|
||||
}
|
||||
deviceHardware.Model = model;
|
||||
|
||||
deviceHardware.ModelType = ((PCSystemTypes)mItem.GetPropertyValue("PCSystemType")).Description();
|
||||
|
||||
var chassisSKUNumber = (string)mItem.GetPropertyValue("ChassisSKUNumber");
|
||||
var currentTimeZone = (short?)mItem.GetPropertyValue("CurrentTimeZone");
|
||||
var description = (string)mItem.GetPropertyValue("Description");
|
||||
var oemStringArray = (string[])mItem.GetPropertyValue("OEMStringArray");
|
||||
var pcSystemType = ((PCSystemTypes)mItem.GetPropertyValue("PCSystemType")).ToString();
|
||||
var primaryOwnerContact = (string)mItem.GetPropertyValue("PrimaryOwnerContact");
|
||||
var primaryOwnerName = (string)mItem.GetPropertyValue("PrimaryOwnerName");
|
||||
var roles = (string[])mItem.GetPropertyValue("Roles");
|
||||
var systemSKUNumber = (string)mItem.GetPropertyValue("SystemSKUNumber");
|
||||
var systemType = (string)mItem.GetPropertyValue("SystemType");
|
||||
|
||||
var computerSystem = new ComputerSystem()
|
||||
{
|
||||
ChassisSKUNumber = chassisSKUNumber,
|
||||
CurrentTimeZone = currentTimeZone,
|
||||
Description = description,
|
||||
OEMStringArray = oemStringArray,
|
||||
PCSystemType = pcSystemType,
|
||||
PrimaryOwnerContact = primaryOwnerContact,
|
||||
PrimaryOwnerName = primaryOwnerName,
|
||||
Roles = roles,
|
||||
SystemSKUNumber = systemSKUNumber,
|
||||
SystemType = systemType,
|
||||
};
|
||||
|
||||
deviceHardware.ComputerSystem = new List<ComputerSystem>() { computerSystem };
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -351,7 +435,7 @@ namespace Disco.Client.Interop
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT SerialNumber, Manufacturer, Model, Product FROM Win32_BaseBoard"))
|
||||
using (var mSearcher = new ManagementObjectSearcher("SELECT ConfigOptions, Manufacturer, Model, PartNumber, Product, SerialNumber, SKU, Version FROM Win32_BaseBoard"))
|
||||
{
|
||||
using (var mResults = mSearcher.Get())
|
||||
{
|
||||
@@ -369,13 +453,13 @@ namespace Disco.Client.Interop
|
||||
var model = (string)mItem.GetPropertyValue("Model");
|
||||
if (deviceHardware.Model == null && !string.IsNullOrWhiteSpace(model))
|
||||
{
|
||||
deviceHardware.Model = model.ToString();
|
||||
deviceHardware.Model = model;
|
||||
}
|
||||
|
||||
var product = (string)mItem.GetPropertyValue("Product");
|
||||
if (deviceHardware.Model == null && !string.IsNullOrWhiteSpace(product))
|
||||
{
|
||||
deviceHardware.Model = product.ToString();
|
||||
deviceHardware.Model = product;
|
||||
}
|
||||
|
||||
// Added 2012-11-22 G# - Lenovo IdeaPad Serial SHIM
|
||||
@@ -390,6 +474,25 @@ namespace Disco.Client.Interop
|
||||
deviceHardware.SerialNumber = serialNumber.Trim();
|
||||
ErrorReporting.DeviceIdentifier = deviceHardware.SerialNumber;
|
||||
}
|
||||
|
||||
var configOptions = (string[])mItem.GetPropertyValue("ConfigOptions");
|
||||
var partNumber = (string)mItem.GetPropertyValue("PartNumber");
|
||||
var sku = (string)mItem.GetPropertyValue("SKU");
|
||||
var version = (string)mItem.GetPropertyValue("Version");
|
||||
|
||||
var baseBoard = new BaseBoard()
|
||||
{
|
||||
ConfigOptions = configOptions,
|
||||
Manufacturer = manufacturer,
|
||||
Model = model,
|
||||
PartNumber = partNumber,
|
||||
Product = product,
|
||||
SerialNumber = serialNumber,
|
||||
SKU = sku,
|
||||
Version = version,
|
||||
};
|
||||
|
||||
deviceHardware.BasebBoard = new List<BaseBoard>() { baseBoard };
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -546,5 +649,42 @@ namespace Disco.Client.Interop
|
||||
F3_240M_512,
|
||||
F3_32M_512,
|
||||
}
|
||||
|
||||
private enum BatteryAvailability : ushort
|
||||
{
|
||||
Other = 1,
|
||||
Unknown = 2,
|
||||
RunningFullPower = 3,
|
||||
Warning = 4,
|
||||
InTest = 5,
|
||||
NotApplicable = 6,
|
||||
PowerOff = 7,
|
||||
OffLine = 8,
|
||||
OffDuty = 9,
|
||||
Degraded = 10,
|
||||
NotInstalled = 11,
|
||||
InstallError = 12,
|
||||
PowerSaveUnknown = 13,
|
||||
PowerSaveLowPowerMode = 14,
|
||||
PowerSaveStandby = 15,
|
||||
PowerCycle = 16,
|
||||
PowerSaveWarning = 17,
|
||||
Paused = 18,
|
||||
NotReady = 19,
|
||||
NotConfigured = 20,
|
||||
Quiesced = 21,
|
||||
}
|
||||
|
||||
private enum BatteryChemistry : ushort
|
||||
{
|
||||
Other = 1,
|
||||
Unknown = 2,
|
||||
LeadAcid = 3,
|
||||
NickelCadmium = 4,
|
||||
NickelMetalHydride = 5,
|
||||
LithiumIon = 6,
|
||||
ZincAir = 7,
|
||||
LithiumPolymer = 8,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class BaseBoard
|
||||
{
|
||||
public string[] ConfigOptions { get; set; }
|
||||
public string Manufacturer { get; set; }
|
||||
public string Model { get; set; }
|
||||
public string PartNumber { get; set; }
|
||||
public string Product { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public string SKU { get; set; }
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class Battery
|
||||
{
|
||||
public string Availability { get; set; }
|
||||
public string Chemistry { get; set; }
|
||||
public string Description { get; set; }
|
||||
public uint? DesignCapacity { get; set; }
|
||||
public ulong? DesignVoltage { get; set; }
|
||||
public string DeviceID { get; set; }
|
||||
public uint? FullChargeCapacity { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class Bios
|
||||
{
|
||||
public string[] BIOSVersion { get; set; }
|
||||
public string Manufacturer { get; set; }
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public string SMBIOSBIOSVersion { get; set; }
|
||||
public ushort? SMBIOSMajorVersion { get; set; }
|
||||
public ushort? SMBIOSMinorVersion { get; set; }
|
||||
public byte? SystemBiosMajorVersion { get; set; }
|
||||
public byte? SystemBiosMinorVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
{
|
||||
public class ComputerSystem
|
||||
{
|
||||
public string ChassisSKUNumber { get; set; }
|
||||
public short? CurrentTimeZone { get; set;}
|
||||
public string Description { get; set; }
|
||||
public string[] OEMStringArray { get; set; }
|
||||
public string PCSystemType { get; set; }
|
||||
public string PrimaryOwnerContact { get; set; }
|
||||
public string PrimaryOwnerName { get; set; }
|
||||
public string[] Roles { get; set; }
|
||||
public string SystemSKUNumber { get; set; }
|
||||
public string SystemType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,13 @@ namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
public string Model { get; set; }
|
||||
public string ModelType { get; set; }
|
||||
|
||||
public List<Bios> Bios { get; set; }
|
||||
public List<BaseBoard> BasebBoard { get; set; }
|
||||
public List<ComputerSystem> ComputerSystem { get; set; }
|
||||
public List<Processor> Processors { get; set; }
|
||||
public List<PhysicalMemory> PhysicalMemory { get; set; }
|
||||
public List<DiskDrive> DiskDrives { get; set; }
|
||||
public List<NetworkAdapter> NetworkAdapters { get; set; }
|
||||
|
||||
public List<Battery> Batteries { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Disco.Models.ClientServices.EnrolmentInformation
|
||||
public string InterfaceType { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public string FirmwareRevision { get; set; }
|
||||
public ulong Size { get; set; }
|
||||
public ulong? Size { get; set; }
|
||||
|
||||
public List<DiskDrivePartition> Partitions { get; set; }
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
public class DiskDrivePartition
|
||||
{
|
||||
public string DeviceID { get; set; }
|
||||
public bool Bootable { get; set; }
|
||||
public bool BootPartition { get; set; }
|
||||
public bool PrimaryParition { get; set; }
|
||||
public ulong Size { get; set; }
|
||||
public ulong StartingOffset { get; set; }
|
||||
public bool? Bootable { get; set; }
|
||||
public bool? BootPartition { get; set; }
|
||||
public bool? PrimaryParition { get; set; }
|
||||
public ulong? Size { get; set; }
|
||||
public ulong? StartingOffset { get; set; }
|
||||
public string Type { get; set; }
|
||||
|
||||
public DiskLogical LogicalDisk { get; set; }
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
public string DriveType { get; set; }
|
||||
public string MediaType { get; set; }
|
||||
public string FileSystem { get; set; }
|
||||
public ulong Size { get; set; }
|
||||
public ulong FreeSpace { get; set; }
|
||||
public ulong? Size { get; set; }
|
||||
public ulong? FreeSpace { get; set; }
|
||||
public string VolumeName { get; set; }
|
||||
public string VolumeSerialNumber { get; set; }
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
public string Manufacturer { get; set; }
|
||||
public string PartNumber { get; set; }
|
||||
|
||||
public ulong Capacity { get; set; }
|
||||
public uint ConfiguredClockSpeed { get; set; }
|
||||
public uint Speed { get; set; }
|
||||
public ulong? Capacity { get; set; }
|
||||
public uint? ConfiguredClockSpeed { get; set; }
|
||||
public uint? Speed { get; set; }
|
||||
|
||||
public string DeviceLocator { get; set; }
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Architecture { get; set; }
|
||||
public ushort Family { get; set; }
|
||||
public uint MaxClockSpeed { get; set; }
|
||||
public uint NumberOfCores { get; set; }
|
||||
public uint NumberOfLogicalProcessors { get; set; }
|
||||
public ushort? Family { get; set; }
|
||||
public uint? MaxClockSpeed { get; set; }
|
||||
public uint? NumberOfCores { get; set; }
|
||||
public uint? NumberOfLogicalProcessors { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,10 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BI\Config\OrganisationAddress.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\BaseBoard.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\Battery.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\Bios.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\ComputerSystem.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\DiskLogical.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\DeviceHardware.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\DiskDrive.cs" />
|
||||
@@ -60,6 +64,7 @@
|
||||
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfile.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileStore.cs" />
|
||||
<Compile Include="ClientServices\EnrolmentInformation\WirelessProfileTransformation.cs" />
|
||||
<Compile Include="Repository\Device\DeviceBatchAttachment.cs" />
|
||||
<Compile Include="Services\Devices\Exporting\DeviceExportFieldMetadata.cs" />
|
||||
<Compile Include="Services\Devices\Importing\IDeviceImportColumn.cs" />
|
||||
<Compile Include="Services\Devices\Importing\IDeviceImportDataReader.cs" />
|
||||
@@ -202,6 +207,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_StartDate="2000/1/1" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -16,6 +16,10 @@ namespace Disco.Models.Repository
|
||||
public const string HardwareKeyProcessors = "Processors";
|
||||
public const string HardwareKeyPhysicalMemory = "PhysicalMemory";
|
||||
public const string HardwareKeyDiskDrives = "DiskDrives";
|
||||
public const string HardwareKeyBios = "Bios";
|
||||
public const string HardwareKeyBaseBoard = "BaseBoard";
|
||||
public const string HardwareKeyComputerSystem = "ComputerSystem";
|
||||
public const string HardwareKeyBatteries = "Batteries";
|
||||
|
||||
[Column(Order = 0), Key]
|
||||
public string DeviceSerialNumber { get; set; }
|
||||
|
||||
@@ -104,6 +104,12 @@ namespace Disco.Models.Services.Devices.Exporting
|
||||
public bool Certificates { get; set; }
|
||||
|
||||
// Details
|
||||
[Display(ShortName = "Details", Name = "BIOS", Description = "The BIOS associated with the device")]
|
||||
public bool DetailBios { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Base Board", Description = "The Base Board associated with the device")]
|
||||
public bool DetailBaseBoard { get; set; }
|
||||
[Display(ShortName = "Details", Name = "System", Description = "The System information associated with the device")]
|
||||
public bool DetailComputerSystem { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Processors", Description = "The CPU Processors associated with the device")]
|
||||
public bool DetailProcessors { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Memory", Description = "The Memory/RAM associated with the device")]
|
||||
@@ -116,7 +122,9 @@ namespace Disco.Models.Services.Devices.Exporting
|
||||
public bool DetailWLanAdapters { get; set; }
|
||||
[Display(ShortName = "Details", Name = "AC Adapter", Description = "The AC Adapter associated with the device")]
|
||||
public bool DetailACAdapter { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Battery", Description = "The Battery associated with the device")]
|
||||
[Display(ShortName = "Details", Name = "Battery", Description = "The manually entered battery associated with the device")]
|
||||
public bool DetailBatteries { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Batteries", Description = "The reported batteries associated with the device")]
|
||||
public bool DetailBattery { get; set; }
|
||||
[Display(ShortName = "Details", Name = "Keyboard", Description = "The Keyboard associated with the device")]
|
||||
public bool DetailKeyboard { get; set; }
|
||||
|
||||
@@ -11,12 +11,16 @@ namespace Disco.Models.Services.Devices.Exporting
|
||||
|
||||
// Details
|
||||
public IList<DeviceDetail> DeviceDetails { get; set; }
|
||||
public List<Bios> DeviceDetailBios { get; set; }
|
||||
public List<BaseBoard> DeviceDetailBaseBoard { get; set; }
|
||||
public List<ComputerSystem> DeviceDetailComputerSystem { get; set; }
|
||||
public List<Processor> DeviceDetailProcessors { get; set; }
|
||||
public List<PhysicalMemory> DeviceDetailPhysicalMemory { get; set; }
|
||||
public List<DiskDrive> DeviceDetailDiskDrives { get; set; }
|
||||
public List<NetworkAdapter> DeviceDetailNetworkAdapters { get; set; }
|
||||
public List<string> DeviceDetailLanMacAddresses { get; set; }
|
||||
public List<string> DeviceDetailWlanMacAddresses { get; set; }
|
||||
public List<Battery> DeviceDetailBatteries { get; set; }
|
||||
|
||||
// Model
|
||||
public int? ModelId { get; set; }
|
||||
|
||||
@@ -258,5 +258,105 @@ namespace Disco.Services
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyDiskDrives, json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Bios Device Detail Value
|
||||
/// </summary>
|
||||
public static List<Bios> Bios(this IEnumerable<DeviceDetail> details)
|
||||
{
|
||||
var json = details.GetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyBios);
|
||||
|
||||
if (string.IsNullOrEmpty(json))
|
||||
return null;
|
||||
|
||||
return JsonConvert.DeserializeObject<List<Bios>>(json);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the Bios Device Detail Value
|
||||
/// </summary>
|
||||
public static void Bios(this IEnumerable<DeviceDetail> details, Device device, List<Bios> bios)
|
||||
{
|
||||
var json = default(string);
|
||||
|
||||
if (bios != null && bios.Count > 0)
|
||||
json = JsonConvert.SerializeObject(bios);
|
||||
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyBios, json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Base Board Device Detail Value
|
||||
/// </summary>
|
||||
public static List<BaseBoard> BaseBoard(this IEnumerable<DeviceDetail> details)
|
||||
{
|
||||
var json = details.GetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyBaseBoard);
|
||||
|
||||
if (string.IsNullOrEmpty(json))
|
||||
return null;
|
||||
|
||||
return JsonConvert.DeserializeObject<List<BaseBoard>>(json);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the Base Board Device Detail Value
|
||||
/// </summary>
|
||||
public static void BaseBoard(this IEnumerable<DeviceDetail> details, Device device, List<BaseBoard> baseBoard)
|
||||
{
|
||||
var json = default(string);
|
||||
|
||||
if (baseBoard != null && baseBoard.Count > 0)
|
||||
json = JsonConvert.SerializeObject(baseBoard);
|
||||
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyBaseBoard, json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Computer System Device Detail Value
|
||||
/// </summary>
|
||||
public static List<ComputerSystem> ComputerSystem(this IEnumerable<DeviceDetail> details)
|
||||
{
|
||||
var json = details.GetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyComputerSystem);
|
||||
|
||||
if (string.IsNullOrEmpty(json))
|
||||
return null;
|
||||
|
||||
return JsonConvert.DeserializeObject<List<ComputerSystem>>(json);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the Computer System Device Detail Value
|
||||
/// </summary>
|
||||
public static void ComputerSystem(this IEnumerable<DeviceDetail> details, Device device, List<ComputerSystem> computerSystem)
|
||||
{
|
||||
var json = default(string);
|
||||
|
||||
if (computerSystem != null && computerSystem.Count > 0)
|
||||
json = JsonConvert.SerializeObject(computerSystem);
|
||||
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyComputerSystem, json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Batteries Device Detail Value
|
||||
/// </summary>
|
||||
public static List<Battery> Batteries(this IEnumerable<DeviceDetail> details)
|
||||
{
|
||||
var json = details.GetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyBatteries);
|
||||
|
||||
if (string.IsNullOrEmpty(json))
|
||||
return null;
|
||||
|
||||
return JsonConvert.DeserializeObject<List<Battery>>(json);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the Batteries Device Detail Value
|
||||
/// </summary>
|
||||
public static void Batteries(this IEnumerable<DeviceDetail> details, Device device, List<Battery> batteries)
|
||||
{
|
||||
var json = default(string);
|
||||
|
||||
if (batteries != null && batteries.Count > 0)
|
||||
json = JsonConvert.SerializeObject(batteries);
|
||||
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyBatteries, json);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,6 +454,12 @@ namespace Disco.Services.Devices.Enrolment
|
||||
}
|
||||
|
||||
// store hardware audit information
|
||||
if (Request.Hardware.Bios?.Count > 0)
|
||||
RepoDevice.DeviceDetails.Bios(RepoDevice, Request.Hardware.Bios);
|
||||
if (Request.Hardware.BasebBoard?.Count > 0)
|
||||
RepoDevice.DeviceDetails.BaseBoard(RepoDevice, Request.Hardware.BasebBoard);
|
||||
if (Request.Hardware.ComputerSystem?.Count > 0)
|
||||
RepoDevice.DeviceDetails.ComputerSystem(RepoDevice, Request.Hardware.ComputerSystem);
|
||||
if (Request.Hardware.Processors?.Count > 0)
|
||||
RepoDevice.DeviceDetails.Processors(RepoDevice, Request.Hardware.Processors);
|
||||
if (Request.Hardware.PhysicalMemory?.Count > 0)
|
||||
@@ -462,6 +468,8 @@ namespace Disco.Services.Devices.Enrolment
|
||||
RepoDevice.DeviceDetails.DiskDrives(RepoDevice, Request.Hardware.DiskDrives);
|
||||
if (Request.Hardware.NetworkAdapters?.Count > 0)
|
||||
RepoDevice.DeviceDetails.NetworkAdapters(RepoDevice, Request.Hardware.NetworkAdapters);
|
||||
if (Request.Hardware.Batteries?.Count > 0)
|
||||
RepoDevice.DeviceDetails.Batteries(RepoDevice, Request.Hardware.Batteries);
|
||||
|
||||
if (adMachineAccount == null)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,12 @@ namespace Disco.Services.Devices.Exporting
|
||||
// materialize device details
|
||||
records.ForEach(r =>
|
||||
{
|
||||
if (Options.DetailBios)
|
||||
r.DeviceDetailBios = r.DeviceDetails.Bios();
|
||||
if (Options.DetailBaseBoard)
|
||||
r.DeviceDetailBaseBoard = r.DeviceDetails.BaseBoard();
|
||||
if (Options.DetailComputerSystem)
|
||||
r.DeviceDetailComputerSystem = r.DeviceDetails.ComputerSystem();
|
||||
if (Options.DetailProcessors)
|
||||
r.DeviceDetailProcessors = r.DeviceDetails.Processors();
|
||||
if (Options.DetailMemory)
|
||||
@@ -41,6 +47,8 @@ namespace Disco.Services.Devices.Exporting
|
||||
r.DeviceDetailWlanMacAddresses = r.DeviceDetails.WLanMacAddress()?.Split(';').Select(a => a.Trim()).ToList();
|
||||
}
|
||||
}
|
||||
if (Options.DetailBatteries)
|
||||
r.DeviceDetailBatteries = r.DeviceDetails.Batteries();
|
||||
});
|
||||
|
||||
TaskStatus.UpdateStatus(40, "Building metadata and database query");
|
||||
@@ -239,8 +247,9 @@ namespace Disco.Services.Devices.Exporting
|
||||
var lanAdapterMaxCount = Math.Max(1, records.Max(r => r.DeviceDetailNetworkAdapters?.Count(a => !a.IsWlanAdapter) ?? r.DeviceDetailLanMacAddresses?.Count ?? 0));
|
||||
var wlanAdapterMaxCount = Math.Max(1, records.Max(r => r.DeviceDetailNetworkAdapters?.Count(a => a.IsWlanAdapter) ?? r.DeviceDetailWlanMacAddresses?.Count ?? 0));
|
||||
var certificateMaxCount = Math.Max(1, records.Max(r => r.DeviceCertificates?.Count() ?? 0));
|
||||
var batteriesMaxCount = Math.Max(1, records.Max(r => r.DeviceDetailBatteries?.Count ?? 0));
|
||||
|
||||
var allAssessors = BuildRecordAccessors(processorMaxCount, memoryMaxCount, diskDriveMaxCount, lanAdapterMaxCount, wlanAdapterMaxCount, certificateMaxCount);
|
||||
var allAssessors = BuildRecordAccessors(processorMaxCount, memoryMaxCount, diskDriveMaxCount, lanAdapterMaxCount, wlanAdapterMaxCount, certificateMaxCount, batteriesMaxCount);
|
||||
|
||||
return typeof(DeviceExportOptions).GetProperties()
|
||||
.Where(p => p.PropertyType == typeof(bool))
|
||||
@@ -262,7 +271,7 @@ namespace Disco.Services.Devices.Exporting
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private static Dictionary<string, List<DeviceExportFieldMetadata>> BuildRecordAccessors(int processorMaxCount, int memoryMaxCount, int diskDriveMaxCount, int lanAdapterMaxCount, int wlanAdapterMaxCount, int certificateMaxCount)
|
||||
private static Dictionary<string, List<DeviceExportFieldMetadata>> BuildRecordAccessors(int processorMaxCount, int memoryMaxCount, int diskDriveMaxCount, int lanAdapterMaxCount, int wlanAdapterMaxCount, int certificateMaxCount, int batteriesMaxCount)
|
||||
{
|
||||
const string DateFormat = "yyyy-MM-dd";
|
||||
const string DateTimeFormat = DateFormat + " HH:mm:ss";
|
||||
@@ -343,6 +352,80 @@ namespace Disco.Services.Devices.Exporting
|
||||
metadata.Add(nameof(DeviceExportOptions.Certificates), certificateFields);
|
||||
|
||||
// Details
|
||||
var biosFields = new List<DeviceExportFieldMetadata>()
|
||||
{
|
||||
new DeviceExportFieldMetadata("BIOSManufacturer", "BIOS Manufacturer", typeof(string), r => r.DeviceDetailBios?.FirstOrDefault()?.Manufacturer, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BIOSSerialNumber", "BIOS Serial Number", typeof(string), r => r.DeviceDetailBios?.FirstOrDefault()?.SerialNumber, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BIOSVersion", "BIOS Version", typeof(string), r => {
|
||||
var bios = r.DeviceDetailBios?.FirstOrDefault();
|
||||
if (bios?.SMBIOSBIOSVersion != null)
|
||||
return $"{bios.SMBIOSBIOSVersion} {bios.SMBIOSMajorVersion}.{bios.SMBIOSMinorVersion}";
|
||||
else
|
||||
return null;
|
||||
}, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BIOSSystemVersion", "BIOS System Version", typeof(string), r => {
|
||||
var bios = r.DeviceDetailBios?.FirstOrDefault();
|
||||
if (bios?.SystemBiosMajorVersion.HasValue ?? false)
|
||||
return $"{bios.SystemBiosMajorVersion}.{bios.SystemBiosMinorVersion}";
|
||||
else
|
||||
return null;
|
||||
}, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BIOSReleaseDate", "BIOS Release Date", typeof(DateTime), r => r.DeviceDetailBios?.FirstOrDefault()?.ReleaseDate, csvNullableDateTimeEncoded),
|
||||
};
|
||||
metadata.Add(nameof(DeviceExportOptions.DetailBios), biosFields);
|
||||
|
||||
var baseBoardFields = new List<DeviceExportFieldMetadata>()
|
||||
{
|
||||
new DeviceExportFieldMetadata("BaseBoardManufacturer", "Base Board Manufacturer", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Manufacturer, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BaseBoardModel", "Base Board Model", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Model, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BaseBoardProduct", "Base Board Product", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Product, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BaseBoardPartNumber", "Base Board Part Number", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.PartNumber, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BaseBoardSKU", "Base Board SKU", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.SKU, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BaseBoardSerialNumber", "Base Board Serial Number", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.SerialNumber, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BaseBoardConfigOptions", "Base Board Config Options", typeof(string), r => {
|
||||
var baseBoard = r.DeviceDetailBaseBoard?.FirstOrDefault();
|
||||
if (baseBoard?.ConfigOptions != null)
|
||||
return string.Join("; ", baseBoard.ConfigOptions);
|
||||
else
|
||||
return null;
|
||||
}, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("BaseBoardVersion", "Base Board Version", typeof(string), r => r.DeviceDetailBaseBoard?.FirstOrDefault()?.Version, csvStringEncoded),
|
||||
};
|
||||
metadata.Add(nameof(DeviceExportOptions.DetailBaseBoard), baseBoardFields);
|
||||
|
||||
var computerSystemFields = new List<DeviceExportFieldMetadata>()
|
||||
{
|
||||
new DeviceExportFieldMetadata("ComputerSystemDescription", "System Description", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.Description, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("ComputerSystemPCSystemType", "System Form Factor", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.PCSystemType, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("ComputerSystemSystemType", "System Type", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.SystemType, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("ComputerSystemPrimaryOwnerName", "System Primary Owner Name", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.PrimaryOwnerName, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("ComputerSystemPrimaryOwnerContact", "System Primary Owner Contact", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.PrimaryOwnerContact, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("ComputerSystemChassisSKU", "System Chassis SKU", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.ChassisSKUNumber, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("ComputerSystemSystemSKU", "System SKU", typeof(string), r => r.DeviceDetailComputerSystem?.FirstOrDefault()?.SystemSKUNumber, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("ComputerSystemOEMReference", "System OEM Reference", typeof(string), r => {
|
||||
var computerSystem = r.DeviceDetailComputerSystem?.FirstOrDefault();
|
||||
if (computerSystem?.OEMStringArray != null)
|
||||
return string.Join("; ", computerSystem.OEMStringArray);
|
||||
else
|
||||
return null;
|
||||
}, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("ComputerSystemCurrentTimeZone", "System Time Zone", typeof(string), r => {
|
||||
var computerSystem = r.DeviceDetailComputerSystem?.FirstOrDefault();
|
||||
if (computerSystem?.CurrentTimeZone.HasValue ?? false)
|
||||
return $"{computerSystem.CurrentTimeZone.Value / 60:00}:{Math.Abs(computerSystem.CurrentTimeZone.Value % 60):00}";
|
||||
else
|
||||
return null;
|
||||
}, csvStringEncoded),
|
||||
new DeviceExportFieldMetadata("ComputerSystemRoles", "System Roles", typeof(string), r => {
|
||||
var computerSystem = r.DeviceDetailComputerSystem?.FirstOrDefault();
|
||||
if (computerSystem?.Roles != null)
|
||||
return string.Join("; ", computerSystem.Roles);
|
||||
else
|
||||
return null;
|
||||
}, csvStringEncoded),
|
||||
};
|
||||
metadata.Add(nameof(DeviceExportOptions.DetailComputerSystem), computerSystemFields);
|
||||
|
||||
var processorFields = new List<DeviceExportFieldMetadata>(processorMaxCount * 6);
|
||||
for (int i = 0; i < processorMaxCount; i++)
|
||||
{
|
||||
@@ -410,6 +493,20 @@ namespace Disco.Services.Devices.Exporting
|
||||
|
||||
metadata.Add(nameof(DeviceExportOptions.DetailACAdapter), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DetailACAdapter), typeof(string), r => r.DeviceDetails.Where(dd => dd.Key == DeviceDetail.HardwareKeyACAdapter).Select(dd => dd.Value).FirstOrDefault(), csvStringEncoded) });
|
||||
metadata.Add(nameof(DeviceExportOptions.DetailBattery), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DetailBattery), typeof(string), r => r.DeviceDetails.Where(dd => dd.Key == DeviceDetail.HardwareKeyBattery).Select(dd => dd.Value).FirstOrDefault(), csvStringEncoded) });
|
||||
var batteriesFields = new List<DeviceExportFieldMetadata>(processorMaxCount * 6);
|
||||
for (int i = 0; i < batteriesMaxCount; i++)
|
||||
{
|
||||
var v = i;
|
||||
var index = i + 1;
|
||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}Name", $"Battery {index} Name", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Name, csvStringEncoded));
|
||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}Description", $"Battery {index} Description", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Description, csvStringEncoded));
|
||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}Availability", $"Battery {index} Availability", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Availability, csvStringEncoded));
|
||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}Chemistry", $"Battery {index} Chemistry", typeof(string), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.Chemistry, csvStringEncoded));
|
||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}DesignVoltage", $"Battery {index} Design Voltage", typeof(long), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.DesignVoltage, csvToStringEncoded));
|
||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}DesignCapacity", $"Battery {index} Design Capacity", typeof(int), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.DesignCapacity, csvToStringEncoded));
|
||||
batteriesFields.Add(new DeviceExportFieldMetadata($"Batteries{index}FullChargeCapacity", $"Battery {index} Capacity", typeof(int), r => r.DeviceDetailBatteries?.Skip(v).FirstOrDefault()?.FullChargeCapacity, csvToStringEncoded));
|
||||
}
|
||||
metadata.Add(nameof(DeviceExportOptions.DetailBatteries), batteriesFields);
|
||||
metadata.Add(nameof(DeviceExportOptions.DetailKeyboard), new List<DeviceExportFieldMetadata>() { new DeviceExportFieldMetadata(nameof(DeviceExportOptions.DetailKeyboard), typeof(string), r => r.DeviceDetails.Where(dd => dd.Key == DeviceDetail.HardwareKeyKeyboard).Select(dd => dd.Value).FirstOrDefault(), csvStringEncoded) });
|
||||
|
||||
return metadata;
|
||||
|
||||
@@ -78,13 +78,13 @@ namespace Disco.Services
|
||||
return $"{speed:N0} MHz";
|
||||
}
|
||||
|
||||
public static string SizeFriendly(this DiskDrive diskDrive) => ByteSizeToFriendly(diskDrive.Size);
|
||||
public static string SizeFriendly(this DiskDrivePartition partition) => ByteSizeToFriendly(partition.Size);
|
||||
public static string SizeFriendly(this DiskLogical disk) => ByteSizeToFriendly(disk.Size);
|
||||
public static string FreeSpaceFriendly(this DiskLogical disk) => ByteSizeToFriendly(disk.FreeSpace);
|
||||
public static string SizeFriendly(this DiskDrive diskDrive) => ByteSizeToFriendly(diskDrive.Size ?? 0);
|
||||
public static string SizeFriendly(this DiskDrivePartition partition) => ByteSizeToFriendly(partition.Size ?? 0);
|
||||
public static string SizeFriendly(this DiskLogical disk) => ByteSizeToFriendly(disk.Size ?? 0);
|
||||
public static string FreeSpaceFriendly(this DiskLogical disk) => ByteSizeToFriendly(disk.FreeSpace ?? 0);
|
||||
public static string SpeedFriendly(this NetworkAdapter networkAdapter) => SpeedPacketBitsToFriendly(networkAdapter.Speed);
|
||||
public static string CapacityFriendly(this PhysicalMemory physicalMemory) => ByteSizeToFriendly(physicalMemory.Capacity);
|
||||
public static string MaxClockSpeedFriendly(this Processor processor) => SpeedMegahertzToFriendly(processor.MaxClockSpeed);
|
||||
public static string CapacityFriendly(this PhysicalMemory physicalMemory) => ByteSizeToFriendly(physicalMemory.Capacity ?? 0);
|
||||
public static string MaxClockSpeedFriendly(this Processor processor) => SpeedMegahertzToFriendly(processor.MaxClockSpeed ?? 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,16 +15,152 @@
|
||||
var networkAdapters = Model.Device.DeviceDetails.NetworkAdapters();
|
||||
var lanMacAddress = Model.Device.DeviceDetails.LanMacAddress();
|
||||
var wlanMacAddress = Model.Device.DeviceDetails.WLanMacAddress();
|
||||
var bios = Model.Device.DeviceDetails.Bios();
|
||||
var baseBoard = Model.Device.DeviceDetails.BaseBoard();
|
||||
var computerSystem = Model.Device.DeviceDetails.ComputerSystem();
|
||||
var batteries = Model.Device.DeviceDetails.Batteries();
|
||||
}
|
||||
<div id="DeviceDetailTab-Details" class="DevicePart">
|
||||
<div id="DeviceDetailTab-DetailsContainer">
|
||||
<table class="tableData">
|
||||
<tbody>
|
||||
@if (processors != null)
|
||||
@if (bios != null)
|
||||
{
|
||||
<tr class="device_detail_bios">
|
||||
<th>BIOS</th>
|
||||
<td>
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Manufacturer</th>
|
||||
<th>Serial Number</th>
|
||||
<th>Version</th>
|
||||
<th>System Version</th>
|
||||
<th>Release Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var b in bios)
|
||||
{
|
||||
<tr>
|
||||
<td>@b.Manufacturer</td>
|
||||
<td>@b.SerialNumber</td>
|
||||
<td>@b.SMBIOSBIOSVersion @(b.SMBIOSMajorVersion.GetValueOrDefault(0)).@b.SMBIOSMinorVersion</td>
|
||||
<td>@(b.SystemBiosMajorVersion).@b.SystemBiosMinorVersion</td>
|
||||
<td>
|
||||
@if (b.ReleaseDate.HasValue)
|
||||
{
|
||||
@b.ReleaseDate.Value.ToString("yyyy-MM-dd")
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (baseBoard != null)
|
||||
{
|
||||
<tr class="device_detail_base_board">
|
||||
<th>Base Board</th>
|
||||
<td>
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Manufacturer</th>
|
||||
<th>Model</th>
|
||||
<th>Product</th>
|
||||
<th>Part Number</th>
|
||||
<th>SKU</th>
|
||||
<th>Serial Number</th>
|
||||
<th>Config Options</th>
|
||||
<th>Version</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var b in baseBoard)
|
||||
{
|
||||
<tr>
|
||||
<td>@b.Manufacturer</td>
|
||||
<td>@b.Model</td>
|
||||
<td>@b.Product</td>
|
||||
<td>@b.PartNumber</td>
|
||||
<td>@b.SKU</td>
|
||||
<td>@b.SerialNumber</td>
|
||||
<td>
|
||||
@if (b.ConfigOptions != null)
|
||||
{
|
||||
@string.Join("; ", b.ConfigOptions)
|
||||
}
|
||||
</td>
|
||||
<td>@b.Version</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (computerSystem != null)
|
||||
{
|
||||
<tr class="device_detail_computer_system">
|
||||
<th>System</th>
|
||||
<td>
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<th>Form Factor</th>
|
||||
<th>Type</th>
|
||||
<th>Primary Owner</th>
|
||||
<th>Chassis SKU</th>
|
||||
<th>System SKU</th>
|
||||
<th>OEM Reference</th>
|
||||
<th>Time Zone</th>
|
||||
<th>Roles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var c in computerSystem)
|
||||
{
|
||||
<tr>
|
||||
<td>@c.Description</td>
|
||||
<td>@c.PCSystemType</td>
|
||||
<td>@c.SystemType</td>
|
||||
<td>@c.PrimaryOwnerName @c.PrimaryOwnerContact</td>
|
||||
<td>@c.ChassisSKUNumber</td>
|
||||
<td>@c.SystemSKUNumber</td>
|
||||
<td>
|
||||
@if (c.OEMStringArray != null)
|
||||
{
|
||||
@string.Join("; ", c.OEMStringArray)
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (c.CurrentTimeZone.HasValue)
|
||||
{
|
||||
@((c.CurrentTimeZone.Value / 60).ToString(@"00\:"))@(Math.Abs(c.CurrentTimeZone.Value % 60).ToString("00"))
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (c.Roles != null)
|
||||
{
|
||||
@string.Join("; ", c.Roles)
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (processors != null)
|
||||
{
|
||||
<tr class="device_detail_processors">
|
||||
<th>Processors</th>
|
||||
<td class="device_detail_processors">
|
||||
<td>
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -44,8 +180,8 @@
|
||||
<td>@processor.Description</td>
|
||||
<td>@processor.Architecture</td>
|
||||
<td>@processor.MaxClockSpeedFriendly()</td>
|
||||
<td>@processor.NumberOfCores.ToString("N0")</td>
|
||||
<td>@processor.NumberOfLogicalProcessors.ToString("N0")</td>
|
||||
<td>@processor.NumberOfCores.GetValueOrDefault(0).ToString("N0")</td>
|
||||
<td>@processor.NumberOfLogicalProcessors.GetValueOrDefault(0).ToString("N0")</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
@@ -124,14 +260,14 @@
|
||||
{
|
||||
if (lanMacAddress != null)
|
||||
{
|
||||
<tr>
|
||||
<tr class="device_detail_lan_mac_address">
|
||||
<th>LAN MAC Address</th>
|
||||
<td class="pad code">@(lanMacAddress)</td>
|
||||
</tr>
|
||||
}
|
||||
if (wlanMacAddress != null)
|
||||
{
|
||||
<tr>
|
||||
<tr class="device_detail_wlan_mac_address">
|
||||
<th>WLAN MAC Address</th>
|
||||
<td class="pad code">@(wlanMacAddress)</td>
|
||||
</tr>
|
||||
@@ -170,7 +306,7 @@
|
||||
{
|
||||
// calculate stretched offsets
|
||||
var minPartitionSize = (double)disk.Size * 0.1;
|
||||
var diskSizeAdjusted = disk.Partitions.Sum(p => Math.Max(minPartitionSize, p.Size));
|
||||
var diskSizeAdjusted = disk.Partitions.Sum(p => Math.Max(minPartitionSize, p.Size.GetValueOrDefault(0)));
|
||||
var diskAdjustedOffet = (double)0;
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
@@ -179,21 +315,21 @@
|
||||
{
|
||||
var logicalDisk = partition.LogicalDisk;
|
||||
|
||||
var offsetPercentage = Math.Round(((partition.StartingOffset + diskAdjustedOffet) / diskSizeAdjusted) * 100, 3);
|
||||
var widthPercentage = Math.Round((Math.Max(minPartitionSize, partition.Size) / diskSizeAdjusted) * 100, 3);
|
||||
var offsetPercentage = Math.Round(((partition.StartingOffset.GetValueOrDefault(0) + diskAdjustedOffet) / diskSizeAdjusted) * 100, 3);
|
||||
var widthPercentage = Math.Round((Math.Max(minPartitionSize, partition.Size.GetValueOrDefault(0)) / diskSizeAdjusted) * 100, 3);
|
||||
var freeSpacePercentage = 0d;
|
||||
if (partition.Size < minPartitionSize)
|
||||
{
|
||||
diskAdjustedOffet += minPartitionSize - partition.Size;
|
||||
diskAdjustedOffet += minPartitionSize - partition.Size.GetValueOrDefault(0);
|
||||
}
|
||||
|
||||
var partitionTitle = partition.Type;
|
||||
var tags = new List<string>();
|
||||
if (partition.BootPartition)
|
||||
if (partition.BootPartition.GetValueOrDefault(false))
|
||||
{
|
||||
tags.Add("Boot");
|
||||
}
|
||||
if (partition.PrimaryParition)
|
||||
if (partition.PrimaryParition.GetValueOrDefault(false))
|
||||
{
|
||||
tags.Add("Primary");
|
||||
}
|
||||
@@ -204,7 +340,7 @@
|
||||
tags.Add(logicalDisk.FreeSpaceFriendly() + " Free");
|
||||
tags.Add(logicalDisk.FileSystem);
|
||||
tags.Add(logicalDisk.DriveType);
|
||||
freeSpacePercentage = Math.Round(((double)logicalDisk.FreeSpace / logicalDisk.Size) * 100, 3);
|
||||
freeSpacePercentage = Math.Round(((double)logicalDisk.FreeSpace.GetValueOrDefault(0) / logicalDisk.Size.GetValueOrDefault(0)) * 100, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -233,7 +369,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
|
||||
<tr class="device_detail_ac_adapter">
|
||||
<th>AC Adapter</th>
|
||||
<td class="pad">
|
||||
@if (canConfig)
|
||||
@@ -251,7 +388,7 @@
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="device_detail_battery">
|
||||
<th>Battery</th>
|
||||
<td class="pad">
|
||||
@if (canConfig)
|
||||
@@ -269,7 +406,42 @@
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
@if (batteries != null)
|
||||
{
|
||||
<tr class="device_detail_batteries">
|
||||
<th> </th>
|
||||
<td>
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Availability</th>
|
||||
<th>Chemistry</th>
|
||||
<th>Design Voltage</th>
|
||||
<th>Design Capacity</th>
|
||||
<th>Capacity</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var battery in batteries)
|
||||
{
|
||||
<tr>
|
||||
<td>@battery.Name</td>
|
||||
<td>@battery.Description</td>
|
||||
<td>@battery.Availability</td>
|
||||
<td>@battery.Chemistry</td>
|
||||
<td>@battery.DesignVoltage.GetValueOrDefault(0).ToString("N0") mV</td>
|
||||
<td>@battery.DesignCapacity.GetValueOrDefault(0).ToString("N0") mWh</td>
|
||||
<td>@battery.FullChargeCapacity.GetValueOrDefault(0).ToString("N0") mWh</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr class="device_detail_keyboard">
|
||||
<th>Keyboard</th>
|
||||
<td class="pad">
|
||||
@if (canConfig)
|
||||
@@ -289,7 +461,7 @@
|
||||
</tr>
|
||||
@if (Model.Device.LastEnrolDate.HasValue)
|
||||
{
|
||||
<tr>
|
||||
<tr class="device_detail_update">
|
||||
<td colspan="2"><em>Details collected @CommonHelpers.FriendlyDate(Model.Device.LastEnrolDate) at time of last enrolment</em></td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user