public MacOperatingSystemVersion() { var cli = new CliRunner(CliProgramName); var detectedVersion = string.Empty; var detectedBuildVersion = string.Empty; var detectedProductName = string.Empty; cli.ReadLines(line => { if (line == null) { return; } if (line.StartsWith("ProductVersion:")) { detectedVersion = line.Substring(15).Trim(); } else if (line.StartsWith("BuildVersion:")) { detectedBuildVersion = line.Substring(14).Trim(); } else if (line.StartsWith("ProductName:")) { detectedProductName = line.Substring(12).Trim(); } }); ProductName = detectedProductName; ProductVersion = detectedVersion; BuildVersion = detectedBuildVersion; }
public LinuxLinuxStandardBaseInfo() { var cli = new CliRunner("lsb_release", "--all"); var detectedId = ""; var detectedDescription = ""; var detectedRelease = ""; var detectedCodeName = ""; cli.ReadLines(line => { if (line.StartsWith("Distributor ID:\t")) { detectedId = line.Substring(16); } if (line.StartsWith("Description:\t")) { detectedDescription = line.Substring(13); } if (line.StartsWith("Release:\t")) { detectedRelease = line.Substring(9); } if (line.StartsWith("Codename:\t")) { detectedCodeName = line.Substring(10); } }); Id = detectedId; Description = detectedDescription; Release = detectedRelease; CodeName = detectedCodeName; }