public static Dictionary <string, string> Info() { if (Profile.s_Info != null) { return(Profile.s_Info); } string index = "Android"; Dictionary <string, string> dictionary = new Dictionary <string, string>() { { "ProcessorId", SystemUtils.GetSysInfo("Select processorID from Win32_Processor") }, { "Processor", Profile.CPU } }; string sysInfo = SystemUtils.GetSysInfo("Select NumberOfLogicalProcessors from Win32_Processor"); Logger.Info("the length of numOfProcessor string is {0}", (object)sysInfo.Length.ToString((IFormatProvider)CultureInfo.InvariantCulture)); dictionary.Add("NumberOfProcessors", sysInfo); dictionary.Add("GPU", Profile.GPU); dictionary.Add("GPUDriver", SystemUtils.GetSysInfo("Select DriverVersion from Win32_VideoController")); dictionary.Add("OS", Profile.OS); string str1 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}.{1}", (object)Environment.OSVersion.Version.Major, (object)Environment.OSVersion.Version.Minor); dictionary.Add("OSVersion", str1); dictionary.Add("RAM", Profile.RAM); try { string version = RegistryManager.Instance.Version; dictionary.Add("BlueStacksVersion", version); } catch { } int num1; try { num1 = RegistryManager.Instance.Guest[index].GlMode; } catch { num1 = -1; } dictionary.Add("GlMode", num1.ToString((IFormatProvider)CultureInfo.InvariantCulture)); int num2; try { num2 = RegistryManager.Instance.Guest[index].GlRenderMode; } catch { num2 = -1; } dictionary.Add("GlRenderMode", num2.ToString((IFormatProvider)CultureInfo.InvariantCulture)); string str2 = ""; try { RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\OEMInformation"); str2 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} {1}", (object)(string)registryKey.GetValue("Manufacturer", (object)""), (object)(string)registryKey.GetValue("Model", (object)"")); } catch { } dictionary.Add("OEMInfo", str2); int width = Screen.PrimaryScreen.Bounds.Width; int num3 = Screen.PrimaryScreen.Bounds.Height; dictionary.Add("ScreenResolution", width.ToString((IFormatProvider)CultureInfo.InvariantCulture) + "x" + num3.ToString((IFormatProvider)CultureInfo.InvariantCulture)); try { int windowWidth = RegistryManager.Instance.Guest[index].WindowWidth; num3 = RegistryManager.Instance.Guest[index].WindowHeight; dictionary.Add("BlueStacksResolution", windowWidth.ToString((IFormatProvider)CultureInfo.InvariantCulture) + "x" + num3.ToString((IFormatProvider)CultureInfo.InvariantCulture)); } catch { } string str3 = ""; try { RegistryKey registryKey1 = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP"); foreach (string subKeyName in registryKey1.GetSubKeyNames()) { if (subKeyName.StartsWith("v", StringComparison.OrdinalIgnoreCase)) { RegistryKey registryKey2 = registryKey1.OpenSubKey(subKeyName); if (registryKey2.GetValue("Install") != null && (int)registryKey2.GetValue("Install") == 1) { str3 = (string)registryKey2.GetValue("Version"); } if (subKeyName == "v4") { RegistryKey registryKey3 = registryKey2.OpenSubKey("Client"); if (registryKey3 != null && (int)registryKey3.GetValue("Install") == 1) { str3 = (string)registryKey3.GetValue("Version") + " Client"; } RegistryKey registryKey4 = registryKey2.OpenSubKey("Full"); if (registryKey4 != null && (int)registryKey4.GetValue("Install") == 1) { str3 = (string)registryKey4.GetValue("Version") + " Full"; } } } } } catch (Exception ex) { Logger.Error("Got exception when checking dot net version,err: {0}", (object)ex.ToString()); } dictionary.Add("DotNetVersion", str3); if (Profile.IsOs64Bit()) { dictionary.Add("OSVERSIONTYPE", "64 bit"); } else { dictionary.Add("OSVERSIONTYPE", "32 bit"); } Profile.s_Info = dictionary; return(Profile.s_Info); }
public static Dictionary <string, string> InfoForGraphicsDriverCheck() { Dictionary <string, string> dictionary = new Dictionary <string, string>() { { "os_version", SystemUtils.GetSysInfo("Select Caption from Win32_OperatingSystem") }, { "os_arch", SystemUtils.GetSysInfo("Select OSArchitecture from Win32_OperatingSystem") }, { "processor_vendor", SystemUtils.GetSysInfo("Select Manufacturer from Win32_Processor") }, { "processor", SystemUtils.GetSysInfo("Select Name from Win32_Processor") } }; string sysInfo1 = SystemUtils.GetSysInfo("Select Caption from Win32_VideoController"); string str1 = ""; string[] strArray1 = sysInfo1.Split(new string[3] { Environment.NewLine, "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); if (!string.IsNullOrEmpty(sysInfo1)) { foreach (string str2 in strArray1) { str1 = str1 + str2.Substring(0, str2.IndexOf(" ", StringComparison.OrdinalIgnoreCase)) + "\r\n"; } str1 = str1.Trim(); } string sysInfo2 = SystemUtils.GetSysInfo("Select DriverVersion from Win32_VideoController"); string sysInfo3 = SystemUtils.GetSysInfo("Select DriverDate from Win32_VideoController"); string[] strArray2 = str1.Split(new string[3] { Environment.NewLine, "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); string[] strArray3 = sysInfo2.Split(new string[3] { Environment.NewLine, "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); string[] strArray4 = sysInfo3.Split(new string[3] { Environment.NewLine, "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); for (int index = 0; index < strArray1.Length; ++index) { if (strArray1[index] == Profile.GlRenderer || Profile.GlVendor.Contains(strArray2[index])) { sysInfo1 = strArray1[index]; str1 = strArray2[index]; sysInfo2 = strArray3[index]; sysInfo3 = strArray4[index]; break; } } dictionary.Add("gpu", sysInfo1); dictionary.Add("gpu_vendor", str1); dictionary.Add("driver_version", sysInfo2); dictionary.Add("driver_date", sysInfo3); string str3 = ""; RegistryKey registryKey1; using (registryKey1 = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\OEMInformation")) { if (registryKey1 != null) { str3 = (string)registryKey1.GetValue("Manufacturer", (object)""); } } dictionary.Add("oem_manufacturer", str3); string str4 = ""; RegistryKey registryKey2; using (registryKey2 = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\OEMInformation")) { if (registryKey2 != null) { str4 = (string)registryKey2.GetValue("Model", (object)""); } } dictionary.Add("oem_model", str4); dictionary.Add("bst_oem", RegistryManager.Instance.Oem); return(dictionary); }
public static RegistryKey InitKeyWithSecurityCheck(string keyName) { return(!SystemUtils.IsAdministrator() ? Registry.LocalMachine.OpenSubKey(keyName) : Registry.LocalMachine.CreateSubKey(keyName)); }
public static bool GetOSInfo(out string osName, out string servicePack, out string osArch) { osName = ""; servicePack = ""; osArch = ""; OperatingSystem osVersion = Environment.OSVersion; System.Version version = osVersion.Version; if (osVersion.Platform == PlatformID.Win32Windows) { switch (version.Minor) { case 0: osName = "95"; break; case 10: int revision = version.Revision; osName = !(revision.ToString((IFormatProvider)CultureInfo.InvariantCulture) == "2222A") ? "98" : "98SE"; break; case 90: osName = "Me"; break; } } else if (osVersion.Platform == PlatformID.Win32NT) { switch (version.Major) { case 3: osName = "NT 3.51"; break; case 4: osName = "NT 4.0"; break; case 5: osName = version.Minor != 0 ? "XP" : "2000"; break; case 6: if (version.Minor == 0) { osName = "Vista"; break; } if (version.Minor == 1) { osName = "7"; break; } if (version.Minor == 2) { osName = "8"; break; } if (version.Minor == 3) { osName = "8.1"; break; } break; case 10: osName = "10"; break; } } string str1 = osName; if (string.IsNullOrEmpty(str1)) { return(false); } string str2 = "Windows " + str1; if (!string.IsNullOrEmpty(osVersion.ServicePack)) { servicePack = osVersion.ServicePack.Substring(osVersion.ServicePack.LastIndexOf(' ') + 1); str2 = str2 + " " + osVersion.ServicePack; } osArch = SystemUtils.GetOSArchitecture().ToString((IFormatProvider)CultureInfo.InvariantCulture) + "-bit"; Logger.Info("Operating system details: " + (str2 + " " + osArch)); return(true); }
public static int GetDPI() { Logger.Info("Getting DPI"); IntPtr hdc = Graphics.FromHwnd(IntPtr.Zero).GetHdc(); int num = (int)((double)SystemUtils.GetDeviceCaps(hdc, 88) * (double)((float)SystemUtils.GetDeviceCaps(hdc, 10) / (float)SystemUtils.GetDeviceCaps(hdc, 117))); Logger.Info("DPI = {0}", (object)num); return(num); }
public static void LogProcessContextDetails() { Logger.Info("PID {0}, CLR version {0}", (object)Process.GetCurrentProcess().Id, (object)Environment.Version); Logger.Info("IsAdministrator: {0}", (object)SystemUtils.IsAdministrator()); }