private static SccmRegistryDetectionRule CreateNewRegistryRuleWithDefaults() { var registryRule = new SccmRegistryDetectionRule { UseDefaultValue = true, RegKeyMustExist = true, RegKeyAssociate32On64 = false, RegistryDataType = RegistryDataType.RegSz, RegistryHive = RegistryHiveType.HkeyLocalMachine, RegistryKey = string.Empty, RegistryValue = string.Empty, RegRuleOperator = RegistryRuleOperatorType.Equals, RegRuleValue = string.Empty }; return registryRule; }
private static string ToRegistryClause(SccmRegistryDetectionRule registryRule) { var clause = new StringBuilder(); if (registryRule.RegKeyMustExist) { if (registryRule.UseDefaultValue) { clause.AppendFormat("{0}\\{1} Value: (Default) Exists", registryRule.RegistryHive, registryRule.RegistryKey); } else { clause.AppendFormat("{0}\\{1} Value: {2} Exists", registryRule.RegistryHive, registryRule.RegistryKey, registryRule.RegistryValue); } } else { if (registryRule.UseDefaultValue) { clause.AppendFormat("{0}\\{1} Value: (Default) {2} {3}", registryRule.RegistryHive, registryRule.RegistryKey, registryRule.RegRuleOperator, registryRule.RegRuleValue); } else { clause.AppendFormat("{0}\\{1} Value: {2} {3} {4}", registryRule.RegistryHive, registryRule.RegistryKey, registryRule.RegistryValue, registryRule.RegRuleOperator, registryRule.RegRuleValue); } } return clause.ToString(); }
private static SccmRegistryDetectionRule CreateNewRegistryRuleWithDefaults() { var registryRule = new SccmRegistryDetectionRule() { UseDefaultValue = true, RegKeyMustExist = true, RegKeyAssociate32On64 = false, RegistryDataType = RegistryDataType.REG_SZ, RegistryHive = RegistryHiveType.HKEY_LOCAL_MACHINE, RegistryKey = string.Empty, RegistryValue = string.Empty, RegRuleOperator = RegistryRuleOperatorType.Equals, RegRuleValue = string.Empty }; return registryRule; }