资源简介
开发工具:VS2017 所有均为事件与封装完全分享。代码高度简洁。不管是学习TCP/IP通信,还是项目中使用TCP/IP均为首选

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualBasic.Devices;
using System.IO;
using System.Net;
using System.Text.Regularexpressions;
using System.Collections;
using System.ComponentModel;
using System.Management;
using System.Net.Sockets;
using System.Runtime.InteropServices;
namespace SignalCommunication
{
///
/// 获取硬件信息,网络状态,各种硬件的编号,生成机器码,应用程序运行路径等
///
public static class ComputerInfo
{
///
/// 获取根目录
///
/// 根目录的路径
public static string getContents()
{
string AppPath = AppDomain.CurrentDomain.SetupInformation.Applicationbase;
if (AppPath.EndsWith(“\\“) || AppPath.EndsWith(“/“))
{
AppPath = AppPath.Substring(0 AppPath.Length - 1) + “\\“;
}
return AppPath;
}
///
/// 获取本机是否联系到网络
///
/// 是否连接到网络
public static bool GetNetworkIsAvailable()
{
Computer computer = new Computer();
return computer.Network.IsAvailable;
}
///
/// 获取主板序列号
///
/// 得到的结果
public static string GetMotherBoardSerialNumber()
{
ManagementClass mc = new ManagementClass(“WIN32_baseBoard“);
ManagementobjectCollection moc = mc.GetInstances();
string SerialNumber = ““;
foreach (Managementobject mo in moc)
{
SerialNumber = mo[“SerialNumber“].ToString();
break;
}
return SerialNumber;
}
///
/// 获取本机的MAC地址
///
/// 返回MAC地址
public static string GetMAC()
{
string mac = ““;
//利用DNS组件的GetHostName函数读取机器名
//利用ManagementClass类取得MAC地址
ManagementClass mc;
mc = new ManagementClass(“Win32_NetworkAdapterConfiguration“);
ManagementobjectCollection moc = mc.GetInstances();
foreach (Managementobject mo in moc)
{
if (mo[“IPEnabled“].ToString() == “True“)
mac = mo[“MacAddress“].ToString();
}
return mac;
}
///
/// 获取IP地址不包含127.0.0.1
///
///
public static string GetAddressIP()
{
///获取本地的IP地址
string AddressIP = string.Empty;
foreach (IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
{
if (_IPAddress.AddressFamily.ToString() == “InterNetwork“)
{
//if (_IPAddress.ToString() != ““ && _IPAddress.ToStrin
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-12-19 15:35 SignalCommunication\
目录 0 2017-11-24 16:59 SignalCommunication\SignalCommunication\
文件 1156 2017-11-20 09:30 SignalCommunication\SignalCommunication.sln
文件 1320 2017-11-24 16:02 SignalCommunication\SignalCommunication\App.config
目录 0 2017-11-20 09:49 SignalCommunication\SignalCommunication\bin\
目录 0 2017-11-24 09:56 SignalCommunication\SignalCommunication\bin\Debug\
目录 0 2017-11-20 10:34 SignalCommunication\SignalCommunication\bin\Debug\Images\
文件 49 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\a.gif
文件 295 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\about.gif
文件 1214 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\alert.gif
文件 1150 2017-09-06 17:27 SignalCommunication\SignalCommunication\bin\Debug\Images\Ash.ico
文件 623 2017-09-06 17:29 SignalCommunication\SignalCommunication\bin\Debug\Images\Ash.png
文件 99847 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\butnon.psd
文件 768 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\collector.gif
文件 1150 2017-09-06 17:27 SignalCommunication\SignalCommunication\bin\Debug\Images\Green.ico
文件 670 2017-09-06 17:29 SignalCommunication\SignalCommunication\bin\Debug\Images\green.png
文件 67646 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\H.ico
文件 115648 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\load.gif
文件 3897 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\Loading.gif
文件 16958 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\logo.ico
文件 1373 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\Monitor.gif
文件 798 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\Operationcenter.gif
文件 257808 2017-07-28 11:19 SignalCommunication\SignalCommunication\bin\Debug\Images\OurProducts.png
文件 1353 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\Setup.gif
文件 1270 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\Signout.gif
文件 2050 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\SOP.gif
文件 7223 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\SOP.jpg
文件 1316 2017-07-28 11:18 SignalCommunication\SignalCommunication\bin\Debug\Images\Speedofprogress.gif
文件 238228 2017-07-28 11:19 SignalCommunication\SignalCommunication\bin\Debug\Images\WorldClass.png
目录 0 2017-11-24 09:56 SignalCommunication\SignalCommunication\bin\Debug\log\
目录 0 2017-11-24 09:56 SignalCommunication\SignalCommunication\bin\Debug\log\2017\
............此处省略50个文件信息
- 上一篇:C#利用自带控件实现圆形指示灯
- 下一篇:C# 计算器 VS2010 完美版
相关资源
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
评论
共有 条评论