Browse Source

完善计算机信息工具类

yuzhengyang 8 years ago
parent
commit
5458ce735b

+ 0 - 125
Fork.Net/Test/Y.Test/Form1.Designer.cs

@@ -1,125 +0,0 @@
-namespace Y.Test
-{
-    partial class Form1
-    {
-        /// <summary>
-        /// 必需的设计器变量。
-        /// </summary>
-        private System.ComponentModel.IContainer components = null;
-
-        /// <summary>
-        /// 清理所有正在使用的资源。
-        /// </summary>
-        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        #region Windows 窗体设计器生成的代码
-
-        /// <summary>
-        /// 设计器支持所需的方法 - 不要修改
-        /// 使用代码编辑器修改此方法的内容。
-        /// </summary>
-        private void InitializeComponent()
-        {
-            this.components = new System.ComponentModel.Container();
-            this.button2 = new System.Windows.Forms.Button();
-            this.embedPanel1 = new Y.Skin.YoPanel.EmbedPanel(this.components);
-            this.flexiblePanel1 = new Y.Skin.YoPanel.FlexiblePanel();
-            this.listBox1 = new System.Windows.Forms.ListBox();
-            this.label1 = new System.Windows.Forms.Label();
-            this.button1 = new System.Windows.Forms.Button();
-            this.flexiblePanel1.SuspendLayout();
-            this.SuspendLayout();
-            // 
-            // button2
-            // 
-            this.button2.Location = new System.Drawing.Point(220, 57);
-            this.button2.Name = "button2";
-            this.button2.Size = new System.Drawing.Size(75, 23);
-            this.button2.TabIndex = 3;
-            this.button2.Text = "button2";
-            this.button2.UseVisualStyleBackColor = true;
-            this.button2.Click += new System.EventHandler(this.button2_Click);
-            // 
-            // embedPanel1
-            // 
-            this.embedPanel1.AppProcess = null;
-            this.embedPanel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
-            this.embedPanel1.Dock = System.Windows.Forms.DockStyle.Right;
-            this.embedPanel1.Location = new System.Drawing.Point(314, 0);
-            this.embedPanel1.Name = "embedPanel1";
-            this.embedPanel1.Size = new System.Drawing.Size(466, 413);
-            this.embedPanel1.TabIndex = 2;
-            // 
-            // flexiblePanel1
-            // 
-            this.flexiblePanel1.Controls.Add(this.listBox1);
-            this.flexiblePanel1.Controls.Add(this.label1);
-            this.flexiblePanel1.Controls.Add(this.button1);
-            this.flexiblePanel1.Location = new System.Drawing.Point(12, 12);
-            this.flexiblePanel1.Name = "flexiblePanel1";
-            this.flexiblePanel1.Size = new System.Drawing.Size(172, 369);
-            this.flexiblePanel1.TabIndex = 0;
-            // 
-            // listBox1
-            // 
-            this.listBox1.FormattingEnabled = true;
-            this.listBox1.ItemHeight = 12;
-            this.listBox1.Location = new System.Drawing.Point(17, 200);
-            this.listBox1.Name = "listBox1";
-            this.listBox1.Size = new System.Drawing.Size(120, 88);
-            this.listBox1.TabIndex = 2;
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(15, 45);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(41, 12);
-            this.label1.TabIndex = 1;
-            this.label1.Text = "label1";
-            // 
-            // button1
-            // 
-            this.button1.Location = new System.Drawing.Point(17, 3);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(75, 23);
-            this.button1.TabIndex = 0;
-            this.button1.Text = "button1";
-            this.button1.UseVisualStyleBackColor = true;
-            // 
-            // Form1
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(780, 413);
-            this.Controls.Add(this.button2);
-            this.Controls.Add(this.embedPanel1);
-            this.Controls.Add(this.flexiblePanel1);
-            this.Name = "Form1";
-            this.Text = "Test";
-            this.Load += new System.EventHandler(this.Form1_Load);
-            this.flexiblePanel1.ResumeLayout(false);
-            this.flexiblePanel1.PerformLayout();
-            this.ResumeLayout(false);
-
-        }
-
-        #endregion
-
-        private Skin.YoPanel.FlexiblePanel flexiblePanel1;
-        private System.Windows.Forms.ListBox listBox1;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.Button button1;
-        private Skin.YoPanel.EmbedPanel embedPanel1;
-        private System.Windows.Forms.Button button2;
-    }
-}
-

+ 0 - 32
Fork.Net/Test/Y.Test/Form1.cs

@@ -1,32 +0,0 @@
-using System;
-using System.Windows.Forms;
-
-namespace Y.Test
-{
-    public partial class Form1 : Form
-    {
-        public Form1()
-        {
-            InitializeComponent();
-        }
-        private void Form1_Load(object sender, EventArgs e)
-        {
-            //flexiblePanel1.InitMouseAndContolStyle();
-            //embedPanel1.Start(@"D:\Soft\DisplayX.1034260498.exe");
-            embedPanel1.Start(@"D:\CoCo\GitHub\Temp\ClipboardMonitor\ClipboardMonitor\ClipboardMonitor\bin\Debug\ClipboardMonitor.exe");
-        }
-
-        private void button2_Click(object sender, EventArgs e)
-        {
-            //1 焦点问题,焦点导致内外两个窗口标题栏颜色不一致;
-            //2 有些应用嵌入不了,会直接被单独打开;
-            //3 有些应用嵌入不正常,位置与预计的不同;
-            //4 有些应用嵌入关闭时会在后台继续运行;
-            //5 调试期间 vs 不能强行退出 否则嵌入的程序不会退出;
-
-            //embedPanel1.ReEmbed();
-            //embedPanel1.Start(@"D:\CoCo\GitHub\Temp\ClipboardMonitor\ClipboardMonitor\ClipboardMonitor\bin\Debug\ClipboardMonitor.exe");
-            embedPanel1.Start(@"D:\Soft\DisplayX.1034260498.exe");
-        }
-    }
-}

+ 1 - 1
Fork.Net/Test/Y.Test/Program.cs

@@ -17,7 +17,7 @@ namespace Y.Test
         {
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
-            Application.Run(new MainForm());
+            Application.Run(new TestComputerInfoForm());
         }
     }
 }

+ 47 - 0
Fork.Net/Test/Y.Test/Views/Form1.Designer.cs

@@ -0,0 +1,47 @@
+namespace Y.Test.Views
+{
+    partial class Form1
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.SuspendLayout();
+            // 
+            // Form1
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(120, 279);
+            this.MinimumSize = new System.Drawing.Size(1, 1);
+            this.Name = "Form1";
+            this.Text = "Form1";
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+    }
+}

+ 19 - 0
Fork.Net/Test/Y.Test/Views/Form1.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Y.Test.Views
+{
+    public partial class Form1 : Form
+    {
+        public Form1()
+        {
+            InitializeComponent();
+        }
+    }
+}

Fork.Net/Test/Y.Test/Form1.resx → Fork.Net/Test/Y.Test/Views/Form1.resx


+ 1 - 2
Fork.Net/Test/Y.Test/Views/MainForm.Designer.cs

@@ -271,8 +271,7 @@
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
-            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
-            this.ClientSize = new System.Drawing.Size(814, 470);
+            this.ClientSize = new System.Drawing.Size(27, 25);
             this.Controls.Add(this.panel1);
             this.Controls.Add(this.pictureBox3);
             this.Controls.Add(this.pictureBox2);

+ 61 - 0
Fork.Net/Test/Y.Test/Views/TestComputerInfoForm.Designer.cs

@@ -0,0 +1,61 @@
+namespace Y.Test.Views
+{
+    partial class TestComputerInfoForm
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.SuspendLayout();
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(13, 13);
+            this.textBox1.Multiline = true;
+            this.textBox1.Name = "textBox1";
+            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
+            this.textBox1.Size = new System.Drawing.Size(560, 400);
+            this.textBox1.TabIndex = 0;
+            // 
+            // TestComputerInfoForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(585, 425);
+            this.Controls.Add(this.textBox1);
+            this.Name = "TestComputerInfoForm";
+            this.Text = "TestComputerInfoForm";
+            this.Load += new System.EventHandler(this.TestComputerInfoForm_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.TextBox textBox1;
+    }
+}

+ 53 - 0
Fork.Net/Test/Y.Test/Views/TestComputerInfoForm.cs

@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using Y.Utils.WindowsUtils.InfoUtils;
+
+namespace Y.Test.Views
+{
+    public partial class TestComputerInfoForm : Form
+    {
+        public TestComputerInfoForm()
+        {
+            InitializeComponent();
+        }
+
+        private void TestComputerInfoForm_Load(object sender, EventArgs e)
+        {
+            Print("UserName: " + Environment.UserName);
+            Print("UserDomainName: " + Environment.UserDomainName);
+            Print("TickCount: " + Environment.TickCount);
+            Print("ProcessorCount: " + Environment.ProcessorCount);
+            Print("OSVersion: " + Environment.OSVersion);
+            Print("MachineName: " + Environment.MachineName);
+            Print("Is64BitOperatingSystem: " + Environment.Is64BitOperatingSystem);
+            Print("-------------------------");
+            Print("CPUID: " + ComputerInfoTool.CPUID());
+            Print("CPU信息: " + ComputerInfoTool.CPUModel());
+            Print("显卡信息: " + string.Join(",", ComputerInfoTool.GraphicsCardModel()));
+            Print("声卡信息: " + string.Join(",", ComputerInfoTool.SoundCardModel()));
+            Print("内存: " + ComputerInfoTool.AvailablePhysicalMemory() + " / " + ComputerInfoTool.TotalPhysicalMemory());
+            Print("硬盘ID: " + ComputerInfoTool.GetHDiskID("C"));
+            Print("硬盘信息: " + string.Join(",", ComputerInfoTool.HardDiskModel()));
+            Print("操作系统: " + ComputerInfoTool.GetOS());
+            Print("系统类型: " + ComputerInfoTool.GetSystemType());
+            Print("系统安装日期: " + ComputerInfoTool.GetSystemInstallDate());
+            Print("登录用户名: " + ComputerInfoTool.GetLoginUserName());
+            Print("计算机名: " + ComputerInfoTool.GetComputerName());
+            Print("系统所有用户名: " + string.Join(",", ComputerInfoTool.GetSysUserNames()));
+            Print("主板: " + ComputerInfoTool.GetBoardManufacturer());
+            Print("主板: " + ComputerInfoTool.GetBoardProduct());
+            Print("主板序列号: " + ComputerInfoTool.GetBoardSerialNumber());
+        }
+        private void Print(string s)
+        {
+            textBox1.AppendText(s);
+            textBox1.AppendText(Environment.NewLine);
+        }
+    }
+}

+ 120 - 0
Fork.Net/Test/Y.Test/Views/TestComputerInfoForm.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 18 - 10
Fork.Net/Test/Y.Test/Y.Test.csproj

@@ -80,17 +80,10 @@
     <Reference Include="System.Data" />
     <Reference Include="System.Deployment" />
     <Reference Include="System.Drawing" />
-    <Reference Include="System.Net.Http" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Form1.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="Form1.Designer.cs">
-      <DependentUpon>Form1.cs</DependentUpon>
-    </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Views\ChineseCalendarForm.cs">
@@ -99,12 +92,24 @@
     <Compile Include="Views\ChineseCalendarForm.Designer.cs">
       <DependentUpon>ChineseCalendarForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="Views\Form1.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Views\Form1.Designer.cs">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </Compile>
     <Compile Include="Views\MainForm.cs">
       <SubType>Form</SubType>
     </Compile>
     <Compile Include="Views\MainForm.Designer.cs">
       <DependentUpon>MainForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="Views\TestComputerInfoForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Views\TestComputerInfoForm.Designer.cs">
+      <DependentUpon>TestComputerInfoForm.cs</DependentUpon>
+    </Compile>
     <Compile Include="Views\TestInputForm.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -123,9 +128,6 @@
     <Compile Include="Views\TestWebForm.Designer.cs">
       <DependentUpon>TestWebForm.cs</DependentUpon>
     </Compile>
-    <EmbeddedResource Include="Form1.resx">
-      <DependentUpon>Form1.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -139,9 +141,15 @@
     <EmbeddedResource Include="Views\ChineseCalendarForm.resx">
       <DependentUpon>ChineseCalendarForm.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Views\Form1.resx">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Views\MainForm.resx">
       <DependentUpon>MainForm.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Views\TestComputerInfoForm.resx">
+      <DependentUpon>TestComputerInfoForm.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Views\TestInputForm.resx">
       <DependentUpon>TestInputForm.cs</DependentUpon>
     </EmbeddedResource>

+ 1 - 0
Fork.Net/Y.Skin/YoForm/Irregular/IrregularForm.Designer.cs

@@ -38,6 +38,7 @@
             this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
             this.ClientSize = new System.Drawing.Size(284, 261);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.MinimumSize = new System.Drawing.Size(1, 1);
             this.Name = "IrregularForm";
             this.Text = "IrregularForm";
             this.Load += new System.EventHandler(this.IrregularForm_Load);

+ 17 - 0
Fork.Net/Y.Skin/YoForm/Irregular/IrregularForm.cs

@@ -80,5 +80,22 @@ namespace Y.Skin.YoForm.Irregular
                 }
             });
         }
+        /// <summary>
+        /// 窗体显示状态
+        /// </summary>
+        /// <param name="value"></param>
+        public void Visibility(bool value)
+        {
+            if (value)
+            {
+                Show();
+                Skin.Show();
+            }
+            else
+            {
+                Hide();
+                Skin.Hide();
+            }
+        }
     }
 }

+ 1 - 0
Fork.Net/Y.Skin/YoForm/Irregular/IrregularFormSkin.Designer.cs

@@ -37,6 +37,7 @@
             this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
             this.ClientSize = new System.Drawing.Size(284, 261);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.MinimumSize = new System.Drawing.Size(1, 1);
             this.Name = "IrregularFormSkin";
             this.Text = "IrregularFormSkin";
             this.ResumeLayout(false);

+ 10 - 0
Fork.Net/Y.Skin/YoPanel/EmbedPanel.cs

@@ -9,6 +9,16 @@ namespace Y.Skin.YoPanel
 {
     public partial class EmbedPanel : Panel
     {
+        //1 焦点问题,焦点导致内外两个窗口标题栏颜色不一致;
+        //2 有些应用嵌入不了,会直接被单独打开;
+        //3 有些应用嵌入不正常,位置与预计的不同;
+        //4 有些应用嵌入关闭时会在后台继续运行;
+        //5 调试期间 vs 不能强行退出 否则嵌入的程序不会退出;
+
+        //embedPanel1.ReEmbed();
+        //embedPanel1.Start(@"D:\CoCo\GitHub\Temp\ClipboardMonitor\ClipboardMonitor\ClipboardMonitor\bin\Debug\ClipboardMonitor.exe");
+        //embedPanel1.Start(@"D:\Soft\DisplayX.1034260498.exe");
+
         Action<object, EventArgs> appIdleAction = null;
         EventHandler appIdleEvent = null;
         public EmbedPanel()

+ 325 - 12
Fork.Net/Y.Utils/WindowsUtils/InfoUtils/ComputerInfoTool.cs

@@ -1,18 +1,29 @@
-//############################################################
+//************************************************************************
 //      https://github.com/yuzhengyang
-//      author:yuzhengyang
-//############################################################
+//      author:     yuzhengyang
+//      date:       2017.3.29 - 2017.7.12
+//      desc:       计算机信息
+//      Copyright (c) yuzhengyang. All rights reserved.
+//************************************************************************
 using System;
 using System.Collections.Generic;
 using System.Management;
 using System.Net.NetworkInformation;
+using System.Runtime.InteropServices;
 
 namespace Y.Utils.WindowsUtils.InfoUtils
 {
+    /// <summary>
+    /// 计算机信息
+    /// </summary>
     public static class ComputerInfoTool
     {
-        #region 获取CpuId
-        public static string GetCpuId()
+        const string UNKNOW = "unknow";
+        /// <summary>
+        /// CPU 序列号
+        /// </summary>
+        /// <returns></returns>
+        public static string CPUID()
         {
             ManagementClass mc = null;
             ManagementObjectCollection moc = null;
@@ -27,9 +38,9 @@ namespace Y.Utils.WindowsUtils.InfoUtils
                 }
                 return ProcessorId;
             }
-            catch
+            catch (Exception e)
             {
-                return "unknow";
+                return UNKNOW;
             }
             finally
             {
@@ -37,9 +48,11 @@ namespace Y.Utils.WindowsUtils.InfoUtils
                 if (mc != null) mc.Dispose();
             }
         }
-        #endregion
-        #region 获取CPU信息
-        public static string GetCpuInfo()
+        /// <summary>
+        /// CPU 型号
+        /// </summary>
+        /// <returns></returns>
+        public static string CPUModel()
         {
             try
             {
@@ -52,9 +65,309 @@ namespace Y.Utils.WindowsUtils.InfoUtils
                 return result;
             }
             catch
-            { return "unknown"; }
+            { return UNKNOW; }
+        }
+        /// <summary>
+        /// 显卡型号
+        /// </summary>
+        /// <returns></returns>
+        public static List<string> GraphicsCardModel()
+        {
+            try
+            {
+                List<string> rs = new List<string>();
+                ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from  Win32_VideoController");
+                foreach (ManagementObject item in searcher.Get())
+                {
+                    rs.Add(item["Name"].ToString());
+                }
+                return rs;
+            }
+            catch { return null; }
+        }
+        /// <summary>
+        /// 声卡型号
+        /// </summary>
+        /// <returns></returns>
+        public static List<string> SoundCardModel()
+        {
+            try
+            {
+                List<string> rs = new List<string>();
+                ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from  Win32_SoundDevice");
+                foreach (ManagementObject item in searcher.Get())
+                {
+                    rs.Add(item["Name"].ToString());
+                }
+                return rs;
+            }
+            catch
+            { return null; }
+        }
+        /// <summary>
+        /// 物理内存
+        /// </summary>
+        /// <returns></returns>
+        public static ulong TotalPhysicalMemory()
+        {
+            ulong size = 0;
+            try
+            {
+                ManagementClass mc = new ManagementClass("Win32_ComputerSystem");
+                ManagementObjectCollection moc = mc.GetInstances();
+                foreach (ManagementObject mo in moc)
+                {
+                    ulong.TryParse(mo["TotalPhysicalMemory"].ToString(), out size);
+                }
+            }
+            catch { }
+            return size;
+        }
+        /// <summary>
+        /// 可用物理内存
+        /// </summary>
+        /// <returns></returns>
+        public static ulong AvailablePhysicalMemory()
+        {
+            ulong size = 0;
+            try
+            {
+                ManagementClass mc = new ManagementClass("Win32_OperatingSystem");
+                ManagementObjectCollection moc = mc.GetInstances();
+                foreach (ManagementObject mo in moc)
+                {
+                    ulong.TryParse(mo["FreePhysicalMemory"].ToString(), out size);
+                }
+            }
+            catch { }
+            return size;
+        }
+        /// <summary>
+        /// 硬盘型号
+        /// </summary>
+        /// <returns></returns>
+        public static List<string> HardDiskModel()
+        {
+            try
+            {
+                List<string> rs = new List<string>();
+                ManagementClass mc = new ManagementClass("Win32_DiskDrive");
+                ManagementObjectCollection moc = mc.GetInstances();
+                foreach (ManagementObject mo in moc)
+                {
+                    rs.Add(mo.Properties["Model"].Value.ToString() + "--" + mo.Properties["SerialNumber"].Value.ToString());
+                    //result = (string);
+                    //if (!result.ToLower().Contains("usb"))
+                    //    return result;
+                }
+                return rs;
+            }
+            catch { return null; }
+        }
+        #region 获取硬盘ID
+        public static string GetHDiskID(string hdModel)
+        {
+            try
+            {
+                string result = "";
+                ManagementClass mc = new ManagementClass("Win32_DiskDrive");
+                ManagementObjectCollection moc = mc.GetInstances();
+                foreach (ManagementObject mo in moc)
+                {
+                    if (mo.Properties["Model"].Value.ToString().Contains(hdModel))
+                    {
+                        result = (string)mo.Properties["SerialNumber"].Value;
+                    }
+                }
+                return result.Trim();
+            }
+            catch
+            { return UNKNOW; }
+        }
+        #endregion
+        #region 获取操作系统
+        public static string GetOS()
+        {
+            try
+            {
+                string result = "";
+                ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
+                foreach (ManagementObject MyObject in MySearcher.Get())
+                {
+                    result = MyObject["Caption"].ToString();
+                }
+                return result;
+            }
+            catch
+            { return UNKNOW; }
+        }
+        #endregion
+        #region 获取系统类型
+        public static string GetSystemType()
+        {
+            try
+            {
+                string result = "";
+                ManagementClass mc = new ManagementClass("Win32_ComputerSystem");
+                ManagementObjectCollection moc = mc.GetInstances();
+                foreach (ManagementObject mo in moc)
+                {
+
+                    result = mo["SystemType"].ToString();
+
+                }
+                return result;
+            }
+            catch
+            { return UNKNOW; }
+        }
+        #endregion
+        #region 获取系统安装日期
+        public static string GetSystemInstallDate()
+        {
+            try
+            {
+                string result = "";
+                ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
+                foreach (ManagementObject MyObject in MySearcher.Get())
+                {
+                    result = MyObject["InstallDate"].ToString().Substring(0, 14);
+                    result = result.Insert(12, ":");
+                    result = result.Insert(10, ":");
+                    result = result.Insert(8, " ");
+                    result = result.Insert(6, "-");
+                    result = result.Insert(4, "-");
+                }
+                return result;
+            }
+            catch
+            { return UNKNOW; }
+        }
+        #endregion
+        #region 获取登陆用户名
+        public static string GetLoginUserName()
+        {
+            try
+            {
+                string result = "";
+                ManagementClass mc = new ManagementClass("Win32_ComputerSystem");
+                ManagementObjectCollection moc = mc.GetInstances();
+                foreach (ManagementObject mo in moc)
+                {
+                    result = mo["UserName"].ToString();
+                }
+                return result;
+            }
+            catch
+            { return UNKNOW; }
+        }
+        #endregion
+        #region 获取计算机名
+        public static string GetComputerName()
+        {
+            try
+            {
+                string result = "";
+                result = System.Environment.GetEnvironmentVariable("ComputerName");
+                return result;
+            }
+            catch
+            { return UNKNOW; }
+        }
+        #endregion
+        #region 获取所有用户名
+        public static List<string> GetSysUserNames()
+        {
+            int EntriesRead;
+            int TotalEntries;
+            int Resume;
+            IntPtr bufPtr;
+            List<string> temp = new List<string>();
+
+            NetUserEnum(null, 0, 2, out bufPtr, -1, out EntriesRead, out TotalEntries, out Resume);
+            if (EntriesRead > 0)
+            {
+                USER_INFO_0[] Users = new USER_INFO_0[EntriesRead];
+                IntPtr iter = bufPtr;
+                for (int i = 0; i < EntriesRead; i++)
+                {
+                    Users[i] = (USER_INFO_0)Marshal.PtrToStructure(iter, typeof(USER_INFO_0));
+                    iter = (IntPtr)((long)iter + Marshal.SizeOf(typeof(USER_INFO_0)));
+                    temp.Add(Users[i].Username);
+                }
+                NetApiBufferFree(bufPtr);
+            }
+            return temp;
+        }
+        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+        private struct USER_INFO_0
+        {
+            public string Username;
+        }
+        [DllImport("Netapi32.dll ")]
+        extern static int NetUserEnum([MarshalAs(UnmanagedType.LPWStr)]
+        string servername,
+                int level,
+                int filter,
+                out IntPtr bufptr,
+                int prefmaxlen,
+                out int entriesread,
+                out int totalentries,
+                out int resume_handle);
+
+        [DllImport("Netapi32.dll ")]
+        extern static int NetApiBufferFree(IntPtr Buffer);
+        #endregion
+        #region 获取主板制造商
+        public static string GetBoardManufacturer()
+        {
+            try
+            {
+                string result = "";
+                ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");
+                foreach (ManagementObject MyObject in MySearcher.Get())
+                {
+                    result = MyObject["Manufacturer"].ToString();
+                }
+                return result;
+            }
+            catch
+            { return UNKNOW; }
+        }
+        #endregion
+        #region 获取主板型号
+        public static string GetBoardProduct()
+        {
+            try
+            {
+                string result = "";
+                ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");
+                foreach (ManagementObject MyObject in MySearcher.Get())
+                {
+                    result = MyObject["Product"].ToString();
+                }
+                return result;
+            }
+            catch
+            { return UNKNOW; }
+        }
+        #endregion
+        #region 获取主板序列号
+        public static string GetBoardSerialNumber()
+        {
+            try
+            {
+                string result = "";
+                ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");
+                foreach (ManagementObject MyObject in MySearcher.Get())
+                {
+                    result = MyObject["SerialNumber"].ToString();
+                }
+                return result;
+            }
+            catch
+            { return UNKNOW; }
         }
         #endregion
-        
     }
 }