读取注册表值
1 public static bool IsAisino()
2 {
3 bool IsAisino = false;
4 //获取注册表路径
5 RegeditKey regeditKey = TaxSoftwareBaseInfo.GetRealyTrueRegeditPath(WindowsInfo.GetWindowsVersion());
6 RegistryKey regSubKey = null;
7 //获取驱动路径
8 regSubKey = regeditKey.Registry.OpenSubKey(@"System\CurrentControlSet\Control\Print\Printers\", false);
9 string[] rk = regSubKey.GetSubKeyNames();
10 foreach (var item in rk)
11 {
12
13 这里就是要判断读取注册表的值
14 }
15 }
获取当前计算机系统版本
1 public static WindowsVersion GetWindowsVersion()
2 {
3 int version = Environment.OSVersion.Version.Major;
4 string os = String.Concat(Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("ProductName").ToString());//, " ", Environment.OSVersion.ServicePack
5 if (os.Contains("7"))
6 {
7 if (GetSystemType() == 64)
8 return WindowsVersion.Windows7_64Bit;
9 else
10 return WindowsVersion.Windows7_32Bit;
11 }
12 if (os.Contains("8"))
13 {
14 if (GetSystemType() == 64)
15 return WindowsVersion.Windows8_64Bit;
16 else
17 return WindowsVersion.Windows8_32Bit;
18 }
19
20 if (os.Contains("XP") && os.Contains("xp"))
21 {
22 if (GetSystemType() == 64)
23 return WindowsVersion.WindowsXP;
24 else
25 return WindowsVersion.WindowsXP;
26 }
27 int banben = GetSystemType();
28 throw new Exception("无法获取系统版本");
29 }