【问题标题】:Mac serial number (system)Mac 序列号(系统)
【发布时间】:2013-06-11 22:40:49
【问题描述】:

我知道如何使用objective c 获取mac 计算机的序列号,但想知道是否有使用c#(单声道)的方法?

显然这是为了唯一标识一台机器。我已经在使用 MAC 地址,但需要一些不能被欺骗的东西。

【问题讨论】:

    标签: mono serial-number


    【解决方案1】:

    以下内容应为您提供序列号。虽然它不是纯粹通过单声道。但这应该可行。

           string serialNumber;
            using (var p = new Process())
            {
                var serialRegex = new Regex("\"IOPlatformSerialNumber\" = \"(\\S+)\"");
                p.StartInfo = new ProcessStartInfo("/usr/sbin/ioreg",
                                                   "-c IOPlatformExpertDevice");
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardOutput = true;
                p.Start();
                serialNumber = serialRegex.Match(p.StandardOutput.ReadToEnd()).Groups[1].Captures[0].Value;
                p.WaitForExit();
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-05
      • 1970-01-01
      • 1970-01-01
      • 2013-03-05
      • 1970-01-01
      • 1970-01-01
      • 2015-01-05
      • 1970-01-01
      相关资源
      最近更新 更多