public static bool GetMenuLoaderState() { bool result; try { RegistryKey currentProductKey = Reg.GetCurrentProductKey(true); RegistryKey registryKey = currentProductKey.OpenSubKey("Applications", true); registryKey = registryKey.OpenSubKey("TCPlugin", true); string a = (string)registryKey.GetValue("EXECUTEMENULOADER", "TRUE"); if (a == "FALSE") { result = false; } else { registryKey.SetValue("EXECUTEMENULOADER", "FALSE", RegistryValueKind.String); result = true; } } catch { result = false; } return(result); }
public static void RegisterComputationalCADVersion(string currentVersion) { try { RegistryKey registryKey = Reg.GetCurrentProductKey(true); registryKey = registryKey.CreateSubKey("Applications\\TCPlugin", RegistryKeyPermissionCheck.ReadWriteSubTree); registryKey.SetValue("LastUsedVersion", currentVersion, RegistryValueKind.String); } catch (System.Exception ex) { throw new System.Exception("TCPlugin could not register current version." + Environment.NewLine + ex.Message); } }
public static string GetInstallationFolder() { string directoryName; try { RegistryKey registryKey = Reg.GetCurrentProductKey(false); registryKey = registryKey.OpenSubKey("Applications\\TCPlugin"); directoryName = Path.GetDirectoryName(registryKey.GetValue("LOADER").ToString()); } catch (System.Exception ex) { throw new System.Exception("Can not determine TCPlugin installation path:" + Environment.NewLine + ex.Message); } return(directoryName); }
public static string GetLastUsedComputationalCADVersion() { string result; try { RegistryKey registryKey = Reg.GetCurrentProductKey(false); registryKey = registryKey.OpenSubKey("Applications\\TCPlugin"); try { result = registryKey.GetValue("LastUsedVersion").ToString(); } catch { result = ""; } } catch (System.Exception ex) { throw new System.Exception("Can not determine last used TCPlugin version:" + Environment.NewLine + ex.Message); } return(result); }