public static string GetOSVersion() { string os = SystemInfo.operatingSystem; Match match = Regex.Match(os, @"[0-9]+\.[0-9]+(\.[0-9]+)?(\.[0-9]+)?", RegexOptions.IgnoreCase); if (match.Success) { os = match.Value; } return(os); }
public SpeechConfig(string version = "2.0.12341") { this.system = new ContextSystem(); this.system.version = version; this.os = new ContextOS(); this.os.platform = GetPlatform(); this.os.name = GetOS(); this.os.version = GetOSVersion(); this.device = new ContextDevice(); this.device.model = SystemInfo.deviceModel; this.device.manufacturer = GetDeviceManufacturer(); this.device.version = GetDeviceVersion(); }
public static string GetOS() { string os = SystemInfo.operatingSystem; if (os.Contains("Mac OS X")) { return("Mac OS X"); } Match match = Regex.Match(os, @"on\s([0-9]{2}\sbit\s)?([A-z0-9\s]*)$", RegexOptions.IgnoreCase); if (match.Success) { os = match.Groups[2].Value; } return(os); }