From e3ae44d85f7e4fc42c0f2d2a9a3e49b00bcdd1df Mon Sep 17 00:00:00 2001 From: Schizo Date: Thu, 20 Jul 2023 16:17:25 +0300 Subject: [PATCH] Added a module for obtaining information about the BIOS. --- README.md | 223 +++++++-- src/OSI/.gitignore | 1 + src/OSI/Information/BiosInformation.cs | 472 ++++++++++++++++++ .../OperationSystemVersionInformation.cs | 4 +- .../Enums/ProcessorArchitecture.cs | 2 +- .../Enums/ProcessorInfoUnion.cs | 2 +- .../Enums/ScreenInformation.cs | 2 +- .../Enums/SoftwareArchitecture.cs | 2 +- .../Enums/SystemInformation.cs | 2 +- .../Services/BitsService.cs | 10 +- .../Services/FrameworkService.cs | 2 +- .../SystemInformation.cs} | 24 +- src/OSI/OSI.csproj | 26 +- src/OSI/Properties/AssemblyInfo.cs | 6 +- src/OSI/packages.config | 4 + 15 files changed, 699 insertions(+), 83 deletions(-) create mode 100644 src/OSI/Information/BiosInformation.cs rename src/OSI/{OperationSystem => Information}/Enums/OperationSystemVersionInformation.cs (94%) rename src/OSI/{OperationSystem => Information}/Enums/ProcessorArchitecture.cs (92%) rename src/OSI/{OperationSystem => Information}/Enums/ProcessorInfoUnion.cs (93%) rename src/OSI/{OperationSystem => Information}/Enums/ScreenInformation.cs (93%) rename src/OSI/{OperationSystem => Information}/Enums/SoftwareArchitecture.cs (90%) rename src/OSI/{OperationSystem => Information}/Enums/SystemInformation.cs (97%) rename src/OSI/{OperationSystem => Information}/Services/BitsService.cs (93%) rename src/OSI/{OperationSystem => Information}/Services/FrameworkService.cs (99%) rename src/OSI/{OperationSystem/OperationSystem.cs => Information/SystemInformation.cs} (98%) create mode 100644 src/OSI/packages.config diff --git a/README.md b/README.md index 06b2817..98de4f1 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,41 @@ # Operation system information by Schizo -Provides the ability to quickly obtain detailed information about the Windows operating system, processor, installed SP, .NET Frameworks. It also allows you to get information about running system processes and manage them. +Provides the ability to quickly obtain detailed information about the Windows operating system, processor, installed SP, .NET Frameworks and BIOS. Also allows you to get information about running system processes and manage them. # Adding to the project #### .NET CLI ```CLI -> dotnet add package Hopex.OSI --version 23.0.1 +> dotnet add package Hopex.OSI --version 23.0.3 ``` #### Package Manager ```CLI -PM> NuGet\Install-Package Hopex.OSI -Version 23.0.1 +PM> NuGet\Install-Package Hopex.OSI -Version 23.0.3 ``` #### PackageReference ```XML - + ``` #### Paket CLI ```CLI -> paket add Hopex.OSI --version 23.0.1 +> paket add Hopex.OSI --version 23.0.3 ``` #### Script & Interactive ```CLI -> #r "nuget: Hopex.OSI, 23.0.1" +> #r "nuget: Hopex.OSI, 23.0.3" ``` #### Cake ``` // Install Hopex.OSI as a Cake Addin -#addin nuget:?package=Hopex.OSI&version=23.0.1 +#addin nuget:?package=Hopex.OSI&version=23.0.3 // Install Hopex.OSI as a Cake Tool -#tool nuget:?package=Hopex.OSI&version=23.0.1 +#tool nuget:?package=Hopex.OSI&version=23.0.3 ``` # Opportunities @@ -83,6 +83,41 @@ PM> NuGet\Install-Package Hopex.OSI -Version 23.0.1 | Getting user displays information (name, is it the main one, resolution) | :white_check_mark: | | Getting connected drives information | :white_check_mark: | +### BIOS +| Option | Status | +| --- | ----------- | +| Bios characteristics | :white_check_mark: | +| BIOS version | :white_check_mark: | +| Build number | :white_check_mark: | +| Caption | :white_check_mark: | +| CodeSet | :white_check_mark: | +| Current language | :white_check_mark: | +| Description | :white_check_mark: | +| Embedded controller major version | :white_check_mark: | +| Embedded controller minor version | :white_check_mark: | +| Identification code | :white_check_mark: | +| Installable languages | :white_check_mark: | +| Install date | :white_check_mark: | +| Language edition | :white_check_mark: | +| List of languages | :white_check_mark: | +| Manufacturer | :white_check_mark: | +| Name | :white_check_mark: | +| Other target OS | :white_check_mark: | +| Primary BIOS | :white_check_mark: | +| Release date | :white_check_mark: | +| Serial number | :white_check_mark: | +| SMBIOS BIOS version | :white_check_mark: | +| SMBIOS major version | :white_check_mark: | +| SMBIOS minor version | :white_check_mark: | +| SMBIOS present | :white_check_mark: | +| Software element ID | :white_check_mark: | +| Software element state | :white_check_mark: | +| Status | :white_check_mark: | +| System BIOS major version | :white_check_mark: | +| System BIOS minor version | :white_check_mark: | +| Target operating system | :white_check_mark: | +| Version | :white_check_mark: | + # How to use ### Hidden command line @@ -129,48 +164,148 @@ public void LainchEndCloseNotepad() ### Detailed information about the system ```C# +using Hopex.OSI.Information; +using Newtonsoft.Json; +using System; + public void SystemInformation() { - OperationSystem OS = new OperationSystem(); - Console.WriteLine(string.Join( - "\n", - $"Computer name: {OS.ComputerName}", - $"User name: {OS.UserName}", - $"OS name: {OS.Name}", - $"Core counts: {OS.CoreCounts}", - $"OS version: {OS.VersionString}", - $"Major version: {OS.MajorVersion}", - $"Minor version: {OS.MinorVersion}", - $"Build version: {OS.BuildVersion}", - $"Revision version: {OS.RevisionVersion}", - $"RAM size: {OS.RandomAccessMemorySize}", - $"WindowsVersion: {OS.WindowsVersion}", - $"WindowsBit: {OS.WindowsBit}", - $"Bist: [OS: {OS.Bits.OperationSystemBits}], [Sofware: {OS.Bits.ProgramBits}], [Processor: {OS.Bits.ProcessorBits}]", - $".NET Framework versions: {string.Join(", ", OS.DotNetFrameworkVersions.ToArray())}", - $"Screens: {OS.Screens.Select(screen => $"{screen.Name}{(screen.IsPrimary? " (main)" : "") } {screen.Size.Width}x{screen.Size.Height}").First()}", - $"Drives: {string.Join(", ", OS.Drives.Select((title, size) => $"{title}: {size}").ToArray())}" - )); + Console.WriteLine(JsonConvert.SerializeObject(new SystemInformation(), Formatting.Indented)); + Console.ReadKey(); + + /** + * Output for this: + * + * { + * "Screens": [ + * { + * "Name": "DISPLAY1", + * "IsPrimary": true, + * "Size": "1920, 1200" + * }, + * { + * "Name": "DISPLAY2", + * "IsPrimary": false, + * "Size": "1920, 1080" + * } + * ], + * "RandomAccessMemorySize": 8, + * "CoreCounts": "4", + * "UserName": "Schizo", + * "ComputerName": "DESKTOP-607U6SR", + * "Bits": { + * "ProgramBits": 1, + * "InformationBits": 2, + * "ProcessorBits": 2 + * }, + * "Edition": "Professional", + * "Name": "Windows 10", + * "ServicePack": "", + * "VersionString": "10.0.19045.0", + * "Version": { + * "Major": 10, + * "Minor": 0, + * "Build": 19045, + * "Revision": 0, + * "MajorRevision": 0, + * "MinorRevision": 0 + * }, + * "MajorVersion": 10, + * "MinorVersion": 0, + * "BuildVersion": 19045, + * "RevisionVersion": 0, + * "DotNetFrameworkVersions": [ + * "2.0.50727.4927 Service Pack 2", + * "3.0.30729.4926 Service Pack 2", + * "3.5.30729.4926 Service Pack 1", + * "4.0.0.0", + * "4.8.04084" + * ], + * "WindowsBit": 64, + * "WindowsVersion": "Windows 10", + * "Drives": { + * "C": "218/239", + * "E": "232/1000", + * "J": "0/1000" + * } + * } + */ +``` + +### Detailed information about the BIOS + +```C# +using Hopex.OSI.Information; +using Newtonsoft.Json; +using System; + +public void BiosInformation() +{ + Console.WriteLine(JsonConvert.SerializeObject(new BiosInformation(), Formatting.Indented)); + Console.ReadKey(); /** * Output for this: * - * Computer name: HOPEX - * User name: schizo - * OS name: Windows 10 - * Core counts: 4 - * OS version: 10.0.22000.0 - * Major version: 10 - * Minor version: 0 - * Build version: 22000 - * Revision version: 0 - * RAM size: 8 - * WindowsVersion: Windows 10 - * WindowsBit: 64 - * Bist:[OS: Bit64], [Sofware: Bit32], [Processor: Bit64] - * .NET Framework versions: 2.0.50727.4927 Service Pack 2, 3.0.30729.4926 Service Pack 2, 3.5.30729.4926 Service Pack 1, 4.0.0.0, 4.8.04161 - * Screens: DISPLAY1 (main) 1920x1200 - * Drives: [C, 181 / 240]: 0, [G, 69 / 1000]: 1, [J, 69 / 1000]: 2 + * { + * "BiosCharacteristics": [ + * 7, + * 11, + * 12, + * 15, + * 16, + * 17, + * 19, + * 23, + * 24, + * 25, + * 26, + * 27, + * 28, + * 29, + * 32, + * 33, + * 40, + * 42, + * 43 + * ], + * "BIOSVersion": [ + * "ALASKA - 1072009", + * "V1.7", + * "American Megatrends - 4028D" + * ], + * "BuildNumber": null, + * "Caption": "V1.7", + * "CodeSet": null, + * "CurrentLanguage": null, + * "Description": null, + * "EmbeddedControllerMajorVersion": 255, + * "EmbeddedControllerMinorVersion": 255, + * "IdentificationCode": null, + * "InstallableLanguages": 0, + * "InstallDate": null, + * "LanguageEdition": null, + * "ListOfLanguages": [ + * "en|US|iso8859-1" + * ], + * "Manufacturer": "American Megatrends Inc.", + * "Name": "V1.7", + * "OtherTargetOS": null, + * "PrimaryBIOS": true, + * "ReleaseDate": "20130930000000.000000+000", + * "SerialNumber": "To be filled by O.E.M.", + * "SMBIOSBIOSVersion": "V1.7", + * "SMBIOSMajorVersion": 2, + * "SMBIOSMinorVersion": 7, + * "SMBIOSPresent": true, + * "SoftwareElementID": "V1.7", + * "SoftwareElementState": 3, + * "Status": "OK", + * "SystemBiosMajorVersion": 4, + * "SystemBiosMinorVersion": 6, + * "TargetOperatingSystem": 0, + * "Version": "ALASKA - 1072009" + * } */ ``` diff --git a/src/OSI/.gitignore b/src/OSI/.gitignore index 377f077..05df61c 100644 --- a/src/OSI/.gitignore +++ b/src/OSI/.gitignore @@ -1,4 +1,5 @@ .cr +.vs docs images *.nupkg diff --git a/src/OSI/Information/BiosInformation.cs b/src/OSI/Information/BiosInformation.cs new file mode 100644 index 0000000..0876155 --- /dev/null +++ b/src/OSI/Information/BiosInformation.cs @@ -0,0 +1,472 @@ +using System.Linq; +using System.Management; + +namespace Hopex.OSI.Information +{ + /// + /// Provides a structure for storing information about the installed BIOS. + /// + public class BiosInformation + { + /// + /// Provides a structure for storing information about the installed BIOS. + /// + public BiosInformation() + { + new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_BIOS") + .Get() + .OfType() + .ToList() + .ForEach(bios => + { + BiosCharacteristics = (ushort[])bios["BiosCharacteristics"]; + BIOSVersion = (string[])bios["BIOSVersion"]; + BuildNumber = (string)bios["BuildNumber"]; + Caption = (string)bios["Caption"]; + CodeSet = (string)bios["CodeSet"]; + CurrentLanguage = (string)bios["CodeSet"]; + Description = (string)bios["CodeSet"]; + EmbeddedControllerMajorVersion = (byte)bios["EmbeddedControllerMajorVersion"]; + EmbeddedControllerMinorVersion = (byte)bios["EmbeddedControllerMinorVersion"]; + IdentificationCode = (string)bios["IdentificationCode"]; + InstallDate = bios["InstallDate"]; + LanguageEdition = (string)bios["LanguageEdition"]; + ListOfLanguages = (string[])bios["ListOfLanguages"]; + Manufacturer = (string)bios["Manufacturer"]; + Name = (string)bios["Name"]; + OtherTargetOS = (string)bios["OtherTargetOS"]; + PrimaryBIOS = (bool)bios["PrimaryBIOS"]; + ReleaseDate = bios["ReleaseDate"]; + SerialNumber = (string)bios["SerialNumber"]; + SMBIOSBIOSVersion = (string)bios["SMBIOSBIOSVersion"]; + SMBIOSMajorVersion = (ushort)bios["SMBIOSMajorVersion"]; + SMBIOSMinorVersion = (ushort)bios["SMBIOSMinorVersion"]; + SMBIOSPresent = (bool)bios["SMBIOSPresent"]; + SoftwareElementID = (string)bios["SoftwareElementID"]; + SoftwareElementState = (ushort)bios["SoftwareElementState"]; + Status = (string)bios["Status"]; + SystemBiosMajorVersion = (byte)bios["SystemBiosMajorVersion"]; + SystemBiosMinorVersion = (byte)bios["SystemBiosMinorVersion"]; + TargetOperatingSystem = (ushort)bios["TargetOperatingSystem"]; + Version = (string)bios["Version"]; + }); + } + + + /// + /// Array of BIOS characteristics supported by the system as defined by the System + /// Management BIOS Reference Specification. + /// This value comes from the BIOS Characteristics member of the BIOS Information + /// structure in the SMBIOS information. + /// + /// + /// + /// Read more + /// + /// + public ushort[] BiosCharacteristics { get; private set; } + + /// + /// Array of the complete system BIOS information. + /// In many computers there can be several version strings that are stored in the + /// registry and represent the system BIOS information + /// + public string[] BIOSVersion { get; private set; } + + /// + /// Internal identifier for this compilation of this software element. + /// + public string BuildNumber { get; private set; } + + /// + /// Short description of the object a one-line string. + /// + public string Caption { get; private set; } + + /// + /// Code set used by this software element. + /// + public string CodeSet { get; private set; } + + /// + /// Name of the current BIOS language. + /// + public string CurrentLanguage { get; private set; } + + /// + /// Description of the object. + /// + public string Description { get; private set; } + + /// + /// The major release of the embedded controller firmware. + /// + /// + /// This value comes from the Embedded Controller Firmware Major Release member + /// of the BIOS Information structure in the SMBIOS information. + /// Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, + /// Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows + /// Vista: This property is not supported before Windows 10 and Windows Server 2016. + /// + public byte EmbeddedControllerMajorVersion { get; private set; } + + /// + /// The minor release of the embedded controller firmware. + /// + /// + /// This value comes from the Embedded Controller Firmware Minor Release member + /// of the BIOS Information structure in the SMBIOS information. + /// Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, + /// Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows + /// Vista: This property is not supported before Windows 10 and Windows Server 2016. + /// + public byte EmbeddedControllerMinorVersion { get; private set; } + + /// + /// Manufacturer's identifier for this software element. Often this will be a stock + /// keeping unit (SKU) or a part number. + /// + public string IdentificationCode { get; private set; } + + /// + /// Number of languages available for installation on this system. Language may determine + /// properties such as the need for Unicode and bidirectional text. + /// + public ushort InstallableLanguages { get; private set; } + + /// + /// Date and time the object was installed. This property does not need a value to + /// indicate that the object is installed. + /// + public object InstallDate { get; private set; } + + /// + /// Language edition of this software element. The language codes defined in + /// ISO 639 should be used. Where the software element represents a multilingual + /// or international version of a product, the string "multilingual" should be used. + /// + public string LanguageEdition { get; private set; } + + /// + /// Array of names of available BIOS-installable languages. + /// + public string[] ListOfLanguages { get; private set; } + + /// + /// Manufacturer of this software element. + /// + /// + /// This value comes from the Vendor member of the BIOS Information structure + /// in the SMBIOS information. + /// + public string Manufacturer { get; private set; } + + /// + /// Name used to identify this software element. + /// + public string Name { get; private set; } + + /// + /// Records the manufacturer and operating system type for a software element + /// when the TargetOperatingSystem property has a value of 1 (Other). + /// When TargetOperatingSystem has a value of 1, OtherTargetOS must have a nonnull value. + /// For all other values of TargetOperatingSystem, OtherTargetOS is . + /// + public string OtherTargetOS { get; private set; } + + /// + /// If , this is the primary BIOS of the computer system. + /// + public bool PrimaryBIOS { get; private set; } + + /// + /// Release date of the Windows BIOS in the Coordinated Universal Time (UTC) format + /// of YYYYMMDDHHMMSS.MMMMMM(+-)OOO. + /// + /// + /// This value comes from the BIOS Release Date member of the BIOS Information structure + /// in the SMBIOS information. + /// + public object ReleaseDate { get; private set; } + + /// + /// Assigned serial number of the software element. + /// + public string SerialNumber { get; private set; } + + /// + /// BIOS version as reported by SMBIOS. + /// + /// + /// This value comes from the BIOS Version member of the BIOS Information structure + /// in the SMBIOS information. + /// + public string SMBIOSBIOSVersion { get; private set; } + + /// + /// Major SMBIOS version number. This property is NULL if SMBIOS is not found. + /// + public ushort SMBIOSMajorVersion { get; private set; } + + /// + /// Minor SMBIOS version number. This property is NULL if SMBIOS is not found. + /// + public ushort SMBIOSMinorVersion { get; private set; } + + /// + /// If , the SMBIOS is available on this computer system. + /// + public bool SMBIOSPresent { get; private set; } + + /// + /// Identifier for this software element; designed to be used in conjunction + /// with other keys to create a unique representation of this instance. + /// + public string SoftwareElementID { get; private set; } + + /// + /// State of a software element. + /// + public ushort SoftwareElementState { get; private set; } + + /// + /// Current status of the object. Various operational and nonoperational statuses + /// can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" + /// (an element, such as a SMART-enabled hard disk drive, may be functioning + /// properly but predicting a failure in the near future). Nonoperational statuses + /// include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", + /// could apply during mirror-resilvering of a disk, reload of a user permissions + /// list, or other administrative work. Not all such work is online, yet the + /// managed element is neither "OK" nor in one of the other states. + /// + public string Status { get; private set; } + + /// + /// The major release of the System BIOS. + /// + /// + /// This value comes from the System BIOS Major Release member of the BIOS Information structure + /// in the SMBIOS information. + /// Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, + /// Windows 7, Windows Server 2008 and Windows Vista: This property is not supported before + /// Windows 10 and Windows Server 2016. + /// + public byte SystemBiosMajorVersion { get; private set; } + + /// + /// The minor release of the System BIOS. + /// + /// + /// This value comes from the System BIOS Minor Release member of the BIOS Information structure + /// in the SMBIOS information. + /// Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, + /// Windows 7, Windows Server 2008 and Windows Vista: This property is not supported before + /// Windows 10 and Windows Server 2016. + /// + public byte SystemBiosMinorVersion { get; private set; } + + /// + /// Target operating system of the owning software element. + /// The possible values are (1-61). + /// + /// Read more + /// + /// + /// + /// + /// + /// 0Unknown + /// + /// + /// 1Other + /// + /// + /// 2MACOS + /// + /// + /// 3ATTUNIX + /// + /// + /// 4DGUX + /// + /// + /// 5DECNT + /// + /// + /// 6Digital Unix + /// + /// + /// 7OpenVMS + /// + /// + /// 8HPUX + /// + /// + /// 9AIX + /// + /// + /// 10MVS + /// + /// + /// 11OS400 + /// + /// + /// 12OS/2 + /// + /// + /// 13JavaVM + /// + /// + /// 14MSDOS + /// + /// + /// 15WIN3x + /// + /// + /// 16WIN95 + /// + /// + /// 17WIN98 + /// + /// + /// 18WINNT + /// + /// + /// 19WINCE + /// + /// + /// 20NCR3000 + /// + /// + /// 21NetWare + /// + /// + /// 22OSF + /// + /// + /// 23DC/OS + /// + /// + /// 24Reliant UNIX + /// + /// + /// 25SCO UnixWare + /// + /// + /// 26SCO OpenServer + /// + /// + /// 27Sequent + /// + /// + /// 28IRIX + /// + /// + /// 29Solaris + /// + /// + /// 30SunOS + /// + /// + /// 31U6000 + /// + /// + /// 32ASERIES + /// + /// + /// 33TandemNSK + /// + /// + /// 34TandemNT + /// + /// + /// 35BS2000 + /// + /// + /// 36LINUX + /// + /// + /// 37Lynx + /// + /// + /// 38XENIX + /// + /// + /// 39VM/ESA + /// + /// + /// 40Interactive UNIX + /// + /// + /// 41BSDUNIX + /// + /// + /// 42FreeBSD + /// + /// + /// 43NetBSD + /// + /// + /// 44GNU Hurd + /// + /// + /// 45OS9 + /// + /// + /// 46MACH Kernel + /// + /// + /// 47Inferno + /// + /// + /// 48QNX + /// + /// + /// 49EPOC + /// + /// + /// 50IxWorks + /// + /// + /// 51VxWorks + /// + /// + /// 52MiNT + /// + /// + /// 53BeOS + /// + /// + /// 54HP MPE + /// + /// + /// 55NextStep + /// + /// + /// 56PalmPilot + /// + /// + /// 57Rhapsody + /// + /// + /// 58Windows 2000 + /// + /// + /// 59Dedicated + /// + /// + /// 60VSE + /// + /// + /// 61TPF + /// + /// + /// + public ushort TargetOperatingSystem { get; private set; } + + /// + /// Version of the BIOS. This string is created by the BIOS manufacturer. + /// + public string Version { get; private set; } + } +} diff --git a/src/OSI/OperationSystem/Enums/OperationSystemVersionInformation.cs b/src/OSI/Information/Enums/OperationSystemVersionInformation.cs similarity index 94% rename from src/OSI/OperationSystem/Enums/OperationSystemVersionInformation.cs rename to src/OSI/Information/Enums/OperationSystemVersionInformation.cs index aae1b7b..4fe9c06 100644 --- a/src/OSI/OperationSystem/Enums/OperationSystemVersionInformation.cs +++ b/src/OSI/Information/Enums/OperationSystemVersionInformation.cs @@ -1,12 +1,12 @@ using System.Runtime.InteropServices; -namespace Hopex.OSI.OperationSystem.Enums +namespace Hopex.OSI.Information.Enums { /// /// Operating system version informations. /// [StructLayout(LayoutKind.Sequential)] - public struct OperationSystemVersionInformation + public struct InformationVersionInformation { /// /// Information of size, operating system version. diff --git a/src/OSI/OperationSystem/Enums/ProcessorArchitecture.cs b/src/OSI/Information/Enums/ProcessorArchitecture.cs similarity index 92% rename from src/OSI/OperationSystem/Enums/ProcessorArchitecture.cs rename to src/OSI/Information/Enums/ProcessorArchitecture.cs index b26dde4..6512c43 100644 --- a/src/OSI/OperationSystem/Enums/ProcessorArchitecture.cs +++ b/src/OSI/Information/Enums/ProcessorArchitecture.cs @@ -1,4 +1,4 @@ -namespace Hopex.OSI.OperationSystem.Enums +namespace Hopex.OSI.Information.Enums { /// /// Information of processor architecture. diff --git a/src/OSI/OperationSystem/Enums/ProcessorInfoUnion.cs b/src/OSI/Information/Enums/ProcessorInfoUnion.cs similarity index 93% rename from src/OSI/OperationSystem/Enums/ProcessorInfoUnion.cs rename to src/OSI/Information/Enums/ProcessorInfoUnion.cs index 00b4423..f50d1d2 100644 --- a/src/OSI/OperationSystem/Enums/ProcessorInfoUnion.cs +++ b/src/OSI/Information/Enums/ProcessorInfoUnion.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Hopex.OSI.OperationSystem.Enums +namespace Hopex.OSI.Information.Enums { /// /// Processor info union. diff --git a/src/OSI/OperationSystem/Enums/ScreenInformation.cs b/src/OSI/Information/Enums/ScreenInformation.cs similarity index 93% rename from src/OSI/OperationSystem/Enums/ScreenInformation.cs rename to src/OSI/Information/Enums/ScreenInformation.cs index c9b3980..6b4b5fb 100644 --- a/src/OSI/OperationSystem/Enums/ScreenInformation.cs +++ b/src/OSI/Information/Enums/ScreenInformation.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Linq; -namespace Hopex.OSI.OperationSystem.Enums +namespace Hopex.OSI.Information.Enums { /// /// Basic information about the user's display. diff --git a/src/OSI/OperationSystem/Enums/SoftwareArchitecture.cs b/src/OSI/Information/Enums/SoftwareArchitecture.cs similarity index 90% rename from src/OSI/OperationSystem/Enums/SoftwareArchitecture.cs rename to src/OSI/Information/Enums/SoftwareArchitecture.cs index 875de29..00e0a7b 100644 --- a/src/OSI/OperationSystem/Enums/SoftwareArchitecture.cs +++ b/src/OSI/Information/Enums/SoftwareArchitecture.cs @@ -1,4 +1,4 @@ -namespace Hopex.OSI.OperationSystem.Enums +namespace Hopex.OSI.Information.Enums { /// /// Software architecture. diff --git a/src/OSI/OperationSystem/Enums/SystemInformation.cs b/src/OSI/Information/Enums/SystemInformation.cs similarity index 97% rename from src/OSI/OperationSystem/Enums/SystemInformation.cs rename to src/OSI/Information/Enums/SystemInformation.cs index 92a63c5..569b2af 100644 --- a/src/OSI/OperationSystem/Enums/SystemInformation.cs +++ b/src/OSI/Information/Enums/SystemInformation.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace Hopex.OSI.OperationSystem.Enums +namespace Hopex.OSI.Information.Enums { /// /// System information. diff --git a/src/OSI/OperationSystem/Services/BitsService.cs b/src/OSI/Information/Services/BitsService.cs similarity index 93% rename from src/OSI/OperationSystem/Services/BitsService.cs rename to src/OSI/Information/Services/BitsService.cs index 5609cf3..dc61d84 100644 --- a/src/OSI/OperationSystem/Services/BitsService.cs +++ b/src/OSI/Information/Services/BitsService.cs @@ -1,5 +1,5 @@  -using Hopex.OSI.OperationSystem.Enums; +using Hopex.OSI.Information.Enums; using System; using System.Diagnostics; @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; -namespace Hopex.OSI.OperationSystem.Services +namespace Hopex.OSI.Information.Services { /// /// A service for obtaining data about bits. @@ -16,7 +16,7 @@ public class BitsService { #pragma warning disable CS1591 [DllImport("kernel32.dll")] - public static extern void GetNativeSystemInfo([MarshalAs(UnmanagedType.Struct)] ref SystemInformation lpSystemInfo); + public static extern void GetNativeSystemInfo([MarshalAs(UnmanagedType.Struct)] ref Enums.SystemInformation lpSystemInfo); [DllImport("kernel32", SetLastError = true, CallingConvention = CallingConvention.Winapi)] public extern static IntPtr GetProcAddress(IntPtr hwnd, string procedureName); @@ -99,7 +99,7 @@ public SoftwareArchitecture ProgramBits /// /// Operation system bits. /// - public SoftwareArchitecture OperationSystemBits + public SoftwareArchitecture InformationBits { get { @@ -127,7 +127,7 @@ public ProcessorArchitecture ProcessorBits { try { - SystemInformation nativeSystemInfo = new SystemInformation(); + Enums.SystemInformation nativeSystemInfo = new Enums.SystemInformation(); GetNativeSystemInfo(ref nativeSystemInfo); switch (nativeSystemInfo.uProcessorInfo.wProcessorArchitecture) diff --git a/src/OSI/OperationSystem/Services/FrameworkService.cs b/src/OSI/Information/Services/FrameworkService.cs similarity index 99% rename from src/OSI/OperationSystem/Services/FrameworkService.cs rename to src/OSI/Information/Services/FrameworkService.cs index 10cc60c..680c80a 100644 --- a/src/OSI/OperationSystem/Services/FrameworkService.cs +++ b/src/OSI/Information/Services/FrameworkService.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Microsoft.Win32; -namespace Hopex.OSI.OperationSystem.Services +namespace Hopex.OSI.Information.Services { /// /// Service for obtaining data about frameworks. diff --git a/src/OSI/OperationSystem/OperationSystem.cs b/src/OSI/Information/SystemInformation.cs similarity index 98% rename from src/OSI/OperationSystem/OperationSystem.cs rename to src/OSI/Information/SystemInformation.cs index a3a2765..09d44c0 100644 --- a/src/OSI/OperationSystem/OperationSystem.cs +++ b/src/OSI/Information/SystemInformation.cs @@ -1,6 +1,6 @@  -using Hopex.OSI.OperationSystem.Enums; -using Hopex.OSI.OperationSystem.Services; +using Hopex.OSI.Information.Enums; +using Hopex.OSI.Information.Services; using Microsoft.Win32; @@ -14,12 +14,12 @@ using System.Windows.Forms; -namespace Hopex.OSI.OperationSystem +namespace Hopex.OSI.Information { /// /// Summary information about the operating system. /// - public class OperationSystem + public class SystemInformation { #region Constantes @@ -125,7 +125,7 @@ out int edition ); [DllImport("kernel32.dll")] - private static extern bool GetVersionEx(ref OperationSystemVersionInformation osVersionInfo); + private static extern bool GetVersionEx(ref InformationVersionInformation osVersionInfo); [DllImport("user32")] public static extern int GetSystemMetrics(int nIndex); @@ -209,9 +209,9 @@ public string Edition get { OperatingSystem osVersion = Environment.OSVersion; - OperationSystemVersionInformation osVersionInfo = new OperationSystemVersionInformation + InformationVersionInformation osVersionInfo = new InformationVersionInformation { - dwOSVersionInfoSize = Marshal.SizeOf(typeof(OperationSystemVersionInformation)) + dwOSVersionInfoSize = Marshal.SizeOf(typeof(InformationVersionInformation)) }; if (GetVersionEx(ref osVersionInfo)) @@ -472,9 +472,9 @@ public string Name get { OperatingSystem osVersion = Environment.OSVersion; - OperationSystemVersionInformation osVersionInfo = new OperationSystemVersionInformation + InformationVersionInformation osVersionInfo = new InformationVersionInformation { - dwOSVersionInfoSize = Marshal.SizeOf(typeof(OperationSystemVersionInformation)) + dwOSVersionInfoSize = Marshal.SizeOf(typeof(InformationVersionInformation)) }; if (GetVersionEx(ref osVersionInfo)) @@ -646,9 +646,9 @@ public string ServicePack { get { - OperationSystemVersionInformation osVersionInfo = new OperationSystemVersionInformation + InformationVersionInformation osVersionInfo = new InformationVersionInformation { - dwOSVersionInfoSize = Marshal.SizeOf(typeof(OperationSystemVersionInformation)) + dwOSVersionInfoSize = Marshal.SizeOf(typeof(InformationVersionInformation)) }; if (GetVersionEx(ref osVersionInfo)) @@ -753,7 +753,7 @@ public int RevisionVersion /// /// Summary information about the operating system. /// - public OperationSystem() + public SystemInformation() { } diff --git a/src/OSI/OSI.csproj b/src/OSI/OSI.csproj index 6a29c7f..0e63575 100644 --- a/src/OSI/OSI.csproj +++ b/src/OSI/OSI.csproj @@ -33,8 +33,8 @@ bin\Release\Hopex.OSI.xml - - ..\..\..\RegEdit\bin\Release\Hopex.RegEdit.dll + + packages\Hopex.RegEdit.23.0.1\lib\net472\Hopex.RegEdit.dll @@ -50,17 +50,21 @@ - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/OSI/Properties/AssemblyInfo.cs b/src/OSI/Properties/AssemblyInfo.cs index d77b9cd..7d8dc45 100644 --- a/src/OSI/Properties/AssemblyInfo.cs +++ b/src/OSI/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ // набора атрибутов. Измените значения этих атрибутов для изменения сведений, // связанные со сборкой. [assembly: AssemblyTitle("Hopex.OSI")] -[assembly: AssemblyDescription("Provides the ability to quickly obtain detailed information about the Windows operating system, processor, installed SP, .NET Frameworks. It also allows you to get information about running system processes and manage them.")] +[assembly: AssemblyDescription("Provides the ability to quickly obtain detailed information about the Windows operating system, processor, installed SP, .NET Frameworks and BIOS. Also allows you to get information about running system processes and manage them.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Hopex")] [assembly: AssemblyProduct("Hopex.OSI")] @@ -32,5 +32,5 @@ // Можно задать все значения или принять номера сборки и редакции по умолчанию // используя "*", как показано ниже: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("23.0.0.1")] -[assembly: AssemblyFileVersion("23.0.0.1")] +[assembly: AssemblyVersion("23.0.0.3")] +[assembly: AssemblyFileVersion("23.0.0.3")] diff --git a/src/OSI/packages.config b/src/OSI/packages.config new file mode 100644 index 0000000..af70455 --- /dev/null +++ b/src/OSI/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file