commit 8b3d0b35de959d72abaa2192038477a161b040b3 Author: Eugen Höglinger Date: Wed Oct 2 14:39:21 2024 +0200 Initialized diff --git a/.vs/WindowsInfo.git/FileContentIndex/9252fce7-6b10-48ae-a4f9-beebf5e33144.vsidx b/.vs/WindowsInfo.git/FileContentIndex/9252fce7-6b10-48ae-a4f9-beebf5e33144.vsidx new file mode 100644 index 0000000..3047d20 Binary files /dev/null and b/.vs/WindowsInfo.git/FileContentIndex/9252fce7-6b10-48ae-a4f9-beebf5e33144.vsidx differ diff --git a/.vs/WindowsInfo.git/v17/.suo b/.vs/WindowsInfo.git/v17/.suo new file mode 100644 index 0000000..17206cd Binary files /dev/null and b/.vs/WindowsInfo.git/v17/.suo differ diff --git a/.vs/WindowsInfo.git/v17/DocumentLayout.backup.json b/.vs/WindowsInfo.git/v17/DocumentLayout.backup.json new file mode 100644 index 0000000..bb090c8 --- /dev/null +++ b/.vs/WindowsInfo.git/v17/DocumentLayout.backup.json @@ -0,0 +1,65 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{B5D24208-0AC9-4455-9586-6A3BAA3A1A02}|Test_WindowsInfo\\Test_WindowsInfo.csproj|c:\\cad\\git-workrepository\\visualstudio\\_dll\\windowsinfo.git\\test_windowsinfo\\form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form", + "RelativeMoniker": "D:0:0:{B5D24208-0AC9-4455-9586-6A3BAA3A1A02}|Test_WindowsInfo\\Test_WindowsInfo.csproj|solutionrelative:test_windowsinfo\\form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form" + }, + { + "AbsoluteMoniker": "D:0:0:{98F90132-262C-4D6E-B110-572FF383D42B}|WindowsInfo\\WindowsInfo.csproj|c:\\cad\\git-workrepository\\visualstudio\\_dll\\windowsinfo.git\\windowsinfo\\windowsinfo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{98F90132-262C-4D6E-B110-572FF383D42B}|WindowsInfo\\WindowsInfo.csproj|solutionrelative:windowsinfo\\windowsinfo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 3, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{e506b91c-c606-466a-90a9-123d1d1e12b3}" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "Form1.cs [Entwurf]", + "DocumentMoniker": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\Test_WindowsInfo\\Form1.cs", + "RelativeDocumentMoniker": "Test_WindowsInfo\\Form1.cs", + "ToolTip": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\Test_WindowsInfo\\Form1.cs [Entwurf]", + "RelativeToolTip": "Test_WindowsInfo\\Form1.cs [Entwurf]", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-02T12:38:14.02Z", + "EditorCaption": " [Entwurf]" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "WindowsInfo.cs", + "DocumentMoniker": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\WindowsInfo\\WindowsInfo.cs", + "RelativeDocumentMoniker": "WindowsInfo\\WindowsInfo.cs", + "ToolTip": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\WindowsInfo\\WindowsInfo.cs", + "RelativeToolTip": "WindowsInfo\\WindowsInfo.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-02T12:38:09.561Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/WindowsInfo.git/v17/DocumentLayout.json b/.vs/WindowsInfo.git/v17/DocumentLayout.json new file mode 100644 index 0000000..bb090c8 --- /dev/null +++ b/.vs/WindowsInfo.git/v17/DocumentLayout.json @@ -0,0 +1,65 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{B5D24208-0AC9-4455-9586-6A3BAA3A1A02}|Test_WindowsInfo\\Test_WindowsInfo.csproj|c:\\cad\\git-workrepository\\visualstudio\\_dll\\windowsinfo.git\\test_windowsinfo\\form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form", + "RelativeMoniker": "D:0:0:{B5D24208-0AC9-4455-9586-6A3BAA3A1A02}|Test_WindowsInfo\\Test_WindowsInfo.csproj|solutionrelative:test_windowsinfo\\form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form" + }, + { + "AbsoluteMoniker": "D:0:0:{98F90132-262C-4D6E-B110-572FF383D42B}|WindowsInfo\\WindowsInfo.csproj|c:\\cad\\git-workrepository\\visualstudio\\_dll\\windowsinfo.git\\windowsinfo\\windowsinfo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{98F90132-262C-4D6E-B110-572FF383D42B}|WindowsInfo\\WindowsInfo.csproj|solutionrelative:windowsinfo\\windowsinfo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 3, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{e506b91c-c606-466a-90a9-123d1d1e12b3}" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "Form1.cs [Entwurf]", + "DocumentMoniker": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\Test_WindowsInfo\\Form1.cs", + "RelativeDocumentMoniker": "Test_WindowsInfo\\Form1.cs", + "ToolTip": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\Test_WindowsInfo\\Form1.cs [Entwurf]", + "RelativeToolTip": "Test_WindowsInfo\\Form1.cs [Entwurf]", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-02T12:38:14.02Z", + "EditorCaption": " [Entwurf]" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "WindowsInfo.cs", + "DocumentMoniker": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\WindowsInfo\\WindowsInfo.cs", + "RelativeDocumentMoniker": "WindowsInfo\\WindowsInfo.cs", + "ToolTip": "C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\WindowsInfo\\WindowsInfo.cs", + "RelativeToolTip": "WindowsInfo\\WindowsInfo.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-02T12:38:09.561Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/Test_WindowsInfo/.vs/Test_WindowsInfo.csproj.dtbcache.json b/Test_WindowsInfo/.vs/Test_WindowsInfo.csproj.dtbcache.json new file mode 100644 index 0000000..d7427c4 --- /dev/null +++ b/Test_WindowsInfo/.vs/Test_WindowsInfo.csproj.dtbcache.json @@ -0,0 +1 @@ +{"RootPath":"C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\Test_WindowsInfo","ProjectFileName":"Test_WindowsInfo.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"Form1.cs"},{"SourceFile":"Form1.Designer.cs"},{"SourceFile":"Program.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"Properties\\Settings.Designer.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\WindowsInfo\\bin\\Debug\\hewininfo.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Deployment.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\Test_WindowsInfo\\bin\\Debug\\Test_WindowsInfo.exe","OutputItemRelativePath":"Test_WindowsInfo.exe"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]} \ No newline at end of file diff --git a/Test_WindowsInfo/App.config b/Test_WindowsInfo/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Test_WindowsInfo/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Test_WindowsInfo/Form1.Designer.cs b/Test_WindowsInfo/Form1.Designer.cs new file mode 100644 index 0000000..a40fd26 --- /dev/null +++ b/Test_WindowsInfo/Form1.Designer.cs @@ -0,0 +1,130 @@ +namespace Test_WindowsInfo +{ + partial class Form1 + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.buttonWindowsInfo = new System.Windows.Forms.Button(); + this.labelWindowsInfo = new System.Windows.Forms.Label(); + this.groupBoxProgramInfo = new System.Windows.Forms.GroupBox(); + this.labelProgramInfo = new System.Windows.Forms.Label(); + this.groupBoxDLLInfo = new System.Windows.Forms.GroupBox(); + this.labelDLLInfo = new System.Windows.Forms.Label(); + this.groupBoxProgramInfo.SuspendLayout(); + this.groupBoxDLLInfo.SuspendLayout(); + this.SuspendLayout(); + // + // buttonWindowsInfo + // + this.buttonWindowsInfo.Location = new System.Drawing.Point(12, 343); + this.buttonWindowsInfo.Name = "buttonWindowsInfo"; + this.buttonWindowsInfo.Size = new System.Drawing.Size(775, 23); + this.buttonWindowsInfo.TabIndex = 0; + this.buttonWindowsInfo.Text = "Windows Informationen anzeigen"; + this.buttonWindowsInfo.UseVisualStyleBackColor = true; + this.buttonWindowsInfo.Click += new System.EventHandler(this.buttonWindowsInfo_Click); + // + // labelWindowsInfo + // + this.labelWindowsInfo.AutoSize = true; + this.labelWindowsInfo.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelWindowsInfo.Location = new System.Drawing.Point(13, 13); + this.labelWindowsInfo.Name = "labelWindowsInfo"; + this.labelWindowsInfo.Size = new System.Drawing.Size(28, 14); + this.labelWindowsInfo.TabIndex = 1; + this.labelWindowsInfo.Text = "..."; + // + // groupBoxProgramInfo + // + this.groupBoxProgramInfo.Controls.Add(this.labelProgramInfo); + this.groupBoxProgramInfo.Location = new System.Drawing.Point(12, 372); + this.groupBoxProgramInfo.Name = "groupBoxProgramInfo"; + this.groupBoxProgramInfo.Size = new System.Drawing.Size(385, 66); + this.groupBoxProgramInfo.TabIndex = 2; + this.groupBoxProgramInfo.TabStop = false; + this.groupBoxProgramInfo.Text = "Programm Information"; + // + // labelProgramInfo + // + this.labelProgramInfo.AutoSize = true; + this.labelProgramInfo.Location = new System.Drawing.Point(7, 20); + this.labelProgramInfo.Name = "labelProgramInfo"; + this.labelProgramInfo.Size = new System.Drawing.Size(16, 13); + this.labelProgramInfo.TabIndex = 0; + this.labelProgramInfo.Text = "..."; + // + // groupBoxDLLInfo + // + this.groupBoxDLLInfo.Controls.Add(this.labelDLLInfo); + this.groupBoxDLLInfo.Location = new System.Drawing.Point(403, 372); + this.groupBoxDLLInfo.Name = "groupBoxDLLInfo"; + this.groupBoxDLLInfo.Size = new System.Drawing.Size(385, 66); + this.groupBoxDLLInfo.TabIndex = 3; + this.groupBoxDLLInfo.TabStop = false; + this.groupBoxDLLInfo.Text = "DLL Information"; + // + // labelDLLInfo + // + this.labelDLLInfo.AutoSize = true; + this.labelDLLInfo.Location = new System.Drawing.Point(7, 20); + this.labelDLLInfo.Name = "labelDLLInfo"; + this.labelDLLInfo.Size = new System.Drawing.Size(16, 13); + this.labelDLLInfo.TabIndex = 0; + this.labelDLLInfo.Text = "..."; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.groupBoxDLLInfo); + this.Controls.Add(this.groupBoxProgramInfo); + this.Controls.Add(this.labelWindowsInfo); + this.Controls.Add(this.buttonWindowsInfo); + this.Name = "Form1"; + this.Text = "Test_WindowsInfo"; + this.Load += new System.EventHandler(this.Form1_Load); + this.groupBoxProgramInfo.ResumeLayout(false); + this.groupBoxProgramInfo.PerformLayout(); + this.groupBoxDLLInfo.ResumeLayout(false); + this.groupBoxDLLInfo.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button buttonWindowsInfo; + private System.Windows.Forms.Label labelWindowsInfo; + private System.Windows.Forms.GroupBox groupBoxProgramInfo; + private System.Windows.Forms.Label labelProgramInfo; + private System.Windows.Forms.GroupBox groupBoxDLLInfo; + private System.Windows.Forms.Label labelDLLInfo; + } +} + diff --git a/Test_WindowsInfo/Form1.cs b/Test_WindowsInfo/Form1.cs new file mode 100644 index 0000000..b086ccd --- /dev/null +++ b/Test_WindowsInfo/Form1.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Eugen.ESystem.Windows.Info; + +namespace Test_WindowsInfo +{ + public partial class Form1 : Form + { + #region Version und Copyright + // Version und Copyright + string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen + string programVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + string copyright = GenerateCopyright(); + string icon = Application.StartupPath + "\\Info.bmp"; + //Assembly Datum und Zeit + static DateTime value = AssemblyDateTime(); + string date = value.ToShortDateString(); + string time = value.ToLongTimeString(); + private static DateTime AssemblyDateTime() + { + var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision)); + //Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original) + return buildDateTime; + } + + private static string CurrentYear() + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + + private static string StartYear() + { + //string startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + //return startYear.Remove(0, startYear.LastIndexOf(" ") + 1); + string startYear = ""; + if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © ")) + { + startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", ""); + while (startYear.StartsWith(" ")) + { + startYear = startYear.Remove(0, 1); + } + startYear = startYear.Remove(startYear.IndexOf(" ")); + return startYear; + } + else + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + } + + private static string GenerateCopyright() + { + string startYear = StartYear(); + string currentYear = CurrentYear(); + + if (startYear == currentYear) + { + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + else + { + //return String.Concat(((AssemblyCopyrightAttribute)attributes[0]).Copyright, "-", currentYear); + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace(startYear, String.Concat(startYear, "-", currentYear)); + } + } + #endregion + + #region Programm-Info + /// + /// Contains the name of the program file + /// + public static string ProgramName { set; get; } + + /// + /// Contains the version of the program file + /// + public static string ProgramVersion { set; get; } + + /// + /// Contains the copyright notice + /// + public static string Copyright { set; get; } + + private void SetProgramInfo() + { + //Name, Version und Copyright setzen + ProgramName = programName; + ProgramVersion = programVersion; + Copyright = copyright; + } + #endregion + + public Form1() + { + SetProgramInfo(); + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + ShowInformation(); //Programm- und DLL-Information anzeigen + } + + private void ShowInformation() + { + labelProgramInfo.Text = String.Concat(ProgramName, "\n", ProgramVersion, "\n", Copyright); //Programm-Information anzeigen + + // DLL-Information anzeigen + labelDLLInfo.Text = String.Concat(WindowsInfo.DllName, "\n", WindowsInfo.DllVersion, "\n", WindowsInfo.Copyright); + } + + private void buttonWindowsInfo_Click(object sender, EventArgs e) + { + //-------------------------------------------------------------- + //--- Diesen Bereich ins eigene Programm einfügen --- Anfang --- + //-------------------------------------------------------------- + + string info = ""; + + try + { + info = String.Concat("Build Lab: ", WindowsInfo.BuildLab, "\n"); + info = String.Concat(info, "Current Build Number: ", WindowsInfo.CurrentBuildNumber, "\n"); + info = String.Concat(info, "Current Version: ", WindowsInfo.CurrentVersion, "\n"); + info = String.Concat(info, "Edition Id: ", WindowsInfo.EditionId, "\n"); + info = String.Concat(info, "Operating System: ", WindowsInfo.OS, "\n"); + info = String.Concat(info, "Operating System Archtecture: ", WindowsInfo.OSArchitecture, "\n"); + info = String.Concat(info, "Operating System Build: ", WindowsInfo.OSBuild, "\n"); + info = String.Concat(info, "Operating System Major Revision: ", WindowsInfo.OSMajorRevision, "\n"); + info = String.Concat(info, "Operating System Major Version : ", WindowsInfo.OSMajorVersion, "\n"); + info = String.Concat(info, "Operating System Minor Revision: ", WindowsInfo.OSMinorRevision, "\n"); + info = String.Concat(info, "Operating System Major Version: ", WindowsInfo.OSMinorVersion, "\n"); + info = String.Concat(info, "Operating System Name: ", WindowsInfo.OSName, "\n"); + info = String.Concat(info, "Operating System Service Pack: ", WindowsInfo.OSServicePack, "\n"); + info = String.Concat(info, "Operating System Version: ", WindowsInfo.OSVersion, "\n"); + info = String.Concat(info, "Operating System Version String: ", WindowsInfo.OSVersionString, "\n"); + info = String.Concat(info, "Processor Architecture: ", WindowsInfo.ProcessArchitecture, "\n"); + info = String.Concat(info, "Product Name: ", WindowsInfo.ProductName, "\n"); + info = String.Concat(info, "Released: ", WindowsInfo.ReleaseId, "\n"); + } + catch (Exception) + { + MessageBox.Show("Werte konnten nicht gelesen werden"); + } + //catch (Exception ex) + //{ + // MessageBox.Show(ex.Message); + //} + + labelWindowsInfo.Text = info; + //-------------------------------------------------------------- + //--- Diesen Bereich ins eigene Programm einfügen --- Ende --- + //-------------------------------------------------------------- + } + } +} diff --git a/Test_WindowsInfo/Form1.resx b/Test_WindowsInfo/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Test_WindowsInfo/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Test_WindowsInfo/Program.cs b/Test_WindowsInfo/Program.cs new file mode 100644 index 0000000..664175a --- /dev/null +++ b/Test_WindowsInfo/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Test_WindowsInfo +{ + static class Program + { + /// + /// Der Haupteinstiegspunkt für die Anwendung. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Test_WindowsInfo/Properties/AssemblyInfo.cs b/Test_WindowsInfo/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..91c4f95 --- /dev/null +++ b/Test_WindowsInfo/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("Test_WindowsInfo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Test_WindowsInfo")] +[assembly: AssemblyCopyright("Copyright © 2020 by Eugen Höglinger")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("b5d24208-0ac9-4455-9586-6a3baa3a1a02")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Test_WindowsInfo/Properties/Resources.Designer.cs b/Test_WindowsInfo/Properties/Resources.Designer.cs new file mode 100644 index 0000000..6a3e8ce --- /dev/null +++ b/Test_WindowsInfo/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion: 4.0.30319.42000 +// +// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn +// der Code neu generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Test_WindowsInfo.Properties +{ + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse + // über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test_WindowsInfo.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Test_WindowsInfo/Properties/Resources.resx b/Test_WindowsInfo/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Test_WindowsInfo/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Test_WindowsInfo/Properties/Settings.Designer.cs b/Test_WindowsInfo/Properties/Settings.Designer.cs new file mode 100644 index 0000000..556090b --- /dev/null +++ b/Test_WindowsInfo/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Test_WindowsInfo.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Test_WindowsInfo/Properties/Settings.settings b/Test_WindowsInfo/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Test_WindowsInfo/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Test_WindowsInfo/Test_WindowsInfo.csproj b/Test_WindowsInfo/Test_WindowsInfo.csproj new file mode 100644 index 0000000..c012e77 --- /dev/null +++ b/Test_WindowsInfo/Test_WindowsInfo.csproj @@ -0,0 +1,87 @@ + + + + + Debug + AnyCPU + {B5D24208-0AC9-4455-9586-6A3BAA3A1A02} + WinExe + Test_WindowsInfo + Test_WindowsInfo + v4.7.2 + 512 + true + false + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\WindowsInfo\bin\Debug\hewininfo.dll + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/Test_WindowsInfo/bin/Debug/Test_WindowsInfo.exe b/Test_WindowsInfo/bin/Debug/Test_WindowsInfo.exe new file mode 100644 index 0000000..be725b8 Binary files /dev/null and b/Test_WindowsInfo/bin/Debug/Test_WindowsInfo.exe differ diff --git a/Test_WindowsInfo/bin/Debug/Test_WindowsInfo.exe.config b/Test_WindowsInfo/bin/Debug/Test_WindowsInfo.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Test_WindowsInfo/bin/Debug/Test_WindowsInfo.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Test_WindowsInfo/bin/Debug/Test_WindowsInfo.pdb b/Test_WindowsInfo/bin/Debug/Test_WindowsInfo.pdb new file mode 100644 index 0000000..dc5eaed Binary files /dev/null and b/Test_WindowsInfo/bin/Debug/Test_WindowsInfo.pdb differ diff --git a/Test_WindowsInfo/bin/Debug/hewininfo.dll b/Test_WindowsInfo/bin/Debug/hewininfo.dll new file mode 100644 index 0000000..412bf4f Binary files /dev/null and b/Test_WindowsInfo/bin/Debug/hewininfo.dll differ diff --git a/Test_WindowsInfo/bin/Debug/hewininfo.pdb b/Test_WindowsInfo/bin/Debug/hewininfo.pdb new file mode 100644 index 0000000..e634407 Binary files /dev/null and b/Test_WindowsInfo/bin/Debug/hewininfo.pdb differ diff --git a/Test_WindowsInfo/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/Test_WindowsInfo/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/Test_WindowsInfo/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/Test_WindowsInfo/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Test_WindowsInfo/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..2d21f8d Binary files /dev/null and b/Test_WindowsInfo/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Test_WindowsInfo/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Test_WindowsInfo/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..72f52c6 Binary files /dev/null and b/Test_WindowsInfo/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Test_WindowsInfo/obj/Debug/Test_Win.39942AAC.Up2Date b/Test_WindowsInfo/obj/Debug/Test_Win.39942AAC.Up2Date new file mode 100644 index 0000000..e69de29 diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.Form1.resources b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.Form1.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.Form1.resources differ diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.Properties.Resources.resources b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.Properties.Resources.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.Properties.Resources.resources differ diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.AssemblyReference.cache b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.AssemblyReference.cache new file mode 100644 index 0000000..d3f1fc5 Binary files /dev/null and b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.AssemblyReference.cache differ diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.CopyComplete b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.CopyComplete new file mode 100644 index 0000000..e69de29 diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.CoreCompileInputs.cache b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..15e7fdf --- /dev/null +++ b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +803e574a6828a51a5f0b422298c1f9bb0b71aee87c17e71de363a6cc66170c28 diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.FileListAbsolute.txt b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..1c6b694 --- /dev/null +++ b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.FileListAbsolute.txt @@ -0,0 +1,40 @@ +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\Test_WindowsInfo.exe.config +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\Test_WindowsInfo.exe +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\Test_WindowsInfo.pdb +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csprojAssemblyReference.cache +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.Form1.resources +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.Properties.Resources.resources +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.GenerateResource.cache +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.CoreCompileInputs.cache +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.exe +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.pdb +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\WindowsInfo.dll +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\WindowsInfo.pdb +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.CopyComplete +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\Test_WindowsInfo.exe.config +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\Test_WindowsInfo.exe +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\Test_WindowsInfo.pdb +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\hewininfo.dll +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\hewininfo.pdb +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.Form1.resources +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.Properties.Resources.resources +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.GenerateResource.cache +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.CoreCompileInputs.cache +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.CopyComplete +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.exe +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.pdb +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.AssemblyReference.cache +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.SuggestedBindingRedirects.cache +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\Test_WindowsInfo.exe.config +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\Test_WindowsInfo.exe +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\Test_WindowsInfo.pdb +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\hewininfo.pdb +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.AssemblyReference.cache +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.Form1.resources +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.Properties.Resources.resources +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.GenerateResource.cache +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.csproj.CoreCompileInputs.cache +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_Win.39942AAC.Up2Date +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.exe +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\obj\Debug\Test_WindowsInfo.pdb +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\Test_WindowsInfo\bin\Debug\hewininfo.dll diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.GenerateResource.cache b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.GenerateResource.cache new file mode 100644 index 0000000..bbddfa7 Binary files /dev/null and b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.GenerateResource.cache differ diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.SuggestedBindingRedirects.cache b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.csproj.SuggestedBindingRedirects.cache new file mode 100644 index 0000000..e69de29 diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.exe b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.exe new file mode 100644 index 0000000..be725b8 Binary files /dev/null and b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.exe differ diff --git a/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.pdb b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.pdb new file mode 100644 index 0000000..dc5eaed Binary files /dev/null and b/Test_WindowsInfo/obj/Debug/Test_WindowsInfo.pdb differ diff --git a/WindowsInfo.git.sln b/WindowsInfo.git.sln new file mode 100644 index 0000000..81a6119 --- /dev/null +++ b/WindowsInfo.git.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30621.155 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsInfo", "WindowsInfo\WindowsInfo.csproj", "{98F90132-262C-4D6E-B110-572FF383D42B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_WindowsInfo", "Test_WindowsInfo\Test_WindowsInfo.csproj", "{B5D24208-0AC9-4455-9586-6A3BAA3A1A02}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {98F90132-262C-4D6E-B110-572FF383D42B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {98F90132-262C-4D6E-B110-572FF383D42B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {98F90132-262C-4D6E-B110-572FF383D42B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {98F90132-262C-4D6E-B110-572FF383D42B}.Release|Any CPU.Build.0 = Release|Any CPU + {B5D24208-0AC9-4455-9586-6A3BAA3A1A02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B5D24208-0AC9-4455-9586-6A3BAA3A1A02}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B5D24208-0AC9-4455-9586-6A3BAA3A1A02}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B5D24208-0AC9-4455-9586-6A3BAA3A1A02}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {594721DB-5599-4A15-ABC3-263865C6E5D6} + EndGlobalSection +EndGlobal diff --git a/WindowsInfo/.vs/WindowsInfo.csproj.dtbcache.json b/WindowsInfo/.vs/WindowsInfo.csproj.dtbcache.json new file mode 100644 index 0000000..0f78653 --- /dev/null +++ b/WindowsInfo/.vs/WindowsInfo.csproj.dtbcache.json @@ -0,0 +1 @@ +{"RootPath":"C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\WindowsInfo","ProjectFileName":"WindowsInfo.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"WindowsInfo.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Management.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.7.2\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\CAD\\Git-WorkRepository\\VisualStudio\\_DLL\\WindowsInfo.git\\WindowsInfo\\bin\\Debug\\hewininfo.dll","OutputItemRelativePath":"hewininfo.dll"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]} \ No newline at end of file diff --git a/WindowsInfo/Properties/AssemblyInfo.cs b/WindowsInfo/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6f46c9e --- /dev/null +++ b/WindowsInfo/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("WindowsInfo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsInfo")] +[assembly: AssemblyCopyright("Copyright © 2020 by Eugen Höglinger")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("98f90132-262c-4d6e-b110-572ff383d42b")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WindowsInfo/WindowsInfo.cs b/WindowsInfo/WindowsInfo.cs new file mode 100644 index 0000000..9e5dda9 --- /dev/null +++ b/WindowsInfo/WindowsInfo.cs @@ -0,0 +1,504 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Microsoft.Win32; + +namespace Eugen.ESystem.Windows.Info +{ + public class WindowsInfo + { + #region Version und Copyright + // Version und Copyright + static string dllName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen + static string dllVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + static string copyright = GenerateCopyright(); + + //Assembly Datum und Zeit + static DateTime value = AssemblyDateTime(); + static string date = value.ToShortDateString(); + static string time = value.ToLongTimeString(); + + private static DateTime AssemblyDateTime() + { + var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision)); + //Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original) + return buildDateTime; + } + + private static string CurrentYear() + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + + private static string StartYear() + { + string startYear = ""; + if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © ")) + { + startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", ""); + while (startYear.StartsWith(" ")) + { + startYear = startYear.Remove(0, 1); + } + + if (startYear.Contains("-")) + { + startYear = startYear.Remove(startYear.IndexOf("-")); + } + else + { + startYear = startYear.Remove(startYear.IndexOf(" ")); + } + return startYear; + } + else + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + } + + private static string GenerateCopyright() + { + string startYear = StartYear(); + string currentYear = CurrentYear(); + + if (startYear == currentYear) + { + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + else + { + string temp = ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + string start = temp.Remove(temp.IndexOf(startYear) - 1); + string end = (temp.Remove(0, temp.IndexOf(" by"))); + + return String.Concat(start, " ", startYear, "-", currentYear, end); + } + } + #endregion + + #region DLL-Info + /// + /// Contains the name of the program file + /// + public static string DllName { set; get; } + + /// + /// Contains the version of the program file + /// + public static string DllVersion { set; get; } + + /// + /// Contains the copyright notice + /// + public static string Copyright { set; get; } + + private static void SetDllInfo() + { + //Name, Version und Copyright setzen + DllName = dllName; + DllVersion = dllVersion; + Copyright = copyright; + } + #endregion + + /// + /// Information about Windows + /// + static WindowsInfo() + { + SetDllInfo(); //Name, Version und Copyright setzen + CollectWindowsInfomations(); + } + + #region Globale_Variablen + /// + /// Returns the installed operating system. E.g.: Microsoft Windows 10 Enterprise - 64-Bit + /// + public static string OS { set; get; } + + /// + /// Returns the product name of the installed operating system. E.g.: Windows 10 Enterprise + /// + public static string ProductName { set; get; } + + /// + /// Returns the edition ID of the installed operating system. E.g.: Enterprise + /// + public static string EditionId { set; get; } + + /// + /// Returns the current version of the installed operating system. E.g.: 6.3 + /// + public static string CurrentVersion { set; get; } + + /// + /// Returns the current release ID of the installed operating system. E.g.: 1709 + /// + public static string ReleaseId { set; get; } + + /// + /// Returns the current build number of the installed operating system. E.g.: 16299 + /// + public static string CurrentBuildNumber { set; get; } + + /// + /// Returns the build lab of the installed operating system. E.g.: 16299.431 + /// + public static string BuildLab { set; get; } + + /// + /// Returns the operating system name of the installed operating system. E.g.: Microsoft Windows 10 Enterprise + /// + public static string OSName { set; get; } + + /// + /// Returns the OS version string of the installed operating system. E.g.: Microsoft Windows NT 6.2.9200.0 + /// + public static string OSVersionString { set; get; } + + /// + /// Returns the OS version of the installed operating system. E.g.: 6.2.9200.0 + /// + public static string OSVersion { set; get; } + + /// + /// Returns the OS architecture of the installed operating system. E.g.: 64-Bit + /// + public static string OSArchitecture { set; get; } + + /// + /// Returns the OS service pack of the installed operating system. E.g.: SP1 + /// + public static string OSServicePack { set; get; } + + /// + /// Returns the OS major version of the installed operating system. E.g.: 6 + /// + public static int OSMajorVersion { set; get; } + + /// + /// Returns the OS minor version of the installed operating system. E.g.: 2 + /// + public static int OSMinorVersion { set; get; } + + /// + /// Returns the OS major revision of the installed operating system. E.g.: 0 + /// + public static int OSMajorRevision { set; get; } + + /// + /// Returns the OS minor revision of the installed operating system. E.g.: 0 + /// + public static int OSMinorRevision { set; get; } + + /// + /// Returns the OS build of the installed operating system. E.g.: 9200 + /// + public static int OSBuild { set; get; } + + /// + /// Returns the process architecture of the installed operating system. E.g.: Win32NT + /// + public static string ProcessArchitecture { set; get; } + #endregion + + OperatingSystem os = Environment.OSVersion; + + #region Methoden + /// + /// Collects all Windows informations + /// + /// If a value cannot be read, an exception is thrown + public static void CollectWindowsInfomations() + { + try + { + OS = GetOS(); + ProductName = GetProductName(); + EditionId = GetEditionId(); + CurrentVersion = GetCurrentVersion(); + ReleaseId = GetReleaseId(); + CurrentBuildNumber = GetCurrentBuildNumber(); + BuildLab = GetBuildLab(); + OSName = GetOSName(); + OSVersionString = GetOSVersionString(); + OSVersion = GetOSVersion(); + OSArchitecture = GetOSArchitecture(); + OSServicePack = GetOSServicePack(); + OSMajorVersion = GetOSMajorVersion(); + OSMinorVersion = GetOSMinorVersion(); + OSMajorRevision = GetOSMajorRevision(); + OSMinorRevision = GetOSMinorRevision(); + OSBuild = GetOSBuild(); + ProcessArchitecture = GetProcessArchitecture(); + } + catch (Exception) + { + throw new UnableToReadOSInformationException(); + } + } + /// + /// Get the installed operating system. + /// + /// The installed OS. E.g.: Microsoft Windows 10 Enterprise - 64-Bit + private static string GetOS() + { + string r = ""; + using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem")) + { + ManagementObjectCollection information = searcher.Get(); + if (information != null) + { + foreach (ManagementObject obj in information) + { + r = obj["Caption"].ToString() + " - " + obj["OSArchitecture"].ToString(); + } + } + r = r.Replace("NT 5.1.2600", "XP"); + r = r.Replace("NT 5.2.3790", "Server 2003"); + } + return r; + } + + /// + /// Get the product name of the installed operating system. + /// + /// The product name. E.g.: Windows 10 Enterprise + private static string GetProductName() + { + var regKey = Registry.LocalMachine; + var subKey = regKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false); + return subKey.GetValue("ProductName").ToString(); + } + + /// + /// Get the edition ID of the installed operating system. + /// + /// The edition ID. E.g.: Enterprise + private static string GetEditionId() + { + var regKey = Registry.LocalMachine; + var subKey = regKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false); + return subKey.GetValue("EditionID").ToString(); + } + + /// + /// Get the current version of the installed operating system. + /// + /// The current version. E.g.: 6.3 + private static string GetCurrentVersion() + { + var regKey = Registry.LocalMachine; + var subKey = regKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false); + return subKey.GetValue("CurrentVersion").ToString(); + } + + /// + /// Get the current release ID of the installed operating system. + /// + /// The current release ID. E.g.: 1709 + private static string GetReleaseId() + { + var regKey = Registry.LocalMachine; + var subKey = regKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false); + return subKey.GetValue("ReleaseId").ToString(); + } + + /// + /// Get the current build number of the installed operating system. + /// + /// The current build number. E.g.: 16299 + private static string GetCurrentBuildNumber() + { + var regKey = Registry.LocalMachine; + var subKey = regKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false); + return subKey.GetValue("CurrentBuildNumber").ToString(); + } + + /// + /// Get the build lab of the installed operating system. + /// + /// + /// The build lab. E.g.: 16299.431 + private static string GetBuildLab() + { + var regKey = Registry.LocalMachine; + var subKey = regKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false); + string key = subKey.GetValue("BuildLabEx").ToString(); + + string value = key.Remove(key.IndexOf(".") + 1); + key = key.Remove(0, key.IndexOf(".") + 1); + value = String.Concat(value, key.Remove(key.IndexOf("."))); + + return value; + } + + /// + /// Get the operating system name of the installed operating system. + /// + /// The OS name. E.g.: Microsoft Windows 10 Enterprise + private static string GetOSName() + { + string r = ""; + using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem")) + { + ManagementObjectCollection information = searcher.Get(); + if (information != null) + { + foreach (ManagementObject obj in information) + { + r = obj["Caption"].ToString(); + } + } + r = r.Replace("NT 5.1.2600", "XP"); + r = r.Replace("NT 5.2.3790", "Server 2003"); + } + return r; + } + + /// + /// Get the OS version string of the installed operating system. + /// + /// The OS version string. E.g.: Microsoft Windows NT 6.2.9200.0 + private static string GetOSVersionString() + { + return Environment.OSVersion.VersionString; + } + + /// + /// Get the OS version of the installed operating system. + /// + /// The OS version. E.g.: 6.2.9200.0 + private static string GetOSVersion() + { + return Environment.OSVersion.Version.ToString(); + } + + /// + /// Get the OS architecture of the installed operating system. + /// + /// The OS architecture. E.g.: 64-Bit + private static string GetOSArchitecture() + { + string r = ""; + using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem")) + { + ManagementObjectCollection information = searcher.Get(); + if (information != null) + { + foreach (ManagementObject obj in information) + { + r = obj["OSArchitecture"].ToString(); + } + } + } + return r; + } + + /// + /// Get the OS service pack of the installed operating system. + /// + /// The OS service pack. E.g.: SP1 + private static string GetOSServicePack() + { + return Environment.OSVersion.ServicePack; + } + + /// + /// Get the OS major version of the installed operating system. + /// + /// The OS major version. E.g.: 6 + private static int GetOSMajorVersion() + { + Version ver = Environment.OSVersion.Version; + return ver.Major; + } + + /// + /// Get the OS minor version of the installed operating system. + /// + /// The OS minor version. E.g.: 2 + private static int GetOSMinorVersion() + { + Version ver = Environment.OSVersion.Version; + return ver.Minor; + } + + /// + /// Get the OS major revision of the installed operating system. + /// + /// The OS major revision. E.g.: 0 + private static int GetOSMajorRevision() + { + Version ver = Environment.OSVersion.Version; + return ver.MajorRevision; + } + + /// + /// Get the OS minor revision of the installed operating system. + /// + /// The OS minor revision. E.g.: 0 + private static int GetOSMinorRevision() + { + Version ver = Environment.OSVersion.Version; + return ver.MinorRevision; + } + + /// + /// Get the OS build of the installed operating system. + /// + /// The OS build. E.g.: 9200 + private static int GetOSBuild() + { + Version ver = Environment.OSVersion.Version; + return ver.Build; + } + + /// + /// Get the process architecture of the installed operating system. + /// + /// The process architecture. E.g.: Win32NT + private static string GetProcessArchitecture() + { + return Environment.OSVersion.Platform.ToString(); + } + #endregion + } + + #region Exceptions + public class UnableToReadOSInformationException : ApplicationException + { + public UnableToReadOSInformationException() + { } + + public UnableToReadOSInformationException(string message) : base(message) + { } + + public UnableToReadOSInformationException(string message, Exception inner) : base(message, inner) + { } + } + + public class UnknownErrorException : ApplicationException + { + public UnknownErrorException() + { } + + public UnknownErrorException(string message) : base(message) + { } + + public UnknownErrorException(string message, Exception inner) : base(message, inner) + { } + } + #endregion +} diff --git a/WindowsInfo/WindowsInfo.csproj b/WindowsInfo/WindowsInfo.csproj new file mode 100644 index 0000000..0eb8e52 --- /dev/null +++ b/WindowsInfo/WindowsInfo.csproj @@ -0,0 +1,50 @@ + + + + + Debug + AnyCPU + {98F90132-262C-4D6E-B110-572FF383D42B} + Library + Properties + WindowsInfo + hewininfo + v4.7.2 + 512 + false + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WindowsInfo/bin/Debug/WindowsInfo.pdb b/WindowsInfo/bin/Debug/WindowsInfo.pdb new file mode 100644 index 0000000..8735e58 Binary files /dev/null and b/WindowsInfo/bin/Debug/WindowsInfo.pdb differ diff --git a/WindowsInfo/bin/Debug/hewininfo.dll b/WindowsInfo/bin/Debug/hewininfo.dll new file mode 100644 index 0000000..412bf4f Binary files /dev/null and b/WindowsInfo/bin/Debug/hewininfo.dll differ diff --git a/WindowsInfo/bin/Debug/hewininfo.pdb b/WindowsInfo/bin/Debug/hewininfo.pdb new file mode 100644 index 0000000..e634407 Binary files /dev/null and b/WindowsInfo/bin/Debug/hewininfo.pdb differ diff --git a/WindowsInfo/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/WindowsInfo/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/WindowsInfo/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/WindowsInfo/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/WindowsInfo/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..dbe0024 Binary files /dev/null and b/WindowsInfo/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/WindowsInfo/obj/Debug/WindowsInfo.csproj.AssemblyReference.cache b/WindowsInfo/obj/Debug/WindowsInfo.csproj.AssemblyReference.cache new file mode 100644 index 0000000..e9566ea Binary files /dev/null and b/WindowsInfo/obj/Debug/WindowsInfo.csproj.AssemblyReference.cache differ diff --git a/WindowsInfo/obj/Debug/WindowsInfo.csproj.CoreCompileInputs.cache b/WindowsInfo/obj/Debug/WindowsInfo.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..e08f0d1 --- /dev/null +++ b/WindowsInfo/obj/Debug/WindowsInfo.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +f85e13739f45aaa47d7a3cc8c99ffe426aab2f8e88ff1adfebaf718f61dc1e5d diff --git a/WindowsInfo/obj/Debug/WindowsInfo.csproj.FileListAbsolute.txt b/WindowsInfo/obj/Debug/WindowsInfo.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..2fe2ca2 --- /dev/null +++ b/WindowsInfo/obj/Debug/WindowsInfo.csproj.FileListAbsolute.txt @@ -0,0 +1,17 @@ +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\WindowsInfo\bin\Debug\WindowsInfo.dll +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\WindowsInfo\bin\Debug\WindowsInfo.pdb +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\WindowsInfo.csproj.CoreCompileInputs.cache +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\WindowsInfo.dll +H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\WindowsInfo.pdb +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\bin\Debug\hewininfo.dll +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\bin\Debug\hewininfo.pdb +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\WindowsInfo.csproj.CoreCompileInputs.cache +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\hewininfo.dll +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\hewininfo.pdb +H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\WindowsInfo.csproj.AssemblyReference.cache +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\bin\Debug\hewininfo.dll +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\bin\Debug\hewininfo.pdb +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\WindowsInfo.csproj.AssemblyReference.cache +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\WindowsInfo.csproj.CoreCompileInputs.cache +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\hewininfo.dll +C:\CAD\Git-WorkRepository\VisualStudio\_DLL\WindowsInfo.git\WindowsInfo\obj\Debug\hewininfo.pdb diff --git a/WindowsInfo/obj/Debug/WindowsInfo.dll b/WindowsInfo/obj/Debug/WindowsInfo.dll new file mode 100644 index 0000000..087088c Binary files /dev/null and b/WindowsInfo/obj/Debug/WindowsInfo.dll differ diff --git a/WindowsInfo/obj/Debug/WindowsInfo.pdb b/WindowsInfo/obj/Debug/WindowsInfo.pdb new file mode 100644 index 0000000..8735e58 Binary files /dev/null and b/WindowsInfo/obj/Debug/WindowsInfo.pdb differ diff --git a/WindowsInfo/obj/Debug/hewininfo.dll b/WindowsInfo/obj/Debug/hewininfo.dll new file mode 100644 index 0000000..412bf4f Binary files /dev/null and b/WindowsInfo/obj/Debug/hewininfo.dll differ diff --git a/WindowsInfo/obj/Debug/hewininfo.pdb b/WindowsInfo/obj/Debug/hewininfo.pdb new file mode 100644 index 0000000..e634407 Binary files /dev/null and b/WindowsInfo/obj/Debug/hewininfo.pdb differ