public string GetHdw() { try { QcHardWare h = new QcHardWare(); string cpuid = h.GetCpuID(); string diskid = h.GetDiskID(); //string macid=h.GetMacAddress(); if (cpuid != "" && diskid != "") { return(cpuid + "igeces" + diskid); } else if (cpuid != "") { return("CPU" + cpuid + "igces" + (System.Environment.MachineName).Trim()); } else if (diskid != "") { return("DISK" + diskid + "igces" + (System.Environment.MachineName).Trim()); } else { return("igces" + (System.Environment.MachineName).Trim()); } } catch { return("igces" + (System.Environment.MachineName).Trim()); } }
public void MakeKeyFile(string keyfile, string 单位名称 = "") { XDocument doc = new XDocument(); XElement root = new XElement("IGCESLicense"); doc.Add(root); QcHardWare hd = new QcHardWare(); string sn = this.GetSn(); if (sn == null) { return; } root.Add(new XElement("序列号", this.GetSn())); root.Add(new XElement("单位名称", 单位名称)); root.Add(new XElement("cpu", hd.GetCpuID())); root.Add(new XElement("disk", hd.GetDiskID())); root.Add(new XElement("hdw", this.GetHdw())); //root.Add(new XElement("mac",hd.GetMacAddress())); //hd.GetSystemInfo(root); doc.Save(keyfile); }