20230115
This commit is contained in:
340
anbs_cp/Classes/OsInfo.cs
Normal file
340
anbs_cp/Classes/OsInfo.cs
Normal file
@@ -0,0 +1,340 @@
|
||||
using System.Management;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
|
||||
using anbs_cp.Classes.OsInfos;
|
||||
using anbs_cp.Enums;
|
||||
using anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
namespace anbs_cp.Classes;
|
||||
|
||||
/// <summary>
|
||||
/// Информация о системе
|
||||
/// </summary>
|
||||
public static class OsInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
static OsInfo ()
|
||||
{
|
||||
Windows = GetWindowsInfo();
|
||||
Processors = GetProcessors();
|
||||
RAM = GetRAMs();
|
||||
Videos = GetVideoAdapterInfos();
|
||||
Drives = GetDriveInfos();
|
||||
Net = GetNet();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Информация о Windows
|
||||
/// </summary>
|
||||
public static IOsWindowsInfo Windows { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Список с информацией о процессоре(-ах)
|
||||
/// </summary>
|
||||
public static List<IOsProcessorInfo> Processors { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Количество оперативной памяти в байтах
|
||||
/// </summary>
|
||||
public static ulong RAM { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Видеоадаптеры
|
||||
/// </summary>
|
||||
public static List<IOsVideoAdapterInfo> Videos { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Диски
|
||||
/// </summary>
|
||||
public static List<IOsDriveInfo> Drives { get; set; }
|
||||
|
||||
public static List<IOsNetInfo> Net { get; set; }
|
||||
|
||||
#region Служебные методы
|
||||
/// <summary>
|
||||
/// Получает информацию о Windows
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IOsWindowsInfo GetWindowsInfo () =>
|
||||
new OsWindowsInfo
|
||||
{
|
||||
Version = Environment.OSVersion.ToString(),
|
||||
Is64 = Environment.Is64BitOperatingSystem,
|
||||
PcName = Environment.MachineName,
|
||||
WindowsFolder = Environment.SystemDirectory
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Получение процессоров
|
||||
/// </summary>
|
||||
/// <returns>Список информации о процессорах</returns>
|
||||
private static List<IOsProcessorInfo> GetProcessors ()
|
||||
{
|
||||
//Создаю результирующий список
|
||||
List<IOsProcessorInfo> processorsList = new();
|
||||
|
||||
//Создаю классы менеджмента
|
||||
ManagementClass management = new("Win32_Processor");
|
||||
ManagementObjectCollection collection = management.GetInstances();
|
||||
|
||||
//Получаю число процессоров
|
||||
int processorsCount = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["ProcessorId"].Value.ToString()).Count();
|
||||
|
||||
//Перебираю массив данных
|
||||
for (int ind = 0; ind < processorsCount; ind++)
|
||||
{
|
||||
//Создаю элемент информации о процессоре
|
||||
OsProcessorInfo processor = new()
|
||||
{
|
||||
Caption = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Caption"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
Description = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Description"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
DeviceId = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["DeviceID"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
Manufacturer = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Manufacturer"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
MaxClockSpeed = TypeConverter.StrToInt(collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["MaxClockSpeed"].Value.ToString()).ElementAtOrDefault(ind) ?? "0"),
|
||||
Name = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Name"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
NumberOfCores = TypeConverter.StrToInt(collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["NumberOfCores"].Value.ToString()).ElementAtOrDefault(ind) ?? "0"),
|
||||
NumberOfLogicalProcessors = TypeConverter.StrToInt(collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["NumberOfLogicalProcessors"].Value.ToString()).ElementAtOrDefault(ind) ?? "0")
|
||||
};
|
||||
|
||||
//Добавляю в список
|
||||
processorsList.Add(processor);
|
||||
}
|
||||
|
||||
//Возвращаю список
|
||||
return processorsList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение общее количество оперативной памяти
|
||||
/// </summary>
|
||||
/// <returns>Список информации о количестве оперативной памяти</returns>
|
||||
private static ulong GetRAMs ()
|
||||
{
|
||||
//Создаю классы менеджмента
|
||||
ManagementClass management = new("Win32_ComputerSystem");
|
||||
ManagementObjectCollection collection = management.GetInstances();
|
||||
|
||||
//Получаю результат
|
||||
return TypeConverter.StrToUInt64(collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["TotalPhysicalMemory"].Value.ToString()).FirstOrDefault() ?? "0");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получает список видеоадаптеров
|
||||
/// </summary>
|
||||
/// <returns>Список информации о видеоадаптерах</returns>
|
||||
private static List<IOsVideoAdapterInfo> GetVideoAdapterInfos ()
|
||||
{
|
||||
//Создаю результирующий список
|
||||
List<IOsVideoAdapterInfo> videosList = new();
|
||||
|
||||
//Создаю классы менеджмента
|
||||
ManagementClass management = new("Win32_VideoController");
|
||||
ManagementObjectCollection collection = management.GetInstances();
|
||||
|
||||
//Получаю число адаптеров
|
||||
int count = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["DeviceID"].Value.ToString()).Count();
|
||||
|
||||
//Перебираю массив данных
|
||||
for (int ind = 0; ind < count; ind++)
|
||||
{
|
||||
//Создаю элемент информации об адаптере
|
||||
OsVideoAdapterInfo adapter = new()
|
||||
{
|
||||
Caption = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Caption"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
Description = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Description"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
DeviceId = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["DeviceID"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
AdapterRAM = TypeConverter.StrToInt(collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["AdapterRAM"].Value.ToString()).ElementAtOrDefault(ind) ?? "0"),
|
||||
DriverDate = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["DriverDate"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
Name = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Name"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
CurrentResolution = (TypeConverter.StrToInt(collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["CurrentHorizontalResolution"].Value.ToString()).ElementAtOrDefault(ind) ?? "0"),
|
||||
TypeConverter.StrToInt(collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["CurrentVerticalResolution"].Value.ToString())
|
||||
.ElementAtOrDefault(ind) ?? "0")),
|
||||
SystemName = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["SystemName"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
DriverVersion = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["DriverVersion"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
InstalledDisplayDrivers = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["InstalledDisplayDrivers"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
VideoProcessor = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["VideoProcessor"].Value.ToString()).ElementAtOrDefault(ind)
|
||||
};
|
||||
|
||||
//Добавляю в список
|
||||
videosList.Add(adapter);
|
||||
}
|
||||
|
||||
//Возвращаю список
|
||||
return videosList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получает список дисков
|
||||
/// </summary>
|
||||
/// <returns>Список информации о дисках</returns>
|
||||
private static List<IOsDriveInfo> GetDriveInfos ()
|
||||
{
|
||||
//Создаю результат
|
||||
List<IOsDriveInfo> result = new();
|
||||
|
||||
//Добавление всех HDD/SSD дисков
|
||||
result.AddRange(GetHDDs());
|
||||
|
||||
//Добавление всех CD/DVD/BD дисков
|
||||
result.AddRange(GetCDRom());
|
||||
|
||||
//Вывожу список
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получаю список HDD/SSD дисков
|
||||
/// </summary>
|
||||
/// <returns>Информация обо всех HDD/SSD дисках</returns>
|
||||
private static List<IOsDriveInfo> GetHDDs ()
|
||||
{
|
||||
//Создаю результирующий список
|
||||
List<IOsDriveInfo> driveList = new();
|
||||
|
||||
//Создаю классы менеджмента
|
||||
ManagementClass management = new("Win32_DiskDrive");
|
||||
ManagementObjectCollection collection = management.GetInstances();
|
||||
|
||||
//Получаю число адаптеров
|
||||
int count = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["DeviceID"].Value.ToString()).Count();
|
||||
|
||||
//Перебираю массив данных
|
||||
for (int ind = 0; ind < count; ind++)
|
||||
{
|
||||
//Создаю элемент информации об адаптере
|
||||
OsDriveInfo drive = new()
|
||||
{
|
||||
Type = EDriveType.DtHardDisc,
|
||||
Caption = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Caption"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
Description = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Description"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
DeviceId = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["DeviceID"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
Name = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Name"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
TotalSize = TypeConverter.StrToUInt64(collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Size"].Value.ToString()).ElementAtOrDefault(ind) ?? "0"),
|
||||
Model = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Model"].Value.ToString()).ElementAtOrDefault(ind)
|
||||
};
|
||||
|
||||
//Добавляю в список
|
||||
driveList.Add(drive);
|
||||
}
|
||||
|
||||
//Возвращаю список
|
||||
return driveList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получаю список CD/DVD/BD дисков
|
||||
/// </summary>
|
||||
/// <returns>Информация обо всех CD/DVD/BD дисках</returns>
|
||||
private static List<IOsDriveInfo> GetCDRom ()
|
||||
{
|
||||
//Создаю результирующий список
|
||||
List<IOsDriveInfo> driveList = new();
|
||||
|
||||
//Создаю классы менеджмента
|
||||
ManagementClass management = new("Win32_CDROMDrive");
|
||||
ManagementObjectCollection collection = management.GetInstances();
|
||||
|
||||
//Получаю число адаптеров
|
||||
int count = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["DeviceID"].Value.ToString()).Count();
|
||||
|
||||
//Перебираю массив данных
|
||||
for (int ind = 0; ind < count; ind++)
|
||||
{
|
||||
//Создаю элемент информации об адаптере
|
||||
OsDriveInfo drive = new()
|
||||
{
|
||||
Type = EDriveType.DtCDRom,
|
||||
Caption = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Caption"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
Description = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Description"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
DeviceId = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["DeviceID"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
Name = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Name"].Value.ToString()).ElementAtOrDefault(ind),
|
||||
//Ставится 0, чтобы не проверять корректность загрузки и читаемость диска, а также избежать удлинения получения информации
|
||||
TotalSize = 0,
|
||||
Model = collection.Cast<ManagementObject>()
|
||||
.Select(static a => a.Properties["Manufacturer"].Value.ToString()).ElementAtOrDefault(ind)
|
||||
};
|
||||
|
||||
//Добавляю в список
|
||||
driveList.Add(drive);
|
||||
}
|
||||
|
||||
//Возвращаю список
|
||||
return driveList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получаю информацию о сети интернет
|
||||
/// </summary>
|
||||
/// <returns>Информация о сети интернет</returns>
|
||||
private static List<IOsNetInfo> GetNet ()
|
||||
{
|
||||
//Создаю результирующий список
|
||||
List<IOsNetInfo> netList = new();
|
||||
|
||||
//Получаю информацию о всех сетевых интерфейсах
|
||||
foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
|
||||
{
|
||||
//Создаю элемент
|
||||
OsNetInfo netInfo = new()
|
||||
{
|
||||
Name = adapter.Name,
|
||||
Description = adapter.Description,
|
||||
MacAddress = adapter.OperationalStatus == OperationalStatus.Up ? adapter.GetPhysicalAddress().ToString() : null
|
||||
};
|
||||
|
||||
//Получаю IP-адрес
|
||||
foreach (UnicastIPAddressInformation info in adapter.GetIPProperties().UnicastAddresses.Where(static info =>
|
||||
info.Address.AddressFamily == AddressFamily.InterNetwork && info.IsDnsEligible))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(netInfo.IPAddress))
|
||||
netInfo.IPAddress += ";";
|
||||
netInfo.IPAddress += info.Address.ToString();
|
||||
}
|
||||
|
||||
//Добавляю адаптер
|
||||
netList.Add(netInfo);
|
||||
}
|
||||
|
||||
//Возвращаю список
|
||||
return netList;
|
||||
}
|
||||
#endregion
|
||||
}
|
59
anbs_cp/Classes/OsInfos/OsDriveInfo.cs
Normal file
59
anbs_cp/Classes/OsInfos/OsDriveInfo.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using anbs_cp.Enums;
|
||||
using anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
namespace anbs_cp.Classes.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Информация о дисках
|
||||
/// </summary>
|
||||
public class OsDriveInfo : IOsDriveInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public OsDriveInfo()
|
||||
{
|
||||
Type = EDriveType.DtHardDisc;
|
||||
Caption = null;
|
||||
Description = null;
|
||||
DeviceId = null;
|
||||
Name = null;
|
||||
Model = null;
|
||||
TotalSize = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Тип диска
|
||||
/// </summary>
|
||||
public EDriveType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Заголовок
|
||||
/// </summary>
|
||||
public string? Caption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Описание
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор устройства
|
||||
/// </summary>
|
||||
public string? DeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя устройства
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Модель
|
||||
/// </summary>
|
||||
public string? Model { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Общий размер
|
||||
/// </summary>
|
||||
public ulong TotalSize { get; set; }
|
||||
}
|
39
anbs_cp/Classes/OsInfos/OsNetInfo.cs
Normal file
39
anbs_cp/Classes/OsInfos/OsNetInfo.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
namespace anbs_cp.Classes.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Информация об интернет-соединении
|
||||
/// </summary>
|
||||
public sealed class OsNetInfo: IOsNetInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Заголовок
|
||||
/// </summary>
|
||||
public string? Caption { get => Name; set => _ = value; }
|
||||
|
||||
/// <summary>
|
||||
/// Описание
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор устройства
|
||||
/// </summary>
|
||||
public string? DeviceId { get => Name; set => _ = value; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя устройства
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP-адрес
|
||||
/// </summary>
|
||||
public string? IPAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MAC-адрес
|
||||
/// </summary>
|
||||
public string? MacAddress { get; set; }
|
||||
}
|
64
anbs_cp/Classes/OsInfos/OsProcessorInfo.cs
Normal file
64
anbs_cp/Classes/OsInfos/OsProcessorInfo.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
namespace anbs_cp.Classes.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Класс информации о процессоре
|
||||
/// </summary>
|
||||
public sealed class OsProcessorInfo : IOsProcessorInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public OsProcessorInfo()
|
||||
{
|
||||
Caption = null;
|
||||
Description = null;
|
||||
DeviceId = null;
|
||||
Manufacturer = null;
|
||||
MaxClockSpeed = 0;
|
||||
Name = null;
|
||||
NumberOfCores = 0;
|
||||
NumberOfLogicalProcessors = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Заголовок
|
||||
/// </summary>
|
||||
public string? Caption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Описание
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор процессора в системе
|
||||
/// </summary>
|
||||
public string? DeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Производитель
|
||||
/// </summary>
|
||||
public string? Manufacturer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Максимальная тактовая частота
|
||||
/// </summary>
|
||||
public int MaxClockSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя процессора
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Число ядер
|
||||
/// </summary>
|
||||
public int NumberOfCores { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Число потоков
|
||||
/// </summary>
|
||||
public int NumberOfLogicalProcessors { get; set; }
|
||||
}
|
82
anbs_cp/Classes/OsInfos/OsVideoAdapterInfo.cs
Normal file
82
anbs_cp/Classes/OsInfos/OsVideoAdapterInfo.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
namespace anbs_cp.Classes.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Информация о видеокарте
|
||||
/// </summary>
|
||||
internal sealed class OsVideoAdapterInfo : IOsVideoAdapterInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public OsVideoAdapterInfo()
|
||||
{
|
||||
AdapterRAM = 0;
|
||||
Caption = null;
|
||||
CurrentResolution = (0, 0);
|
||||
Description = null;
|
||||
DeviceId = null;
|
||||
DriverDate = null;
|
||||
DriverVersion = null;
|
||||
InstalledDisplayDrivers = null;
|
||||
Name = null;
|
||||
SystemName = null;
|
||||
VideoProcessor = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Память
|
||||
/// </summary>
|
||||
public int AdapterRAM { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Заголовок
|
||||
/// </summary>
|
||||
public string? Caption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Текущее разрешение
|
||||
/// </summary>
|
||||
public (int, int) CurrentResolution { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Описание
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор устройства
|
||||
/// </summary>
|
||||
public string? DeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата установки драйвера
|
||||
/// </summary>
|
||||
public string? DriverDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Версия драйвера
|
||||
/// </summary>
|
||||
public string? DriverVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Название драйверов
|
||||
/// </summary>
|
||||
public string? InstalledDisplayDrivers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя в системе
|
||||
/// </summary>
|
||||
public string? SystemName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Видео процессор
|
||||
/// </summary>
|
||||
public string? VideoProcessor { get; set; }
|
||||
}
|
62
anbs_cp/Classes/OsInfos/OsWindowsInfo.cs
Normal file
62
anbs_cp/Classes/OsInfos/OsWindowsInfo.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
namespace anbs_cp.Classes.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Информация о Windows
|
||||
/// </summary>
|
||||
public sealed class OsWindowsInfo : IOsWindowsInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
///</summary>
|
||||
public OsWindowsInfo()
|
||||
{
|
||||
Version = null;
|
||||
Is64 = true;
|
||||
PcName = null;
|
||||
WindowsFolder = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Версия
|
||||
/// </summary>
|
||||
public string? Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 64-разрядная ОС
|
||||
/// </summary>
|
||||
public bool Is64 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя компьютера
|
||||
/// </summary>
|
||||
public string? PcName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Путь к папке Windows
|
||||
/// </summary>
|
||||
public string? WindowsFolder { get; set; }
|
||||
|
||||
#region Реализация интерфейса IBasicInfo
|
||||
/// <summary>
|
||||
/// Заголовок
|
||||
/// </summary>
|
||||
public string? Caption { get => Version; set => _= value; }
|
||||
|
||||
/// <summary>
|
||||
/// Описание
|
||||
/// </summary>
|
||||
public string? Description { get => Version; set => _= value; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор
|
||||
/// </summary>
|
||||
public string? DeviceId { get => Version; set => _= value; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя
|
||||
/// </summary>
|
||||
public string? Name { get => Version; set => _= value; }
|
||||
#endregion
|
||||
}
|
17
anbs_cp/Enums/EDriveType.cs
Normal file
17
anbs_cp/Enums/EDriveType.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace anbs_cp.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Тип носителя
|
||||
/// </summary>
|
||||
public enum EDriveType
|
||||
{
|
||||
/// <summary>
|
||||
/// HDD/SSD/M2
|
||||
/// </summary>
|
||||
DtHardDisc = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Диск CD/DVD/BD
|
||||
/// </summary>
|
||||
DtCDRom = 1
|
||||
}
|
27
anbs_cp/Interfaces/OsInfos/IOsBasicInfo.cs
Normal file
27
anbs_cp/Interfaces/OsInfos/IOsBasicInfo.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Базовые параметры устройства
|
||||
/// </summary>
|
||||
public interface IOsBasicInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Заголовок
|
||||
/// </summary>
|
||||
public string? Caption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Описание
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор устройства
|
||||
/// </summary>
|
||||
public string? DeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя устройства
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
}
|
24
anbs_cp/Interfaces/OsInfos/IOsDriveInfo.cs
Normal file
24
anbs_cp/Interfaces/OsInfos/IOsDriveInfo.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using anbs_cp.Enums;
|
||||
|
||||
namespace anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Информация о дисках
|
||||
/// </summary>
|
||||
public interface IOsDriveInfo : IOsBasicInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Тип диска
|
||||
/// </summary>
|
||||
public EDriveType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Модель
|
||||
/// </summary>
|
||||
public string? Model { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Общий размер
|
||||
/// </summary>
|
||||
public ulong TotalSize { get; set; }
|
||||
}
|
17
anbs_cp/Interfaces/OsInfos/IOsNetInfo.cs
Normal file
17
anbs_cp/Interfaces/OsInfos/IOsNetInfo.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Информация об интернет-соединении
|
||||
/// </summary>
|
||||
public interface IOsNetInfo: IOsBasicInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// IP-адрес
|
||||
/// </summary>
|
||||
public string? IPAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MAC-адрес
|
||||
/// </summary>
|
||||
public string? MacAddress { get; set; }
|
||||
}
|
31
anbs_cp/Interfaces/OsInfos/IOsProcessorInfo.cs
Normal file
31
anbs_cp/Interfaces/OsInfos/IOsProcessorInfo.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Информация о процессоре
|
||||
/// </summary>
|
||||
public interface IOsProcessorInfo : IOsBasicInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Заголовок
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// Производитель
|
||||
/// </summary>
|
||||
public string? Manufacturer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Максимальная тактовая частота
|
||||
/// </summary>
|
||||
public int MaxClockSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Число ядер
|
||||
/// </summary>
|
||||
public int NumberOfCores { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Число потоков
|
||||
/// </summary>
|
||||
public int NumberOfLogicalProcessors { get; set; }
|
||||
}
|
42
anbs_cp/Interfaces/OsInfos/IOsVideoAdapterInfo.cs
Normal file
42
anbs_cp/Interfaces/OsInfos/IOsVideoAdapterInfo.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
namespace anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Информация о видеокарте
|
||||
/// </summary>
|
||||
public interface IOsVideoAdapterInfo : IOsBasicInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Память
|
||||
/// </summary>
|
||||
public int AdapterRAM { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Текущее разрешение
|
||||
/// </summary>
|
||||
public (int, int) CurrentResolution { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата установки драйвера
|
||||
/// </summary>
|
||||
public string? DriverDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Версия драйвера
|
||||
/// </summary>
|
||||
public string? DriverVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Название драйверов
|
||||
/// </summary>
|
||||
public string? InstalledDisplayDrivers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя в системе
|
||||
/// </summary>
|
||||
public string? SystemName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Видео процессор
|
||||
/// </summary>
|
||||
public string? VideoProcessor { get; set; }
|
||||
}
|
27
anbs_cp/Interfaces/OsInfos/IOsWindowsInfo.cs
Normal file
27
anbs_cp/Interfaces/OsInfos/IOsWindowsInfo.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace anbs_cp.Interfaces.OsInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Информация о Windows
|
||||
/// </summary>
|
||||
public interface IOsWindowsInfo: IOsBasicInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Версия
|
||||
/// </summary>
|
||||
public string? Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 64-разрядная ОС
|
||||
/// </summary>
|
||||
public bool Is64 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя компьютера
|
||||
/// </summary>
|
||||
public string? PcName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Путь к папке Windows
|
||||
/// </summary>
|
||||
public string? WindowsFolder { get; set; }
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Version>2023.104.1</Version>
|
||||
<Version>2023.115.0</Version>
|
||||
<Authors>Alexander Babaev</Authors>
|
||||
<Product>ANB Software Components Pack</Product>
|
||||
<Description>Library of some useful functions in C# language.</Description>
|
||||
@@ -15,8 +15,8 @@
|
||||
<SignAssembly>True</SignAssembly>
|
||||
<PackageProjectUrl>https://git.babaev-an.ru/babaev-an/anbsoftware_componentspack</PackageProjectUrl>
|
||||
<RepositoryUrl>https://git.babaev-an.ru/babaev-an/anbsoftware_componentspack</RepositoryUrl>
|
||||
<AssemblyVersion>2023.104.1</AssemblyVersion>
|
||||
<FileVersion>2023.104.1</FileVersion>
|
||||
<AssemblyVersion>2023.115.0</AssemblyVersion>
|
||||
<FileVersion>2023.115.0</FileVersion>
|
||||
<PackageId>ANBSoftware.ComponentsPack</PackageId>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<AnalysisLevel>6.0</AnalysisLevel>
|
||||
@@ -40,6 +40,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="5.0.17" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop" Version="17.4.33103.184" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />
|
||||
<PackageReference Include="MimeTypes" Version="2.4.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
@@ -47,4 +48,8 @@
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Enums\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Reference in New Issue
Block a user