代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
CSharp
】
机器码生成类
作者:
Dezai.CN
/ 发布于
2011/9/14
/
449
<div><span style="color: #0000ff">using</span><span style="color: #000000"> System; </span><span style="color: #0000ff">using</span><span style="color: #000000"> System.Management; </span><span style="color: #0000ff">using</span><span style="color: #000000"> System.IO; </span><span style="color: #0000ff">using</span><span style="color: #000000"> System.Runtime.InteropServices; </span><span style="color: #0000ff">using</span><span style="color: #000000"> System.Security.Cryptography; </span><span style="color: #0000ff">using</span><span style="color: #000000"> System.Text; </span><span style="color: #0000ff">using</span><span style="color: #000000"> Microsoft.Win32; </span><span style="color: #0000ff">namespace</span><span style="color: #000000"> YiSheng { </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"><summary></span><span style="color: #008000"> </span><span style="color: #808080">///</span><span style="color: #008000"> register 的摘要说明。 </span><span style="color: #808080">///</span><span style="color: #008000"> 注册软件所用到的类 </span><span style="color: #808080">///</span><span style="color: #008000">谊生软件 Email:yisheng163*hotmail.com </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"></summary></span><span style="color: #008000"> </span><span style="color: #808080"> </span><span style="color: #000000"> </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> SoftKey { </span><span style="color: #0000ff">#region</span><span style="color: #000000"> 获取cpu序列号 硬盘ID 网卡硬地址 </span><span style="color: #000000"> </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"><summary></span><span style="color: #008000"> </span><span style="color: #808080">///</span><span style="color: #008000"> 获取cpu序列号 </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"></summary></span><span style="color: #008000"> </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"><returns></span><span style="color: #008000">string </span><span style="color: #808080"></returns></span><span style="color: #008000"> </span><span style="color: #808080"> </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">string</span><span style="color: #000000"> GetCpuInfo() { </span><span style="color: #0000ff">string</span><span style="color: #000000"> cpuInfo </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #800000">""</span><span style="color: #000000">; ManagementClass cimobject </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> ManagementClass(</span><span style="color: #800000">"</span><span style="color: #800000">Win32_Processor</span><span style="color: #800000">"</span><span style="color: #000000">); ManagementObjectCollection moc </span><span style="color: #000000">=</span><span style="color: #000000"> cimobject.GetInstances(); </span><span style="color: #0000ff">foreach</span><span style="color: #000000"> (ManagementObject mo </span><span style="color: #0000ff">in</span><span style="color: #000000"> moc) { cpuInfo </span><span style="color: #000000">=</span><span style="color: #000000"> mo.Properties[</span><span style="color: #800000">"</span><span style="color: #800000">ProcessorId</span><span style="color: #800000">"</span><span style="color: #000000">].Value.ToString(); } </span><span style="color: #0000ff">return</span><span style="color: #000000"> cpuInfo.ToString(); } </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"><summary></span><span style="color: #008000"> </span><span style="color: #808080">///</span><span style="color: #008000"> 获取硬盘ID </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"></summary></span><span style="color: #008000"> </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"><returns></span><span style="color: #008000">string </span><span style="color: #808080"></returns></span><span style="color: #008000"> </span><span style="color: #808080"> </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">string</span><span style="color: #000000"> GetHDid() { </span><span style="color: #0000ff">string</span><span style="color: #000000"> HDid </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #800000">""</span><span style="color: #000000">; ManagementClass cimobject1 </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> ManagementClass(</span><span style="color: #800000">"</span><span style="color: #800000">Win32_DiskDrive</span><span style="color: #800000">"</span><span style="color: #000000">); ManagementObjectCollection moc1 </span><span style="color: #000000">=</span><span style="color: #000000"> cimobject1.GetInstances(); </span><span style="color: #0000ff">foreach</span><span style="color: #000000"> (ManagementObject mo </span><span style="color: #0000ff">in</span><span style="color: #000000"> moc1) { HDid </span><span style="color: #000000">=</span><span style="color: #000000"> (</span><span style="color: #0000ff">string</span><span style="color: #000000">)mo.Properties[</span><span style="color: #800000">"</span><span style="color: #800000">Model</span><span style="color: #800000">"</span><span style="color: #000000">].Value; } </span><span style="color: #0000ff">return</span><span style="color: #000000"> HDid.ToString(); } </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"><summary></span><span style="color: #008000"> </span><span style="color: #808080">///</span><span style="color: #008000"> 获取网卡硬件地址 </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"></summary></span><span style="color: #008000"> </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"><returns></span><span style="color: #008000">string </span><span style="color: #808080"></returns></span><span style="color: #008000"> </span><span style="color: #808080"> </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">string</span><span style="color: #000000"> GetMoAddress() { </span><span style="color: #0000ff">string</span><span style="color: #000000"> MoAddress </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #800000">""</span><span style="color: #000000">; ManagementClass mc </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> ManagementClass(</span><span style="color: #800000">"</span><span style="color: #800000">Win32_NetworkAdapterConfiguration</span><span style="color: #800000">"</span><span style="color: #000000">); ManagementObjectCollection moc2 </span><span style="color: #000000">=</span><span style="color: #000000"> mc.GetInstances(); </span><span style="color: #0000ff">foreach</span><span style="color: #000000"> (ManagementObject mo </span><span style="color: #0000ff">in</span><span style="color: #000000"> moc2) { </span><span style="color: #0000ff">if</span><span style="color: #000000"> ((</span><span style="color: #0000ff">bool</span><span style="color: #000000">)mo[</span><span style="color: #800000">"</span><span style="color: #800000">IPEnabled</span><span style="color: #800000">"</span><span style="color: #000000">] </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #0000ff">true</span><span style="color: #000000">) MoAddress </span><span style="color: #000000">=</span><span style="color: #000000"> mo[</span><span style="color: #800000">"</span><span style="color: #800000">MacAddress</span><span style="color: #800000">"</span><span style="color: #000000">].ToString(); mo.Dispose(); } </span><span style="color: #0000ff">return</span><span style="color: #000000"> MoAddress.ToString(); } </span><span style="color: #0000ff">#endregion</span><span style="color: #000000"> </span><span style="color: #000000"> </span><span style="color: #0000ff">#region</span><span style="color: #000000"> 获取网卡硬地址+CPU序列号+硬盘ID字符串 </span><span style="color: #000000"> </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"><summary></span><span style="color: #008000"> </span><span style="color: #808080">///</span><span style="color: #008000"> 获取网卡硬地址+CPU序列号+硬盘ID字符串 </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"></summary></span><span style="color: #008000"> </span><span style="color: #808080">///</span><span style="color: #008000"> </span><span style="color: #808080"><returns></returns></span><span style="color: #008000"> </span><span style="color: #808080"> </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">string</span><span style="color: #000000"> GetAll() { </span><span style="color: #0000ff">return</span><span style="color: #000000"> GetMoAddress() </span><span style="color: #000000">+</span><span style="color: #000000"> GetCpuInfo() </span><span style="color: #000000">+</span><span style="color: #000000"> GetHDid(); } </span><span style="color: #0000ff">#endregion</span><span style="color: #000000"> </span><span style="color: #000000"> } } </span></div>
试试其它关键字
机器码
同语言下
.
文件IO 操作类库
.
Check图片类型[JPEG(.jpg 、.jpeg),TIF,GIF,BMP,PNG,P
.
机器名和IP取得(IPV4 IPV6)
.
Tiff转换Bitmap
.
linqHelper
.
MadieHelper.cs
.
RegHelper.cs
.
如果关闭一个窗体后激活另一个窗体的事件或方法
.
创建日志通用类
.
串口辅助开发类
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
Dezai.CN
贡献的其它代码
(
4037
)
.
多线程Socket服务器模块
.
生成随机密码
.
清除浮动样式
.
弹出窗口居中
.
抓取url的函数
.
使用base HTTP验证
.
div模拟iframe嵌入效果
.
通过header转向的方法
.
Session操作类
.
执行sqlite输入插入操作后获得自动编号的ID
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3